使用产品:iclient 9D 2019 for JavaScript 操作系统:win10 x64
问题详细描述:
1.在页面初始化的时候使用SuperMap.Map.addLayers,正常显示
//添加图层
map.addLayers([beijingXsmLayer, vecotrLayer]);
2.后续有需求,使用添加新的layer放置进Map中进行显示,但是在使用SuperMap.Map.addLayer方法时,浏览器控制台报错
var filterVecotrLayer = new SuperMap.Layer.Vector(paramName+"polygonLayer");
//绘制图层样式
filterVecotrLayer.style = {
fillColor: "blue",
fillOpacity: 1,
hoverFillColor: "white",
hoverFillOpacity: 0.8,
strokeColor: "#ee9900",
strokeOpacity: 1,
strokeWidth: 1,
strokeLinecap: "round",
strokeDashstyle: "solid",
hoverStrokeColor: "red",
hoverStrokeOpacity: 1,
hoverStrokeWidth: 0.2,
pointRadius: 6,
hoverPointRadius: 1,
hoverPointUnit: "%",
pointerEvents: "visiblePainted",
cursor: "inherit",
fontColor: "#000000",
labelAlign: "cm",
labelOutlineColor: "white",
labelOutlineWidth: 3
};
vecotrLayer.display(false);
filterVecotrLayer.addFeatures(vecotrLayer.getFeaturesByAttribute(paramName,value));
//添加图层,运行完这里会出错
map.addLayer(filterVecotrLayer);
3.报错信息
Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
at d (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:468676)
at initialize.drawFeature (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:468091)
at initialize.drawFeatures (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:464999)
at initialize.moveTo (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:464388)
at initialize.redraw (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:61942)
at initialize.redraw (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:465215)
at initialize.addLayer (eval at <anonymous> (http://localhost:8082/js/SuperMap-8.1.1-16520.js:3:1), <anonymous>:1:42824)
at filterByParam (http://localhost:8082/control/Draw.js:274:10)
at HTMLAnchorElement.onclick (http://localhost:8082/supermap/list:32:76)