Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 1542:3e2ef8e0a0dc
Issue 265.
Deactivate measure control and scale line if the map output tab is not
selected.
flys-client/trunk@3761 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 25 Jan 2012 08:50:06 +0000 |
parents | c39aa5a6478c |
children | e2f74131ffc1 |
comparison
equal
deleted
inserted
replaced
1541:959e1d0df941 | 1542:3e2ef8e0a0dc |
---|---|
1 package de.intevation.flys.client.client.ui.map; | 1 package de.intevation.flys.client.client.ui.map; |
2 | |
3 import com.google.gwt.core.client.GWT; | |
2 | 4 |
3 | 5 |
4 import org.gwtopenmaps.openlayers.client.Bounds; | 6 import org.gwtopenmaps.openlayers.client.Bounds; |
5 import org.gwtopenmaps.openlayers.client.Map; | 7 import org.gwtopenmaps.openlayers.client.Map; |
6 import org.gwtopenmaps.openlayers.client.MapOptions; | 8 import org.gwtopenmaps.openlayers.client.MapOptions; |
17 import org.gwtopenmaps.openlayers.client.layer.VectorOptions; | 19 import org.gwtopenmaps.openlayers.client.layer.VectorOptions; |
18 import org.gwtopenmaps.openlayers.client.util.Attributes; | 20 import org.gwtopenmaps.openlayers.client.util.Attributes; |
19 import org.gwtopenmaps.openlayers.client.util.JObjectArray; | 21 import org.gwtopenmaps.openlayers.client.util.JObjectArray; |
20 import org.gwtopenmaps.openlayers.client.util.JSObject; | 22 import org.gwtopenmaps.openlayers.client.util.JSObject; |
21 import org.gwtopenmaps.openlayers.client.LonLat; | 23 import org.gwtopenmaps.openlayers.client.LonLat; |
24 import org.gwtopenmaps.openlayers.client.ZIndexBase; | |
22 | 25 |
23 | 26 |
24 public class FloodMap implements VectorFeatureAddedListener { | 27 public class FloodMap implements VectorFeatureAddedListener { |
25 | 28 |
26 public static final String LAYER_BARRIERS = "vector_layer_barriers"; | 29 public static final String LAYER_BARRIERS = "vector_layer_barriers"; |
32 protected MapWidget mapWidget; | 35 protected MapWidget mapWidget; |
33 protected Map map; | 36 protected Map map; |
34 protected Vector barrierLayer; | 37 protected Vector barrierLayer; |
35 protected String srid; | 38 protected String srid; |
36 protected Bounds maxExtent; | 39 protected Bounds maxExtent; |
37 | 40 protected ScaleLine scaleLine; |
38 | 41 |
39 public FloodMap(String srid, Bounds maxExtent) { | 42 public FloodMap(String srid, Bounds maxExtent) { |
40 this.srid = srid; | 43 this.srid = srid; |
41 this.maxExtent = maxExtent; | 44 this.maxExtent = maxExtent; |
42 | 45 |
48 opts.setUnits("m"); | 51 opts.setUnits("m"); |
49 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY | 52 opts.setMaxResolution(500); // TODO DO THIS ON THE FLY |
50 | 53 |
51 mapWidget = new MapWidget("510px", "635px", opts); | 54 mapWidget = new MapWidget("510px", "635px", opts); |
52 map = mapWidget.getMap(); | 55 map = mapWidget.getMap(); |
53 | |
54 ScaleLineOptions slOpts = new ScaleLineOptions(); | |
55 slOpts.setBottomInUnits("m"); | |
56 slOpts.setBottomOutUnits("km"); | |
57 slOpts.setTopInUnits(""); | |
58 slOpts.setTopOutUnits(""); | |
59 | |
60 map.addControl(new ScaleLine(slOpts)); | |
61 | 56 |
62 getBarrierLayer(); | 57 getBarrierLayer(); |
63 } | 58 } |
64 | 59 |
65 | 60 |
303 | 298 |
304 for (Layer l: layers) { | 299 for (Layer l: layers) { |
305 l.redraw(); | 300 l.redraw(); |
306 } | 301 } |
307 } | 302 } |
303 | |
304 | |
305 public void activateScaleLine(boolean activate) { | |
306 if (activate) { | |
307 ScaleLineOptions slOpts = new ScaleLineOptions(); | |
308 slOpts.setBottomInUnits("m"); | |
309 slOpts.setBottomOutUnits("km"); | |
310 slOpts.setTopInUnits(""); | |
311 slOpts.setTopOutUnits(""); | |
312 | |
313 scaleLine = new ScaleLine(slOpts); | |
314 this.map.addControl(scaleLine); | |
315 } | |
316 else if (!activate && scaleLine != null){ | |
317 this.map.removeControl(scaleLine); | |
318 } | |
319 } | |
308 } | 320 } |
309 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 321 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |