public Envelope getEnvelopeInternal() { return lineString.getEnvelopeInternal(); }
public Envelope getEnvelopeInternal() { return super.getEnvelopeInternal(); }
public Envelope getEnvelopeInternal() { return super.getEnvelopeInternal(); }
@Override protected Envelope computeEnvelopeInternal() { final Envelope result = new Envelope(); for (LineString ls : components) { result.expandToInclude(ls.getEnvelopeInternal()); } return result; }
private Rectangle2D getCurvedLabelBounds( LineStringCursor cursor, double startOrdinate, double endOrdinate, double bufferSize) { LineString cut = cursor.getSubLineString(startOrdinate, endOrdinate); Envelope e = cut.getEnvelopeInternal(); e.expandBy(bufferSize); return new Rectangle2D.Double(e.getMinX(), e.getMinY(), e.getWidth(), e.getHeight()); }
for (int i = 0; i < cleanedLines.size(); i++) { LineString cleaned = cleanedLines.get(i); if (g.getEnvelopeInternal().intersects(cleaned.getEnvelopeInternal())) { Geometry buffer = bufferCache.get(i); if (buffer == null) {
if (clipper.getBounds().contains(line.getEnvelopeInternal())) {
@Test public void smoothLineString() { Coordinate[] coords = getLineCoords(); LineString line = factory.createLineString(coords); Geometry smoothed = JTS.smooth(line, 0); assertTrue(smoothed instanceof LineString); CoordList list = new CoordList(smoothed.getCoordinates()); assertTrue(list.containsAll(coords)); Envelope lineEnv = line.getEnvelopeInternal(); Envelope smoothEnv = smoothed.getEnvelopeInternal(); assertTrue(smoothEnv.covers(lineEnv)); }
@Test public void smoothLinearRing() { Coordinate[] coords = getPolyCoords(); LineString line = factory.createLinearRing(coords); Geometry smoothed = JTS.smooth(line, 0); assertTrue(smoothed instanceof LinearRing); CoordList list = new CoordList(smoothed.getCoordinates()); assertTrue(list.containsAll(coords)); Envelope lineEnv = line.getEnvelopeInternal(); Envelope smoothEnv = smoothed.getEnvelopeInternal(); assertTrue(smoothEnv.covers(lineEnv)); }
private void populateChildren(Coordinate[] pt) { Envelope env = line.getEnvelopeInternal(); for (int i = 0; i < pt.length; i++) { double dist = Double.NaN; if (i < pt.length - 1) dist = pt[i].distance(pt[i + 1]); GeometricObjectNode node = CoordinateNode.create(pt[i], i, dist); children.add(node); } } }
public void paint(LineString line, int lineType, Viewport viewport, Graphics2D g) throws Exception { // cull non-visible geometries if (! viewport.intersectsInModel(line.getEnvelopeInternal())) return; paintLineString(line, lineType, viewport, g); }
/** * * @param coords * @param factory * @param strtree */ public static void addSegments(final Coordinate[] coords, GeometryFactory factory, STRtree strtree) { for (int j = 0; j < coords.length - 1; j++) { Coordinate startCoord = coords[j]; Coordinate endCoord = coords[j + 1]; if (!(Double.isNaN(startCoord.z) || Double.isNaN(endCoord.z))) { LineString lineString = factory.createLineString( new Coordinate[]{startCoord, endCoord}); strtree.insert(lineString.getEnvelopeInternal(), lineString); } } }
private List extractLineStrings(Geometry[] geom, Envelope mask) { List lines = new ArrayList(); LinearComponentExtracter lineExtracter = new LinearComponentExtracter(lines); for (int i = 0; i < geom.length; i++ ) { if (geom[i] == null) continue; if (mask != null && ! mask.intersects(geom[i].getEnvelopeInternal())) continue; geom[i].apply(lineExtracter); } if (mask != null) { List masked = new ArrayList(); for (Iterator i = lines.iterator(); i.hasNext(); ) { LineString line = (LineString) i.next(); if (mask.intersects(line.getEnvelopeInternal())) masked.add(line); } return masked; } return lines; }
private void computeMinDistance(LineString line0, LineString line1, GeometryLocation[] locGeom) { if (line0.getEnvelopeInternal().distance(line1.getEnvelopeInternal()) > minDistance) return; Coordinate[] coord0 = line0.getCoordinates(); Coordinate[] coord1 = line1.getCoordinates(); // brute force approach! for (int i = 0; i < coord0.length - 1; i++) { for (int j = 0; j < coord1.length - 1; j++) { double dist = Distance.segmentToSegment( coord0[i], coord0[i + 1], coord1[j], coord1[j + 1] ); if (dist < minDistance) { minDistance = dist; LineSegment seg0 = new LineSegment(coord0[i], coord0[i + 1]); LineSegment seg1 = new LineSegment(coord1[j], coord1[j + 1]); Coordinate[] closestPt = seg0.closestPoints(seg1); locGeom[0] = new GeometryLocation(line0, i, closestPt[0]); locGeom[1] = new GeometryLocation(line1, j, closestPt[1]); } if (minDistance <= terminateDistance) return; } } }
if (geom.isEmpty() || (geom.getEnvelopeInternal().maxExtent() > maxLineLength)) { return false;
private int locateOnLineString(Coordinate p, LineString l) { // bounding-box check if (! l.getEnvelopeInternal().intersects(p)) return Location.EXTERIOR; CoordinateSequence seq = l.getCoordinateSequence(); if (! l.isClosed()) { if (p.equals(seq.getCoordinate(0)) || p.equals(seq.getCoordinate(seq.size() - 1)) ) { return Location.BOUNDARY; } } if (PointLocation.isOnLine(p, seq)) { return Location.INTERIOR; } return Location.EXTERIOR; }
private void computeMinDistance(LineString line, Point pt, GeometryLocation[] locGeom) { if (line.getEnvelopeInternal().distance(pt.getEnvelopeInternal()) > minDistance) return; Coordinate[] coord0 = line.getCoordinates(); Coordinate coord = pt.getCoordinate(); // brute force approach! for (int i = 0; i < coord0.length - 1; i++) { double dist = Distance.pointToSegment( coord, coord0[i], coord0[i + 1] ); if (dist < minDistance) { minDistance = dist; LineSegment seg = new LineSegment(coord0[i], coord0[i + 1]); Coordinate segClosestPoint = seg.closestPoint(coord); locGeom[0] = new GeometryLocation(line, i, segClosestPoint); locGeom[1] = new GeometryLocation(pt, 0, coord); } if (minDistance <= terminateDistance) return; } }
LineSegment stepLine = new LineSegment(vStart.add(v.multiply(j)).toCoordinate(), vStart.add(v.multiply(j + 1)).toCoordinate()); LineString rayStep = stepLine.toGeometry(factory); List<LineString> interEnv = sTRtree.query(rayStep.getEnvelopeInternal()); if (!interEnv.isEmpty()) { for (LineString lineGeoms : interEnv) {
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()); }