annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 1322:e2749cc3b7ad

Removed obsolete imports. flys-client/trunk@2963 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 13 Oct 2011 12:38:04 +0000
parents 17e7d5e437fb
children d29a9fa10313
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
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
3 import java.util.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
4
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
5 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
6 import com.google.gwt.user.client.rpc.AsyncCallback;
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
7
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
8 import com.smartgwt.client.util.SC;
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
9 import com.smartgwt.client.widgets.Canvas;
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
10 import com.smartgwt.client.widgets.events.ResizedEvent;
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.smartgwt.client.widgets.events.ResizedHandler;
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
12 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
13 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
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
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
15 import org.gwtopenmaps.openlayers.client.Map;
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
16 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:
diff changeset
17 import org.gwtopenmaps.openlayers.client.format.GeoJSON;
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
18 import org.gwtopenmaps.openlayers.client.layer.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
19 import org.gwtopenmaps.openlayers.client.layer.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
20 import org.gwtopenmaps.openlayers.client.layer.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
21
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 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
23 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
24 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
25 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
26 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
27 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
28
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
29 import de.intevation.flys.client.client.Config;
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.client.ui.map.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
31 import de.intevation.flys.client.client.ui.map.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
32 import de.intevation.flys.client.client.services.MapInfoService;
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.client.services.MapInfoServiceAsync;
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
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
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
36 public class DigitizePanel
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
37 extends SelectProvider
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
38 implements 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
39
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
40 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
41
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
42 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
43
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
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 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
46
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
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
48 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
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
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
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
52 @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
53 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
54 List<Data> data = list.getAll();
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
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 Data barriers = 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:
diff changeset
57 for (int i = data.size()-1; i >= 0; i--) {
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 Data d = data.get(i);
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 if (d.getLabel().equals(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
60 barriers = d;
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 data.remove(d);
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
62 }
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
63 }
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
64
872
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
65 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
66 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
67 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
68
a7179e3a774e Suppress the GeoJSON string to be drawn into the static UI.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 833
diff changeset
69 Canvas selectBox = super.create(clone);
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
70
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 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
72 final String url = cfg.getServerUrl();
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
73 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
74
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
75 DataItem[] obj = barriers.getItems();
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
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 final String[] geojson = new String[1];
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 for (DataItem item: obj) {
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 if (item.getLabel().equals(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
80 geojson[0] = item.getStringValue();
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 break;
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 }
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
83 }
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
873
77a549772aa9 Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 872
diff changeset
85 String river = getDataValue("state.winfo.river", "river");
77a549772aa9 Query MapInfo object for correct river (was hard coded).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 872
diff changeset
86 mapInfo.getMapInfo(url, locale, river, new AsyncCallback<MapInfo>() {
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
87 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
88 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
89
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 GWT.log("Error while fetching MapInfo: " + msg);
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 SC.warn(MSG.getString(msg));
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 }
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
93
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
94 public void onSuccess(MapInfo info) {
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
95 createMapWidget(info, geojson[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:
diff changeset
96 }
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
97 });
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
98
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
99 return selectBox;
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
100 }
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
101
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
102
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
103 @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
104 protected Data[] getData() {
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
105 Data[] data = super.getData();
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
106 Data[] total = new Data[2];
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
107
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
108 DataItem item = new 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
109 UESK_BARRIERS, UESK_BARRIERS, floodMap.getFeaturesAsGeoJSON());
dcecdd9693a8 Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
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
111 total[0] = data[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:
diff changeset
112 total[1] = new 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
113 UESK_BARRIERS, null, null, new DataItem[] { item });
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
114
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
115 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
116 }
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
117
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
118
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
119 public void createMapWidget(MapInfo mapInfo, String geojson) {
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
120 final MapPanel mapPanel = new MapPanel(mapInfo, 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
121
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
122 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
123 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
124
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
125 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
126 helperContainer.addResizedHandler(new ResizedHandler() {
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
127 public void onResized(ResizedEvent e) {
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 Integer height = helperContainer.getHeight();
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 Integer width = helperContainer.getWidth();
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
130
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 height = height * 99 / 100;
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
132 width = width * 99 / 100;
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
133
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
134 String w = String.valueOf(width) + "px";
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
135 String h = String.valueOf(height) + "px";
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
136
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
137 mapPanel.getFloodMap().setSize(w, h);
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
138 }
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
139 });
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
140
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
141 parameterList.registerCollectionViewTabHandler(this);
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
142
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
143 WMS axis = 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
144 mapInfo.getWmsUrl(), "riveraxis",
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 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
146 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
147 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
148 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
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 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
151 map.addLayer(back);
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 if (geojson != null && geojson.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:
diff changeset
154 VectorFeature[] features = new GeoJSON().read(geojson);
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
155 floodMap.getBarrierLayer().addFeatures(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:
diff changeset
156 }
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
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
158 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
159 }
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
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
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 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
163 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
164 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
165 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
166 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
167
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
168 WMSOptions opts = new WMSOptions();
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
169 opts.setTransitionEffect("null");
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
170 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
171 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
172 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
173 opts.setBuffer(0);
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
174
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
175 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
176 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
177 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
178
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
179 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
180 }
915
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
181
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
182
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
183 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
184 if (tse.getTabNum () != 0) {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
185 floodMap.hideBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
186 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
187 else {
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
188 floodMap.showBarrierLayer();
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
189 }
89a47098bcbd Hide geometry layer in floodmap when tab selection changes.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 873
diff changeset
190 }
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
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org