/// <summary> /// Nodes the linework of a set of Geometrys using SnapRounding. /// </summary> /// <param name="geoms">A collection of Geometrys of any type</param> /// <returns>A list of LineStrings representing the noded linework of the input</returns> public IList <ILineString> Node(ICollection <IGeometry> geoms) { // get geometry factory foreach (var g in geoms) { _geomFact = g.Factory; break; } var segStrings = ToSegmentStrings(ExtractLines(geoms)); //Noder sr = new SimpleSnapRounder(pm); INoder sr = new MCIndexSnapRounder(_pm); sr.ComputeNodes(segStrings); var nodedLines = sr.GetNodedSubstrings(); //TODO: improve this to check for full snap-rounded correctness if (IsValidityChecked) { NodingValidator nv = new NodingValidator(nodedLines); nv.CheckValid(); } return(ToLineStrings(nodedLines)); }
/// <summary> /// /// </summary> /// <param name="inputSegmentStrings"></param> private void CheckCorrectness(IList inputSegmentStrings) { IList resultSegStrings = SegmentString.GetNodedSubstrings(inputSegmentStrings); NodingValidator nv = new NodingValidator(resultSegStrings); try { nv.CheckValid(); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } }
private void CheckCorrectness(IList inputSegmentStrings) { IList resultSegStrings = SegmentString.GetNodedSubstrings(inputSegmentStrings); NodingValidator nv = new NodingValidator(resultSegStrings); try { nv.CheckValid(); } catch (Exception ex) { ExceptionManager.Publish(ex); } }
/// <summary> /// Nodes the linework of a set of Geometrys using SnapRounding. /// </summary> /// <param name="geoms">A collection of Geometrys of any type</param> /// <returns>A list of LineStrings representing the noded linework of the input</returns> public ReadOnlyCollection <LineString> Node(IEnumerable <Geometry> geoms) { // get geometry factory // DEVIATION: JTS uses an "ExtractLines" helper, but by inlining it, // we can make the parameter any ol' IEnumerable<Geometry> without // iterating over it multiple times. var lines = new List <Geometry>(); var lce = new LinearComponentExtracter(lines); bool first = true; foreach (var g in geoms) { if (first) { _geomFact = g.Factory; first = false; } g.Apply(lce); } var segStrings = ToSegmentStrings(lines); //Noder sr = new SimpleSnapRounder(pm); var sr = new MCIndexSnapRounder(_pm); sr.ComputeNodes(segStrings); var nodedLines = sr.GetNodedSubstrings(); //TODO: improve this to check for full snap-rounded correctness if (IsValidityChecked) { var nv = new NodingValidator(nodedLines); nv.CheckValid(); } return(ToLineStrings(nodedLines)); }
/// <summary> /// Nodes the linework of a set of Geometrys using SnapRounding. /// </summary> /// <param name="geoms">A collection of Geometrys of any type</param> /// <returns>A list of LineStrings representing the noded linework of the input</returns> public IList<ILineString> Node(ICollection<IGeometry> geoms) { // get geometry factory foreach (var g in geoms) { _geomFact = g.Factory; break; } var segStrings = ToSegmentStrings(ExtractLines(geoms)); //Noder sr = new SimpleSnapRounder(pm); INoder sr = new MCIndexSnapRounder(_pm); sr.ComputeNodes(segStrings); var nodedLines = sr.GetNodedSubstrings(); //TODO: improve this to check for full snap-rounded correctness if (IsValidityChecked) { NodingValidator nv = new NodingValidator(nodedLines); nv.CheckValid(); } return ToLineStrings(nodedLines); }
/// <summary> /// /// </summary> /// <param name="edges"></param> public EdgeNodingValidator(IList edges) { nv = new NodingValidator(ToSegmentStrings(edges)); }
/// <summary> /// /// </summary> /// <param name="edges"></param> public EdgeNodingValidator(IEnumerable edges) { _nv = new NodingValidator(ToSegmentStrings(edges)); }
private static void PerformTest(ICoordinateSequence sequence) { if (sequence == null) throw new ArgumentNullException("sequence"); Coordinate[] coordinates = sequence.ToCoordinateArray(); NodedSegmentString segmentString = new NodedSegmentString(coordinates, null); Stopwatch watch = new Stopwatch(); NodingValidator validator = new NodingValidator(new[] { segmentString }); validator.CheckValid(); watch.Start(); validator.CheckValid(); watch.Stop(); Console.WriteLine("NodingValidator.CheckValid => ElapsedMilliseconds: {0}", watch.ElapsedMilliseconds); BasicSegmentString segmentStringBasic = new BasicSegmentString(coordinates, null); FastNodingValidator fastValidator = new FastNodingValidator(new[] { segmentStringBasic }); watch.Reset(); watch.Start(); fastValidator.CheckValid(); watch.Stop(); Console.WriteLine("FastNodingValidator.CheckValid => ElapsedMilliseconds: {0}", watch.ElapsedMilliseconds); }