public static Geometry MCIndexNoding(Geometry geom) { INoder noder = new MCIndexNoder(new IntersectionAdder(new RobustLineIntersector())); noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom)); return(SegmentStringUtil.ToGeometry(noder.GetNodedSubstrings(), geom.Factory)); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="ISegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns> private static IList <Coordinate> FindInteriorIntersections(IList <ISegmentString> segStrings, LineIntersector li) { InteriorIntersectionFinderAdder intFinderAdder = new InteriorIntersectionFinderAdder(li); SinglePassNoder noder = new MCIndexNoder(intFinderAdder); noder.ComputeNodes(segStrings); return(intFinderAdder.InteriorIntersections); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="SegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns> private IList FindInteriorIntersections(IList segStrings, LineIntersector li) { IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li); SinglePassNoder noder = new MCIndexNoder(intFinderAdder); noder.ComputeNodes(segStrings); return(intFinderAdder.InteriorIntersections); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="ISegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of Coordinates for the intersections.</returns> private IList <Coordinate> FindInteriorIntersections(IList <ISegmentString> segStrings, LineIntersector li) { InteriorIntersectionFinderAdder intFinderAdder = new InteriorIntersectionFinderAdder(li); _noder.SegmentIntersector = intFinderAdder; _noder.ComputeNodes(segStrings); return(intFinderAdder.InteriorIntersections); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="SegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of Coordinates for the intersections.</returns> private IList FindInteriorIntersections(IList segStrings, LineIntersector li) { IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li); noder.SegmentIntersector = intFinderAdder; noder.ComputeNodes(segStrings); return(intFinderAdder.InteriorIntersections); }
public static int InteriorIntersectionCount(Geometry geom) { var intCounter = NodingIntersectionFinder.CreateIntersectionCounter(new RobustLineIntersector()); INoder noder = new MCIndexNoder(intCounter); noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom)); return(intCounter.Count); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="ISegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// <para/> /// Also adds the intersection nodes to the segments. /// </summary> /// <param name="segStrings"></param> /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns> private IList <Coordinate> FindInteriorIntersections(IList <ISegmentString> segStrings) { var intAdder = new SnapRoundingIntersectionAdder(_pm); var noder = new MCIndexNoder(); noder.SegmentIntersector = intAdder; noder.ComputeNodes(segStrings); return(intAdder.Intersections); }
/// <summary> /// Detects interior intersections in the collection of {@link SegmentString}s, /// and adds nodes for them to the segment strings. /// Also creates HotPixel nodes for the intersection points. /// </summary> /// <param name="segStrings">The input NodedSegmentStrings</param> private void AddIntersectionPixels(IList<ISegmentString> segStrings) { var intAdder = new SnapRoundingIntersectionAdder(_pm); var noder = new MCIndexNoder(intAdder); //noder.SegmentIntersector = intAdder; noder.ComputeNodes(segStrings); var intPts = intAdder.Intersections; _pixelIndex.AddNodes(intPts); }
public static IGeometry MCIndexNoding(Geometry geom) { IList <ISegmentString> segs = CreateNodedSegmentStrings(geom); INoder noder = new MCIndexNoder(new IntersectionAdder(new RobustLineIntersector())); noder.ComputeNodes(segs); IList <ISegmentString> nodedSegStrings = noder.GetNodedSubstrings(); return(FromSegmentStrings(nodedSegStrings)); }
public static Geometry MCIndexNodingWithPrecision(Geometry geom, double scaleFactor) { var fixedPM = new PrecisionModel(scaleFactor); LineIntersector li = new RobustLineIntersector(); li.PrecisionModel = fixedPM; INoder noder = new MCIndexNoder(new IntersectionAdder(li)); noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom)); return(SegmentStringUtil.ToGeometry(noder.GetNodedSubstrings(), geom.Factory)); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="ISegmentString"/>s, /// and returns their <see cref="NodedSegmentString"/>s. /// <para/> /// Also adds the intersection nodes to the segments. /// </summary> /// <returns>A list of noded substrings</returns> private IList <ISegmentString> ComputeIntersections(IList <ISegmentString> inputSS) { var intAdder = new SnappingIntersectionAdder(_snapTolerance, snapIndex); /* * Use an overlap tolerance to ensure all * possible snapped intersections are found */ var noder = new MCIndexNoder(intAdder, 2 * _snapTolerance); noder.ComputeNodes(inputSS); return(noder.GetNodedSubstrings()); }
public static IGeometry MCIndexNodingWithPrecision(Geometry geom, double scaleFactor) { List <ISegmentString> segs = CreateNodedSegmentStrings(geom); LineIntersector li = new RobustLineIntersector(); li.PrecisionModel = new PrecisionModel(scaleFactor); INoder noder = new MCIndexNoder(new IntersectionAdder(li)); noder.ComputeNodes(segs); IList <ISegmentString> nodedSegStrings = noder.GetNodedSubstrings(); return(FromSegmentStrings(nodedSegStrings)); }
/** * Nodes a LineString and returns a List of Noded LineString's. Used to * repare auto-intersecting LineString and Polygons. This method cannot * process CoordinateSequence. The noding process is limited to 3d * geometries.<br/> * Preserves duplicate coordinates. * * @param coords coordinate array to be noded * @param gf geometryFactory to use * @return a list of noded LineStrings */ private ISet <LineString> nodeLineString(Coordinate[] coords, GeometryFactory gf) { MCIndexNoder noder = new MCIndexNoder(); noder.SegmentIntersector = new IntersectionAdder(new RobustLineIntersector()); List <ISegmentString> list = new (); list.Add(new NodedSegmentString(coords, null)); noder.ComputeNodes(list); List <LineString> lineStringList = new (); foreach (NetTopologySuite.Geometries.Geometry segmentString in noder.GetNodedSubstrings()) { lineStringList.Add(gf.CreateLineString( segmentString.Coordinates )); } // WARNING : merger loose original linestrings // It is useful for LinearRings but should not be used for (Multi)LineStrings LineMerger merger = new LineMerger(); merger.Add(lineStringList); lineStringList = (List <LineString>)merger.GetMergedLineStrings(); // Remove duplicate linestrings preserving main orientation ISet <LineString> lineStringSet = new HashSet <LineString>(); foreach (LineString line in lineStringList) { // TODO as equals makes a topological comparison, comparison with line.reverse maybe useless if (!lineStringSet.Contains(line) && !lineStringSet.Contains((LineString)line.Reverse())) { lineStringSet.Add(line); } } return(lineStringSet); }
private static void ProcessNodes(Geometry geom, NodingIntersectionFinder intFinder) { var noder = new MCIndexNoder(intFinder); noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom)); }
/// <summary> /// Computes all interior intersections in the collection of <see cref="SegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns> private IList FindInteriorIntersections(IList segStrings, LineIntersector li) { IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li); SinglePassNoder noder = new MCIndexNoder(intFinderAdder); noder.ComputeNodes(segStrings); return intFinderAdder.InteriorIntersections; }
/// <summary> /// Computes all interior intersections in the collection of <see cref="ISegmentString" />s, /// and returns their <see cref="Coordinate" />s. /// Does NOT node the segStrings. /// </summary> /// <param name="segStrings"></param> /// <param name="li"></param> /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns> private static IList<Coordinate> FindInteriorIntersections(IList<ISegmentString> segStrings, LineIntersector li) { InteriorIntersectionFinderAdder intFinderAdder = new InteriorIntersectionFinderAdder(li); SinglePassNoder noder = new MCIndexNoder(intFinderAdder); noder.ComputeNodes(segStrings); return intFinderAdder.InteriorIntersections; }