本文整理汇总了Java中com.vividsolutions.jts.geomgraph.GeometryGraph.computeSelfNodes方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryGraph.computeSelfNodes方法的具体用法?Java GeometryGraph.computeSelfNodes怎么用?Java GeometryGraph.computeSelfNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geomgraph.GeometryGraph
的用法示例。
在下文中一共展示了GeometryGraph.computeSelfNodes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkValid
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
/**
* Checks validity of a LinearRing.
*/
private void checkValid(LinearRing g) {
this.checkInvalidCoordinates(g.getCoordinates());
if (this.validErr != null) {
return;
}
this.checkClosedRing(g);
if (this.validErr != null) {
return;
}
GeometryGraph graph = new GeometryGraph(0, g);
this.checkTooFewPoints(graph);
if (this.validErr != null) {
return;
}
LineIntersector li = new RobustLineIntersector();
graph.computeSelfNodes(li, true);
this.checkNoSelfIntersectingRings(graph);
}
示例2: isSimpleLinearGeometry
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
if (geom.isEmpty()) {
return true;
}
GeometryGraph graph = new GeometryGraph(0, geom);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
// if no self-intersection, must be simple
if (!si.hasIntersection()) {
return true;
}
if (si.hasProperIntersection()) {
this.nonSimpleLocation = si.getProperIntersectionPoint();
return false;
}
if (this.hasNonEndpointIntersection(graph)) {
return false;
}
if (this.isClosedEndpointsInInterior) {
if (this.hasClosedEndpointIntersection(graph)) {
return false;
}
}
return true;
}
示例3: isSimpleLinearGeometry
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
private boolean isSimpleLinearGeometry(Geometry geom) {
if (geom.isEmpty()) return true;
GeometryGraph graph = new GeometryGraph(0, geom);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
// if no self-intersection, must be simple
if (!si.hasIntersection()) return true;
if (si.hasProperIntersection()) {
nonSimpleLocation = si.getProperIntersectionPoint();
return false;
}
if (hasNonEndpointIntersection(graph)) return false;
if (isClosedEndpointsInInterior) {
if (hasClosedEndpointIntersection(graph)) return false;
}
return true;
}
示例4: fullClosedLine
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
LineString fullClosedLine(List<LineString> lines) {
List<Coordinate> tail = new ArrayList<>();
boolean found;
do {
found = false;
for (int i = 0; i < lines.size(); i++) {
if (addToClosed(tail, lines.get(i))) {
lines.remove(i);
i--;
found = true;
}
}
} while (found);
LineString s = GeometryHelper.createLine(tail);
if (!s.isClosed()) {
throw new RuntimeException("Non-closed line starts from " + tail.get(0) + " ends to "
+ tail.get(tail.size() - 1));
}
if (!s.isSimple()) {
GeometryGraph graph = new GeometryGraph(0, s);
LineIntersector li = new RobustLineIntersector();
SegmentIntersector si = graph.computeSelfNodes(li, true);
if (si.hasProperInteriorIntersection()) {
throw new RuntimeException("Self-intersection for " + relation.getObjectCode()
+ " near point " + si.getProperIntersectionPoint());
}else {
throw new RuntimeException("Self-intersected line: " + s);
}
}
return s;
}
示例5: checkValid
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
/**
* Checks validity of a LinearRing.
*/
private void checkValid(LinearRing g) {
checkInvalidCoordinates(g.getCoordinates());
if (validErr != null) return;
checkClosedRing(g);
if (validErr != null) return;
GeometryGraph graph = new GeometryGraph(0, g);
checkTooFewPoints(graph);
if (validErr != null) return;
LineIntersector li = new RobustLineIntersector();
graph.computeSelfNodes(li, true);
checkNoSelfIntersectingRings(graph);
}
示例6: isInteriorDisconnected
import com.vividsolutions.jts.geomgraph.GeometryGraph; //导入方法依赖的package包/类
public Expression<K, C, Boolean> isInteriorDisconnected() {
return new AbstractUnaryTestExpression<K, C, T>(this, "IsInteriorDisconnected") {
@Override
public boolean test(T value, C context) {
if (!(value instanceof Surface)) {
return false;
}
try {
final GeometryValidator validator = context.validateGeometry(value).validator;
final Surface polygon = (Surface) value;
final Ring exterior = new DefaultLinearRing("exterior", null, null, polygon
.getExteriorRingCoordinates());
final GeometryFactory geometryFactory = new GeometryFactory();
final LinearRing exteriorRing = getJTSRing(exterior, validator);
final ArrayList<LinearRing> interiorRings = new ArrayList<>();
for (final Points points : polygon.getInteriorRingsCoordinates()) {
final Ring ring = new DefaultLinearRing("interior", null, null, points);
interiorRings.add(getJTSRing(ring, validator));
}
com.vividsolutions.jts.geom.Polygon jtsPolygon = geometryFactory.createPolygon(exteriorRing,
interiorRings.toArray(new LinearRing[interiorRings.size()]));
final GeometryGraph geometryGraph = new GeometryGraph(0, jtsPolygon);
geometryGraph.computeSelfNodes(new RobustLineIntersector(), true);
ConnectedInteriorTester connectedInteriorTester = new ConnectedInteriorTester(geometryGraph);
return !connectedInteriorTester.isInteriorsConnected();
} catch (InvocationTargetException | IllegalArgumentException | IllegalAccessException e) {
throw new ExpressionEvaluationException(e);
}
}
};
}