Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java @ 847:25a4bf390757
Loading recommendations: If no reference artifact is given use current
artifact as master artifact.
flys-client/trunk@2581 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 25 Aug 2011 13:36:06 +0000 |
parents | dcecdd9693a8 |
children | a7179e3a774e |
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; |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 |
dcecdd9693a8
Added a UIProvider 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 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
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 |
dcecdd9693a8
Added a UIProvider 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.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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 public class DigitizePanel extends SelectProvider { |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
37 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 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
|
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 |
dcecdd9693a8
Added a UIProvider 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 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
|
42 |
dcecdd9693a8
Added a UIProvider 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 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
|
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 |
dcecdd9693a8
Added a UIProvider 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 @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
|
49 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
|
50 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
|
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 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
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 } |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 Canvas selectBox = super.create(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
|
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 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
|
64 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
|
65 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
|
66 |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 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
|
68 |
dcecdd9693a8
Added a UIProvider 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 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
|
70 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
|
71 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
|
72 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
|
73 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
|
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 } |
dcecdd9693a8
Added a UIProvider 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 // TODO FIND CORRECT RIVER |
dcecdd9693a8
Added a UIProvider 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 mapInfo.getMapInfo(url, locale, "Saar", new AsyncCallback<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
|
79 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
|
80 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
|
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 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
|
83 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
|
84 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
dcecdd9693a8
Added a UIProvider 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 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
|
87 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
|
88 } |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
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 |
dcecdd9693a8
Added a UIProvider 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 @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
|
96 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
|
97 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
|
98 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
|
99 |
dcecdd9693a8
Added a UIProvider 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 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
|
101 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
|
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 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
|
104 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
|
105 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
|
106 |
dcecdd9693a8
Added a UIProvider 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 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
|
108 } |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
112 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
|
113 |
dcecdd9693a8
Added a UIProvider 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 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
|
115 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
|
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 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 |
dcecdd9693a8
Added a UIProvider 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 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
|
124 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
|
125 |
dcecdd9693a8
Added a UIProvider 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 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
|
127 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
|
128 |
dcecdd9693a8
Added a UIProvider 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 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
|
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 }); |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
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 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
|
141 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
|
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 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
|
144 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
|
145 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
|
146 } |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
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 |
dcecdd9693a8
Added a UIProvider 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 |
dcecdd9693a8
Added a UIProvider 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 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
|
153 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
|
154 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
|
155 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
|
156 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
|
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 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
|
159 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
|
160 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
|
161 opts.setRatio(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
|
162 |
dcecdd9693a8
Added a UIProvider 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 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
|
164 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
|
165 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
|
166 |
dcecdd9693a8
Added a UIProvider 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 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
|
168 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 } |
dcecdd9693a8
Added a UIProvider that displays a combobox on the left and a map widget in the helper container.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |