Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java @ 1306:2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
flys-client/trunk@2940 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 11 Oct 2011 13:25:18 +0000 |
parents | 45791d12a1f4 |
children | 8a93fb299e64 |
line wrap: on
line diff
--- 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;