Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 1396:f3410c96f51a
Removed needless imports.
flys-client/trunk@3231 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 11 Nov 2011 07:26:21 +0000 |
parents | 9aa1a453eed5 |
children | b3264b5770b3 |
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 |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
3 |
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
|
4 import org.gwtopenmaps.openlayers.client.Bounds; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.gwtopenmaps.openlayers.client.Map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.gwtopenmaps.openlayers.client.MapOptions; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 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
|
8 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
|
9 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
|
10 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
|
11 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
|
12 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
|
13 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
|
14 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
|
15 import org.gwtopenmaps.openlayers.client.util.Attributes; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.gwtopenmaps.openlayers.client.util.JObjectArray; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.gwtopenmaps.openlayers.client.util.JSObject; |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
18 import org.gwtopenmaps.openlayers.client.LonLat; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
21 public class FloodMap implements VectorFeatureAddedListener { |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
23 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
|
24 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
25 public static final String MARK_SELECTED = "mark.selected"; |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
26 |
1317
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
27 public static final int SELECTED_STROKE_WIDTH = 2; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
28 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 protected MapWidget mapWidget; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 protected Map map; |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
31 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
|
32 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
|
33 protected Bounds maxExtent; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
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
|
36 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
|
37 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
|
38 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
|
39 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 MapOptions opts = new MapOptions(); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 opts.setControls(new JObjectArray(new JSObject[] {})); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 opts.setNumZoomLevels(16); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 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
|
44 opts.setMaxExtent(maxExtent); |
881
4af1ee86b0b1
Bugfix: #289 Set map units 'm'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
45 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
|
46 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
|
47 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 mapWidget = new MapWidget("510px", "635px", opts); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 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
|
50 |
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
|
51 getBarrierLayer(); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
55 @Override |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
56 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
|
57 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
|
58 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
59 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
|
60 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
|
61 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
62 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
|
63 return; |
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 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
66 Style style = getStyle(type); |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
67 if (style != null) { |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
68 feature.setStyle(style); |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
69 } |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
70 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
71 // 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
|
72 barrierLayer.redraw(); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
73 } |
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 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
76 /** |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
77 * 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
|
78 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
79 * @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
|
80 * "ringdike". |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
81 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
82 * @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
|
83 */ |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
84 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
|
85 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
|
86 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
87 if (type == null) { |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
88 return null; |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
89 } |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
90 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
91 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
|
92 || 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
|
93 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
94 style.setFillColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
95 style.setStrokeColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
96 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
97 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
|
98 || 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
|
99 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
100 style.setFillColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
101 style.setStrokeColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
102 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
103 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
|
104 || 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
|
105 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
106 style.setFillColor("#008000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
107 style.setStrokeColor("#008000"); |
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 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
|
110 || 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
|
111 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
112 style.setFillColor("#800000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
113 style.setStrokeColor("#800000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
114 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
115 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
|
116 || 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
|
117 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
118 style.setFill(false); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
119 style.setStrokeColor("#FF8000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
120 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
121 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
122 return style; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
123 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
124 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
125 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 public MapWidget getMapWidget() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 return mapWidget; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 public Map getMap() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 return map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 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
|
137 return "EPSG:" + srid; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
141 public Bounds getMaxExtent() { |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
142 return maxExtent; |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
143 } |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
144 |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
145 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
146 public Vector getBarrierLayer() { |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
147 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
|
148 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
|
149 opts.setProjection(getRiverProjection()); |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
150 opts.setMaxExtent(getMaxExtent()); |
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
|
151 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
152 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
|
153 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
|
154 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
155 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
|
156 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
157 barrierLayer.addVectorFeatureAddedListener(this); |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
158 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
159 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
160 return barrierLayer; |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
161 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
162 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
163 |
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
|
164 public String getFeaturesAsGeoJSON() { |
1317
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
165 // disable features before exporting to GeoJSON |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
166 disableFeatures(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
167 |
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
|
168 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
|
169 |
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
|
170 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
|
171 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
|
172 } |
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
|
173 |
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
|
174 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
|
175 } |
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
|
176 |
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
|
177 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 public void setSize(String width, String height) { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 mapWidget.setWidth(width); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 mapWidget.setHeight(height); |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
181 int currentZoom = map.getZoom(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
182 LonLat currentCenter = map.getCenter(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
183 map.updateSize(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
184 map.zoomTo(currentZoom); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
185 map.setCenter(currentCenter); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 } |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
187 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
188 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
189 public void hideBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
190 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
191 barrierLayer.setIsVisible(false); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
192 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
193 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
194 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
195 public void showBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
196 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
197 barrierLayer.setIsVisible(true); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
198 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
199 } |
1317
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
200 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
201 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
202 public void selectFeature(VectorFeature feature) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
203 if (feature != null) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
204 selectFeatures(new VectorFeature[] { feature } ); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
205 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
206 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
207 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
208 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
209 public void selectFeatures(VectorFeature[] features) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
210 if (features == null || features.length == 0) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
211 return; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
212 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
213 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
214 for (VectorFeature feature: features) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
215 Attributes attr = feature.getAttributes(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
216 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
217 if (attr.getAttributeAsInt(MARK_SELECTED) == 1) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
218 continue; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
219 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
220 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
221 attr.setAttribute(MARK_SELECTED, 1); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
222 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
223 Style style = feature.getStyle(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
224 double strokeWidth = style.getStrokeWidth(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
225 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
226 style.setStrokeWidth(strokeWidth+SELECTED_STROKE_WIDTH); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
227 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
228 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
229 getBarrierLayer().redraw(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
230 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
231 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
232 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
233 public void disableFeatures() { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
234 Vector barriers = getBarrierLayer(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
235 VectorFeature[] features = barriers.getFeatures(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
236 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
237 if (features == null || features.length == 0) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
238 return; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
239 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
240 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
241 disableFeatures(features); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
242 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
243 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
244 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
245 public void disableFeature(VectorFeature feature) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
246 if (feature != null) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
247 disableFeatures(new VectorFeature[] { feature }); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
248 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
249 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
250 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
251 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
252 public void disableFeatures(VectorFeature[] features) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
253 if (features == null || features.length == 0) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
254 return; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
255 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
256 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
257 for (VectorFeature feature: features) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
258 Attributes attr = feature.getAttributes(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
259 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
260 if (attr.getAttributeAsInt(MARK_SELECTED) == 0) { |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
261 continue; |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
262 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
263 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
264 attr.setAttribute(FloodMap.MARK_SELECTED, 0); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
265 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
266 Style style = feature.getStyle(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
267 double strokeWidth = style.getStrokeWidth(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
268 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
269 style.setStrokeWidth(strokeWidth-SELECTED_STROKE_WIDTH); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
270 } |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
271 |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
272 getBarrierLayer().redraw(); |
45b9b1fc26e2
Improved error handling while using the elevation control - Make selected features in the map visible.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1315
diff
changeset
|
273 } |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
274 } |
799
f4299b90c996
Added controls to navigate in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
275 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |