Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapOutputTab.java @ 9483:992c188b7330
wms uinfo.inundation
author | gernotbelger |
---|---|
date | Thu, 13 Sep 2018 18:22:05 +0200 |
parents | 5e38e2924c07 |
children | 5397555d74c9 |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.map; |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
9483 | 11 import java.util.HashMap; |
12 import java.util.List; | |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
14 import org.dive4elements.river.client.client.Config; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
15 import org.dive4elements.river.client.client.FLYSConstants; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
16 import org.dive4elements.river.client.client.event.OutputParameterChangeEvent; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
17 import org.dive4elements.river.client.client.event.OutputParameterChangeHandler; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
18 import org.dive4elements.river.client.client.event.RedrawRequestEvent; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
19 import org.dive4elements.river.client.client.event.RedrawRequestHandler; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
20 import org.dive4elements.river.client.client.services.LoadArtifactService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.client.services.LoadArtifactServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
22 import org.dive4elements.river.client.client.services.MapOutputService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
23 import org.dive4elements.river.client.client.services.MapOutputServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.river.client.client.services.StepForwardService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.river.client.client.services.StepForwardServiceAsync; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
26 import org.dive4elements.river.client.client.ui.CollectionView; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.river.client.client.ui.OutputTab; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.river.client.client.ui.ThemePanel; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
29 import org.dive4elements.river.client.shared.model.Artifact; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
30 import org.dive4elements.river.client.shared.model.ArtifactDescription; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
31 import org.dive4elements.river.client.shared.model.AttributedTheme; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
32 import org.dive4elements.river.client.shared.model.Collection; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
33 import org.dive4elements.river.client.shared.model.Data; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
34 import org.dive4elements.river.client.shared.model.DataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
35 import org.dive4elements.river.client.shared.model.DataList; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
36 import org.dive4elements.river.client.shared.model.DefaultData; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
37 import org.dive4elements.river.client.shared.model.DefaultDataItem; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
38 import org.dive4elements.river.client.shared.model.MapConfig; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
39 import org.dive4elements.river.client.shared.model.OutputMode; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
40 import org.dive4elements.river.client.shared.model.Recommendation; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
41 import org.dive4elements.river.client.shared.model.Theme; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
42 import org.dive4elements.river.client.shared.model.ThemeList; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
43 import org.dive4elements.river.client.shared.model.WMSLayer; |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
44 import org.gwtopenmaps.openlayers.client.Bounds; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
45 import org.gwtopenmaps.openlayers.client.Map; |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
46 import org.gwtopenmaps.openlayers.client.MapWidget; |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
47 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
48 import org.gwtopenmaps.openlayers.client.event.VectorFeatureRemovedListener; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
49 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
50 import org.gwtopenmaps.openlayers.client.format.GeoJSON; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
51 import org.gwtopenmaps.openlayers.client.layer.Layer; |
5612
4f935415bb20
Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents:
5032
diff
changeset
|
52 import org.gwtopenmaps.openlayers.client.layer.TransitionEffect; |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
53 import org.gwtopenmaps.openlayers.client.layer.Vector; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
54 import org.gwtopenmaps.openlayers.client.layer.WMS; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
55 import org.gwtopenmaps.openlayers.client.layer.WMSOptions; |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
56 import org.gwtopenmaps.openlayers.client.layer.WMSParams; |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
9483 | 58 import com.google.gwt.core.client.GWT; |
59 import com.google.gwt.user.client.rpc.AsyncCallback; | |
60 import com.google.gwt.user.client.ui.AbsolutePanel; | |
61 import com.smartgwt.client.util.SC; | |
62 import com.smartgwt.client.widgets.Canvas; | |
63 import com.smartgwt.client.widgets.events.ParentMovedEvent; | |
64 import com.smartgwt.client.widgets.events.ParentMovedHandler; | |
65 import com.smartgwt.client.widgets.events.ResizedEvent; | |
66 import com.smartgwt.client.widgets.events.ResizedHandler; | |
67 import com.smartgwt.client.widgets.layout.HLayout; | |
68 import com.smartgwt.client.widgets.layout.VLayout; | |
69 import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; | |
70 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; | |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
9483 | 72 public class MapOutputTab extends OutputTab implements RedrawRequestHandler, ExternalWMSWindow.LayerLoader, TabSelectedHandler, OutputParameterChangeHandler { |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
74 public static final String DEFAULT_SRID = "4326"; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
75 |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
76 public static final String BARRIERS_PARAMETER_KEY = "uesk.barriers"; |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
77 |
1269
45791d12a1f4
Bugfix: #298 Floodmaps initial zoom is determined by the WSPLGEN layer's extent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
78 public static final String WSPLGEN_FACET = "floodmap.wsplgen"; |
45791d12a1f4
Bugfix: #298 Floodmaps initial zoom is determined by the WSPLGEN layer's extent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
835
diff
changeset
|
79 |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
80 public static final String EXTERNAL_WMS_FACTORY = "externalwmsfactory"; |
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
81 |
9483 | 82 protected StepForwardServiceAsync feedService = GWT.create(StepForwardService.class); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
83 |
9483 | 84 protected MapOutputServiceAsync mapService = GWT.create(MapOutputService.class); |
1365
4c65c5b60a86
First step of refactoring the map creation - implemented a MapOutputService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1364
diff
changeset
|
85 |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
86 /** Service handle to clone and add artifacts to collection. */ |
9483 | 87 protected LoadArtifactServiceAsync loadArtifactService = GWT.create(LoadArtifactService.class); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
88 |
1415
dfa2d4753fc0
Triggered the reload of MapThemePanel after adding external WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1414
diff
changeset
|
89 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
dfa2d4753fc0
Triggered the reload of MapThemePanel after adding external WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1414
diff
changeset
|
90 |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
91 protected MapToolbar controlPanel; |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
92 protected ThemePanel themePanel; |
9483 | 93 protected Canvas themePanelCanvas; |
94 protected MapWidget mapPanel; | |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
2983
diff
changeset
|
95 protected Canvas mapPanelCanvas; |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
96 protected VLayout rootLayout = new VLayout(); |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
97 protected AbsolutePanel absPan = new AbsolutePanel(); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
98 protected FloodMap floodMap; |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
9483 | 100 private final java.util.Map<String, String> wmsUrls = new HashMap<String, String>(); |
101 | |
102 public MapOutputTab(final String title, final Collection collection, final OutputMode mode, final CollectionView collectionView) { | |
1364
9981ba2ee13a
Display the datacage button in the map toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1327
diff
changeset
|
103 super(title, collection, collectionView, mode); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
105 collectionView.registerTabHandler(this); |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
106 |
9483 | 107 this.mapService.doOut(collection, new AsyncCallback<MapConfig>() { |
108 @Override | |
109 public void onFailure(final Throwable caught) { | |
110 GWT.log("MAP ERROR: " + caught.getMessage()); | |
111 } | |
112 | |
113 @Override | |
114 public void onSuccess(final MapConfig c) { | |
115 GWT.log("MAP SUCCESS!"); | |
116 | |
117 final Bounds max = boundsFromString(c.getMaxExtent()); | |
118 Bounds initial = boundsFromString(c.getInitialExtent()); | |
119 | |
120 if (initial == null) { | |
121 GWT.log("Warning: No initial extent set."); | |
122 initial = max; | |
1365
4c65c5b60a86
First step of refactoring the map creation - implemented a MapOutputService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1364
diff
changeset
|
123 } |
4c65c5b60a86
First step of refactoring the map creation - implemented a MapOutputService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1364
diff
changeset
|
124 |
9483 | 125 setFloodmap(new FloodMap(c.getSrid(), max, 640, 480)); |
1376
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
126 |
9483 | 127 initLayout(); |
128 initBarriers(); | |
1376
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
129 |
9483 | 130 GWT.log("MAX EXTENT: " + max); |
131 GWT.log("ZOOM TO: " + initial); | |
132 getMap().zoomToExtent(initial); | |
1365
4c65c5b60a86
First step of refactoring the map creation - implemented a MapOutputService.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1364
diff
changeset
|
133 } |
9483 | 134 }); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 } |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 protected void initLayout() { |
9483 | 138 this.rootLayout.setHeight100(); |
139 this.rootLayout.setWidth100(); | |
140 this.rootLayout.setMembersMargin(2); | |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
141 |
9483 | 142 final HLayout hlayout = new HLayout(); |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
143 hlayout.setMembersMargin(0); |
798
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
144 |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
145 this.themePanelCanvas = createThemePanel(); |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1382
diff
changeset
|
146 |
9483 | 147 this.controlPanel = createControlPanel(); |
148 this.mapPanel = this.floodMap.getMapWidget(); | |
798
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
149 |
9483 | 150 this.rootLayout.addMember(this.controlPanel); |
151 this.rootLayout.addMember(this.absPan); | |
152 this.absPan.setWidth("100%"); | |
153 this.absPan.setHeight("100%"); | |
154 this.absPan.add(this.themePanelCanvas); | |
155 this.absPan.add(this.mapPanel); | |
798
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
156 |
9483 | 157 this.rootLayout.addResizedHandler(new ResizedHandler() { |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
158 @Override |
9483 | 159 public void onResized(final ResizedEvent e) { |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
160 doLayout(); |
798
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
161 } |
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
162 }); |
7061c2e66039
Finished layouting the map components.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
797
diff
changeset
|
163 |
9483 | 164 this.rootLayout.addParentMovedHandler(new ParentMovedHandler() { |
4570
8ca06d3040d0
flys-client: Map.updateSize() is now called on every windows movement
Christian Lins <christian.lins@intevation.de>
parents:
4531
diff
changeset
|
165 @Override |
9483 | 166 public void onParentMoved(final ParentMovedEvent event) { |
167 MapOutputTab.this.mapPanel.getMap().updateSize(); | |
4570
8ca06d3040d0
flys-client: Map.updateSize() is now called on every windows movement
Christian Lins <christian.lins@intevation.de>
parents:
4531
diff
changeset
|
168 } |
8ca06d3040d0
flys-client: Map.updateSize() is now called on every windows movement
Christian Lins <christian.lins@intevation.de>
parents:
4531
diff
changeset
|
169 }); |
8ca06d3040d0
flys-client: Map.updateSize() is now called on every windows movement
Christian Lins <christian.lins@intevation.de>
parents:
4531
diff
changeset
|
170 |
9483 | 171 setPane(this.rootLayout); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
172 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
173 |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
174 protected void doLayout() { |
9483 | 175 if (!this.rootLayout.isVisible()) { |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
176 return; |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
177 } |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
178 |
8856 | 179 // Manually set the height of the AbsolutePanel, |
180 // somehow this is necessary | |
9483 | 181 this.absPan.setHeight(String.valueOf(this.rootLayout.getHeight() - this.controlPanel.getHeight() - 2) + "px"); |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
182 |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
183 // Calculate bounds of Map |
9483 | 184 final int height = this.rootLayout.getHeight() - this.controlPanel.getHeight() - 6; |
185 final int width = this.controlPanel.getWidth() - (this.themePanelCanvas.isVisible() ? this.themePanelCanvas.getWidth() + 4 : 2); | |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
186 |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
187 // Set size and position of Map |
9483 | 188 final String w = String.valueOf(width) + "px"; |
189 final String h = String.valueOf(height) + "px"; | |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
190 GWT.log("width=" + w); |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
191 |
9483 | 192 this.mapPanel.setSize(w, h); |
193 this.mapPanel.getMap().updateSize(); | |
194 if (this.themePanelCanvas.isVisible()) { | |
195 this.absPan.setWidgetPosition(this.mapPanel, this.themePanelCanvas.getWidth() + 2, 0); | |
196 } else { | |
197 this.absPan.setWidgetPosition(this.mapPanel, 0, 0); | |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
198 } |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
199 |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
200 // Set bounds of ThemePanelCanvas |
9483 | 201 this.themePanelCanvas.setSize(this.themePanelCanvas.getWidthAsString(), String.valueOf(height + 2) + "px"); |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
202 } |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
203 |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
204 protected void initBarriers() { |
9483 | 205 final Vector vector = this.floodMap.getBarrierLayer(); |
206 vector.addVectorFeatureAddedListener(new VectorFeatureAddedListener() { | |
207 @Override | |
208 public void onFeatureAdded(final FeatureAddedEvent e) { | |
209 saveBarriers(); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
210 } |
9483 | 211 }); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
212 |
9483 | 213 vector.addVectorFeatureRemovedListener(new VectorFeatureRemovedListener() { |
214 @Override | |
215 public void onFeatureRemoved(final FeatureRemovedEvent e) { | |
216 saveBarriers(); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
217 } |
9483 | 218 }); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
219 |
9483 | 220 final Artifact artifact = getArtifact(); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
221 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
222 if (artifact == null) { |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
223 return; |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
224 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
225 |
9483 | 226 final ArtifactDescription desc = artifact.getArtifactDescription(); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
227 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
228 String geojson = getGeoJSONFromStatic(desc); |
8856 | 229 geojson = geojson != null ? geojson : getGeoJSONFromDynamic(desc); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
230 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
231 if (geojson == null || geojson.length() == 0) { |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
232 GWT.log("No geojson string found -> no barriers existing."); |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
233 return; |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
234 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
235 |
9483 | 236 final GeoJSON reader = new GeoJSON(); |
237 final VectorFeature[] features = reader.read(geojson); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
238 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
239 vector.addFeatures(features); |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
240 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
241 |
9483 | 242 public void addLayer(final Theme newTheme) { |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
243 |
9483 | 244 final Layer layer = createWMSLayer(newTheme); |
245 | |
246 final FloodMap map = getFloodmap(); | |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
247 |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
248 if (map != null) { |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
249 GWT.log("Add new layer '" + layer.getName() + "' to map."); |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
250 map.addLayer(layer); |
5793
4cc59122b682
Use fullRequestString as WMS Url
Andre Heinecke <aheinecke@intevation.de>
parents:
5612
diff
changeset
|
251 if (layer instanceof WMS) { |
9483 | 252 this.wmsUrls.put(layer.getName(), ((WMS) layer).getFullRequestString(new WMSParams(), null)); |
5793
4cc59122b682
Use fullRequestString as WMS Url
Andre Heinecke <aheinecke@intevation.de>
parents:
5612
diff
changeset
|
253 } |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
254 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
255 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
256 |
9483 | 257 public void removeLayer(final Theme theme) { |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
258 |
9483 | 259 final String layerId = getLayerId(theme); |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
260 |
9483 | 261 final Map map = getMap(); |
262 | |
263 final Layer[] layers = map.getLayers(); | |
264 | |
265 for (final Layer layer : layers) { | |
266 if (layerId.equals(layer.getName())) { | |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
267 map.removeLayer(layer); |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
268 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
269 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
270 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
271 |
1364
9981ba2ee13a
Display the datacage button in the map toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1327
diff
changeset
|
272 @Override |
9483 | 273 public void onRedrawRequest(final RedrawRequestEvent event) { |
274 this.mapService.doOut(this.collection, new AsyncCallback<MapConfig>() { | |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
275 @Override |
9483 | 276 public void onFailure(final Throwable caught) { |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
277 GWT.log("MAP ERROR: " + caught.getMessage()); |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
278 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
279 |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
280 @Override |
9483 | 281 public void onSuccess(final MapConfig c) { |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1386
diff
changeset
|
282 GWT.log("We want to refresh the map now!"); |
9483 | 283 MapOutputTab.this.themePanel.updateCollection(); |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1386
diff
changeset
|
284 getFloodmap().update(); |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
285 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
286 }); |
1364
9981ba2ee13a
Display the datacage button in the map toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1327
diff
changeset
|
287 } |
9981ba2ee13a
Display the datacage button in the map toolbar.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1327
diff
changeset
|
288 |
1412
659a488243da
Added code to trigger loading selected WMS layers from ExternalWMSWindow. Note: no code for loading/adding layers to the current map existing yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1403
diff
changeset
|
289 @Override |
9483 | 290 public void load(final List<WMSLayer> toLoad) { |
1412
659a488243da
Added code to trigger loading selected WMS layers from ExternalWMSWindow. Note: no code for loading/adding layers to the current map existing yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1403
diff
changeset
|
291 GWT.log("The user wants to add " + toLoad.size() + " new WMS layers."); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
292 |
9483 | 293 final int len = toLoad.size(); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
294 |
9483 | 295 final Recommendation[] recom = new Recommendation[len]; |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
296 |
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
297 for (int i = 0; i < len; i++) { |
9483 | 298 final WMSLayer w = toLoad.get(i); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
299 |
9483 | 300 final String ids = w.getServer() + ";" + w.getName() + ";" + w.getTitle(); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
301 recom[i] = new Recommendation(EXTERNAL_WMS_FACTORY, ids); |
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
302 } |
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
303 |
9483 | 304 final Collection c = getCollection(); |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
305 |
9483 | 306 final Config config = Config.getInstance(); |
307 final String locale = config.getLocale(); | |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
308 |
9483 | 309 this.loadArtifactService.loadMany(c, recom, EXTERNAL_WMS_FACTORY, locale, new AsyncCallback<Artifact[]>() { |
310 | |
311 @Override | |
312 public void onFailure(final Throwable throwable) { | |
313 SC.warn(MapOutputTab.this.MSG.getString(throwable.getMessage())); | |
1414
3484cbfaf369
Create new Artifacts for selected WMS layers of the ExternalWMSWindow.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1412
diff
changeset
|
314 } |
9483 | 315 |
316 @Override | |
317 public void onSuccess(final Artifact[] newArtifacts) { | |
318 getThemePanel().updateCollection(); | |
319 } | |
320 }); | |
1412
659a488243da
Added code to trigger loading selected WMS layers from ExternalWMSWindow. Note: no code for loading/adding layers to the current map existing yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1403
diff
changeset
|
321 } |
659a488243da
Added code to trigger loading selected WMS layers from ExternalWMSWindow. Note: no code for loading/adding layers to the current map existing yet.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1403
diff
changeset
|
322 |
9483 | 323 protected void setFloodmap(final FloodMap floodMap) { |
1376
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
324 this.floodMap = floodMap; |
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
325 } |
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
326 |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1386
diff
changeset
|
327 protected FloodMap getFloodmap() { |
9483 | 328 return this.floodMap; |
1397
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1386
diff
changeset
|
329 } |
b3264b5770b3
Update the map when receiving a RedrawRequestEvent.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1386
diff
changeset
|
330 |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
331 protected Map getMap() { |
9483 | 332 return this.floodMap.getMap(); |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
333 } |
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
334 |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
335 protected ThemePanel getThemePanel() { |
9483 | 336 return this.themePanel; |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
337 } |
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
338 |
9483 | 339 protected String getGeoJSONFromDynamic(final ArtifactDescription desc) { |
340 final DataList list = desc.getCurrentData(); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
341 |
835
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
342 if (list == null) { |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
343 return null; |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
344 } |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
345 |
9483 | 346 final List<Data> datas = list.getAll(); |
347 for (final Data data : datas) { | |
348 final String key = data.getLabel(); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
349 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
350 if (key != null && key.equals(BARRIERS_PARAMETER_KEY)) { |
9483 | 351 final DataItem def = data.getDefault(); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
352 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
353 if (def != null) { |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
354 return def.getStringValue(); |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
355 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
356 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
357 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
358 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
359 return null; |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
360 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
361 |
9483 | 362 protected String getGeoJSONFromStatic(final ArtifactDescription desc) { |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
363 // TODO Implement this method, if there are reachable states right after |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
364 // the floodmap state - which is currently not the case. |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
365 return null; |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
366 } |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
367 |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
368 public ThemeList getThemeList() { |
9483 | 369 return this.collection.getThemeList(this.mode.getName()); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
370 } |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
371 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
372 public String getSrid() { |
9483 | 373 final ThemeList themeList = getThemeList(); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
374 |
9483 | 375 final int num = themeList.getThemeCount(); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
376 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
377 for (int i = 1; i <= num; i++) { |
9483 | 378 final AttributedTheme theme = (AttributedTheme) themeList.getThemeAt(i); |
835
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
379 |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
380 if (theme == null) { |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
381 continue; |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
382 } |
c89a42950d11
Removed the digitize controls from map widget that is used in the floodmap state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
825
diff
changeset
|
383 |
9483 | 384 final String srid = theme.getAttr("srid"); |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
385 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
386 if (srid != null && srid.length() > 0) { |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
387 return srid; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
388 } |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
389 } |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
390 |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
391 return DEFAULT_SRID; |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
392 } |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
393 |
9483 | 394 protected Bounds boundsFromString(final String bounds) { |
1376
28eb4dfe2cbf
Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1370
diff
changeset
|
395 GWT.log("Create Bounds from String: '" + bounds + "'"); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
396 if (bounds == null || bounds.length() == 0) { |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
397 return null; |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
398 } |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
399 |
9483 | 400 final String[] values = bounds.split(" "); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
401 |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
402 if (values == null || values.length < 4) { |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
403 return null; |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
404 } |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
405 |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
406 try { |
9483 | 407 return new Bounds(Double.valueOf(values[0]), Double.valueOf(values[1]), Double.valueOf(values[2]), Double.valueOf(values[3])); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
408 } |
9483 | 409 catch (final NumberFormatException nfe) { |
410 } | |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
411 |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
412 return null; |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
413 } |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
414 |
9483 | 415 private Layer createWMSLayer(final Theme theme) { |
4752
ce570c74aa94
Removed null comparison where also instanceof is used.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4739
diff
changeset
|
416 if (!(theme instanceof AttributedTheme)) { |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
417 return null; |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
418 } |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
419 |
9483 | 420 final AttributedTheme at = (AttributedTheme) theme; |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
421 |
9483 | 422 // final String desc = at.getAttr("description"); |
423 final String url = at.getAttr("url"); | |
424 final String layers = at.getAttr("layers"); | |
425 | |
426 final String layerId = getLayerId(theme); | |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
427 |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
428 if (url == null || layers == null) { |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
429 return null; |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
430 } |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
431 |
9483 | 432 final WMSParams params = new WMSParams(); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
433 params.setLayers(layers); |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
434 params.setFormat("image/png"); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
435 params.setIsTransparent(true); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
436 |
9483 | 437 final WMSOptions opts = new WMSOptions(); |
438 | |
823
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
439 opts.setProjection("EPSG:" + getSrid()); |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
440 opts.setSingleTile(true); |
407de0f4b66a
Set the map projection and its max extent dynamically - information extracted from facets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
815
diff
changeset
|
441 opts.setRatio(1); |
5032
4bf3b89b38d5
Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents:
4752
diff
changeset
|
442 if (layers.equals("OSM-WMS-Dienst")) { |
9483 | 443 opts.setAttribution(this.MSG.attribution()); |
5612
4f935415bb20
Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents:
5032
diff
changeset
|
444 opts.setSingleTile(true); |
4f935415bb20
Hopefully fix for some map resizing issues.
Christian Lins <christian.lins@intevation.de>
parents:
5032
diff
changeset
|
445 opts.setTransitionEffect(TransitionEffect.RESIZE); |
5032
4bf3b89b38d5
Added attribution to osm wms background layer.
Raimund Renkert <rrenkert@intevation.de>
parents:
4752
diff
changeset
|
446 } |
9483 | 447 final WMS wms = new WMS(layerId, url, params, opts); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
448 wms.setIsVisible(at.getActive() == 1); |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
449 wms.setIsBaseLayer(false); |
5793
4cc59122b682
Use fullRequestString as WMS Url
Andre Heinecke <aheinecke@intevation.de>
parents:
5612
diff
changeset
|
450 // We can't set the full_url attribute here because map is not set |
4cc59122b682
Use fullRequestString as WMS Url
Andre Heinecke <aheinecke@intevation.de>
parents:
5612
diff
changeset
|
451 // at.addAttr("full_url", wms.getFullRequestString(params, null)); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
452 return wms; |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
453 } |
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
454 |
9483 | 455 private String getLayerId(final Theme theme) { |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
456 |
9483 | 457 final AttributedTheme at = (AttributedTheme) theme; |
458 | |
459 final String name = at.getAttr("name"); | |
460 final String layers = at.getAttr("layers"); | |
461 | |
462 return name + "_" + layers; | |
4739
5014a84c0c7d
Add "maptype" parameter to MapInfoService.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
463 } |
5014a84c0c7d
Add "maptype" parameter to MapInfoService.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
464 |
1386
9aa1a453eed5
Issue 294.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1382
diff
changeset
|
465 protected MapToolbar createControlPanel() { |
9483 | 466 return new MapToolbar(this, this.floodMap, false); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
467 } |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
468 |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
469 protected Canvas createThemePanel() { |
9483 | 470 final Canvas c = new Canvas(); |
1327
8a93fb299e64
#288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1306
diff
changeset
|
471 c.setMinWidth(300); |
4330
93e023131546
Removed the legend images from map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4329
diff
changeset
|
472 c.setWidth(200); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
473 c.setHeight100(); |
1327
8a93fb299e64
#288 Added legend symbols to the MapThemePanel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1306
diff
changeset
|
474 c.setCanDragResize(true); |
797
cc3f481e9484
Introduced GwtOpenLayers to bring up maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
475 c.setBorder("1px solid black"); |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
476 |
9483 | 477 this.themePanel = new MapThemePanel(this.getCollectionView(), this.mode, this, new MapThemePanel.ActivateCallback() { |
478 @Override | |
479 public void activate(final Theme theme, final boolean active) { | |
480 fireActivateTheme(theme, active); | |
481 } | |
482 }, new MapThemePanel.ThemeMovedCallback() { | |
483 @Override | |
484 public void onThemeMoved(final Theme theme, final int oldIdx, final int newIdx) { | |
485 // this code synchronizes the ThemePanel and the OpenLayers | |
486 // internal order of layers. | |
487 final AttributedTheme at = (AttributedTheme) theme; | |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
488 |
9483 | 489 final String layerId = getLayerId(theme); |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
490 |
9483 | 491 final Map map = getMap(); |
492 final Layer[] layers = map.getLayersByName(layerId); | |
493 | |
494 if (layers == null || layers.length == 0) { | |
495 GWT.log("Error: Cannot find layer '" + layerId + "'"); | |
496 return; | |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
497 } |
1377
b0fe35d4ce6b
Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1376
diff
changeset
|
498 |
9483 | 499 map.raiseLayer(layers[0], (newIdx - oldIdx) * -1); |
500 map.zoomTo(map.getZoom() - 1); | |
501 map.zoomTo(map.getZoom() + 1); | |
502 } | |
503 }, new MapThemePanel.LayerZoomCallback() { | |
504 @Override | |
505 public void onLayerZoom(final Theme theme, final String extent) { | |
506 final Bounds zoomTo = boundsFromString(extent); | |
1377
b0fe35d4ce6b
Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1376
diff
changeset
|
507 |
9483 | 508 if (zoomTo == null) { |
509 GWT.log("WARNING: No valid bounds for zooming found!"); | |
510 return; | |
1377
b0fe35d4ce6b
Added a 'zoom to layer' menu item to the map theme panel which triggers a zoom to the specific layer/theme.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1376
diff
changeset
|
511 } |
9483 | 512 |
513 getMap().zoomToExtent(zoomTo); | |
1306
2e57776f77b5
#300 Synchronized the ThemePanel's layer order with the internal order of the Map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1269
diff
changeset
|
514 } |
9483 | 515 }); |
516 this.themePanel.addRedrawRequestHandler(this); | |
517 this.themePanel.addOutputParameterChangeHandler(this); | |
518 c.addChild(this.themePanel); | |
796
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
519 |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
520 return c; |
cd8603aaa730
Improved the process of creating OutputTabs. Added support for map output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
521 } |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
522 |
9483 | 523 private void fireActivateTheme(final Theme theme, final boolean active) { |
4329
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
524 activateTheme(theme, active); |
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
525 } |
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
526 |
9483 | 527 protected void activateTheme(final Theme theme, final boolean active) { |
1403
6a7cfe9d87fe
Repaired broken WMS layer controls in map theme panel.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1400
diff
changeset
|
528 |
9483 | 529 final String layerId = getLayerId(theme); |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
530 |
9483 | 531 final Layer layer = this.floodMap.getMap().getLayerByName(layerId); |
532 | |
533 GWT.log("Set visibility of '" + layerId + "': " + active); | |
1382
78542ff1f562
Update map and theme panel when new layers are added via datacage or removed by context menu.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1377
diff
changeset
|
534 |
806
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
535 if (layer != null) { |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
536 layer.setIsVisible(active); |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
537 } |
e50da1f74e58
The layers created in the floodmap reflect to the facets this output mode has.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
800
diff
changeset
|
538 } |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
539 |
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
540 protected void saveBarriers() { |
9483 | 541 final Vector layer = this.floodMap.getBarrierLayer(); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
542 |
9483 | 543 final GeoJSON format = new GeoJSON(); |
544 final String features = format.write(layer.getFeatures()); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
545 |
9483 | 546 final DataItem item = new DefaultDataItem(BARRIERS_PARAMETER_KEY, BARRIERS_PARAMETER_KEY, features); |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
547 |
9483 | 548 final Data data = new DefaultData(BARRIERS_PARAMETER_KEY, BARRIERS_PARAMETER_KEY, "String", new DataItem[] { item }); |
549 | |
550 final Config config = Config.getInstance(); | |
551 final String locale = config.getLocale(); | |
552 | |
553 this.feedService.go(locale, getArtifact(), new Data[] { data }, new AsyncCallback<Artifact>() { | |
554 @Override | |
555 public void onFailure(final Throwable caught) { | |
556 GWT.log("Could not save barrier geometries: " + caught.getMessage()); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
557 } |
9483 | 558 |
559 @Override | |
560 public void onSuccess(final Artifact artifact) { | |
561 GWT.log("Successfully saved barrier geometries."); | |
562 } | |
563 }); | |
825
1b9b7e9ab219
Save and reload user defined geometries (barriers) in the map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
823
diff
changeset
|
564 } |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
565 |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
566 @Override |
9483 | 567 public void onTabSelected(final TabSelectedEvent tse) { |
568 if (this.floodMap == null) { | |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
569 return; |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
570 } |
9483 | 571 if (this.equals(tse.getTab())) { |
572 this.floodMap.activateScaleLine(true); | |
573 } else { | |
574 this.controlPanel.activateMeasureControl(false); | |
575 this.floodMap.activateScaleLine(false); | |
1542
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
576 } |
3e2ef8e0a0dc
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1448
diff
changeset
|
577 } |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
578 |
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
579 public void toogleThemePanel() { |
9483 | 580 this.themePanelCanvas.setVisible(!this.themePanelCanvas.isVisible()); |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
581 |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
582 // Trigger resize event handler |
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4330
diff
changeset
|
583 doLayout(); |
2983
725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
Christian Lins <christian.lins@intevation.de>
parents:
1555
diff
changeset
|
584 } |
4329
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
585 |
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
586 @Override |
9483 | 587 public void onOutputParameterChanged(final OutputParameterChangeEvent evt) { |
4329
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
588 GWT.log("OutputParameterChanged"); |
9483 | 589 this.controlPanel.updateThemes(getThemePanel().getThemeList()); |
4329
c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4064
diff
changeset
|
590 } |
9483 | 591 |
592 public String getWMSUrl(final Theme theme) { | |
593 final String layerId = getLayerId(theme); | |
594 return this.wmsUrls.get(layerId); | |
595 } | |
596 } |