如何将功能拖动到另一个功能并在更改其图标后

时间:2014-07-02 13:37:53

标签: javascript json vector openlayers geojson

我不知道当我将我的功能拖动到另一个时保持第一个功能的相同坐标时,如何自动更改图标。

所以当我将“geojson_etat3”拖到第二个“geojson_etat4”时,我想将第一个图标更改为Etat4.png

        var geojson_etat3 = new OpenLayers.Layer.Vector("etat3", {
        styleMap: new OpenLayers.StyleMap({
                    "default": new OpenLayers.Style({
                    externalGraphic: './images/Etat3.png', 
                    graphicWidth: 21, 
                    graphicHeight: 25,
                    graphicYOffset: -24,
                    label : "${name}"
                    } ),

                }),
        projection: epsg4326,
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: "data/data_etat3.json",
            format: new OpenLayers.Format.GeoJSON()
            })

        });
        var geojson_etat4 = new OpenLayers.Layer.Vector("etat4", {
        styleMap: new OpenLayers.StyleMap({
                    "default": new OpenLayers.Style({
                    externalGraphic: './images/Etat4.png', 
                    graphicWidth: 21, 
                    graphicHeight: 25,
                    graphicYOffset: -24,
                    label : "${name}"
                    } ),

                }),
        projection: epsg4326,
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: "data/data_etat4.json",
            format: new OpenLayers.Format.GeoJSON()
            })

        }); 

0 个答案:

没有答案