Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 4921:d0fd78d5c1eb
flys/issue1116: Fix m³/q³ label.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 30 Jan 2013 23:14:19 +0100 |
parents | fac54b8470d4 |
children | 4bf3b89b38d5 |
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; |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1594
diff
changeset
|
4 import org.gwtopenmaps.openlayers.client.LonLat; |
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; |
1398
3f6d2f18ee7b
Added a ScaleLine to the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1397
diff
changeset
|
9 import org.gwtopenmaps.openlayers.client.control.ScaleLine; |
3f6d2f18ee7b
Added a ScaleLine to the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1397
diff
changeset
|
10 import org.gwtopenmaps.openlayers.client.control.ScaleLineOptions; |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
11 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; |
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
|
12 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
|
13 import org.gwtopenmaps.openlayers.client.format.GeoJSON; |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
14 import org.gwtopenmaps.openlayers.client.layer.Layer; |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
15 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
|
16 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
|
17 import org.gwtopenmaps.openlayers.client.util.Attributes; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.gwtopenmaps.openlayers.client.util.JObjectArray; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import org.gwtopenmaps.openlayers.client.util.JSObject; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
22 public class FloodMap implements VectorFeatureAddedListener { |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
24 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
|
25 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
26 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
|
27 |
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
|
28 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
|
29 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 protected MapWidget mapWidget; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 protected Map map; |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
32 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
|
33 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
|
34 protected Bounds maxExtent; |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
35 protected ScaleLine scaleLine; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
4476
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
37 public FloodMap(String srid, Bounds maxExtent, int width, int height) { |
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 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
|
39 this.maxExtent = maxExtent; |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
3347
diff
changeset
|
40 recreateWidget(width, height); |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1594
diff
changeset
|
41 getBarrierLayer(); |
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1594
diff
changeset
|
42 } |
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
|
43 |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1594
diff
changeset
|
44 |
4476
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
45 public void recreateWidget(int width, int height) { |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 MapOptions opts = new MapOptions(); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 opts.setControls(new JObjectArray(new JSObject[] {})); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 opts.setNumZoomLevels(16); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 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
|
50 opts.setMaxExtent(maxExtent); |
881
4af1ee86b0b1
Bugfix: #289 Set map units 'm'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
833
diff
changeset
|
51 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
|
52 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
|
53 |
4476
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
54 mapWidget = new MapWidget( |
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
55 Integer.toString(width - 4), |
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
56 Integer.toString(height), |
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
57 opts); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 map = mapWidget.getMap(); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
62 @Override |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
63 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
|
64 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
|
65 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
66 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
|
67 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
|
68 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
69 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
|
70 return; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
71 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
72 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
73 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
|
74 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
|
75 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
|
76 } |
882
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 // 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
|
79 barrierLayer.redraw(); |
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 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
82 |
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 * 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
|
85 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
86 * @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
|
87 * "ringdike". |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
88 * |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
89 * @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
|
90 */ |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
91 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
|
92 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
|
93 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
94 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
|
95 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
|
96 } |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
97 |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
98 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
|
99 || 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
|
100 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
101 style.setFillColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
102 style.setStrokeColor("#800080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
103 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
104 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
|
105 || 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
|
106 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
107 style.setFillColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
108 style.setStrokeColor("#808080"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
109 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
110 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
|
111 || 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
|
112 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
113 style.setFillColor("#008000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
114 style.setStrokeColor("#008000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
115 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
116 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
|
117 || 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
|
118 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
119 style.setFillColor("#800000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
120 style.setStrokeColor("#800000"); |
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 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
|
123 || 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
|
124 ) { |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
125 style.setFill(false); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
126 style.setStrokeColor("#FF8000"); |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
127 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
128 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
129 return style; |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
130 } |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
131 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
132 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 public MapWidget getMapWidget() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 return mapWidget; |
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 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 public Map getMap() { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 return map; |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 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
|
144 return "EPSG:" + srid; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 |
1315
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
148 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
|
149 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
|
150 } |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
151 |
cf0f906921de
#297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
915
diff
changeset
|
152 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
153 public Vector getBarrierLayer() { |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
154 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
|
155 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
|
156 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
|
157 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
|
158 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
806
diff
changeset
|
159 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
|
160 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
|
161 |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
162 map.addLayer(barrierLayer); |
4553
fac54b8470d4
Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
163 map.setLayerZIndex(barrierLayer, 1000); |
882
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
164 |
d3b4010d2c89
I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
881
diff
changeset
|
165 barrierLayer.addVectorFeatureAddedListener(this); |
800
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
166 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
167 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
168 return barrierLayer; |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
169 } |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
170 |
95cc560ce7c4
Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
799
diff
changeset
|
171 |
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
|
172 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
|
173 // 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
|
174 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
|
175 |
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
|
176 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
|
177 |
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
|
178 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
|
179 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
|
180 } |
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
|
181 |
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
|
182 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
|
183 } |
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
|
184 |
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
|
185 |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 public void setSize(String width, String height) { |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 mapWidget.setWidth(width); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 mapWidget.setHeight(height); |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
189 int currentZoom = map.getZoom(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
190 LonLat currentCenter = map.getCenter(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
191 map.updateSize(); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
192 map.zoomTo(currentZoom); |
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1317
diff
changeset
|
193 map.setCenter(currentCenter); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 } |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
195 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
196 |
1448
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
197 public void addLayer(Layer layer) { |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
198 if (layer != null) { |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
199 map.addLayer(layer); |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
200 |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
201 int index = map.getLayerIndex(layer); |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
202 int newIndex = index * (-1) + 1; |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
203 |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
204 map.raiseLayer(layer, newIndex); |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
205 |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
206 update(); |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
207 } |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
208 } |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
209 |
c39aa5a6478c
#409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1398
diff
changeset
|
210 |
915
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
211 public void hideBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
212 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
213 barrierLayer.setIsVisible(false); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
214 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
215 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
216 |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
217 public void showBarrierLayer () { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
218 if (barrierLayer != null) { |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
219 barrierLayer.setIsVisible(true); |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
220 } |
89a47098bcbd
Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
882
diff
changeset
|
221 } |
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
|
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 |
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 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
|
225 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
|
226 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
|
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 |
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 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
|
232 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
|
233 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
|
234 } |
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 |
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 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
|
237 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
|
238 |
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 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
|
240 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
|
241 } |
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 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
|
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 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
|
246 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
|
247 |
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 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
|
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 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
|
252 } |
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 |
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 |
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 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
|
256 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
|
257 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
|
258 |
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 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
|
260 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
|
261 } |
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 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
|
264 } |
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 |
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 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
|
268 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
|
269 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
|
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 |
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 |
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
|
274 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
|
275 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
|
276 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
|
277 } |
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
|
278 |
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
|
279 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
|
280 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
|
281 |
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
|
282 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
|
283 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
|
284 } |
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
|
285 |
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
|
286 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
|
287 |
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
|
288 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
|
289 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
|
290 |
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
|
291 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
|
292 } |
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
|
293 |
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
|
294 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
|
295 } |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
296 |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
297 |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
298 public void update() { |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
299 Layer[] layers = map.getLayers(); |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
300 |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
301 for (Layer l: layers) { |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
302 l.redraw(); |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
303 } |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1396
diff
changeset
|
304 } |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
305 |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
306 |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
307 public void activateScaleLine(boolean activate) { |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
308 if (activate) { |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
309 ScaleLineOptions slOpts = new ScaleLineOptions(); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
310 slOpts.setBottomInUnits("m"); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
311 slOpts.setBottomOutUnits("km"); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
312 slOpts.setTopInUnits(""); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
313 slOpts.setTopOutUnits(""); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
314 |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
315 scaleLine = new ScaleLine(slOpts); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
316 this.map.addControl(scaleLine); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
317 } |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
318 else if (!activate && scaleLine != null){ |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
319 this.map.removeControl(scaleLine); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
320 } |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
321 } |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
322 } |
799
f4299b90c996
Added controls to navigate in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
323 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |