if (shell.contains(hole)) { ((List<LinearRing>) shell.getUserData()).add(hole); break outer;
public boolean contains(Geometry g) { return polygon.contains(g); }
/** As if the ring is the outer ring of a polygon */ SpatialRelation relateEnclosedRing(LinearRing ring) { SpatialRelation rel = relateLineString(ring); if (rel == SpatialRelation.DISJOINT && ctx.getGeometryFactory().createPolygon(ring, null).contains(ctrGeom)) { // If it contains the circle center point, then the result is CONTAINS rel = SpatialRelation.CONTAINS; } return rel; }
|| (line23.ptSegDist(point2D) <= TOLERANCE)) { ret = ON_EDGE; } else if (poly.contains(nPoint)) { ret = INSIDE; } else {
if (!ls.contains(pt)) { r = true;
public void testSampleForCentralPoint() throws Exception { // create a "C" shape polygon that won't contain it's centroid Polygon g = (Polygon) new WKTReader() .read( "POLYGON ((-112.534433451864 43.8706532611928,-112.499157652296 44.7878240499628,-99.6587666095152 44.7878240499628,-99.7242788087131 43.2155312692142,-111.085391877449 43.099601544023,-110.744593363875 36.1862602686501,-98.6760836215473 35.9436771582516,-98.7415958207452 33.5197257879307,-111.77852346112 33.9783111823157,-111.758573671673 34.6566040234952,-113.088767445077 34.7644575726901,-113.023255245879 43.8706532611928,-112.534433451864 43.8706532611928))"); Point p = g.getCentroid(); assertFalse(g.contains(p)); // test with few samples, we shouldn't hit the inside assertNull(RendererUtilities.sampleForInternalPoint(g, p, null, null, -1, 2)); // up the samples, we should hit the inside now assertNotNull(RendererUtilities.sampleForInternalPoint(g, p, null, null, -1, 10)); }
/** * Splits a Polygon using a LineString. * * @param polygon * @param lineString * @return */ private static Collection<Polygon> polygonWithLineSplitter(Polygon polygon, LineString lineString) throws SQLException { Collection<Polygon> polygons = splitPolygonizer(polygon, lineString); if (polygons != null && polygons.size() > 1) { List<Polygon> pols = new ArrayList<Polygon>(); for (Polygon pol : polygons) { if (polygon.contains(pol.getInteriorPoint())) { pols.add(pol); } } return pols; } return null; }
if (shell.contains(hole)) { ((List<LinearRing>) shell.getUserData()).add(hole); break outer;
if (!poly.contains(insidePt)) { throw new RuntimeException("Can't locate interior point for polygon");
|| (line23.ptSegDist(point2D) <= TOLERANCE)) { ret = ON_EDGE; } else if (poly.contains(nPoint)) { ret = INSIDE; } else {