# HG changeset patch # User Ingo Weinzierl # Date 1318339518 0 # Node ID 2e57776f77b57962f30086eb633fea373dbc2421 # Parent 014fc183c640ea02db18ef874bdd6acca5599aa6 #300 Synchronized the ThemePanel's layer order with the internal order of the Map. flys-client/trunk@2940 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 014fc183c640 -r 2e57776f77b5 flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Oct 11 12:20:32 2011 +0000 +++ b/flys-client/ChangeLog Tue Oct 11 13:25:18 2011 +0000 @@ -1,3 +1,11 @@ +2011-10-11 Ingo Weinzierl + + flys/issue300 (ÜSK: Reihenfolge der Ebenen findet keine Berücksichtigung) + + * src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java: + Implemented a ThemeMovedCallback to synchronize the ThemePanel's layer + order with the internal order of the Map. + 2011-10-11 Felix Wolfsteller Squashed "swapped minuend and subtrahend"-bug in wdiff calculation. diff -r 014fc183c640 -r 2e57776f77b5 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 Tue Oct 11 12:20:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Tue Oct 11 13:25:18 2011 +0000 @@ -146,7 +146,7 @@ Bounds extent = null; Bounds wsplgenExtent = null; - for (int i = 1; i <= num; i++) { + for (int i = num; i >= 0; i--) { Theme theme = themeList.getThemeAt(i); Layer layer = createWMSLayer(theme); @@ -231,6 +231,11 @@ } + protected Map getMap() { + return floodMap.getMap(); + } + + protected String getGeoJSONFromDynamic(ArtifactDescription desc) { DataList list = desc.getCurrentData(); @@ -401,11 +406,32 @@ c.setBorder("1px solid black"); themePanel = new MapThemePanel( - collection, mode, new MapThemePanel.ActivateCallback() { + collection, + mode, + new MapThemePanel.ActivateCallback() { public void activate(Theme theme, boolean active) { activateTheme(theme, active); } - }); + }, + new MapThemePanel.ThemeMovedCallback() { + public void onThemeMoved(Theme theme, int oldIdx, int newIdx) { + // this code synchronizes the ThemePanel and the OpenLayers + // internal order of layers. + String name = theme.getDescription(); + Map map = getMap(); + Layer[] layers = map.getLayersByName(name); + + if (layers == null || layers.length == 0) { + GWT.log("Error: Cannot find layer '" + name + "'"); + return; + } + + map.raiseLayer(layers[0], (newIdx-oldIdx)*-1); + map.zoomTo(map.getZoom()-1); + map.zoomTo(map.getZoom()+1); + } + } + ); c.addChild(themePanel); return c;