public static Vector narrowToVector(JSObject vectorLayer) { return (vectorLayer == null) ? null : new Vector(vectorLayer); }
/** * Constructor. * * @param vectorLayer * The layer that this DragFeature belongs. */ public DragFeature(Vector vectorLayer) { this(DragFeatureImpl.create(vectorLayer.getJSObject())); }
/** * @return Array of VectorFeature objects or null if layer does not contain * any features */ public VectorFeature[] getFeatures() { int nr = getNumberOfFeatures(); if (nr < 1) { return null; } else { VectorFeature[] vfs = new VectorFeature[nr]; for (int i = 0; i < nr; i++) { VectorFeature vf = VectorFeature.narrowToVectorFeature(VectorImpl.getFeature(getJSObject(), i)); vfs[i] = vf; } return vfs; } };
/** * Erase features. */ public void eraseFeatures() { this.vector.destroyFeatures(); this.vector.redraw(); this.map.updateSize(); }
/** * Gets an array of all selected features. * * @return Array of VectorFeature objects or null if layer does not contain * any features */ public VectorFeature[] getSelectedFeatures() { int nr = getNumberOfSelectedFeatures(); if (nr < 1) { return null; } else { VectorFeature[] vfs = new VectorFeature[nr]; for (int i = 0; i < nr; i++) { VectorFeature vf = VectorFeature.narrowToVectorFeature( VectorImpl.getSelectedFeature( getJSObject(), i)); vfs[i] = vf; } return vfs; } }
public Vector getSource() { return Vector.narrowToLayer(super.getSourceJSObject()); }
public Vector getSource(){ JSObject object = getSourceJSObject(); return (object!=null)?Vector.narrowToVector(object):null; }
/** * Draw aoi on map. * * @param wkt * the wkt */ public void drawAoiOnMap(String wkt) { this.eraseFeatures(); MultiPolygon geom = MultiPolygon.narrowToMultiPolygon(Geometry.fromWKT(wkt).getJSObject()); geom.transform(new Projection("EPSG:4326"), new Projection("EPSG:900913")); VectorFeature vectorFeature = new VectorFeature(geom); this.vector.addFeature(vectorFeature); this.map.zoomToExtent(geom.getBounds()); }
@Override public Vector getLayer() { return Vector.narrowToLayer(getJSObject().getProperty("layer")); }
/** * Destroy all features in the vector layer */ public void destroyFeatures() { VectorImpl.destroyFeatures(getJSObject()); }
public L createLayer(JSObject jsObject) { return (L) new Vector(jsObject); } };
/** * @return Array of VectorFeature objects or null if layer does not contain * any features */ public VectorFeature[] getFeatures() { int nr = getNumberOfFeatures(); if (nr < 1) { return null; } else { VectorFeature[] vfs = new VectorFeature[nr]; for (int i = 0; i < nr; i++) { VectorFeature vf = VectorFeature.narrowToVectorFeature( VectorImpl.getFeature( getJSObject(), i)); vfs[i] = vf; } return vfs; } }
/** * * @return Vector on which features are drawn */ public Vector getLayer() { return Vector.narrowToLayer(ControlImpl.getLayer(getJSObject())); }
/** * * @param layer */ public SelectFeature(Vector layer) { this(SelectFeatureImpl.create(layer.getJSObject())); }
/** * Inits the vector layer. */ private void initVectorLayer() { VectorOptions vectorOption = new VectorOptions(); vectorOption.setStyle(this.createStyle()); vectorOption.setDisplayInLayerSwitcher(false); this.vector = new Vector("Geofence PREVIEW Vector Layer", vectorOption); this.map.addLayer(vector); }
/** * * @return Vector */ public Vector getLayer() { return Vector.narrowToLayer(getJSObject().getProperty("layer")); }
/** * * @param layer */ public SelectFeature(Vector layer) { this(SelectFeatureImpl.create(layer.getJSObject())); }
/** * Create a Vector layer from a geoJSOn file. * @param layerName The name you want to give to this layer. * @param url The URL to the geoJSON file you want to create a layer from. * @return A Vector layouer */ public static Vector createLayerFromJson(String layerName, String url) { FixedStrategyOptions fOptions = new FixedStrategyOptions(); FixedStrategy fStrategy = new FixedStrategy(fOptions); GeoJSON geoJson = new GeoJSON(); HTTPProtocolOptions httpProtOptions = new HTTPProtocolOptions(); httpProtOptions.setUrl(url); httpProtOptions.setFormat(geoJson); HTTPProtocol httpProt = new HTTPProtocol(httpProtOptions); VectorOptions options = new VectorOptions(); options.setStrategies(new Strategy[]{fStrategy}); options.setProtocol(httpProt); return new Vector(layerName, options); } }
public Vector getLayer() { return Vector.narrowToLayer(getJSObject().getProperty("layer")); }
/** * Constructor. * * @param vectorLayer * The layer that this DragFeature belongs. */ public DragFeature(Vector vectorLayer) { this(DragFeatureImpl.create(vectorLayer.getJSObject())); }