[fusion-commits] r1755 - trunk/layers/MapServer
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jan 28 15:44:45 EST 2009
Author: madair
Date: 2009-01-28 15:44:44 -0500 (Wed, 28 Jan 2009)
New Revision: 1755
Modified:
trunk/layers/MapServer/MapServer.js
Log:
closes #167: restore previous state of layers after show/hide of groups in the legend
Modified: trunk/layers/MapServer/MapServer.js
===================================================================
--- trunk/layers/MapServer/MapServer.js 2009-01-28 20:07:44 UTC (rev 1754)
+++ trunk/layers/MapServer/MapServer.js 2009-01-28 20:44:44 UTC (rev 1755)
@@ -260,11 +260,8 @@
reloadMap: function() {
this.mapWidget._addWorker();
- this.aShowLayers = [];
- this.aHideLayers = [];
- this.aShowGroups = [];
- this.aHideGroups = [];
- this.aRefreshLayers = [];
+ this.aVisibleLayers = [];
+ this.aVisibleGroups = [];
this.layerRoot.clear();
this.aLayers = [];
@@ -475,10 +472,16 @@
if (group.groupName == 'layerRoot') {
this.oLayerOL.setVisibility(true);
} else {
- this.aShowGroups.push(group.uniqueId);
- if (!noDraw) {
- this.drawMap();
+ this.aVisibleGroups.push(group.uniqueId);
+ this.deferredDraw = true;
+ for (var i=0; i<group.layers.length; ++i) {
+ if (group.layers[i].wasVisibleInGroup) {
+ group.layers[i].show();
+ }
+ group.layers[i].wasVisibleInGroup = null;
}
+ this.deferredDraw = false;
+ this.drawMap();
}
},
hideGroup: function( group, noDraw ) {
@@ -486,10 +489,21 @@
if (group.groupName == 'layerRoot') {
this.oLayerOL.setVisibility(false);
} else {
- this.aHideGroups.push(group.uniqueId);
- if (!noDraw) {
- this.drawMap();
+ for (var i=0; i<this.aVisibleGroups.length; i++) {
+ if (this.aVisibleGroups[i] == group.uniqueId) {
+ this.aVisibleGroups.splice(i,1);
+ break;
+ }
}
+ this.deferredDraw = true;
+ for (var i=0; i<group.layers.length; ++i) {
+ if (group.layers[i].visible) {
+ group.layers[i].wasVisibleInGroup = true;
+ group.layers[i].hide();
+ }
+ }
+ this.deferredDraw = false;
+ this.drawMap();
}
},
showGroupOLD: function( sGroup ) {
More information about the fusion-commits
mailing list