Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 1282:3904519ec161
Bugfix: #179 Repaired broken zoom-out-by-factor function for charts.
flys-client/trunk@2864 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 29 Sep 2011 14:52:29 +0000 |
parents | 89a47098bcbd |
children | cf0f906921de |
rev | line source |
---|---|
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
3 import org.gwtopenmaps.openlayers.client.Bounds; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import org.gwtopenmaps.openlayers.client.Map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.gwtopenmaps.openlayers.client.MapOptions; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.gwtopenmaps.openlayers.client.MapWidget; |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
7 import org.gwtopenmaps.openlayers.client.Style; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
8 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
9 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener.FeatureAddedEvent; |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
10 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
11 import org.gwtopenmaps.openlayers.client.format.GeoJSON; |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
12 import org.gwtopenmaps.openlayers.client.layer.Vector; |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
13 import org.gwtopenmaps.openlayers.client.layer.VectorOptions; |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
14 import org.gwtopenmaps.openlayers.client.util.Attributes; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.gwtopenmaps.openlayers.client.util.JObjectArray; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.gwtopenmaps.openlayers.client.util.JSObject; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
19 public class FloodMap implements VectorFeatureAddedListener { |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
21 public static final String LAYER_BARRIERS = "vector_layer_barriers"; |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
22 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 protected MapWidget mapWidget; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 protected Map map; |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
25 protected Vector barrierLayer; |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
26 protected String srid; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
27 protected Bounds maxExtent; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
30 public FloodMap(String srid, Bounds maxExtent) { |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
31 this.srid = srid; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
32 this.maxExtent = maxExtent; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
33 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 MapOptions opts = new MapOptions(); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 opts.setControls(new JObjectArray(new JSObject[] {})); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 opts.setNumZoomLevels(16); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 opts.setProjection(getRiverProjection()); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
38 opts.setMaxExtent(maxExtent); |
881
4af1ee86b0b1
Bugfix: #289 Set map units 'm'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
39 opts.setUnits("m"); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
40 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 mapWidget = new MapWidget("510px", "635px", opts); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 map = mapWidget.getMap(); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
44 |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
45 getBarrierLayer(); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
49 @Override |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
50 public void onFeatureAdded(FeatureAddedEvent evt) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
51 VectorFeature feature = evt.getVectorFeature(); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
52 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
53 Attributes attrs = feature.getAttributes(); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
54 String type = attrs.getAttributeAsString("typ"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
55 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
56 if (type == null || type.length() == 0) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
57 return; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
58 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
59 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
60 feature.setStyle(getStyle(type)); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
61 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
62 // necessary, otherwise the setStyle() has no effect |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
63 barrierLayer.redraw(); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
64 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
65 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
66 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
67 /** |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
68 * Returns an OpenLayers.Style based on a given type. |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
69 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
70 * @param type Type can be one of "pipe1", "pipe2", "ditch", "dam", |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
71 * "ringdike". |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
72 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
73 * @return an OpenLayers.Style object. |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
74 */ |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
75 public static Style getStyle(String type) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
76 Style style = new Style(); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
77 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
78 if (type.equals(DrawControl.BARRIER_PIPE1) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
79 || type.equals(DrawControl.BARRIER_PIPE1_VALUE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
80 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
81 style.setFillColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
82 style.setStrokeColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
83 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
84 else if (type.equals(DrawControl.BARRIER_PIPE2) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
85 || type.equals(DrawControl.BARRIER_PIPE2_VALUE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
86 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
87 style.setFillColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
88 style.setStrokeColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
89 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
90 else if (type.equals(DrawControl.BARRIER_DAM) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
91 || type.equals(DrawControl.BARRIER_DAM_VALUE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
92 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
93 style.setFillColor("#008000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
94 style.setStrokeColor("#008000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
95 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
96 else if (type.equals(DrawControl.BARRIER_DITCH) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
97 || type.equals(DrawControl.BARRIER_DITCH_VALUE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
98 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
99 style.setFillColor("#800000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
100 style.setStrokeColor("#800000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
101 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
102 else if (type.equals(DrawControl.BARRIER_RINGDIKE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
103 || type.equals(DrawControl.BARRIER_RINGDIKE_VALUE) |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
104 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
105 style.setFill(false); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
106 style.setStrokeColor("#FF8000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
107 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
108 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
109 return style; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
110 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
111 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
112 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 public MapWidget getMapWidget() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 return mapWidget; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 public Map getMap() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 return map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 public String getRiverProjection() { |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
124 return "EPSG:" + srid; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
128 public Vector getBarrierLayer() { |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
129 if (barrierLayer == null) { |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
130 VectorOptions opts = new VectorOptions(); |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
131 opts.setProjection(getRiverProjection()); |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
132 opts.setMaxExtent(maxExtent); |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
133 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
134 barrierLayer = new Vector(LAYER_BARRIERS, opts); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
135 barrierLayer.setIsBaseLayer(true); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
136 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
137 map.addLayer(barrierLayer); |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
138 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
139 barrierLayer.addVectorFeatureAddedListener(this); |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
140 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
141 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
142 return barrierLayer; |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
143 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
144 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
145 |
833
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
146 public String getFeaturesAsGeoJSON() { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
147 VectorFeature[] features = barrierLayer.getFeatures(); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
148 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
149 if (features == null || features.length == 0) { |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
150 return null; |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
151 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
152 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
153 return new GeoJSON().write(features); |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
154 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
155 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
156 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 public void setSize(String width, String height) { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 mapWidget.setWidth(width); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 mapWidget.setHeight(height); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 } |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
161 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
162 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
163 public void hideBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
164 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
165 barrierLayer.setIsVisible(false); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
166 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
167 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
168 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
169 public void showBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
170 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
171 barrierLayer.setIsVisible(true); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
172 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
173 } |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 } |
799
f4299b90c996
Added controls to navigate in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
175 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |