public Point getStartPoint() { return lineString.getStartPoint(); }
public static Point startPoint(Geometry arg0) { if (!(arg0 instanceof LineString)) return null; LineString _this = (LineString) arg0; return _this.getStartPoint(); }
public Point getStartPoint() { return linearize().getStartPoint(); }
public boolean isClosed() { LineString firstComponent = components.get(0); LineString lastComponent = components.get(components.size() - 1); return firstComponent.getStartPoint().equals(lastComponent.getEndPoint()); }
/** Creates a compound curve with the given components */ public LineString createCurvedGeometry(List<LineString> components) { if (components.isEmpty()) { // return an empty lineString? return new CompoundCurve(components, this, tolerance); } LineString first = components.get(0); LineString last = components.get(components.size() - 1); if (first.getStartPoint().equals(last.getEndPoint())) { return new CompoundRing(components, this, tolerance); } else { return new CompoundCurve(components, this, tolerance); } }
@DescribeProcess( title = "Start Point", description = "Returns a point geometry equal to the first vertex of a LineString." ) @DescribeResult(description = "First vertex as point geometry") public static Point startPoint( @DescribeParameter(name = "geom", description = "Input line") LineString line) { return line.getStartPoint(); }
Point str = ls.getStartPoint(); Point end = ls.getEndPoint();
/** * @param geometry Geometry * @return The first coordinate of a Geometry as a POINT, given that the * Geometry is a LINESTRING or a MULTILINESTRING containing only one * LINESTRING; Returns NULL for all other Geometries. */ public static Geometry getStartPoint(Geometry geometry) { if(geometry== null){ return null; } if (geometry instanceof MultiLineString) { if (geometry.getNumGeometries() == 1) { return ((LineString) geometry.getGeometryN(0)).getStartPoint(); } } else if (geometry instanceof LineString) { return ((LineString) geometry).getStartPoint(); } return null; } }
private Geometry boundaryLineString(LineString line) { if (geom.isEmpty()) { return getEmptyMultiPoint(); } if (line.isClosed()) { // check whether endpoints of valence 2 are on the boundary or not boolean closedEndpointOnBoundary = bnRule.isInBoundary(2); if (closedEndpointOnBoundary) { return line.getStartPoint(); } else { return geomFact.createMultiPoint(); } } return geomFact.createMultiPoint(new Point[]{ line.getStartPoint(), line.getEndPoint() }); } }
/** * Interpolate a linestring according the start and the end coordinates z * value. If the start or the end z is NaN return the input linestring * * @param lineString * @return */ private static LineString linearZInterpolation(LineString lineString) { double startz = lineString.getStartPoint().getCoordinate().z; double endz = lineString.getEndPoint().getCoordinate().z; if (Double.isNaN(startz) || Double.isNaN(endz)) { return lineString; } else { double length = lineString.getLength(); lineString.apply(new LinearZInterpolationFilter(startz, endz, length)); return lineString; } }
/** * Interpolate each linestring of the multilinestring. * * @param multiLineString * @return */ private static MultiLineString linearZInterpolation(MultiLineString multiLineString) { int nbGeom = multiLineString.getNumGeometries(); LineString[] lines = new LineString[nbGeom]; for (int i = 0; i < nbGeom; i++) { LineString subGeom = (LineString) multiLineString.getGeometryN(i); double startz = subGeom.getStartPoint().getCoordinates()[0].z; double endz = subGeom.getEndPoint().getCoordinates()[0].z; double length = subGeom.getLength(); subGeom.apply(new LinearZInterpolationFilter(startz, endz, length)); lines[i] = subGeom; } return FACTORY.createMultiLineString(lines); }
/** * @todo Enable when #isSimple implemented */ // public void testLineStringIsSimple1() throws Exception { // Geometry g = reader.read("LINESTRING(10 10, 20 10, 15 20)"); // assertTrue(g.isSimple()); // } public void testLineStringGetBoundary1() throws Exception { LineString g = (LineString) reader.read("LINESTRING(10 10, 20 10, 15 20)"); assertTrue(g.getBoundary() instanceof MultiPoint); MultiPoint boundary = (MultiPoint) g.getBoundary(); assertTrue(boundary.getGeometryN(0).equals(g.getStartPoint())); assertTrue(boundary.getGeometryN(1).equals(g.getEndPoint())); }
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()); }