Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPositionPanel.java @ 1425:bc06a671ef60
Removed the URL parameter from service calls. The service
implementations read the URL from the web.xml config file now.
flys-client/trunk@3367 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 08 Dec 2011 09:12:27 +0000 |
parents | f3410c96f51a |
children | d73f503f2465 |
line wrap: on
line source
package de.intevation.flys.client.client.ui.map; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.layout.HLayout; import org.gwtopenmaps.openlayers.client.LonLat; import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.MapWidget; import org.gwtopenmaps.openlayers.client.Pixel; import org.gwtopenmaps.openlayers.client.event.EventHandler; import org.gwtopenmaps.openlayers.client.event.EventObject; import org.gwtopenmaps.openlayers.client.util.JSObject; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class MapPositionPanel extends HLayout { protected MapWidget mapWidget; protected final Map map; protected Label x; protected Label y; public MapPositionPanel(MapWidget mapWidget) { this.mapWidget = mapWidget; this.map = mapWidget.getMap(); this.x = new Label(); this.y = new Label(); Label d = new Label("|"); setWidth(60); setMembersMargin(2); x.setWidth(25); y.setWidth(25); d.setWidth(5); addMember(x); addMember(d); addMember(y); // TODO This is not an optimal way to get the mouse position but makes // the wrapper canvas superfluous. this.map.getEvents().register("mousemove", map, new EventHandler() { @Override public void onHandle(EventObject eventObject) { JSObject xy = eventObject.getJSObject().getProperty("xy"); Pixel px = Pixel.narrowToPixel(xy); LonLat lonlat = map.getLonLatFromPixel(px); setX(lonlat.lon()); setY(lonlat.lat()); } }); } protected void setX(double x) { this.x.setContents(String.valueOf(x)); } protected void setY(double y) { this.y.setContents(String.valueOf(y)); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :