static public Geometry interiorPoint(Geometry arg0) { if (arg0 == null) return null; Geometry _this = arg0; return _this.getInteriorPoint(); }
static public Geometry interiorPoint(Geometry arg0) { Geometry _this = arg0; return _this.getInteriorPoint(); }
/** * @param geometry Valid Geometry instance * @return A Point that lie on the surface or null if input geometry is not a surface. */ public static Geometry getInteriorPoint(Geometry geometry) { if(geometry==null) { return null; } return geometry.getInteriorPoint(); } }
/** * @param geometry Valid Geometry instance * @return A Point that lie on the surface or null if input geometry is not a surface. */ public static Geometry getInteriorPoint(Geometry geometry) { if(geometry==null) { return null; } return geometry.getInteriorPoint(); } }
/** * @param geometry Valid Geometry instance * @return A Point that lie on the surface or null if input geometry is not a surface. */ public static Geometry getInteriorPoint(Geometry geometry) { if(geometry==null) { return null; } return geometry.getInteriorPoint(); } }
public Point getInteriorPoint() { return geometry.getInteriorPoint(); }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return toElement(checkGeo(0, qc).getInteriorPoint(), qc); } }
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); Point point = g.getInteriorPoint(); if (point == null) { return null; } return getGeometryType(point, geom.getSrid()); }
/** * Returns a point interior to the geometry. */ public final DirectPosition getRepresentativePoint() { com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry(); com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint(); return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem()); }
/** * Returns a point interior to the geometry. */ public final DirectPosition getRepresentativePoint() { com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry(); com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint(); return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem()); }
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); Point point = g.getInteriorPoint(); if (point == null) { return null; } return getGeometryType(point, geom.getSrid()); }
/** * Return one point for each geometry * * @param rs * @param fid * @param mt * @return * @throws ParameterException * @throws IOException * @throws SQLException */ public Point2D getPointShape(ResultSet rs, long fid, MapTransform mt, Geometry theGeom) throws ParameterException, IOException, SQLException { Geometry geom = getGeometry(rs, fid, theGeom); AffineTransform at = mt.getAffineTransform(); Point point; try { point = geom.getInteriorPoint(); } catch (TopologyException ex) { LOGGER.error("getPointShape :: TopologyException: ", ex); point = geom.getCentroid(); } return at.transform(new Point2D.Double(point.getX(), point.getY()), null); }
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); Point point = g.getInteriorPoint(); if (point == null) { return null; } point.setSRID(geom.getSrid()); return getGeometryType(point); }
private static Geometry pointInGeometry(Geometry g) { if(g instanceof Polygon) { Point p = g.getCentroid(); // if the geometry is heavily generalized centroid computation may fail and return NaN if(Double.isNaN(p.getX()) || Double.isNaN(p.getY())) return g.getFactory().createPoint(g.getCoordinate()); if(!g.contains(p)) try { return g.getInteriorPoint(); } catch(Exception e) { // generalized geometries might make interior point go bye bye return p; } else return p; } else { return g.getCentroid(); } } }
private static Geometry pointInGeometry(Geometry g) { Point p = g.getCentroid(); if(g instanceof Polygon) { // if the geometry is heavily generalized centroid computation may fail and return NaN if(Double.isNaN(p.getX()) || Double.isNaN(p.getY())) return g.getFactory().createPoint(g.getCoordinate()); // otherwise let's check if the point is inside. Again, this check and "getInteriorPoint" // will work only if the geometry is valid if(g.isValid() && !g.contains(p)) { try { p = g.getInteriorPoint(); } catch(Exception e) { // generalized geometries might make interior point go bye bye return p; } } else { return p; } } return p; }
/** * Get the point from samplingGeometry or featureOfInterest * * @return The {@link Point} */ private Point getPoint() { Point point = null; if (isSetSpatialFilteringProfileParameter()) { Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue(); point = geometry.getInteriorPoint(); point.setSRID(geometry.getSRID()); } else { if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature && ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).isSetGeometry()) { Geometry geometry = ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry(); point = geometry.getInteriorPoint(); point.setSRID(geometry.getSRID()); } } return point; }
public SimpleFeature next() throws NoSuchElementException { SimpleFeature sourceFeature = delegate.next(); for (Object attribute : sourceFeature.getAttributes()) { if (attribute instanceof Geometry) { // centroid or interior point Geometry geometry = (Geometry) attribute; Point center = geometry.getCentroid(); if (useInside && shapeType == SimpleShapeType.POLYGON && !geometry.contains(center)) { center = geometry.getInteriorPoint(); } attribute = center; } builder.add(attribute); } SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID()); builder.reset(); return nextFeature; } }
/** * Get the point from samplingGeometry or featureOfInterest * * @return The {@link Point} */ private Point getPoint() { Point point = null; if (isSetSpatialFilteringProfileParameter()) { Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue(); point = geometry.getInteriorPoint(); point.setSRID(geometry.getSRID()); } else { if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature && ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()) .isSetGeometry()) { Geometry geometry = ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry(); point = geometry.getInteriorPoint(); point.setSRID(geometry.getSRID()); } } return point; }
public SimpleFeature next() throws NoSuchElementException { SimpleFeature sourceFeature = delegate.next(); SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID()); // transfer attributes transferAttribute(sourceFeature, nextFeature); // calculate xy coordinates Geometry g = (Geometry) sourceFeature.getDefaultGeometry(); Point center = useInside ? g.getInteriorPoint() : g.getCentroid(); if (transformer != null) { try { center.setUserData(sourceFeature.getFeatureType() .getCoordinateReferenceSystem()); center = (Point) transformer.transform(center); } catch (TransformException e) { String msg = "Error occured transforming " + center.toString(); LOGGER.log(Level.WARNING, msg); } } nextFeature.setAttribute(xField, center.getX()); nextFeature.setAttribute(yField, center.getY()); return nextFeature; } }
private void writeInsertWithAttributes(String layer, String ownerHandle, String name, SimpleFeature f) throws IOException { writeGroup(0, "INSERT"); writeOwnerHandle(ownerHandle); writeHandle("Geometry"); writeSubClass("AcDbEntity"); writeLayer(layer); writeSubClass("AcDbBlockReference"); writeGroup(66, " 1"); writeName(name); Geometry geometry = (Geometry)f.getDefaultGeometry(); Point intPoint = geometry.getInteriorPoint(); writePoint(intPoint.getX(), intPoint.getY(), 0.0); writeAttributes(layer, ownerHandle, f); writeGroup(0, "SEQEND"); writeHandle("Geometry"); // String handle = getNewHandle("AttDef"); // writeGroup(5, handle); writeOwnerHandle(ownerHandle); writeSubClass("AcDbEntity"); writeLayer(layer); }