Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPanel.java @ 9696:e388db7fd72e
another attempt
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 20 Jan 2021 15:55:08 +0100 |
parents | 5e38e2924c07 |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.map; |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
11 import com.google.gwt.core.client.GWT; |
5538
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
12 import com.google.gwt.user.client.ui.AbsolutePanel; |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
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.shared.model.BBox; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
15 import org.dive4elements.river.client.shared.model.MapInfo; |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
17 import org.gwtopenmaps.openlayers.client.Bounds; |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
18 import org.gwtopenmaps.openlayers.client.MapWidget; |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
19 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
20 /** |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
21 * Panel that contains a MapWidget and a MapToolbar. |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
22 * This panel is used by the flood map calculation input helper. |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
23 */ |
5538
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
24 public class MapPanel extends AbsolutePanel { |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 protected MapToolbar toolbar; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
28 protected FloodMap floodMap; |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
29 protected MapWidget floodMapWidget; |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
30 protected boolean digitizeEnabled; |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public MapPanel(MapInfo mapInfo, boolean digitizeEnabled) { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 BBox bbox = mapInfo.getBBox(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 this.digitizeEnabled = digitizeEnabled; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 this.floodMap = new FloodMap( |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 String.valueOf(mapInfo.getSrid()), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 new Bounds( |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 bbox.getLowerX(), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 bbox.getLowerY(), |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 bbox.getUpperX(), |
4402
c84630d544a1
Get rid of HorizontalLayout in MapOutputTab and use manual resizing.
Christian Lins <christian.lins@intevation.de>
parents:
4064
diff
changeset
|
42 bbox.getUpperY()), |
4476
099d136b215b
Try to fix resize problems with MapWidget in DigitizePanel (#802).
Christian Lins <christian.lins@intevation.de>
parents:
4475
diff
changeset
|
43 640, 480); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 initLayout(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 private void initLayout() { |
5538
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
50 setWidth("100%"); |
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
51 setHeight("100%"); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
53 floodMapWidget = floodMap.getMapWidget(); |
1386 | 54 toolbar = new MapToolbar(floodMap, digitizeEnabled); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 |
5538
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
56 add(toolbar); |
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
57 add(floodMapWidget); |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
58 } |
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
59 |
5538
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
60 public void doLayout(int w, int h) { |
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
61 int width = w; |
ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
Christian Lins <christian.lins@intevation.de>
parents:
4571
diff
changeset
|
62 int height = h; |
4541
7b454c6e2bcb
MapPanel position and size now properly aligned (#568).
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
63 GWT.log("MapPanel.size: " + width + "x" + height); |
4475
6fb4e29a2a9b
Resize MapWidget in MapPanel manually using a ResizedHandler.
Christian Lins <christian.lins@intevation.de>
parents:
4402
diff
changeset
|
64 |
4541
7b454c6e2bcb
MapPanel position and size now properly aligned (#568).
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
65 width -= 2; // minus black borders |
7b454c6e2bcb
MapPanel position and size now properly aligned (#568).
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
66 height -= toolbar.getHeight() + 4; |
7b454c6e2bcb
MapPanel position and size now properly aligned (#568).
Christian Lins <christian.lins@intevation.de>
parents:
4476
diff
changeset
|
67 |
4571
95e23bcf6a50
Fix FLYS logo URL for printing.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
68 if (width < 0 || height < 0) { |
95e23bcf6a50
Fix FLYS logo URL for printing.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
69 GWT.log("MapPanel: Oops what a size!"); |
95e23bcf6a50
Fix FLYS logo URL for printing.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
70 return; |
95e23bcf6a50
Fix FLYS logo URL for printing.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
71 } |
95e23bcf6a50
Fix FLYS logo URL for printing.
Christian Lins <christian.lins@intevation.de>
parents:
4570
diff
changeset
|
72 |
8856 | 73 floodMapWidget.setSize( |
74 Integer.toString(width), Integer.toString(height)); | |
4553
fac54b8470d4
Map view in DigitizePanel now shows OSM background, river axis and
Christian Lins <christian.lins@intevation.de>
parents:
4541
diff
changeset
|
75 floodMapWidget.getMap().updateSize(); |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 public FloodMap getFloodMap() { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 return floodMap; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
82 |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
83 public MapToolbar getMapToolbar () { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
84 return toolbar; |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
85 } |
832
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |