HTML Viewer中的IdentifyAll工具只返回指定的可见图层的要素

HTML Viewer中的IdentifyAll工具默认返回所有可见图层的要素,
下面的定制使
HTML Viewer中的IdentifyAll工具只返回指定的可见图层的要素



例子:这个站点有5个图层cities, rivers,lakes,country和latlon,设置为只查看cities, rivers,lakes,country图层。见图

需要修改位于
<磁盘>/ArcIMS/Website/<Website_Name>文件夹中的ArcIMSParam.js和
<磁盘>/ArcIMS/Website/<Website_Name>/Javascript 目录中的aimsIdentify.js文件。
1.打开地图配置文件(后缀.AXL),创建用于HTML Viewer的服务,注意要查看的图层的ID值。
  或从图层信息中查看





2.在文本编辑器中打开ArcIMSParam.js文件,作下列修改:
A.找到这行代码:
var useIdentify=true;
改为:var useIdentify=false;
B.将这行代码:
var useIdentifyAll=false;
改为:
var useIdentifyAll=true;


3.在文本编辑器中打开aimsIdentify.js:
A.找到:
aimsIdentifyPresent=true;
在这行代码后添加新变量如下,指名选择的层的ID(参见步骤1),ID间用逗号隔开。
var idLayers = "1,2,3,4";


B.找到identifyAll函数,将下列代码:

for (var i=(LayerID.length-1);i>=0;i--) {
replyArray="";
if ((mapScaleFactor>=LayerMinScale) &&
(mapScaleFactor<=LayerMaxScale) && (LayerVisible) && (LayerIsFeature)) j =
i;
}

改为:


for (var i=(LayerID.length-1);i>=0;i--) {
replyArray="";
var idLayer = idLayers.split(",");
var isLayerId = false;
for (var xx = 0; xx<idLayer.length; xx++){
if (LayerID==idLayer[xx]) isLayerId = true;
}
if (isLayerId){
if ((mapScaleFactor>=LayerMinScale) &&
(mapScaleFactor<=LayerMaxScale) && (LayerVisible) && (LayerIsFeature)) j =
i;
}
}



C.找到doIdentifyAll函数,将下列代码:

if (fID < (LayerID.length)) {
if ((mapScaleFactor>=LayerMinScale[fID]) && (mapScaleFactor<=LayerMaxScale[fID]) && (LayerVisible[fID]) && (LayerIsFeature[fID])) {
theString = writeGetFeaturesDrill(idWest,idSouth,idEast,idNorth,fID);
//alert(theString);
sendToServer(imsQueryURL,theString,10);
} else {
doIdentifyAll("");
}
}


改为:


if (fID < (LayerID.length)) {
var idLayer = idLayers.split(",");
var isLayerId = false;
for (var xx = 0; xx<idLayer.length; xx++){
if (LayerID[fID]==idLayer[xx]) isLayerId = true;
}
if (isLayerId){
if ((mapScaleFactor>=LayerMinScale[fID]) && (mapScaleFactor<=LayerMaxScale[fID]) && (LayerVisible[fID]) && (LayerIsFeature[fID])) {
theString = writeGetFeaturesDrill(idWest,idSouth,idEast,idNorth,fID);
//alert(theString);
sendToServer(imsQueryURL,theString,10);
}
} else {
doIdentifyAll("");
}
}





只查看cities, rivers,lakes,country图层




点击在新窗口查看全图
CTRL+鼠标滚轮放大或缩小


posted on 2007-10-25 13:18  GIS云中飞鹏  阅读(881)  评论(0编辑  收藏  举报

导航