annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/FloodMap.java @ 9561:5397555d74c9

MapOutputTab fix
author gernotbelger
date Thu, 25 Oct 2018 17:00:58 +0200
parents ea9eef426962
children
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.ui.map;
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
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
11 import org.gwtopenmaps.openlayers.client.Bounds;
3347
6d749af6a9c2 Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents: 1594
diff changeset
12 import org.gwtopenmaps.openlayers.client.LonLat;
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.gwtopenmaps.openlayers.client.Map;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.gwtopenmaps.openlayers.client.MapOptions;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 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
16 import org.gwtopenmaps.openlayers.client.Style;
5032
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 4553
diff changeset
17 import org.gwtopenmaps.openlayers.client.control.Attribution;
1398
3f6d2f18ee7b Added a ScaleLine to the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1397
diff changeset
18 import org.gwtopenmaps.openlayers.client.control.ScaleLine;
3f6d2f18ee7b Added a ScaleLine to the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1397
diff changeset
19 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
20 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
21 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
22 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
23 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
24 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
25 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
26 import org.gwtopenmaps.openlayers.client.util.Attributes;
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import org.gwtopenmaps.openlayers.client.util.JObjectArray;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import org.gwtopenmaps.openlayers.client.util.JSObject;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
31 public class FloodMap implements VectorFeatureAddedListener {
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
800
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
33 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
34
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
35 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
36
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
37 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
38
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 protected MapWidget mapWidget;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 protected Map map;
800
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
41 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
42 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
43 protected Bounds maxExtent;
1542
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
44 protected ScaleLine scaleLine;
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
4476
099d136b215b Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents: 4402
diff changeset
46 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
47 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
48 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
49 recreateWidget(width, height);
3347
6d749af6a9c2 Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents: 1594
diff changeset
50 getBarrierLayer();
6d749af6a9c2 Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents: 1594
diff changeset
51 }
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
3347
6d749af6a9c2 Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents: 1594
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 public void recreateWidget(int width, int height) {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
55 final MapOptions opts = new MapOptions();
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 opts.setControls(new JObjectArray(new JSObject[] {}));
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 opts.setNumZoomLevels(16);
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 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
59 opts.setMaxExtent(maxExtent);
881
4af1ee86b0b1 Bugfix: #289 Set map units 'm'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
60 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
61 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
62
4476
099d136b215b Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents: 4402
diff changeset
63 mapWidget = new MapWidget(
099d136b215b Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents: 4402
diff changeset
64 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
65 Integer.toString(height),
099d136b215b Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents: 4402
diff changeset
66 opts);
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 map = mapWidget.getMap();
5032
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 4553
diff changeset
68 map.addControl(new Attribution());
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
72 @Override
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
73 public void onFeatureAdded(FeatureAddedEvent evt) {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
74 final VectorFeature feature = evt.getVectorFeature();
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
75
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
76 final Attributes attrs = feature.getAttributes();
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
77 final String type = attrs.getAttributeAsString("typ");
882
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 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
80 return;
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
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
83 final Style style = getStyle(type);
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
84 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
85 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
86 }
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
87
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
88 // necessary, otherwise the setStyle() has no effect
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
89 getBarrierLayer().redraw();
882
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
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
92
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
93 /**
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
94 * 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
95 *
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
96 * @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
97 * "ringdike".
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
98 *
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
99 * @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
100 */
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
101 public static Style getStyle(String type) {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
102 final Style style = new Style();
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
103
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
104 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
105 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
106 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
107
882
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
108 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
109 || 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
110 ) {
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
111 style.setFillColor("#800080");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
112 style.setStrokeColor("#800080");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
113 }
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
114 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
115 || 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
116 ) {
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
117 style.setFillColor("#808080");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
118 style.setStrokeColor("#808080");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
119 }
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
120 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
121 || 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
122 ) {
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
123 style.setFillColor("#008000");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
124 style.setStrokeColor("#008000");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
125 }
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
126 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
127 || 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
128 ) {
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
129 style.setFillColor("#800000");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
130 style.setStrokeColor("#800000");
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 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
133 || 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
134 ) {
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
135 style.setFill(false);
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
136 style.setStrokeColor("#FF8000");
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
137 }
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
138
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
139 return style;
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
140 }
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
141
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
142
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 public MapWidget getMapWidget() {
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 return mapWidget;
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
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 public Map getMap() {
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 return map;
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 }
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 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
154 return "EPSG:" + srid;
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 }
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
1315
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
158 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
159 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
160 }
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
161
cf0f906921de #297 Implemented a window to adjust elevations of geometries in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
162
800
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
163 public Vector getBarrierLayer() {
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
164 if (barrierLayer == null) {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
165 final VectorOptions opts = new VectorOptions();
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
166 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
167 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
168
407de0f4b66a Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 806
diff changeset
169 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
170 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
171
800
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
172 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
173 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
174
d3b4010d2c89 I293: Set the style of digitized features in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 881
diff changeset
175 barrierLayer.addVectorFeatureAddedListener(this);
800
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
176 }
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
177
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
178 return barrierLayer;
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
179 }
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
180
95cc560ce7c4 Added map controls for digitizing and removing barriers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 799
diff changeset
181
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
182 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
183 // 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
184 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
185
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
186 final VectorFeature[] features = barrierLayer.getFeatures();
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
187
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
188 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
189 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
190 }
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
191
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
192 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
193 }
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
194
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
195
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 public void setSize(String width, String height) {
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 mapWidget.setWidth(width);
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 mapWidget.setHeight(height);
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
199 final int currentZoom = map.getZoom();
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
200 final LonLat currentCenter = map.getCenter();
1386
9aa1a453eed5 Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1317
diff changeset
201 map.updateSize();
9aa1a453eed5 Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1317
diff changeset
202 map.zoomTo(currentZoom);
9aa1a453eed5 Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1317
diff changeset
203 map.setCenter(currentCenter);
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 }
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
205
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
206
1448
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
207 public void addLayer(Layer layer) {
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
208 if (layer != null) {
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
209 map.addLayer(layer);
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
210
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
211 final int index = map.getLayerIndex(layer);
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
212 final int newIndex = index * (-1) + 1;
1448
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
213
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
214 map.raiseLayer(layer, newIndex);
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
215
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
216 update();
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
217 }
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
218 }
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
219
c39aa5a6478c #409 Made layer list and map layers synchron.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1398
diff changeset
220
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
221 public void hideBarrierLayer () {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
222 if (getBarrierLayer() != null) {
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
223 barrierLayer.setIsVisible(false);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
224 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
225 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
226
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
227 public void showBarrierLayer () {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
228 if (getBarrierLayer() != null) {
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
229 barrierLayer.setIsVisible(true);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
230 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 882
diff changeset
231 }
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
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
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 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
235 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
236 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
237 }
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
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 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
242 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
243 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
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
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
246 for (final VectorFeature feature: features) {
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
247 final Attributes attr = feature.getAttributes();
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
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 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
250 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
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
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 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
254
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
255 final Style style = feature.getStyle();
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
256 final double strokeWidth = style.getStrokeWidth();
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
257
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 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
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
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 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
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
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 public void disableFeatures() {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
266 final Vector barriers = getBarrierLayer();
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
267 final VectorFeature[] features = barriers.getFeatures();
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
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 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
270 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
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 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
274 }
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
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
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 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
278 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
279 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
280 }
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
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
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 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
285 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
286 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
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
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
289 for (final VectorFeature feature: features) {
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
290 final Attributes attr = feature.getAttributes();
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
291
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 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
293 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
294 }
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
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
296 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
297
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
298 final Style style = feature.getStyle();
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
299 final double strokeWidth = style.getStrokeWidth();
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
300
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
301 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
302 }
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
303
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
304 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
305 }
1397
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
306
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
307
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
308 public void update() {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
309 final Layer[] layers = map.getLayers();
1397
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
310
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
311 for (final Layer l: layers) {
1397
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
312 l.redraw();
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
313 }
5612
4f935415bb20 Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents: 5609
diff changeset
314 }
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
315
5612
4f935415bb20 Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents: 5609
diff changeset
316
4f935415bb20 Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents: 5609
diff changeset
317 public void updateSize() {
4f935415bb20 Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents: 5609
diff changeset
318 this.map.updateSize();
1397
b3264b5770b3 Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1396
diff changeset
319 }
1542
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
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
322 public void activateScaleLine(boolean activate) {
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
323 if (activate) {
5609
80e8ef91223c Fix for #802: digitized pipes and dikes should be visible now
Christian Lins <christian.lins@intevation.de>
parents: 5032
diff changeset
324 final ScaleLineOptions slOpts = new ScaleLineOptions();
1542
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
325 slOpts.setBottomInUnits("m");
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
326 slOpts.setBottomOutUnits("km");
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
327 slOpts.setTopInUnits("");
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
328 slOpts.setTopOutUnits("");
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
329
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
330 scaleLine = new ScaleLine(slOpts);
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
331 this.map.addControl(scaleLine);
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
332 }
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
333 else if (!activate && scaleLine != null){
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
334 this.map.removeControl(scaleLine);
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
335 }
3e2ef8e0a0dc Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1448
diff changeset
336 }
9561
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
337
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
338
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
339 public void destroy() {
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
340 if( this.map != null)
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
341 this.map.destroy();
5397555d74c9 MapOutputTab fix
gernotbelger
parents: 5993
diff changeset
342 }
797
cc3f481e9484 Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343 }
799
f4299b90c996 Added controls to navigate in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 797
diff changeset
344 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org