package com.wj.sample;
import java.rmi.RemoteException;
import com.esri.adf.web.ags.ADFAGSException;
import com.esri.adf.web.ags.data.AGSMapResource;
import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.WebMap;
import com.esri.adf.web.data.geometry.WebExtent;
import com.esri.adf.web.faces.event.MapEvent;
import com.esri.arcgisws.EnvelopeN;
import com.esri.arcgisws.EsriSearchOrder;
import com.esri.arcgisws.EsriSpatialRelEnum;
import com.esri.arcgisws.MapServerPort;
import com.esri.arcgisws.SpatialFilter;
public class FeatureCounter {
private WebContext context;
private int countedFeatures;
public WebContext getWebContext(){
return context;
}
public void setWebContext(WebContext context){
this.context = context;
}
public int getCountedFeatures(){
return countedFeatures;
}
public void setCountedFeatures(int count){
this.countedFeatures = count;
}
public String countFeaturesInFullExtent(){
WebExtent fullExtent = context.getWebMap().getCurrentExtent();
this.countFeatures(fullExtent);
return null;
}
private void countFeatures(WebExtent extent){
//Get the MapServerPort to execute methods through the ArcGIS Server API.
AGSMapResource agsMap = ((AGSMapResource)context.getResources().get("ags1"));
MapServerPort mapServer = agsMap.getMapServer();
//Make a new envelope from the Web extent.
EnvelopeN env = new EnvelopeN(extent.getMinX(), extent.getMinY(), extent.getMaxX
(), extent.getMaxY(), null, null, null, null, null);
//Set up a spatial filter for an intersection relationship.
SpatialFilter spatialFilter = new SpatialFilter();
spatialFilter.setSpatialRel(EsriSpatialRelEnum.esriSpatialRelIntersects);
spatialFilter.setWhereClause("");
spatialFilter.setSearchOrder(EsriSearchOrder.esriSearchOrderSpatial);
spatialFilter.setSpatialRelDescription("");
spatialFilter.setGeometryFieldName("");
//Set the envelope as the geometry.
spatialFilter.setFilterGeometry(env);
//MapServer::queryFeatureCount() executes on the server and can throw a RemoteException.
try{
//Count features in the fourth layer that intersect with the envelope.
int layerId = 0;
this.countedFeatures = mapServer.queryFeatureCount(mapServer.getDefaultMapName(), layerId, spatialFilter);
}
catch (RemoteException rme){
//Rethrow this as ADFAGSException so that it can participate in the exception framework.
throw new ADFAGSException("Could not execute MapServer::queryFeatureCount()",
rme);
}
}
public void countFeaturesInRectange(MapEvent event){
//得到用户绘制的矩形范围
WebMap webMap = context.getWebMap();
WebExtent chosenExent = (WebExtent)event.getWebGeometry().toMapGeometry(webMap);
this.countFeatures(chosenExent);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
arcgis server9.3案例(jsf)1 (859个子文件)
FeatureCounter.class 4KB
CustomTask.class 2KB
MyCustomAttribute.class 2KB
CustomTaskInfo.class 2KB
.classpath 618B
org.eclipse.wst.common.component 408B
esri_styles.css 10KB
Thumbs.db 209KB
navigator.gif 1KB
fullextD.gif 1KB
fullextU.gif 1023B
zoominD.gif 996B
zoomoutD.gif 991B
addstopU.gif 986B
addstopD.gif 986B
zoominU.gif 968B
searchD.gif 967B
searchU.gif 967B
zoomoutU.gif 965B
addbarrierD.gif 963B
fullext.gif 960B
addbarrierU.gif 960B
polygonD.gif 956B
polygonU.gif 956B
solveD.gif 956B
polygonD.gif 956B
polygonU.gif 956B
solveU.gif 956B
polylineU.gif 947B
polylineD.gif 947B
addstop.gif 938B
pointU.gif 926B
zoomin.gif 924B
pointD.gif 922B
pointD.gif 921B
pointU.gif 921B
zoomout.gif 920B
search.gif 911B
polygon.gif 909B
polygon.gif 909B
addbarrier.gif 905B
solve.gif 902B
polyline.gif 894B
point.gif 871B
point.gif 866B
plus.gif 861B
minus.gif 856B
pixel.gif 807B
loading.gif 701B
saveeditingD.gif 362B
saveeditingU.gif 361B
cleargraphicsD.gif 356B
cleargraphicsU.gif 349B
cleargraphicsX.gif 345B
saveeditingX.gif 325B
cleargraphics.gif 318B
saveediting.gif 315B
clearstopD.gif 306B
clearstopU.gif 301B
clearbarriersD.gif 287B
clearbarriersU.gif 286B
clearstopX.gif 283B
clearrouteD.gif 276B
clearrouteU.gif 276B
stopeditingdiscardX.gif 266B
clearstop.gif 265B
clearbarriersX.gif 245B
clearbarriers.gif 244B
stopeditingdiscardU.gif 237B
stopeditingdiscardD.gif 237B
clearrouteX.gif 233B
clearroute.gif 229B
searchextentU.gif 209B
searchextentD.gif 209B
splitpolygonD.gif 197B
starteditingD.gif 197B
stopeditingU.gif 196B
splitpolygonU.gif 195B
stopeditingdiscard.gif 195B
starteditingU.gif 195B
stopeditingD.gif 194B
copylineD.gif 188B
copylineU.gif 188B
copypolygonU.gif 185B
copypolygonD.gif 185B
starteditingX.gif 183B
stopeditingX.gif 183B
searchextentX.gif 182B
deletevertexD.gif 179B
searchextent.gif 178B
deletevertexU.gif 177B
reshapepolygonD.gif 177B
reshapepolygonU.gif 176B
selectfeatureD.gif 176B
selectfeatureU.gif 176B
expand.gif 176B
splitlineD.gif 175B
splitlineU.gif 175B
showvertD.gif 174B
showvertU.gif 173B
共 859 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
布谷……布谷
- 粉丝: 2
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功