public static DirectPosition[][] getInteriorDirectPositions(final Polygon polygon) { final SurfaceBoundary surfaceBoundary = polygon.getBoundary(); final List interiorRings = surfaceBoundary.getInteriors(); final DirectPosition[][] returnable = new DirectPosition[interiorRings.size()][]; for (int i = 0; i < interiorRings.size(); i++) { returnable[i] = getDirectPositions((Ring)interiorRings.get(i)); } return returnable; }
/** * Returns a list of the rings which define the surface: First element is * the exterior ring (island), the following elements, if exist, define the * interior rings (holes) * * @return List of Ring: First element is the exterior ring (island), * the following elements, if exist, define the interior rings * (holes) */ public List<Ring> getBoundaryRings() { List<Ring> rList = new ArrayList(); rList.add(this.boundary.getExterior()); Iterator tInteriorRings = this.boundary.getInteriors().iterator(); while (tInteriorRings.hasNext()) { rList.add((Ring) tInteriorRings.next()); } return rList; }
public static DirectPosition[][] getInteriorDirectPositions(final Polygon polygon) { final SurfaceBoundary surfaceBoundary = polygon.getBoundary(); final List interiorRings = surfaceBoundary.getInteriors(); final DirectPosition[][] returnable = new DirectPosition[interiorRings.size()][]; for (int i = 0; i < interiorRings.size(); i++) { returnable[i] = getDirectPositions((Ring)interiorRings.get(i)); } return returnable; }
public static DirectPosition[][] getInteriorDirectPositions(final Polygon polygon) { final SurfaceBoundary surfaceBoundary = polygon.getBoundary(); final List interiorRings = surfaceBoundary.getInteriors(); final DirectPosition[][] returnable = new DirectPosition[interiorRings.size()][]; for (int i = 0; i < interiorRings.size(); i++) { returnable[i] = getDirectPositions((Ring)interiorRings.get(i)); } return returnable; }
private String surfaceBoundaryCoordToString(SurfaceBoundary sb) { String rString = "("; rString += ringCoordToString((Ring) sb.getExterior()); rString += ")"; List<Ring> interior = sb.getInteriors(); if (interior.size() > 0) { for (int i = 0; i < interior.size(); i++) { rString += ", ("; rString += ringCoordToString((Ring) interior.get(i)); rString += ")"; } } return rString; }
public PolygonType(final JTSPolygon poly) { if (poly != null && poly.getBoundary() != null) { this.coordinateReferenceSystem = poly.getBoundary().getCoordinateReferenceSystem(); this.exterior = poly.getBoundary().getExterior(); this.interior = poly.getBoundary().getInteriors(); } }
/** * @return * @see com.polexis.lite.spatialschema.geometry.primitive.SurfacePatchImpl#calculateJTSPeer() */ public com.vividsolutions.jts.geom.Geometry calculateJTSPeer() { SurfaceBoundary boundary = getBoundary(); Ring exterior = boundary.getExterior(); List interiors = boundary.getInteriors(); com.vividsolutions.jts.geom.Geometry g = ((JTSGeometry) exterior).getJTSGeometry(); int numHoles = (interiors != null) ? interiors.size() : 0; com.vividsolutions.jts.geom.LinearRing jtsExterior = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g.getCoordinates()); com.vividsolutions.jts.geom.LinearRing [] jtsInterior = new com.vividsolutions.jts.geom.LinearRing[numHoles]; for (int i=0; i<numHoles; i++) { com.vividsolutions.jts.geom.Geometry g2 = ((JTSGeometry) interiors.get(i)).getJTSGeometry(); jtsInterior[i] = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g2.getCoordinates()); } com.vividsolutions.jts.geom.Polygon result = JTSUtils.GEOMETRY_FACTORY.createPolygon(jtsExterior, jtsInterior); return result; }
/** * @return * @see com.polexis.lite.spatialschema.geometry.primitive.SurfacePatchImpl#calculateJTSPeer() */ public com.vividsolutions.jts.geom.Geometry calculateJTSPeer() { SurfaceBoundary boundary = getBoundary(); Ring exterior = boundary.getExterior(); List interiors = boundary.getInteriors(); com.vividsolutions.jts.geom.Geometry g = ((JTSGeometry) exterior).getJTSGeometry(); int numHoles = (interiors != null) ? interiors.size() : 0; com.vividsolutions.jts.geom.LinearRing jtsExterior = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g.getCoordinates()); com.vividsolutions.jts.geom.LinearRing [] jtsInterior = new com.vividsolutions.jts.geom.LinearRing[numHoles]; for (int i=0; i<numHoles; i++) { com.vividsolutions.jts.geom.Geometry g2 = ((JTSGeometry) interiors.get(i)).getJTSGeometry(); jtsInterior[i] = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g2.getCoordinates()); } com.vividsolutions.jts.geom.Polygon result = JTSUtils.GEOMETRY_FACTORY.createPolygon(jtsExterior, jtsInterior); return result; }
/** * {@inheritDoc } */ @Override public org.locationtech.jts.geom.Geometry computeJTSPeer() { final SurfaceBoundary boundary = getBoundary(); final Ring exterior = boundary.getExterior(); final List interiors = boundary.getInteriors(); if (exterior != null) { final org.locationtech.jts.geom.Geometry g = ((JTSGeometry) exterior).getJTSGeometry(); final int numHoles = (interiors != null) ? interiors.size() : 0; final org.locationtech.jts.geom.LinearRing jtsExterior = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g.getCoordinates()); final org.locationtech.jts.geom.LinearRing [] jtsInterior = new org.locationtech.jts.geom.LinearRing[numHoles]; for (int i=0; i<numHoles; i++) { final org.locationtech.jts.geom.Geometry g2 = ((JTSGeometry) interiors.get(i)).getJTSGeometry(); jtsInterior[i] = JTSUtils.GEOMETRY_FACTORY.createLinearRing(g2.getCoordinates()); } final org.locationtech.jts.geom.Polygon result = JTSUtils.GEOMETRY_FACTORY.createPolygon(jtsExterior, jtsInterior); final CoordinateReferenceSystem crs = getCoordinateReferenceSystem(); if (crs != null) { final int srid = SRIDGenerator.toSRID(crs, Version.V1); result.setSRID(srid); } return result; } return null; }
if (polygon.getBoundary().getInteriors() != null) { for (Ring ring : polygon.getBoundary().getInteriors()) { ((JTSRing) ring).setCoordinateReferenceSystem(getCoordinateReferenceSystem()); for (Primitive p : ring.getElements()) {
JTSPolyhedralSurface resPoly = (JTSPolyhedralSurface) result.getElements().iterator().next(); assertEquals(expPoly.getPatches().get(0).getBoundary().getExterior(), resPoly.getPatches().get(0).getBoundary().getExterior()); assertEquals(expPoly.getPatches().get(0).getBoundary().getInteriors(), resPoly.getPatches().get(0).getBoundary().getInteriors()); assertEquals(expPoly.getPatches().get(0).getBoundary(), resPoly.getPatches().get(0).getBoundary()); assertEquals(expPoly.getPatches().get(0).getInterpolation(), resPoly.getPatches().get(0).getInterpolation()); assertEquals(expCurve, resCurve); assertEquals(expPolygon.getBoundary().getExterior(), resPolygon.getBoundary().getExterior()); assertEquals(expPolygon.getBoundary().getInteriors(), resPolygon.getBoundary().getInteriors()); assertEquals(expPolygon.getBoundary(), resPolygon.getBoundary()); assertEquals(expPolygon, resPolygon);