点击地图上一个面,弹出框显示此面的一系列属性

0 投票
点击地图上一个面,弹出框显示此面的一系列属性怎么实现
9月 21, 2017 分类:  1231次浏览 | 用户: lin2018 初出茅庐 (70 分)

1个回答

0 投票

你好,可以参考范例矢量图层选择事件

用SelectFeature控件进行点击,回调里面会包含这个面的属性信息

9月 21, 2017 用户: 郑雅琳 名扬四海 (1,600 分)

按照那个方法还是不能弹出

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);
        }

你的vectorLayer图层是否在map的最上面呢?

selectfeature和modifyfeature不能同时激活
您好,咋样看是否在最上面,不能同时激活有没有其他方法,还是一次只能一个被激活。

如下图文字所述

...