changeset 1397:b3264b5770b3

Update the map when receiving a RedrawRequestEvent. flys-client/trunk@3235 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 11 Nov 2011 10:43:36 +0000
parents f3410c96f51a
children 3f6d2f18ee7b
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java
diffstat 3 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Nov 11 07:26:21 2011 +0000
+++ b/flys-client/ChangeLog	Fri Nov 11 10:43:36 2011 +0000
@@ -1,3 +1,13 @@
+2011-11-11  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java:
+	  Added an update() method that redraws all layers contained in the
+	  current map.
+
+	* src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java:
+	  Registered MapOutputTab as RedrawRequestHandler. When receiving a
+	  RedrawRequestEvent, that map is updated (layers are redrawn).
+
 2011-11-11  Ingo Weinzierl <ingo@intevation.de>
 
 	* 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	Fri Nov 11 07:26:21 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java	Fri Nov 11 10:43:36 2011 +0000
@@ -10,6 +10,7 @@
 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener.FeatureAddedEvent;
 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
 import org.gwtopenmaps.openlayers.client.format.GeoJSON;
+import org.gwtopenmaps.openlayers.client.layer.Layer;
 import org.gwtopenmaps.openlayers.client.layer.Vector;
 import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
 import org.gwtopenmaps.openlayers.client.util.Attributes;
@@ -271,5 +272,14 @@
 
         getBarrierLayer().redraw();
     }
+
+
+    public void update() {
+        Layer[] layers = map.getLayers();
+
+        for (Layer l: layers) {
+            l.redraw();
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Fri Nov 11 07:26:21 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Fri Nov 11 10:43:36 2011 +0000
@@ -231,7 +231,9 @@
             }
 
             public void onSuccess(MapConfig c) {
+                GWT.log("We want to refresh the map now!");
                 themePanel.updateCollection();
+                getFloodmap().update();
             }
         });
     }
@@ -242,6 +244,11 @@
     }
 
 
+    protected FloodMap getFloodmap() {
+        return floodMap;
+    }
+
+
     protected Map getMap() {
         return floodMap.getMap();
     }
@@ -425,6 +432,7 @@
                 }
             }
         );
+        themePanel.addRedrawRequestHandler(this);
         c.addChild(themePanel);
 
         return c;

http://dive4elements.wald.intevation.org