Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
822:ffb98b228b3c | 823:407de0f4b66a |
---|---|
1 package de.intevation.flys.client.client.ui.map; | 1 package de.intevation.flys.client.client.ui.map; |
2 | 2 |
3 import org.gwtopenmaps.openlayers.client.Bounds; | |
3 import org.gwtopenmaps.openlayers.client.Map; | 4 import org.gwtopenmaps.openlayers.client.Map; |
4 import org.gwtopenmaps.openlayers.client.MapOptions; | 5 import org.gwtopenmaps.openlayers.client.MapOptions; |
5 import org.gwtopenmaps.openlayers.client.MapWidget; | 6 import org.gwtopenmaps.openlayers.client.MapWidget; |
6 import org.gwtopenmaps.openlayers.client.layer.Vector; | 7 import org.gwtopenmaps.openlayers.client.layer.Vector; |
8 import org.gwtopenmaps.openlayers.client.layer.VectorOptions; | |
7 import org.gwtopenmaps.openlayers.client.util.JObjectArray; | 9 import org.gwtopenmaps.openlayers.client.util.JObjectArray; |
8 import org.gwtopenmaps.openlayers.client.util.JSObject; | 10 import org.gwtopenmaps.openlayers.client.util.JSObject; |
9 | 11 |
10 | 12 |
11 public class FloodMap { | 13 public class FloodMap { |
13 public static final String LAYER_BARRIERS = "vector_layer_barriers"; | 15 public static final String LAYER_BARRIERS = "vector_layer_barriers"; |
14 | 16 |
15 protected MapWidget mapWidget; | 17 protected MapWidget mapWidget; |
16 protected Map map; | 18 protected Map map; |
17 protected Vector barrierLayer; | 19 protected Vector barrierLayer; |
20 protected String srid; | |
21 protected Bounds maxExtent; | |
18 | 22 |
19 | 23 |
20 public FloodMap() { | 24 public FloodMap(String srid, Bounds maxExtent) { |
25 this.srid = srid; | |
26 this.maxExtent = maxExtent; | |
27 | |
21 MapOptions opts = new MapOptions(); | 28 MapOptions opts = new MapOptions(); |
22 opts.setControls(new JObjectArray(new JSObject[] {})); | 29 opts.setControls(new JObjectArray(new JSObject[] {})); |
23 opts.setNumZoomLevels(16); | 30 opts.setNumZoomLevels(16); |
24 opts.setProjection(getRiverProjection()); | 31 opts.setProjection(getRiverProjection()); |
32 opts.setMaxExtent(maxExtent); | |
33 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY | |
25 | 34 |
26 mapWidget = new MapWidget("510px", "635px", opts); | 35 mapWidget = new MapWidget("510px", "635px", opts); |
27 map = mapWidget.getMap(); | 36 map = mapWidget.getMap(); |
28 | 37 |
29 getBarrierLayer(); | 38 getBarrierLayer(); |
39 return map; | 48 return map; |
40 } | 49 } |
41 | 50 |
42 | 51 |
43 public String getRiverProjection() { | 52 public String getRiverProjection() { |
44 return "EPSG:4326"; | 53 return "EPSG:" + srid; |
45 } | 54 } |
46 | 55 |
47 | 56 |
48 public Vector getBarrierLayer() { | 57 public Vector getBarrierLayer() { |
49 if (barrierLayer == null) { | 58 if (barrierLayer == null) { |
50 barrierLayer = new Vector(LAYER_BARRIERS); | 59 VectorOptions opts = new VectorOptions(); |
60 opts.setProjection(getRiverProjection()); | |
61 opts.setMaxExtent(maxExtent); | |
62 | |
63 barrierLayer = new Vector(LAYER_BARRIERS, opts); | |
51 barrierLayer.setIsBaseLayer(true); | 64 barrierLayer.setIsBaseLayer(true); |
65 | |
52 map.addLayer(barrierLayer); | 66 map.addLayer(barrierLayer); |
53 } | 67 } |
54 | 68 |
55 return barrierLayer; | 69 return barrierLayer; |
56 } | 70 } |