package com.intellegent;
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 String countFeaturesInRectangle(MapEvent event) {
//Get the chosen extent
WebMap webMap = context.getWebMap();
WebExtent chosenExent = (WebExtent) event.getWebGeometry()
.toMapGeometry(webMap);
//Delegate to countFeatures()
this.countFeatures(chosenExent);
//Don't want to navigate to another page
return null;
}
public String countFeaturesInFullExtent() {
//Get the full extent
WebExtent fullExtent = context.getWebMap().getFullExtent();
//Delegate to countFeatures()
this.countFeatures(fullExtent);
//Don't want to navigate to another page
return null;
}
private void countFeatures(WebExtent extent) {
// Get the MapServerPort so we can execute methods through ArcGIS Server API
AGSMapResource agsMap = (AGSMapResource) context.getResources().get(
"ags0");
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);
// Setup 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 4th layer which intersect with the envelope
int layerId = 3;
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 WebContext getContext() {
return context;
}
public void setContext(WebContext context) {
this.context = context;
}
public int getCountedFeatures() {
return countedFeatures;
}
public void setCountedFeatures(int countedFeatures) {
this.countedFeatures = countedFeatures;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
arcgis server 9.3 案例(jsf)3 (212个子文件)
TaskResultDetailsRenderer.class 4KB
FeatureCounter.class 4KB
MapViewerBean.class 4KB
MapViewerPhaseListener.class 3KB
MapViewerElementsRenderer.class 3KB
.classpath 533B
org.eclipse.wst.common.component 406B
brown.css 19KB
common.css 6KB
navigation.gif 4KB
loading.gif 3KB
globe.gif 2KB
sel_off.gif 1KB
delete_lastU.gif 1KB
delete_lastD.gif 1KB
three.gif 1KB
circleD.gif 1KB
circleU.gif 1KB
two.gif 1KB
fullextD.gif 1KB
fullextU.gif 1023B
delete_last.gif 1022B
one.gif 1010B
classifyU.gif 1010B
classifyD.gif 1007B
delete_selectD.gif 1001B
delete_selectU.gif 998B
zoominD.gif 996B
zoomoutD.gif 991B
circle.gif 984B
forwardD.gif 982B
page_zoominU.gif 981B
findD.gif 979B
backD.gif 979B
panD.gif 979B
page_forwardU.gif 977B
page_backU.gif 977B
page_fullextentU.gif 974B
page_zoomoutU.gif 971B
page_fullsizeU.gif 970B
page_panU.gif 969B
zoominU.gif 968B
forwardU.gif 967B
zoomoutU.gif 965B
panU.gif 965B
backU.gif 965B
identifyD.gif 963B
adddataU.gif 962B
find.gif 962B
delete_allD.gif 961B
delete_allU.gif 961B
fullext.gif 960B
delete_select.gif 959B
polygonD.gif 956B
polygonU.gif 956B
textD.gif 954B
textU.gif 954B
classify.gif 952B
adddataD.gif 952B
identifyU.gif 950B
polylineD.gif 947B
polylineU.gif 947B
rectangleD.gif 944B
rectangleU.gif 943B
ovalU.gif 941B
cancelD.gif 941B
cancelU.gif 941B
ovalD.gif 940B
restartD.gif 934B
lineD.gif 934B
restartU.gif 934B
lineU.gif 933B
page_zoomin.gif 933B
page_back.gif 931B
page_forward.gif 929B
page_fullextent.gif 924B
zoomin.gif 924B
page_zoomout.gif 924B
page_fullsize.gif 922B
pointU.gif 921B
pointD.gif 921B
page_pan.gif 920B
zoomout.gif 920B
pan.gif 914B
delete_all.gif 914B
back.gif 913B
forward.gif 912B
polygon.gif 909B
rectangle.gif 908B
highlight.gif 905B
flag.gif 904B
content_2.gif 903B
adddata.gif 902B
text.gif 900B
identify.gif 898B
polyline.gif 894B
oval.gif 889B
upperright.gif 882B
upperleft.gif 882B
lowerright.gif 881B
共 212 条
- 1
- 2
- 3
布谷……布谷
- 粉丝: 2
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0