protected Geometry createSubGeomInstance(String token, boolean haveM) throws SQLException { return new Polygon(token, haveM); }
private static org.postgis.Polygon convert(Polygon polygon) { int numRings = polygon.getNumInteriorRing(); org.postgis.LinearRing[] rings = new org.postgis.LinearRing[numRings + 1]; rings[0] = convert(polygon.getExteriorRing()); for (int i = 0; i < numRings; i++) { rings[i + 1] = convert(polygon.getInteriorRingN(i)); } org.postgis.Polygon pgPolygon = new org.postgis.Polygon(rings); pgPolygon.setSrid(polygon.getSRID()); return pgPolygon; }
ICRS crs = CRSManager.getCRSRef( "EPSG:" + pgPolygon.getSrid() ); org.postgis.LinearRing ring = pgPolygon.getRing( 0 ); Point min = ring.getPoint( 0 ); Point max = ring.getPoint( 2 ); double[] ma = null; if ( pgPolygon.getDimension() == 2 ) { mi = new double[] { translationVector[0] + min.getX(), translationVector[1] + min.getY() }; ma = new double[] { translationVector[0] + max.getX(), translationVector[1] + max.getY() };
private static org.postgis.Polygon convert(Polygon polygon) { int numRings = polygon.getNumInteriorRing(); org.postgis.LinearRing[] rings = new org.postgis.LinearRing[numRings + 1]; rings[0] = convert(polygon.getExteriorRing()); for (int i = 0; i < numRings; i++) { rings[i+1] = convert(polygon.getInteriorRingN(i)); } org.postgis.Polygon pgPolygon = new org.postgis.Polygon(rings); pgPolygon.setSrid(polygon.getSRID()); return pgPolygon; }
protected Geometry createSubGeomInstance(String token, boolean haveM) throws SQLException { return new Polygon(token, haveM); }
private Polygon convertJTSPolygon( com.vividsolutions.jts.geom.Polygon jtsPolygon) { int numRings = jtsPolygon.getNumInteriorRing(); org.postgis.LinearRing[] rings = new org.postgis.LinearRing[numRings + 1]; rings[0] = convertJTSLineStringToLinearRing(jtsPolygon .getExteriorRing()); for (int i = 0; i < numRings; i++) { rings[i + 1] = convertJTSLineStringToLinearRing(jtsPolygon .getInteriorRingN(i)); } Polygon polygon = new org.postgis.Polygon(rings); polygon.setSrid(jtsPolygon.getSRID()); return polygon; }
private Polygon parsePolygon(ValueGetter data, boolean haveZ, boolean haveM) { int count = data.getInt(); LinearRing[] rings = new LinearRing[count]; for (int i = 0; i < count; i++) { rings[i] = parseLinearRing(data, haveZ, haveM); } return new Polygon(rings); }
org.postgis.Polygon pgPoly = new org.postgis.Polygon( linRing ); pgPoly.setSrid( parseSRID( geometry.getCoordinateSystem() ) ); return new PGgeometry( pgPoly );
private Polygon parsePolygon(ValueGetter data, boolean haveZ, boolean haveM) { int count = data.getInt(); LinearRing[] rings = new LinearRing[count]; for (int i = 0; i < count; i++) { rings[i] = parseLinearRing(data, haveZ, haveM); } return new Polygon(rings); }
/** * Creates a PostGIS Polygon object corresponding to the provided Point * list. * * @param points * The points to build a polygon from. * @return The Polygon object. */ public Polygon createPolygon(Point[] points) { Polygon result; result = new Polygon(new LinearRing[] {new LinearRing(points)}); result.srid = 4326; return result; } }
/** * Creates a PostGIS Polygon object corresponding to the provided Point * list. * * @param points * The points to build a polygon from. * @return The Polygon object. */ public Polygon createPolygon(Point[] points) { Polygon result; result = new Polygon(new LinearRing[] {new LinearRing(points)}); result.srid = 4326; return result; } }
protected com.vividsolutions.jts.geom.Geometry convertPolygon( Polygon polygon) { com.vividsolutions.jts.geom.LinearRing shell = getGeometryFactory() .createLinearRing( toJTSCoordinates(polygon.getRing(0).getPoints())); com.vividsolutions.jts.geom.Polygon out = null; if (polygon.numRings() > 1) { com.vividsolutions.jts.geom.LinearRing[] rings = new com.vividsolutions.jts.geom.LinearRing[polygon .numRings() - 1]; for (int r = 1; r < polygon.numRings(); r++) { rings[r - 1] = getGeometryFactory().createLinearRing( toJTSCoordinates(polygon.getRing(r).getPoints())); } out = getGeometryFactory().createPolygon(shell, rings); } else { out = getGeometryFactory().createPolygon(shell, null); } return out; }
result = new MultiPoint(value, haveM); } else if (value.startsWith("POLYGON")) { result = new Polygon(value, haveM); } else if (value.startsWith("LINESTRING")) { result = new LineString(value, haveM);
result = new MultiPoint(value, haveM); } else if (value.startsWith("POLYGON")) { result = new Polygon(value, haveM); } else if (value.startsWith("LINESTRING")) { result = new LineString(value, haveM);