public static int InteriorIntersectionCount(IGeometry geom)
 {
     InteriorIntersectionFinder intCounter = InteriorIntersectionFinder.CreateIntersectionCounter(new RobustLineIntersector());
     INoder noder = new MCIndexNoder(intCounter);
     noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom));
     return intCounter.Count;
 }
        /// <summary>
        /// Node the input segment strings once
        /// and create the split edges between the nodes.
        /// </summary>
        /// <param name="segStrings"></param>
        /// <param name="numInteriorIntersections"></param>
        private void Node(IList <ISegmentString> segStrings, int[] numInteriorIntersections)
        {
            var si    = new IntersectionAdder(_li);
            var noder = new MCIndexNoder(si);

            noder.ComputeNodes(segStrings);
            _nodedSegStrings            = noder.GetNodedSubstrings();
            numInteriorIntersections[0] = si.NumInteriorIntersections;
        }
        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);
        }
        private void CheckInteriorIntersections()
        {
            /*
             * MD - It may even be reliable to simply check whether
             * end segments (of SegmentStrings) have an interior intersection,
             * since noding should have split any true interior intersections already.
             */
            _isValid = true;
            _segInt  = new InteriorIntersectionFinder(_li);
            _segInt.FindAllIntersections = FindAllIntersections;
            MCIndexNoder noder = new MCIndexNoder(_segInt);

            noder.ComputeNodes(_segStrings); //.ComputeNodes(segStrings);
            if (_segInt.HasIntersection)
            {
                _isValid = false;
                return;
            }
        }
 /// <summary>
 /// Node the input segment strings once
 /// and create the split edges between the nodes.
 /// </summary>
 /// <param name="segStrings"></param>
 /// <param name="numInteriorIntersections"></param>
 private void Node(IList<ISegmentString> segStrings, int[] numInteriorIntersections)
 {
     var si = new IntersectionAdder(_li);
     var noder = new MCIndexNoder(si);            
     noder.ComputeNodes(segStrings);
     _nodedSegStrings = noder.GetNodedSubstrings();
     numInteriorIntersections[0] = si.NumInteriorIntersections;            
 }
 private void CheckInteriorIntersections()
 {
     /*
      * MD - It may even be reliable to simply check whether
      * end segments (of SegmentStrings) have an interior intersection,
      * since noding should have split any true interior intersections already.
      */
     _isValid = true;
     _segInt = new InteriorIntersectionFinder(_li);
     _segInt.FindAllIntersections = FindAllIntersections;
     MCIndexNoder noder = new MCIndexNoder(_segInt);
     noder.ComputeNodes(_segStrings); //.ComputeNodes(segStrings);
     if (_segInt.HasIntersection)
     {
         _isValid = false;
         return;
     }
 }
 public static IGeometry MCIndexNoding(IGeometry geom)
 {
     INoder noder = new MCIndexNoder(new IntersectionAdder(new RobustLineIntersector()));
     noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom));
     return SegmentStringUtil.ToGeometry(noder.GetNodedSubstrings(), geom.Factory);
 }
        public static IGeometry MCIndexNodingWithPrecision(IGeometry geom, double scaleFactor)
        {
            IPrecisionModel 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);
        }
        private INoder GetNoder(IPrecisionModel precisionModel)
        {
            if (_workingNoder != null) return _workingNoder;

            // otherwise use a fast (but non-robust) noder
            var noder = new MCIndexNoder(new IntersectionAdder(new RobustLineIntersector { PrecisionModel = precisionModel}));

            //var li = new RobustLineIntersector();
            //li.PrecisionModel = precisionModel;
            //noder.SegmentIntersector = new IntersectionAdder(li);
            //    Noder noder = new IteratedNoder(precisionModel);
            return noder;
            //    Noder noder = new SimpleSnapRounder(precisionModel);
            //    Noder noder = new MCIndexSnapRounder(precisionModel);
            //    Noder noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
            //                                  precisionModel.getScale());
        }
 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);
 }