/// <summary> /// Checks validity of a LinearRing. /// </summary> /// <param name="g"></param> private void CheckValidRing(ILinearRing g) { CheckClosedRing(g); if (_validErr != null) return; GeometryGraph graph = new GeometryGraph(0, g); LineIntersector li = new RobustLineIntersector(); graph.ComputeSelfNodes(li, true); CheckNoSelfIntersectingRings(graph); }
/// <summary> /// /// </summary> /// <param name="geom"></param> /// <returns></returns> private 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) return false; if (HasNonEndpointIntersection(graph)) return false; if (HasClosedEndpointIntersection(graph)) return false; return true; }