Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Wed Jan 25 08:42:46 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Wed Jan 25 08:50:06 2012 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.client.client.ui.map; +import com.google.gwt.core.client.GWT; + import org.gwtopenmaps.openlayers.client.Bounds; import org.gwtopenmaps.openlayers.client.Map; @@ -19,6 +21,7 @@ import org.gwtopenmaps.openlayers.client.util.JObjectArray; import org.gwtopenmaps.openlayers.client.util.JSObject; import org.gwtopenmaps.openlayers.client.LonLat; +import org.gwtopenmaps.openlayers.client.ZIndexBase; public class FloodMap implements VectorFeatureAddedListener { @@ -34,7 +37,7 @@ protected Vector barrierLayer; protected String srid; protected Bounds maxExtent; - + protected ScaleLine scaleLine; public FloodMap(String srid, Bounds maxExtent) { this.srid = srid; @@ -51,14 +54,6 @@ mapWidget = new MapWidget("510px", "635px", opts); map = mapWidget.getMap(); - ScaleLineOptions slOpts = new ScaleLineOptions(); - slOpts.setBottomInUnits("m"); - slOpts.setBottomOutUnits("km"); - slOpts.setTopInUnits(""); - slOpts.setTopOutUnits(""); - - map.addControl(new ScaleLine(slOpts)); - getBarrierLayer(); } @@ -305,5 +300,22 @@ l.redraw(); } } + + + public void activateScaleLine(boolean activate) { + if (activate) { + ScaleLineOptions slOpts = new ScaleLineOptions(); + slOpts.setBottomInUnits("m"); + slOpts.setBottomOutUnits("km"); + slOpts.setTopInUnits(""); + slOpts.setTopOutUnits(""); + + scaleLine = new ScaleLine(slOpts); + this.map.addControl(scaleLine); + } + else if (!activate && scaleLine != null){ + this.map.removeControl(scaleLine); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :