/// <summary>
        /// This method is called by clients
        /// of the <see cref="ISegmentIntersector" /> class to process
        /// intersections for two segments of the <see cref="ISegmentString" />s being intersected.<br/>
        /// Note that some clients (such as <c>MonotoneChain</c>s) may optimize away
        /// this call for segment pairs which they have determined do not intersect
        /// (e.g. by an disjoint envelope test).
        /// </summary>
        /// <param name="e0"></param>
        /// <param name="segIndex0"></param>
        /// <param name="e1"></param>
        /// <param name="segIndex1"></param>
        public void ProcessIntersections(ISegmentString e0, int segIndex0, ISegmentString e1, int segIndex1)
        {
            // don't bother intersecting a segment with itself
            if (e0 == e1 && segIndex0 == segIndex1)
            {
                return;
            }

            Coordinate[] coordinates0 = e0.Coordinates;
            Coordinate   p00          = coordinates0[segIndex0];
            Coordinate   p01          = coordinates0[segIndex0 + 1];

            Coordinate[] coordinates1 = e1.Coordinates;
            Coordinate   p10          = coordinates1[segIndex1];
            Coordinate   p11          = coordinates1[segIndex1 + 1];

            _li.ComputeIntersection(p00, p01, p10, p11);

            if (!_li.HasIntersection)
            {
                return;
            }
            if (!_li.IsInteriorIntersection())
            {
                return;
            }
            for (int intIndex = 0; intIndex < _li.IntersectionNum; intIndex++)
            {
                _interiorIntersections.Add(_li.GetIntersection(intIndex));
            }

            NodedSegmentString nss0 = (NodedSegmentString)e0;

            nss0.AddIntersections(_li, segIndex0, 0);
            NodedSegmentString nss1 = (NodedSegmentString)e1;

            nss1.AddIntersections(_li, segIndex1, 1);
        }
Example #2
0
        private readonly NodedSegmentString _edge;  // the parent edge

        /// <summary>
        /// Initializes a new instance of the <see cref="SegmentNodeList"/> class.
        /// </summary>
        /// <param name="edge">The edge.</param>
        public SegmentNodeList(NodedSegmentString edge)
        {
            _edge = edge;
        }
Example #3
0
 /// <summary>
 /// Returns a <see cref="IList{ISegmentString}"/> of fully noded <see cref="ISegmentString"/>s.
 /// The <see cref="ISegmentString"/>s have the same context as their parent.
 /// </summary>
 /// <returns></returns>
 public override IList <ISegmentString> GetNodedSubstrings()
 {
     return(NodedSegmentString.GetNodedSubstrings(_nodedSegStrings));
 }