comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPanel.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPanel.java@821a02bbfb4e
children 172338b1407f
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.client.client.ui.map;
2
3 import com.google.gwt.core.client.GWT;
4 import com.google.gwt.user.client.ui.AbsolutePanel;
5
6 import org.dive4elements.river.client.shared.model.BBox;
7 import org.dive4elements.river.client.shared.model.MapInfo;
8
9 import org.gwtopenmaps.openlayers.client.Bounds;
10 import org.gwtopenmaps.openlayers.client.MapWidget;
11
12 /**
13 * Panel that contains a MapWidget and a MapToolbar.
14 * This panel is used by the flood map calculation input helper.
15 */
16 public class MapPanel extends AbsolutePanel {
17
18 protected MapToolbar toolbar;
19
20 protected FloodMap floodMap;
21 protected MapWidget floodMapWidget;
22 protected boolean digitizeEnabled;
23
24 public MapPanel(MapInfo mapInfo, boolean digitizeEnabled) {
25 BBox bbox = mapInfo.getBBox();
26
27 this.digitizeEnabled = digitizeEnabled;
28 this.floodMap = new FloodMap(
29 String.valueOf(mapInfo.getSrid()),
30 new Bounds(
31 bbox.getLowerX(),
32 bbox.getLowerY(),
33 bbox.getUpperX(),
34 bbox.getUpperY()),
35 640, 480);
36
37 initLayout();
38 }
39
40
41 private void initLayout() {
42 setWidth("100%");
43 setHeight("100%");
44
45 floodMapWidget = floodMap.getMapWidget();
46 toolbar = new MapToolbar(floodMap, digitizeEnabled);
47
48 add(toolbar);
49 add(floodMapWidget);
50 }
51
52 public void doLayout(int w, int h) {
53 int width = w;
54 int height = h;
55 GWT.log("MapPanel.size: " + width + "x" + height);
56
57 width -= 2; // minus black borders
58 height -= toolbar.getHeight() + 4;
59
60 if (width < 0 || height < 0) {
61 GWT.log("MapPanel: Oops what a size!");
62 return;
63 }
64
65 floodMapWidget.setSize(Integer.toString(width), Integer.toString(height));
66 floodMapWidget.getMap().updateSize();
67 }
68
69
70 public FloodMap getFloodMap() {
71 return floodMap;
72 }
73
74 public MapToolbar getMapToolbar () {
75 return toolbar;
76 }
77 }
78 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org