# HG changeset patch # User Ingo Weinzierl # Date 1324306704 0 # Node ID c39aa5a6478cc7f602af5319536f22787d9f50e5 # Parent c4bc320e3d44ee41826b072c6edcd204e6407979 #409 Made layer list and map layers synchron. flys-client/trunk@3465 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r c4bc320e3d44 -r c39aa5a6478c flys-client/ChangeLog --- a/flys-client/ChangeLog Mon Dec 19 10:13:12 2011 +0000 +++ b/flys-client/ChangeLog Mon Dec 19 14:58:24 2011 +0000 @@ -1,3 +1,20 @@ +2011-12-19 Ingo Weinzierl + + flys/issue409 (Überschwemmungsfläche: Reihenfolge in Themenliste nicht immer synchron mit Rendering) + + * src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java: Added + a addLayer() method which should be used to add new layers to the map. New + layers are always displayed at the bottom of the layer stack. + + * src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java: + Use FloodMap.addLayer() to add new layers instead of adding them directly + to the Map. + + * src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java: + Removed the re-order process of map layers. This is no longer necessary, + because MapOutputTab uses FloodMap.addLayer() to add new layers instead of + adding new layers on its own using Map.addLayer() directly. + 2011-12-19 Ingo Weinzierl * src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, diff -r c4bc320e3d44 -r c39aa5a6478c flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Mon Dec 19 10:13:12 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Mon Dec 19 14:58:24 2011 +0000 @@ -197,6 +197,20 @@ } + public void addLayer(Layer layer) { + if (layer != null) { + map.addLayer(layer); + + int index = map.getLayerIndex(layer); + int newIndex = index * (-1) + 1; + + map.raiseLayer(layer, newIndex); + + update(); + } + } + + public void hideBarrierLayer () { if (barrierLayer != null) { barrierLayer.setIsVisible(false); diff -r c4bc320e3d44 -r c39aa5a6478c flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Mon Dec 19 10:13:12 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Mon Dec 19 14:58:24 2011 +0000 @@ -217,7 +217,7 @@ public void addLayer(Layer layer) { - Map map = getMap(); + FloodMap map = getFloodmap(); if (map != null) { GWT.log("Add new layer '" + layer.getName() + "' to map."); diff -r c4bc320e3d44 -r c39aa5a6478c flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java Mon Dec 19 10:13:12 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java Mon Dec 19 14:58:24 2011 +0000 @@ -19,9 +19,6 @@ 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; @@ -200,26 +197,6 @@ } - /** - * 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();