Hi all,
I have an application in which I have a WMS layer with several sublayers.
Using LayerParamNodes in a tree, the user has the opportunity to
change the list of sublayers for the given WMS layer.
Currently the PermalinkProvider provides no way to keep information
about the list of sublayers. Using the following patch, I can easily
get/apply a state which takes this into account.
In your opinion, does it deserve modifying the GeoExt.MapPanel code or
is it to be done at an application level ?
Regards,
Pierre
Index: sitn/public/lib/externals/geoext/lib/GeoExt/widgets/MapPanel.js
===================================================================
--- sitn/public/lib/externals/geoext/lib/GeoExt/widgets/MapPanel.js
(revision
2579)
+++ sitn/public/lib/externals/geoext/lib/GeoExt/widgets/MapPanel.js (working
copy)
@@ -226,7 +226,7 @@
this.zoom = state.zoom;
// set layer visibility and opacity
- var i, l, layer, layerId, visibility, opacity;
+ var i, l, layer, layerId, visibility, opacity, sublayers;
var layers = this.map.layers;
for(i=0, l=layers.length; i<l; i++) {
layer = layers[i];
@@ -247,6 +247,11 @@
if(opacity !== undefined) {
layer.setOpacity(opacity);
}
+ // WMS sublayers
+ sublayers = state["layers_" + layerId];
+ if(sublayers !== undefined) {
+ layer.params.LAYERS = sublayers;
+ }
}
},
@@ -282,6 +287,10 @@
state["visibility_" + layerId] = layer.getVisibility();
state["opacity_" + layerId] = layer.opacity == null ?
1 : layer.opacity;
+
+ if (layer.params && layer.params.LAYERS) {
+ state["layers_" + layerId] = layer.params.LAYERS;
+ }
}
return state;
--
Pierre GIRAUD
Géomaticien, Analyste
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 93
Mail : [email protected]
http://www.camptocamp.com
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev