diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 3808:5fab0fe3c445

Picked rev3356 and rev3358 from trunk. flys-client/tags/pre2.6-2011-12-05@3363 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 07 Dec 2011 14:03:23 +0000
parents 6a7cfe9d87fe
children 25be27e33b77
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Mon Nov 28 16:40:03 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Wed Dec 07 14:03:23 2011 +0000
@@ -17,6 +17,9 @@
 import com.smartgwt.client.widgets.menu.events.ClickHandler;
 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
 
+import org.gwtopenmaps.openlayers.client.Map;
+import org.gwtopenmaps.openlayers.client.layer.Layer;
+
 import de.intevation.flys.client.shared.MapUtils;
 import de.intevation.flys.client.shared.model.AttributedTheme;
 import de.intevation.flys.client.shared.model.Collection;
@@ -195,6 +198,26 @@
     }
 
 
+    /**
+     * This method calls super.updateGrid() at first. Finally, it is used to
+     * reorder the layers in the map. The first layer added to the map is the
+     * layer which is least visible. So, the order needs to be reflected.
+     */
+    @Override
+    protected void updateGrid() {
+        super.updateGrid();
+
+        Map map = mapOut.getMap();
+        int num = map.getNumLayers() - 1; // without the vector layer
+
+        Layer[] layers = map.getLayers();
+
+        for (int i = 1; i < num; i++) {
+            map.raiseLayer(layers[i], num-i);
+        }
+    }
+
+
     @Override
     protected void addFacetRecord(FacetRecord rec) {
         Theme newTheme = rec.getTheme();

http://dive4elements.wald.intevation.org