use of com.revolsys.geometry.model.segment.LineSegment in project com.revolsys.open by revolsys.
the class LineMatchGraph method add.
private void add(final LineString line, final int index) {
if (line.getLength() > 0) {
final LineString coords = line;
final Point coordinate0 = coords.getPoint(0);
final Node<LineSegmentMatch> node = getNode(coordinate0);
final Set<Node<LineSegmentMatch>> indexStartNodes = getStartNodes(index);
indexStartNodes.add(node);
Point previousCoordinate = coordinate0;
for (int i = 1; i < coords.getVertexCount(); i++) {
final Point coordinate = coords.getPoint(i);
final LineSegment segment = new LineSegmentDoubleGF(this.geometryFactory, previousCoordinate, coordinate);
if (segment.getLength() > 0) {
add(previousCoordinate, coordinate, segment, index);
}
previousCoordinate = coordinate;
}
}
}
use of com.revolsys.geometry.model.segment.LineSegment in project com.revolsys.open by revolsys.
the class LineMatchGraph method splitEdge.
@Override
public List<Edge<LineSegmentMatch>> splitEdge(final Edge<LineSegmentMatch> edge, final Point point) {
final LineSegmentMatch lineSegmentMatch = edge.getObject();
final LineSegment segment = lineSegmentMatch.getSegment();
final Edge<LineSegmentMatch> edge1 = add(segment.getPoint(0), point);
final LineSegmentMatch lineSegmentMatch1 = edge1.getObject();
final Edge<LineSegmentMatch> edge2 = add(point, segment.getPoint(1));
final LineSegmentMatch lineSegmentMatch2 = edge2.getObject();
for (int i = 0; i < lineSegmentMatch.getSegmentCount(); i++) {
if (lineSegmentMatch.hasSegment(i)) {
final LineSegment realSegment = lineSegmentMatch.getSegment(i);
final Point projectedCoordinate = realSegment.project(point);
final Point startCoordinate = realSegment.getPoint(0);
final LineSegment segment1 = new LineSegmentDoubleGF(this.geometryFactory, startCoordinate, projectedCoordinate);
lineSegmentMatch1.addSegment(segment1, i);
final Point endCoordinate = realSegment.getPoint(1);
final LineSegment segment2 = new LineSegmentDoubleGF(this.geometryFactory, projectedCoordinate, endCoordinate);
lineSegmentMatch2.addSegment(segment2, i);
}
}
remove(edge);
return Arrays.asList(edge1, edge2);
}
use of com.revolsys.geometry.model.segment.LineSegment in project com.revolsys.open by revolsys.
the class LineSegmentIndex method isWithinDistance.
public boolean isWithinDistance(final Point point) {
BoundingBox envelope = point.getBoundingBox();
envelope = envelope.expand(1);
final List<LineSegment> lines = getItems(envelope);
for (final LineSegment line : lines) {
if (line.distancePoint(point) <= 1) {
return true;
}
}
return false;
}
use of com.revolsys.geometry.model.segment.LineSegment in project com.revolsys.open by revolsys.
the class MonotoneChainOverlapAction method overlap.
/**
* This function can be overridden if the original chains are needed
*
* @param start1 the index of the start of the overlapping segment from mc1
* @param start2 the index of the start of the overlapping segment from mc2
*/
public void overlap(final MonotoneChain mc1, final int start1, final MonotoneChain mc2, final int start2) {
final LineSegment overlapSeg1 = mc1.getLineSegment(start1);
final LineSegment overlapSeg2 = mc2.getLineSegment(start2);
overlap(overlapSeg1, overlapSeg2);
}
use of com.revolsys.geometry.model.segment.LineSegment in project com.revolsys.open by revolsys.
the class MonotoneChainSelectAction method select.
/**
* This method is overridden
* to process a segment
* in the context of the parent chain.
*
* @param mc the parent chain
* @param startIndex the index of the start vertex of the segment being processed
*/
public void select(final MonotoneChain mc, final int startIndex) {
final LineSegment selectedSegment = mc.getLineSegment(startIndex);
// call this routine in case select(segmenet) was overridden
select(selectedSegment);
}
Aggregations