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;
}
}
}
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;
}
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);
}
}
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);
}
}
}
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]);
}
Aggregations