changeset 1421:d50c3262e638

Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel. flys-client/trunk@3358 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 06 Dec 2011 09:08:48 +0000
parents c8481debff70
children 25be27e33b77
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Dec 05 14:39:12 2011 +0000
+++ b/flys-client/ChangeLog	Tue Dec 06 09:08:48 2011 +0000
@@ -1,3 +1,10 @@
+2011-12-06  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java:
+	  Reorder the layers in the map at the end of the layers initialization. A
+	  reordering is necessary, because the order in the map is reflected
+	  considering the order in the map theme panel.
+
 2011-12-05  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Mon Dec 05 14:39:12 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Tue Dec 06 09:08:48 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