你好,可以参考范例矢量图层选择事件
用SelectFeature控件进行点击,回调里面会包含这个面的属性信息
按照那个方法还是不能弹出
init代码如下:
function init() { layer = new SuperMap.Layer.TiledDynamicRESTLayer("yanjin", url1, { transparent: true, cacheEnabled: false }, { maxResolution: "auto", bufferImgCount: 0 }); //将bufferImgCount设置为0,不使用缓存,编辑后,刷新图层,永远请求最新的图片 layer.events.on({ "layerInitialized": addLayer }); vectorLayer = new SuperMap.Layer.Vector("Vector Layer"); vectorLayer.events.on({ "afterfeaturemodified": editFeatureCompleted }); modifyFeature = new SuperMap.Control.ModifyFeature(vectorLayer); drawPoint = new SuperMap.Control.DrawFeature(vectorLayer, SuperMap.Handler.Point); drawPoint.events.on({ "featureadded": selectedFeatureCompleted }); drawPolygon = new SuperMap.Control.DrawFeature(vectorLayer, SuperMap.Handler.Polygon); drawPolygon.events.on({ "featureadded": addFeatureCompleted }); map = new SuperMap.Map("map", { controls: [ new SuperMap.Control.LayerSwitcher(), new SuperMap.Control.ScaleLine(), new SuperMap.Control.Zoom(), new SuperMap.Control.Navigation({ dragPanOptions: { enableKinetic: true } }), drawPoint, drawPolygon] }); // var callbacks = { click: function (currentFeature) { closeInfoWin(); var popup = new SuperMap.Popup.FramedCloud("popwin", new SuperMap.LonLat(0, 0), null, "矢量图层鼠标点击事件 ", null, true); infowin = popup; map.addPopup(popup); } }; var selectFeature = new SuperMap.Control.SelectFeature(vectorLayer, { callbacks: callbacks }); map.addControl(selectFeature); selectFeature.activate(); // map.addControl(modifyFeature); }
如下图文字所述