[mapguide-users] Turn Layers On/Off of The Legend - FusionSF.js - AIMS2017/MapGuide3.1

RenoSun renolionheart at gmail.com
Tue Nov 21 12:38:46 PST 2017


Hi Gordon,

Thank you for your help.

I modified following codes in order to make it work:

Fusion.Layers.Group = OpenLayers.Class(Fusion.Lib.EventMgr, {
...
    show: function (noDraw) {
        if (this.visible) {
            return;
        }
        this.oMap.showGroup(this, noDraw ? true : false);
        this.set('visible', true);
        if (this.legend && this.legend.treeItem) {
            this.legend.treeItem.check(true);
        }
    },

    hide: function (noDraw) {
        if (!this.visible) {
            return;
        }
        this.oMap.hideGroup(this, noDraw ? true : false);
        this.set('visible', false);
        if (this.legend && this.legend.treeItem) {
            this.legend.treeItem.check(false);
        }
    },
...

Fusion.Layers.Layer = OpenLayers.Class(Fusion.Lib.EventMgr, {...
 show: function (noDraw) {
        console.log('showLY: function (noDraw) ');
        if (this.visible) {
            return;
        }
        this.set('visible', true);
        this.oMap.showLayer(this, noDraw ? true : false);
        if (this.legend && this.legend.treeItem) {
            this.legend.treeItem.check(true);
        }
    },

    hide: function (noDraw) {
        console.log('hideLY: function (noDraw) ');
        if (!this.visible) {
            return;
        }
        this.set('visible', false);
        this.oMap.hideLayer(this, noDraw ? true : false);
        if (this.legend && this.legend.treeItem) {
            this.legend.treeItem.check(false);
        }
    },
...


initialize: function (legend, widgetTag) {...
  layerPropertyChanged: function (eventID, layer) {
            console.log('layerPropertyChanged');
            if (typeof layer.legend.treeItem != 'undefined') {
                layer.legend.treeItem.check(layer.isVisible());
            }
        },
...







--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html


More information about the mapguide-users mailing list