use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class QuadEdgeSubdivision method getEdgesLineal.
/**
* Gets the geometry for the edges in the subdivision as a {@link Lineal}
* containing 2-point lines.
*
* @param geometryFactory the GeometryFactory to use
* @return a MultiLineString
*/
public Lineal getEdgesLineal(final GeometryFactory geometryFactory) {
final List<QuadEdge> quadEdges = getPrimaryEdges(false);
final LineString[] lines = new LineString[quadEdges.size()];
int i = 0;
for (final QuadEdge edge : quadEdges) {
lines[i++] = edge.newLineString(geometryFactory);
}
return geometryFactory.lineal(lines);
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class QuadEdgeConformingDelaunayTinBuilder method newConstraintSegments.
private static List<LineSegmentDoubleData> newConstraintSegments(final Geometry geom) {
final List<LineString> lines = geom.getGeometryComponents(LineString.class);
final List<LineSegmentDoubleData> constraintSegs = new ArrayList<>();
for (final LineString line : lines) {
newConstraintSegments(line, constraintSegs);
}
return constraintSegs;
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class Graph method splitEdge.
public List<Edge<T>> splitEdge(final Edge<T> edge, final Point point) {
if (!edge.isRemoved()) {
final LineString line = edge.getLineString();
final List<LineString> lines = line.split(point);
if (lines.size() == 1) {
return Collections.singletonList(edge);
} else {
final List<Edge<T>> newEdges = replaceEdge(edge, lines);
return newEdges;
}
} else {
return Collections.emptyList();
}
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class Graph method replaceEdge.
public List<Edge<T>> replaceEdge(final Edge<T> edge, final List<LineString> lines) {
if (!edge.isRemoved()) {
final List<Edge<T>> edges = new ArrayList<>();
final T object = edge.getObject();
remove(edge);
for (final LineString line : lines) {
final T newObject = clone(object, line);
final Edge<T> newEdge = addEdge(newObject, line);
edges.add(newEdge);
}
return edges;
} else {
return Collections.emptyList();
}
}
use of com.revolsys.geometry.model.LineString in project com.revolsys.open by revolsys.
the class Graph method getEdges.
public List<Edge<T>> getEdges(final Point point, final double maxDistance) {
if (point == null) {
return Collections.emptyList();
} else {
BoundingBox boundingBox = point.getBoundingBox();
boundingBox = boundingBox.expand(maxDistance);
final double x = point.getX();
final double y = point.getY();
final Predicate<Edge<T>> filter = (edge) -> {
final LineString line = edge.getLineString();
final double distance = line.distance(x, y);
if (distance <= maxDistance) {
return true;
} else {
return false;
}
};
return BoundingBox.newArraySorted(this::forEachEdge, boundingBox, filter);
}
}
Aggregations