annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 5312:2c1045a1e3fe

Added new states and transitions to UESK calculation and adjusted states and UI. TODO: Some refactoring and code cleanup.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 14 Mar 2013 17:25:00 +0100
parents 4bf3b89b38d5
children ef32ab3c1679
rev   line source
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:
diff changeset
1 package de.intevation.flys.client.client.ui;
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:
diff changeset
2
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
3 import java.util.List;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
4
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
5 import org.gwtopenmaps.openlayers.client.Map;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
6 import org.gwtopenmaps.openlayers.client.control.Attribution;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
7 import org.gwtopenmaps.openlayers.client.layer.WMS;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
8 import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
9 import org.gwtopenmaps.openlayers.client.layer.WMSParams;
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
10
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:
diff changeset
11 import com.google.gwt.core.client.GWT;
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:
diff changeset
12 import com.google.gwt.user.client.rpc.AsyncCallback;
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
13 import com.smartgwt.client.types.VerticalAlignment;
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:
diff changeset
14 import com.smartgwt.client.util.SC;
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
15 import com.smartgwt.client.widgets.Canvas;
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
16 import com.smartgwt.client.widgets.Label;
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
17 import com.smartgwt.client.widgets.events.VisibilityChangedEvent;
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
18 import com.smartgwt.client.widgets.events.VisibilityChangedHandler;
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
19 import com.smartgwt.client.widgets.layout.VLayout;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
20 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
21 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
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:
diff changeset
22
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
23 import de.intevation.flys.client.client.Config;
4801
6aa1b8abe2d3 MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents: 4632
diff changeset
24 import de.intevation.flys.client.client.FLYS;
6aa1b8abe2d3 MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents: 4632
diff changeset
25 import de.intevation.flys.client.client.FLYSConstants;
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
26 import de.intevation.flys.client.client.services.MapInfoService;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
27 import de.intevation.flys.client.client.services.MapInfoServiceAsync;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
28 import de.intevation.flys.client.client.ui.map.FloodMap;
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
29 import de.intevation.flys.client.client.ui.map.MapPanel;
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:
diff changeset
30 import de.intevation.flys.client.shared.model.Data;
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:
diff changeset
31 import de.intevation.flys.client.shared.model.DataItem;
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:
diff changeset
32 import de.intevation.flys.client.shared.model.DataList;
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:
diff changeset
33 import de.intevation.flys.client.shared.model.DefaultData;
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:
diff changeset
34 import de.intevation.flys.client.shared.model.DefaultDataItem;
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:
diff changeset
35 import de.intevation.flys.client.shared.model.MapInfo;
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:
diff changeset
36
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:
diff changeset
37
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
38 public class DigitizePanel
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
39 extends SelectProvider
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
40 implements TabSelectedHandler, VisibilityChangedHandler {
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:
diff changeset
41
4131
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 4062
diff changeset
42 private static final long serialVersionUID = 3529775660871273314L;
360e22afb98b Cosmetics, warnings and minor TODOs.
Christian Lins <christian.lins@intevation.de>
parents: 4062
diff changeset
43
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:
diff changeset
44 protected MapInfoServiceAsync mapInfo = GWT.create(MapInfoService.class);
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:
diff changeset
45
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:
diff changeset
46 protected FloodMap floodMap;
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:
diff changeset
47
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
48 protected MapPanel mapPanel;
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:
diff changeset
49
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:
diff changeset
50 public static final String UESK_BARRIERS = "uesk.barriers";
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:
diff changeset
51
4801
6aa1b8abe2d3 MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents: 4632
diff changeset
52 /** The message class that provides i18n strings. */
6aa1b8abe2d3 MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents: 4632
diff changeset
53 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
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:
diff changeset
54
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:
diff changeset
55 public DigitizePanel() {
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:
diff changeset
56 }
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:
diff changeset
57
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:
diff changeset
58
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:
diff changeset
59 @Override
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:
diff changeset
60 public Canvas create(DataList list) {
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:
diff changeset
61 List<Data> data = list.getAll();
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
62 helperContainer.addVisibilityChangedHandler(this);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
63
872
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
64 DataList clone = (DataList) list.clone();
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
65 List<Data> all = clone.getAll();
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
66 all.remove(UESK_BARRIERS);
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
67
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
68 Canvas widget = createWidget(list);
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:
diff changeset
69
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:
diff changeset
70 final Config cfg = Config.getInstance();
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:
diff changeset
71 final String locale = cfg.getLocale();
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:
diff changeset
72
873
77a549772aa9 Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 872
diff changeset
73 String river = getDataValue("state.winfo.river", "river");
1425
bc06a671ef60 Removed the URL parameter from service calls. The service
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1389
diff changeset
74 mapInfo.getMapInfo(locale, river, new AsyncCallback<MapInfo>() {
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
75 @Override
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:
diff changeset
76 public void onFailure(Throwable caught) {
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:
diff changeset
77 String msg = caught.getMessage();
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:
diff changeset
78
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:
diff changeset
79 GWT.log("Error while fetching MapInfo: " + msg);
4801
6aa1b8abe2d3 MapInfoService now submits layer names as well as WMS urls.
Christian Lins <christian.lins@intevation.de>
parents: 4632
diff changeset
80 SC.warn(FLYS.getExceptionString(MSG, caught));
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:
diff changeset
81 }
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:
diff changeset
82
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
83 @Override
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:
diff changeset
84 public void onSuccess(MapInfo info) {
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
85 createMapWidget(info);
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:
diff changeset
86 }
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:
diff changeset
87 });
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:
diff changeset
88
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
89 return widget;
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:
diff changeset
90 }
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:
diff changeset
91
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:
diff changeset
92
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
93 /**
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
94 * This method creates the content of the widget.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
95 *
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
96 * @param data The {@link DataList} object.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
97 *
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
98 * @return a combobox.
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
99 */
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
100 @Override
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
101 protected Canvas createWidget(DataList data) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
102 GWT.log("DigitizePanel - createWidget()");
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
103
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
104 VLayout layout = new VLayout();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
105 layout.setAlign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
106 layout.setHeight(25);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
107
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
108 int size = data.size();
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
109
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
110 for (int i = 0; i < size; i++) {
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
111 Data d = data.get(i);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
112
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
113 Label label = new Label(d.getDescription());
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
114 label.setValign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
115 label.setHeight(20);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
116 label.setWidth(400);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
117
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
118 layout.addMember(label);
4574
32a4651eef93 flys-client: Shapefile upload widget readded again (regression).
Christian Lins <christian.lins@intevation.de>
parents: 4553
diff changeset
119 layout.addMember(getNextButton());
2494
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
120 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
121
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
122 layout.setAlign(VerticalAlignment.TOP);
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
123
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
124 return layout;
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
125 }
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
126
88b51e6e0334 Issue 657.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1425
diff changeset
127
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:
diff changeset
128 @Override
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:
diff changeset
129 protected Data[] getData() {
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
130 Data[] total = new Data[1];
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:
diff changeset
131
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
132 if (floodMap != null) {
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
133 DataItem item = new DefaultDataItem(
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
134 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON());
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
135 total[0] = new DefaultData(
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
136 UESK_BARRIERS, null, null, new DataItem[] { item });
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
137 }
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
138 else {
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
139 // Happens when OpenLayers is missing
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
140 GWT.log("floodMap is null -> OpenLayers missing?");
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
141 }
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:
diff changeset
142
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:
diff changeset
143 return total;
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:
diff changeset
144 }
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:
diff changeset
145
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:
diff changeset
146
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
147 public void createMapWidget(MapInfo mapInfo) {
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
148 mapPanel = new MapPanel(mapInfo, true);
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:
diff changeset
149
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:
diff changeset
150 floodMap = mapPanel.getFloodMap();
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:
diff changeset
151 Map map = floodMap.getMap();
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:
diff changeset
152
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 helperContainer.addMember(mapPanel);
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:
diff changeset
154
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
155 parameterList.registerCollectionViewTabHandler(this);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
156
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:
diff changeset
157 WMS axis = getLayer(
4632
02cf2b1dff84 Make floodmap riveraxis layer name configurable.
Christian Lins <christian.lins@intevation.de>
parents: 4574
diff changeset
158 mapInfo.getWmsUrl(), mapInfo.getWmsLayers(),
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:
diff changeset
159 mapInfo.getProjection(), false);
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:
diff changeset
160 WMS back = getLayer(
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:
diff changeset
161 mapInfo.getBackgroundWmsUrl(), mapInfo.getBackgroundWmsLayers(),
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:
diff changeset
162 mapInfo.getProjection(), false);
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:
diff changeset
163
4553
fac54b8470d4 Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents: 4476
diff changeset
164 map.addLayer(back);
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:
diff changeset
165 map.addLayer(axis);
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:
diff changeset
166
5312
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
167 String hws = getDataValue("state.winfo.uesk.dc-hws", "uesk.hws");
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
168 if (hws != null && hws.length() > 0) {
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
169 WMS hwsLayer = getLayer(
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
170 //TODO: Use Mapinfo to get hws layer infos.
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
171 mapInfo.getWmsUrl().replace("river", "user"),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
172 "ms_layer-hws-lines" + artifact.getUuid(),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
173 mapInfo.getProjection(),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
174 false);
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
175 map.addLayer(hwsLayer);
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
176 }
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
177 String userRgd = getDataValue("state.winfo.uesk.user-rgd", "uesk.user-rgd");
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
178 if (userRgd != null && userRgd.length() > 0) {
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
179 WMS userLayer = getLayer(
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
180 //TODO: Use Mapinfo to get hws layer infos.
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
181 mapInfo.getWmsUrl().replace("river", "user"),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
182 "ms_layer-user-rgd" + artifact.getUuid(),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
183 mapInfo.getProjection(),
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
184 false);
2c1045a1e3fe Added new states and transitions to UESK calculation and adjusted states and UI.
Raimund Renkert <rrenkert@intevation.de>
parents: 5032
diff changeset
185 map.addLayer(userLayer);
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:
diff changeset
186 }
5032
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 5008
diff changeset
187 map.addControl(new Attribution());
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:
diff changeset
188 map.zoomToMaxExtent();
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:
diff changeset
189 }
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:
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:
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:
diff changeset
192 protected WMS getLayer(String url, String layers, String proj, boolean x) {
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:
diff changeset
193 WMSParams params = new WMSParams();
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:
diff changeset
194 params.setLayers(layers);
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:
diff changeset
195 params.setFormat("image/png");
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:
diff changeset
196 params.setIsTransparent(!x);
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:
diff changeset
197
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:
diff changeset
198 WMSOptions opts = new WMSOptions();
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:
diff changeset
199 opts.setProjection(proj);
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:
diff changeset
200 opts.setSingleTile(true);
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:
diff changeset
201 opts.setRatio(1);
1302
17e7d5e437fb Bumped OpenLayers to version 2.11 and GWT-OpenLayers to version 0.6
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 915
diff changeset
202 opts.setBuffer(0);
5032
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 5008
diff changeset
203 if (layers.equals("OSM-WMS-Dienst")) {
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 5008
diff changeset
204 opts.setAttribution(MSG.attribution());
4bf3b89b38d5 Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents: 5008
diff changeset
205 }
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:
diff changeset
206 WMS wms = new WMS(layers, url, params, opts);
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:
diff changeset
207 wms.setIsVisible(true);
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:
diff changeset
208 wms.setIsBaseLayer(x);
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:
diff changeset
209
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:
diff changeset
210 return wms;
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:
diff changeset
211 }
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
212
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
213
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
214 @Override
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
215 public void onTabSelected(TabSelectedEvent tse) {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
216 if (tse.getTabNum () != 0) {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
217 floodMap.hideBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
218 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
219 else {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
220 floodMap.showBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
221 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
222 }
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
223
4062
145980c21700 Handle error conditions more robust.
Christian Lins <christian.lins@intevation.de>
parents: 2494
diff changeset
224 @Override
1389
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
225 public void onVisibilityChanged(VisibilityChangedEvent vce) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
226 if (!vce.getIsVisible()) {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
227 floodMap.hideBarrierLayer();
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
228 mapPanel.getMapToolbar().activateDrawFeature(false);
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
229 }
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
230 else {
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
231 floodMap.showBarrierLayer();
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
232 }
d29a9fa10313 Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1322
diff changeset
233 }
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:
diff changeset
234 }
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:
diff changeset
235 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org