this.layer.getZIndex is not a function
selectFeature = new SuperMap.Control.SelectFeature(tLayer, { onSelect: onFeatureSelect, onUnselect: onUnFeatureSelect });
map.addControl(selectFeature);
selectFeature.activate();//这里会报异常:this.layer.getZIndex is not a function
请问是什么原因,有办法处理吗?或者有其他的方法可以实现我的目的吗?谢谢!
我的目的是选择图层的对象,然后弹出一个对话框,上面的图层tLayer是通过GetLayersInfoService查询得到,代码如下:
function GetLayerInfo() {
var getLayersInfoService = new SuperMap.REST.GetLayersInfoService(url);
getLayersInfoService.events.on({ "processCompleted": getLayersInfoCompleted });
getLayersInfoService.processAsync();
}
var selectFeature;
function getLayersInfoCompleted(getLayersInfoEventArgs) {
if (getLayersInfoEventArgs.result) {
{
if (getLayersInfoEventArgs.result.subLayers) {
for (var j = 0; j < getLayersInfoEventArgs.result.subLayers.layers.length; j++) {
var tLayer = getLayersInfoEventArgs.result.subLayers.layers[j];
if (tLayer.name == "Airport@AirRoute") {
try {
selectFeature = new SuperMap.Control.SelectFeature(tLayer, { onSelect: onFeatureSelect, onUnselect: onUnFeatureSelect });
map.addControl(selectFeature);
selectFeature.activate();//这里会报异常:this.layer.getZIndex is not a function
}
catch (e)
{ alert(e.name + ": " + e.message); }
}
}
}
}
}
alert(" GetLayerInfo " + subLayers.length);
}
//要素被选中时调用此函数,需要传入当前选中要素参数feature
function onFeatureSelect(feature) {
alert("onFeatureSelect ; " + feature.style);
}
//要素被取消选中时调用此函数,需要传入当前要素参数feature
function onUnFeatureSelect(feature) {
alert("onUnFeatureSelect");
}