Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java @ 3834:52109c4bc5de
Prevent AIOOB exception.
flys-client/trunk@5540 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 20 Sep 2012 09:58:10 +0000 |
parents | 6d749af6a9c2 |
children | 61020a61ed38 |
rev | line source |
---|---|
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
|
1 package de.intevation.flys.client.client.ui.map; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.user.client.ui.HorizontalPanel; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import com.smartgwt.client.widgets.Canvas; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import com.smartgwt.client.widgets.layout.VLayout; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.client.shared.model.BBox; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.shared.model.MapInfo; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
10 import org.gwtopenmaps.openlayers.client.Bounds; |
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
11 |
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
|
12 |
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 public class MapPanel extends VLayout { |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 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
|
16 protected HorizontalPanel mapArea; |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 protected FloodMap 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
|
19 protected 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
|
20 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 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
|
23 super(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
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 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
|
26 |
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 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 bbox.getUpperX(), |
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 bbox.getUpperY())); |
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 |
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 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
|
37 } |
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 |
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 |
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 private void 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
|
41 setWidth100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 setHeight100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
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 mapArea = new HorizontalPanel(); |
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 mapArea.setWidth("99%"); |
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 mapArea.setHeight("99%"); |
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 mapArea.add(floodMap.getMapWidget()); |
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 Canvas wrapper = new Canvas(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 wrapper.setWidth100(); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 wrapper.setHeight100(); |
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 wrapper.addChild(mapArea); |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
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 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 addMember(toolbar); |
3347
6d749af6a9c2
Issue #726 work.
Christian Lins <christian.lins@intevation.de>
parents:
1389
diff
changeset
|
57 addMember(wrapper); |
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
|
58 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 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
|
62 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
|
63 } |
1389
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
64 |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
65 public MapToolbar getMapToolbar () { |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
66 return toolbar; |
d29a9fa10313
Issue 265.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
67 } |
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
|
68 } |
303a923d232b
Added a panel that wraps all the stuff to combine SmartGWT and GWT-OpenLayers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |