Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java @ 849:d0098fc8c40b
Added translation for "cross_section".
flys-client/trunk@2618 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 31 Aug 2011 10:28:28 +0000 |
parents | dcecdd9693a8 |
children | 4af1ee86b0b1 |
line wrap: on
line source
package de.intevation.flys.client.client.ui.map; import org.gwtopenmaps.openlayers.client.Bounds; import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.MapOptions; import org.gwtopenmaps.openlayers.client.MapWidget; import org.gwtopenmaps.openlayers.client.feature.VectorFeature; import org.gwtopenmaps.openlayers.client.format.GeoJSON; import org.gwtopenmaps.openlayers.client.layer.Vector; import org.gwtopenmaps.openlayers.client.layer.VectorOptions; import org.gwtopenmaps.openlayers.client.util.JObjectArray; import org.gwtopenmaps.openlayers.client.util.JSObject; public class FloodMap { public static final String LAYER_BARRIERS = "vector_layer_barriers"; protected MapWidget mapWidget; protected Map map; protected Vector barrierLayer; protected String srid; protected Bounds maxExtent; public FloodMap(String srid, Bounds maxExtent) { this.srid = srid; this.maxExtent = maxExtent; MapOptions opts = new MapOptions(); opts.setControls(new JObjectArray(new JSObject[] {})); opts.setNumZoomLevels(16); opts.setProjection(getRiverProjection()); opts.setMaxExtent(maxExtent); opts.setMaxResolution(500); // TODO DO THIS ON THE FLY mapWidget = new MapWidget("510px", "635px", opts); map = mapWidget.getMap(); getBarrierLayer(); } public MapWidget getMapWidget() { return mapWidget; } public Map getMap() { return map; } public String getRiverProjection() { return "EPSG:" + srid; } public Vector getBarrierLayer() { if (barrierLayer == null) { VectorOptions opts = new VectorOptions(); opts.setProjection(getRiverProjection()); opts.setMaxExtent(maxExtent); barrierLayer = new Vector(LAYER_BARRIERS, opts); barrierLayer.setIsBaseLayer(true); map.addLayer(barrierLayer); } return barrierLayer; } public String getFeaturesAsGeoJSON() { VectorFeature[] features = barrierLayer.getFeatures(); if (features == null || features.length == 0) { return null; } return new GeoJSON().write(features); } public void setSize(String width, String height) { mapWidget.setWidth(width); mapWidget.setHeight(height); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :