Search in sources :

Example 41 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class RectangleIntersectsSegmentVisitor method checkIntersectionWithLineStrings.

private void checkIntersectionWithLineStrings(final List lines) {
    for (final Iterator i = lines.iterator(); i.hasNext(); ) {
        final LineString testLine = (LineString) i.next();
        checkIntersectionWithSegments(testLine);
        if (this.hasIntersection) {
            return;
        }
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString) Iterator(java.util.Iterator)

Example 42 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class FuzzyPointLocator method isWithinToleranceOfBoundary.

private boolean isWithinToleranceOfBoundary(final Point pt) {
    final double x = pt.getX();
    final double y = pt.getY();
    for (int i = 0; i < this.linework.getGeometryCount(); i++) {
        final LineString line = (LineString) this.linework.getGeometry(i);
        for (int j = 0; j < line.getVertexCount() - 1; j++) {
            final double x1 = line.getX(j);
            final double y1 = line.getY(j + 1);
            final double x2 = line.getX(j);
            final double y2 = line.getY(j + 1);
            final double dist = LineSegmentUtil.distanceLinePoint(x1, y1, x2, y2, x, y);
            if (dist <= this.boundaryDistanceTolerance) {
                return true;
            }
        }
    }
    return false;
}
Also used : LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point)

Example 43 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class OffsetCurveSetBuilder method addPoint.

/**
 * Add a Point to the graph.
 */
private void addPoint(final Point point) {
    // a zero or negative width buffer of a line/point is empty
    if (this.distance > 0.0) {
        final LineString curve = this.curveBuilder.getPointCurve(point, this.distance);
        addCurve(curve, Location.EXTERIOR, Location.INTERIOR);
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString)

Example 44 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class MCIndexSnapRounder method computeVertexSnaps.

/**
 * Snaps segments to the vertices of a Segment String.
 */
private void computeVertexSnaps(final NodedSegmentString segment) {
    final LineString points = segment.getLineString();
    for (int i = 0; i < points.getVertexCount(); i++) {
        final Point point = points.getPoint(i);
        final HotPixel hotPixel = new HotPixel(point, this.scaleFactor, this.li);
        final boolean isNodeAdded = this.pointSnapper.snap(hotPixel, segment, i);
        // if a node is created for a vertex, that vertex must be noded too
        if (isNodeAdded) {
            segment.addIntersection(point, i);
        }
    }
}
Also used : LineString(com.revolsys.geometry.model.LineString) Point(com.revolsys.geometry.model.Point) Point(com.revolsys.geometry.model.Point)

Example 45 with LineString

use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.

the class Counter method computeBoundaryCoordinates.

private Point[] computeBoundaryCoordinates(final Lineal mLine) {
    final List bdyPts = new ArrayList();
    this.endpointMap = new TreeMap();
    for (int i = 0; i < mLine.getGeometryCount(); i++) {
        final LineString line = (LineString) mLine.getGeometry(i);
        if (line.getVertexCount() == 0) {
            continue;
        }
        addEndpoint(line.getPoint(0));
        addEndpoint(line.getPoint(line.getVertexCount() - 1));
    }
    for (final Iterator it = this.endpointMap.entrySet().iterator(); it.hasNext(); ) {
        final Map.Entry entry = (Map.Entry) it.next();
        final Counter counter = (Counter) entry.getValue();
        final int valence = counter.count;
        if (this.bnRule.isInBoundary(valence)) {
            bdyPts.add(entry.getKey());
        }
    }
    return (Point[]) bdyPts.toArray(new Point[0]);
}
Also used : LineString(com.revolsys.geometry.model.LineString) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map) Point(com.revolsys.geometry.model.Point)

Aggregations

LineString (com.revolsys.geometry.model.LineString)380 Point (com.revolsys.geometry.model.Point)184 Geometry (com.revolsys.geometry.model.Geometry)65 ArrayList (java.util.ArrayList)62 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)51 Polygon (com.revolsys.geometry.model.Polygon)37 LineStringGraph (com.revolsys.geometry.graph.linestring.LineStringGraph)24 Edge (com.revolsys.geometry.graph.Edge)22 List (java.util.List)22 BoundingBox (com.revolsys.geometry.model.BoundingBox)20 Lineal (com.revolsys.geometry.model.Lineal)20 Test (org.junit.Test)20 LinearRing (com.revolsys.geometry.model.LinearRing)19 Record (com.revolsys.record.Record)17 Iterator (java.util.Iterator)14 LineStringEditor (com.revolsys.geometry.model.editor.LineStringEditor)13 Punctual (com.revolsys.geometry.model.Punctual)12 LineStringDouble (com.revolsys.geometry.model.impl.LineStringDouble)12 LineSegment (com.revolsys.geometry.model.segment.LineSegment)10 Polygonal (com.revolsys.geometry.model.Polygonal)9