public static VectorFeature narrowToVectorFeature(JSObject vectorFeature) { return (vectorFeature == null) ? null : new VectorFeature(vectorFeature); }
@Deprecated public Attributes getAttributes(VectorFeature attributes){ return this.getAttributes(); }
/** * Set the featureId on VectoreFeauture. Remember the featureId must be * unique * * @param feaureID */ public void setFeatureId(String feaureID) { VectorFeatureImpl.setFeatureId(getJSObject(), feaureID); }
/** * Create a clone of this vector feature. Does not set any non-standard * properties. */ public VectorFeature clone() { return narrowToVectorFeature(VectorFeatureImpl.clone(getJSObject())); }
public VectorFeature getVectorFeature() { JSObject object = getJSObject().getProperty("feature"); return (object != null) ? VectorFeature.narrowToVectorFeature(object) : null; }
/** * Convenient method to convert a LINESTRING VectorFeature to a * MULTILINE featureE. This method can be used of you are trying to save a * VectorFeature Line using WFS-T to geoserver and you are seeing a "Error * performing insert: java.lang.String cannot be cast to * com.vividsolutions.jts.geom.Geometry". * * @return true if converting succeeded (if this is not a LINESTRING) */ public boolean convertLineStringToMultiLineString() { final Geometry g = this.getGeometry(); if (g.getClassName().equals( org.gwtopenmaps.openlayers.client.geometry.Geometry.LINESTRING_CLASS_NAME)) { final LineString ls = LineString.narrowToLineString(g.getJSObject()); final MultiLineString mls = new MultiLineString(new LineString[]{ls}); this.getJSObject().setProperty("geometry", mls.getJSObject()); return true; } else { return false; } }
public boolean redrawParent() { return VectorFeatureImpl.redraw(getLayer().getJSObject(), true); }
public VectorFeature[] getFeatures() { JSObject[] jsArr = getJSObject().getPropertyAsArray("features"); logger.fine("######################DIMENSION : " + jsArr.length); if (jsArr.length == 0) { return null; } // In some cases the parser seems to produces an array with length=1 but with null as element if (jsArr[0] == null) { logger.fine("######################RETURN NULL"); return null; } VectorFeature[] result = new VectorFeature[jsArr.length]; for (int i = 0; i < jsArr.length; i++) { VectorFeature vf = VectorFeature.narrowToVectorFeature(jsArr[i]); result[i] = vf; } return result; }
/** * Get the clustered features in this vector feature. If clustering isn't * used returns null. * * @return the clustered features or null if clustering isn't used */ public VectorFeature[] getCluster() { JSObject jsObjects = VectorFeatureImpl.getCluster(getJSObject()); JObjectArray jObjectArray = JObjectArray.narrowToJObjectArray(jsObjects); // Should be null if this is not a cluster if (jObjectArray == null) { return null; } VectorFeature[] features = new VectorFeature[jObjectArray.length()]; for (int i = 0; i < jObjectArray.length(); i++) { features[i] = VectorFeature.narrowToVectorFeature( jObjectArray.get(i)); } return features; }
/** * Convenient method to convert a POLYGON VectorFeature to a * MULTIPOLYGON feature. This method can be used of you are trying to save a * VectorFeature Polygon using WFS-T to geoserver and you are seeing a "Error * performing insert: java.lang.String cannot be cast to * com.vividsolutions.jts.geom.Geometry". * * @return true if converting succeeded (if this is not a POLYGON) */ public boolean convertPolygonToMultiPolygon() { final Geometry g = this.getGeometry(); if (g.getClassName().equals( org.gwtopenmaps.openlayers.client.geometry.Geometry.POLYGON_CLASS_NAME)) { final Polygon p = Polygon.narrowToPolygon(g.getJSObject()); final MultiPolygon mp = new MultiPolygon(new Polygon[]{p}); this.getJSObject().setProperty("geometry", mp.getJSObject()); return true; } else { return false; } }
/** * Determine whether the feature is displayed or not * */ public boolean getVisibility() { return VectorFeatureImpl.getVisibility(getJSObject()); }
/** * @param obj * @return {@link VectorFeature} */ public VectorFeature parseFeature(JSONObject obj) { return VectorFeature.narrowToVectorFeature(GeoJSONImpl.parseFeature(getJSObject(), obj)); } }
public static VectorFeature narrowToVectorFeature(JSObject vectorFeature) { return (vectorFeature == null) ? null : new VectorFeature(vectorFeature); }
@Deprecated public Attributes getAttributes(VectorFeature attributes) { return this.getAttributes(); }
public String getRenderIntent() { return VectorFeatureImpl.getRenderIntent(getJSObject()); }
public VectorFeature getFeature() { JSObject feature = super.getJSObject().getProperty("feature"); return (feature != null) ? VectorFeature.narrowToVectorFeature( feature) : 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()); }
public void setFID(String fid) { VectorFeatureImpl.setFID(getJSObject(), fid); }
public VectorFeature getVectorFeature(){ JSObject object = getJSObject().getProperty("feature"); return (object!=null)?VectorFeature.narrowToVectorFeature(object):null; }
@Deprecated public void setSelectVectorFeature(VectorFeature feature) { getJSObject().setProperty("select", feature.getJSObject()); }