isSimpleLinearGeometry method

bool isSimpleLinearGeometry(
  1. Geometry geom
)

Implementation

bool 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;
}