comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 3347:6d749af6a9c2

Issue #726 work. flys-client/trunk@5022 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Tue, 17 Jul 2012 11:45:35 +0000
parents ddf43791244c
children c84630d544a1
comparison
equal deleted inserted replaced
3346:f2039d030b5e 3347:6d749af6a9c2
1 package de.intevation.flys.client.client.ui.map; 1 package de.intevation.flys.client.client.ui.map;
2 2
3 import org.gwtopenmaps.openlayers.client.Bounds; 3 import org.gwtopenmaps.openlayers.client.Bounds;
4 import org.gwtopenmaps.openlayers.client.LonLat;
4 import org.gwtopenmaps.openlayers.client.Map; 5 import org.gwtopenmaps.openlayers.client.Map;
5 import org.gwtopenmaps.openlayers.client.MapOptions; 6 import org.gwtopenmaps.openlayers.client.MapOptions;
6 import org.gwtopenmaps.openlayers.client.MapWidget; 7 import org.gwtopenmaps.openlayers.client.MapWidget;
7 import org.gwtopenmaps.openlayers.client.Style; 8 import org.gwtopenmaps.openlayers.client.Style;
8 import org.gwtopenmaps.openlayers.client.control.ScaleLine; 9 import org.gwtopenmaps.openlayers.client.control.ScaleLine;
9 import org.gwtopenmaps.openlayers.client.control.ScaleLineOptions; 10 import org.gwtopenmaps.openlayers.client.control.ScaleLineOptions;
10 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; 11 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener;
11 import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener.FeatureAddedEvent;
12 import org.gwtopenmaps.openlayers.client.feature.VectorFeature; 12 import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
13 import org.gwtopenmaps.openlayers.client.format.GeoJSON; 13 import org.gwtopenmaps.openlayers.client.format.GeoJSON;
14 import org.gwtopenmaps.openlayers.client.layer.Layer; 14 import org.gwtopenmaps.openlayers.client.layer.Layer;
15 import org.gwtopenmaps.openlayers.client.layer.Vector; 15 import org.gwtopenmaps.openlayers.client.layer.Vector;
16 import org.gwtopenmaps.openlayers.client.layer.VectorOptions; 16 import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
17 import org.gwtopenmaps.openlayers.client.util.Attributes; 17 import org.gwtopenmaps.openlayers.client.util.Attributes;
18 import org.gwtopenmaps.openlayers.client.util.JObjectArray; 18 import org.gwtopenmaps.openlayers.client.util.JObjectArray;
19 import org.gwtopenmaps.openlayers.client.util.JSObject; 19 import org.gwtopenmaps.openlayers.client.util.JSObject;
20 import org.gwtopenmaps.openlayers.client.LonLat;
21 20
22 21
23 public class FloodMap implements VectorFeatureAddedListener { 22 public class FloodMap implements VectorFeatureAddedListener {
24 23
25 public static final String LAYER_BARRIERS = "vector_layer_barriers"; 24 public static final String LAYER_BARRIERS = "vector_layer_barriers";
36 protected ScaleLine scaleLine; 35 protected ScaleLine scaleLine;
37 36
38 public FloodMap(String srid, Bounds maxExtent) { 37 public FloodMap(String srid, Bounds maxExtent) {
39 this.srid = srid; 38 this.srid = srid;
40 this.maxExtent = maxExtent; 39 this.maxExtent = maxExtent;
41 40 recreateWidget("100%", "99px");
41 getBarrierLayer();
42 }
43
44
45 public void recreateWidget(String width, String height) {
42 MapOptions opts = new MapOptions(); 46 MapOptions opts = new MapOptions();
43 opts.setControls(new JObjectArray(new JSObject[] {})); 47 opts.setControls(new JObjectArray(new JSObject[] {}));
44 opts.setNumZoomLevels(16); 48 opts.setNumZoomLevels(16);
45 opts.setProjection(getRiverProjection()); 49 opts.setProjection(getRiverProjection());
46 opts.setMaxExtent(maxExtent); 50 opts.setMaxExtent(maxExtent);
47 opts.setUnits("m"); 51 opts.setUnits("m");
48 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY 52 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY
49 53
50 mapWidget = new MapWidget("510px", "635px", opts); 54 mapWidget = new MapWidget(width, height, opts);
51 map = mapWidget.getMap(); 55 map = mapWidget.getMap();
52
53 getBarrierLayer();
54 } 56 }
55 57
56 58
57 @Override 59 @Override
58 public void onFeatureAdded(FeatureAddedEvent evt) { 60 public void onFeatureAdded(FeatureAddedEvent evt) {

http://dive4elements.wald.intevation.org