comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java @ 797:cc3f481e9484

Introduced GwtOpenLayers to bring up maps. flys-client/trunk@2314 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 08 Jul 2011 14:56:02 +0000
parents cd8603aaa730
children 7061c2e66039
comparison
equal deleted inserted replaced
796:cd8603aaa730 797:cc3f481e9484
1 package de.intevation.flys.client.client.ui.map; 1 package de.intevation.flys.client.client.ui.map;
2 2
3 import com.google.gwt.user.client.ui.HorizontalPanel;
4 import com.google.gwt.user.client.ui.VerticalPanel;
5 import com.google.gwt.user.client.ui.Widget;
6
7 import com.smartgwt.client.widgets.Button;
3 import com.smartgwt.client.widgets.Canvas; 8 import com.smartgwt.client.widgets.Canvas;
9 import com.smartgwt.client.widgets.events.ClickEvent;
10 import com.smartgwt.client.widgets.events.ClickHandler;
4 import com.smartgwt.client.widgets.layout.HLayout; 11 import com.smartgwt.client.widgets.layout.HLayout;
12
13 import org.gwtopenmaps.openlayers.client.Bounds;
14 import org.gwtopenmaps.openlayers.client.LonLat;
15 import org.gwtopenmaps.openlayers.client.layer.WMS;
16 import org.gwtopenmaps.openlayers.client.layer.WMSParams;
17
5 18
6 import de.intevation.flys.client.shared.model.Collection; 19 import de.intevation.flys.client.shared.model.Collection;
7 import de.intevation.flys.client.shared.model.OutputMode; 20 import de.intevation.flys.client.shared.model.OutputMode;
8 21
9 import de.intevation.flys.client.client.ui.CollectionView; 22 import de.intevation.flys.client.client.ui.CollectionView;
10 import de.intevation.flys.client.client.ui.OutputTab; 23 import de.intevation.flys.client.client.ui.OutputTab;
24 import de.intevation.flys.client.client.ui.chart.ChartThemePanel;
11 25
12 26
13 public class MapOutputTab extends OutputTab { 27 public class MapOutputTab extends OutputTab {
14 28
15 protected CollectionView parent; 29 protected CollectionView parent;
16 30
31 protected Canvas controlPanel;
17 protected Canvas themePanel; 32 protected Canvas themePanel;
18 protected Canvas mapPanel; 33 protected Widget mapPanel;
34
35 protected FloodMap floodMap;
19 36
20 37
21 public MapOutputTab( 38 public MapOutputTab(
22 String title, 39 String title,
23 Collection collection, 40 Collection collection,
25 CollectionView collectionView 42 CollectionView collectionView
26 ){ 43 ){
27 super(title, collection, mode); 44 super(title, collection, mode);
28 this.parent = collectionView; 45 this.parent = collectionView;
29 46
47 floodMap = new FloodMap();
48
30 initLayout(); 49 initLayout();
50 initLayers();
31 } 51 }
32 52
33 53
34 protected void initLayout() { 54 protected void initLayout() {
35 themePanel = createThemePanel(); 55 Canvas wrapper = new Canvas();
36 mapPanel = createMapPanel(); 56 wrapper.setWidth100();
57 wrapper.setHeight100();
37 58
59 VerticalPanel vlayout = new VerticalPanel();
60 vlayout.setWidth("100%");
61
62 controlPanel = createControlPanel();
63 themePanel = createThemePanel();
64 mapPanel = floodMap.getMapWidget();
65
66 final HorizontalPanel layout = new HorizontalPanel();
67 layout.setWidth("100%");
68 layout.setHeight("635px");
69
70 layout.add(themePanel);
71 layout.add(mapPanel);
72
73 vlayout.add(controlPanel);
74 vlayout.add(layout);
75
76 wrapper.addChild(vlayout);
77
78 setPane(wrapper);
79 }
80
81
82 protected void initLayers() {
83 // TODO Initialize correct layers here
84
85 String url = "http://vmap0.tiles.osgeo.org/wms/vmap0";
86 String layers = "basic";
87
88 WMSParams params = new WMSParams();
89 params.setLayers(layers);
90 params.setFormat("image/png");
91 params.setIsTransparent(false);
92 params.setMaxExtent(new Bounds(90, 180, -90, -180));
93
94 WMS wms = new WMS("vmap0", url, params);
95 wms.setIsBaseLayer(true);
96 wms.setIsVisible(true);
97
98 floodMap.getMap().addLayer(wms);
99 floodMap.getMap().setCenter(new LonLat(0, 0));
100 }
101
102
103 protected Canvas createControlPanel() {
38 HLayout layout = new HLayout(); 104 HLayout layout = new HLayout();
39 layout.setWidth100(); 105 layout.setWidth100();
40 layout.setHeight100(); 106 layout.setHeight(30);
41 layout.addMember(themePanel); 107 layout.setMembersMargin(5);
42 layout.addMember(mapPanel); 108 layout.setBorder("1px solid black");
43 109
44 setPane(layout); 110 Button zoomToMax = new Button("Max Extent");
111 zoomToMax.addClickHandler(new ClickHandler() {
112 public void onClick(ClickEvent event) {
113 floodMap.getMap().zoomToMaxExtent();
114 }
115 });
116
117 layout.addMember(zoomToMax);
118
119 return layout;
45 } 120 }
46 121
47 122
48 protected Canvas createThemePanel() { 123 protected Canvas createThemePanel() {
49 Canvas c = new Canvas(); 124 Canvas c = new Canvas();
50 c.setWidth(200); 125 c.setWidth(200);
51 c.setHeight100(); 126 c.setHeight100();
52 c.setBorder("1px solid blue"); 127 c.setBorder("1px solid black");
53 128
54 return c; 129 ChartThemePanel ctp = new ChartThemePanel(collection, mode);
55 } 130 c.addChild(ctp);
56
57
58 protected Canvas createMapPanel() {
59 Canvas c = new Canvas();
60 c.setWidth("*");
61 c.setHeight100();
62 c.setBorder("1px solid green");
63 131
64 return c; 132 return c;
65 } 133 }
66 } 134 }
67 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org