diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 823:407de0f4b66a

Set the map projection and its max extent dynamically - information extracted from facets. flys-client/trunk@2515 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 19 Aug 2011 15:57:23 +0000
parents e50da1f74e58
children dcecdd9693a8
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java	Fri Aug 12 15:51:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java	Fri Aug 19 15:57:23 2011 +0000
@@ -1,9 +1,11 @@
 package de.intevation.flys.client.client.ui.map;
 
+import org.gwtopenmaps.openlayers.client.Bounds;
 import org.gwtopenmaps.openlayers.client.Map;
 import org.gwtopenmaps.openlayers.client.MapOptions;
 import org.gwtopenmaps.openlayers.client.MapWidget;
 import org.gwtopenmaps.openlayers.client.layer.Vector;
+import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
 import org.gwtopenmaps.openlayers.client.util.JObjectArray;
 import org.gwtopenmaps.openlayers.client.util.JSObject;
 
@@ -15,13 +17,20 @@
     protected MapWidget mapWidget;
     protected Map       map;
     protected Vector    barrierLayer;
+    protected String    srid;
+    protected Bounds    maxExtent;
 
 
-    public FloodMap() {
+    public FloodMap(String srid, Bounds maxExtent) {
+        this.srid      = srid;
+        this.maxExtent = maxExtent;
+
         MapOptions opts = new MapOptions();
         opts.setControls(new JObjectArray(new JSObject[] {}));
         opts.setNumZoomLevels(16);
         opts.setProjection(getRiverProjection());
+        opts.setMaxExtent(maxExtent);
+        opts.setMaxResolution(500); // TODO DO THIS ON THE FLY
 
         mapWidget = new MapWidget("510px", "635px", opts);
         map       = mapWidget.getMap();
@@ -41,14 +50,19 @@
 
 
     public String getRiverProjection() {
-        return "EPSG:4326";
+        return "EPSG:" + srid;
     }
 
 
     public Vector getBarrierLayer() {
         if (barrierLayer == null) {
-            barrierLayer = new Vector(LAYER_BARRIERS);
+            VectorOptions opts = new VectorOptions();
+            opts.setProjection(getRiverProjection());
+            opts.setMaxExtent(maxExtent);
+
+            barrierLayer = new Vector(LAYER_BARRIERS, opts);
             barrierLayer.setIsBaseLayer(true);
+
             map.addLayer(barrierLayer);
         }
 

http://dive4elements.wald.intevation.org