Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
        /// <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));
        }
Exemplo n.º 3
0
        /// <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);
        }