X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.geo%2Fsrc%2Forg%2Fargeo%2Fapp%2Fgeo%2Fux%2FOpenLayersMapPart.java;h=e6edbf6e2861cb556fc1fb7cc9b35e3c13d19c06;hb=efda92d76cd7ccce3925763bf95f68d7927ac5c7;hp=c66ed3a03164760ec6aa61db61273b68d677e48a;hpb=b384a9cbe93b83b3aa94fe46cf2ff0a929f0332c;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.geo/src/org/argeo/app/geo/ux/OpenLayersMapPart.java b/org.argeo.app.geo/src/org/argeo/app/geo/ux/OpenLayersMapPart.java index c66ed3a..e6edbf6 100644 --- a/org.argeo.app.geo/src/org/argeo/app/geo/ux/OpenLayersMapPart.java +++ b/org.argeo.app.geo/src/org/argeo/app/geo/ux/OpenLayersMapPart.java @@ -7,8 +7,12 @@ import org.argeo.app.ol.TileLayer; import org.argeo.app.ol.VectorLayer; import org.argeo.app.ux.js.JsClient; +/** + * A wrapper around an OpenLayers map, adding specific features, such as SLD + * styling. + */ public class OpenLayersMapPart extends AbstractGeoJsObject { - private String mapPartName; + private final String mapPartName; public OpenLayersMapPart(JsClient jsClient, String mapPartName) { super(mapPartName); @@ -24,17 +28,17 @@ public class OpenLayersMapPart extends AbstractGeoJsObject { executeMethod(getMethodName(), JsClient.escapeQuotes(xml)); } - public void applyStyle(String layerName, String styledLayerName) { - executeMethod(getMethodName(), layerName, styledLayerName); + public void setCenter(Double lat, Double lon) { + executeMethod(getMethodName(), lat, lon); } - public void applyBboxStrategy(String layerName) { - executeMethod(getMethodName(), layerName); + public void applyStyle(String layerName, String styledLayerName) { + executeMethod(getMethodName(), layerName, styledLayerName); } public Layer getLayer(String name) { // TODO deal with not found - String reference = "getLayerByName('" + name + "')"; + String reference = getReference() + ".getLayerByName('" + name + "')"; if (getJsClient().isInstanceOf(reference, AbstractOlObject.getJsClassName(VectorLayer.class))) { return new VectorLayer(getJsClient(), reference); } else if (getJsClient().isInstanceOf(reference, AbstractOlObject.getJsClassName(TileLayer.class))) { @@ -43,4 +47,9 @@ public class OpenLayersMapPart extends AbstractGeoJsObject { return new Layer(getJsClient(), reference); } } + + public String getMapPartName() { + return mapPartName; + } + }