public static boolean isClosed(Geometry arg0) { if (!(arg0 instanceof LineString)) return false; LineString _this = (LineString) arg0; return _this.isClosed(); }
public boolean isClosed() { return lineString.isClosed(); }
@DescribeProcess( title = "Closed Test", description = "Tests if the initial vertex equals the final vertex in a linear geometry. Points and polygons always return True." ) @DescribeResult(description = "True if the input is closed") public static boolean isClosed( @DescribeParameter(name = "geom", description = "Input geometry") LineString line) { return line.isClosed(); }
public int getBoundaryDimension() { if (isClosed()) { return Dimension.FALSE; } return 0; }
private LinearRing readRing() throws IOException, ParseException { LineString ls = (LineString) readGeometry(); if (!(ls instanceof LinearRing)) { if (!ls.isClosed()) { if (ls instanceof CompoundCurve) { CompoundCurve cc = (CompoundCurve) ls;
if (line.isClosed() && clipped.size() > 1) {
line.isClosed() && (lineStringLength - ((labelPositions.length - 1) * labelDistance)) < labelDistance;
public boolean isClosed() { if (isEmpty()) { return false; } for (int i = 0; i < geometries.length; i++) { if (!((LineString) geometries[i]).isClosed()) { return false; } } return true; }
public static boolean isClosed(Geometry g) { if (g instanceof LineString) return ((LineString) g).isClosed(); if (g instanceof MultiLineString) return ((MultiLineString) g).isClosed(); // other geometry types are defined to be closed return true; }
AffineTransform tx = new AffineTransform(); boolean mightSkipLastLabel = line.isClosed() && (lineStringLength - ((labelPositions.length - 1) * labelDistance)) < labelDistance;
public boolean isRing() { return isClosed() && isSimple(); }
/** * Tests whether this ring is closed. * Empty rings are closed by definition. * * @return true if this ring is closed */ public boolean isClosed() { if (isEmpty()) { // empty LinearRings are closed by definition return true; } return super.isClosed(); }
/** * Filters linear geometries. * * geom a geometry of any type */ public void filter(Geometry geom) { if (geom instanceof LineString) { LineString line = (LineString) geom; // skip empty geometries if (line.isEmpty()) return; int minSize = ((LineString) line).isClosed() ? 4 : 2; TaggedLineString taggedLine = new TaggedLineString((LineString) line, minSize); tps.linestringMap.put(line, taggedLine); } } }
polygon = (Polygon) geometry; assertTrue(polygon.getExteriorRing() instanceof CircularRing); assertTrue("ring", polygon.getExteriorRing().isClosed()); assertEquals("segmented ring", 51, polygon.getExteriorRing().getNumPoints()); assertEquals("no holes", 0, polygon.getNumInteriorRing()); "CURVEPOLYGON((144.84399355252685 -31.26123924022086, 144.20551952601693 -32.27215644886158, 145.55230712890625 -33.49203872680664, 147.97080993652344 -32.03618621826172, 146.38697244992585 -31.47406391572417, 144.84399355252685 -31.26123924022086))"; polygon = (Polygon) reader.read(WKT); assertTrue("ring", polygon.getExteriorRing().isClosed()); assertEquals("no holes", 0, polygon.getNumInteriorRing()); assertTrue("ring", polygon.getExteriorRing().isClosed()); assertTrue(polygon.getExteriorRing() instanceof CircularRing); assertEquals("one holes", 1, polygon.getNumInteriorRing()); "CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 0,2 0, 2 1, 2 3, 4 3),(4 3, 4 5, 1 4, 0 0)), CIRCULARSTRING(1.7 1, 1.4 0.4, 1.6 0.4, 1.6 0.5, 1.7 1) )"; polygon = (Polygon) reader.read(WKT); assertTrue("ring", polygon.getExteriorRing().isClosed()); assertTrue(polygon.getExteriorRing() instanceof CompoundRing); assertEquals("one holes", 1, polygon.getNumInteriorRing());
static Coordinate[] getRing(Geometry g) { Coordinate[] pts = null; if (g instanceof Polygon) { pts = ((Polygon) g).getExteriorRing().getCoordinates(); } else if (g instanceof LineString && ((LineString) g).isClosed()) { pts = g.getCoordinates(); } return pts; }
private void validateConstruction() { if (!isEmpty() && ! super.isClosed()) { throw new IllegalArgumentException("Points of LinearRing do not form a closed linestring"); } if (getCoordinateSequence().size() >= 1 && getCoordinateSequence().size() < MINIMUM_VALID_SIZE) { throw new IllegalArgumentException("Invalid number of points in LinearRing (found " + getCoordinateSequence().size() + " - must be 0 or >= 4)"); } }
public void testFiveZeros() { LineString ls = new GeometryFactory().createLineString(new Coordinate[]{ new Coordinate(0, 0), new Coordinate(0, 0), new Coordinate(0, 0), new Coordinate(0, 0), new Coordinate(0, 0)}); assertTrue(ls.isClosed()); }
public void testEmptyLineString() throws Exception { LineString l = geometryFactory.createLineString((Coordinate[])null); assertEquals(1, l.getDimension()); assertEquals(new Envelope(), l.getEnvelopeInternal()); /** * @todo Enable when #isSimple implemented */ // assertTrue(l.isSimple()); assertEquals(null, l.getStartPoint()); assertEquals(null, l.getEndPoint()); assertTrue(! l.isClosed()); assertTrue(! l.isRing()); }
public void testEmptyLinearRing() throws Exception { LineString l = geometryFactory.createLinearRing((CoordinateSequence)null); assertEquals(1, l.getDimension()); assertEquals(new Envelope(), l.getEnvelopeInternal()); assertTrue(l.isSimple()); assertEquals(null, l.getStartPoint()); assertEquals(null, l.getEndPoint()); assertTrue(l.isClosed()); assertTrue(l.isRing()); }