/// <summary> Remove the segs in the section of the line</summary>
        /// <param name="line">
        /// </param>
        /// <param name="pts">
        /// </param>
        /// <param name="sectionStartIndex">
        /// </param>
        /// <param name="sectionEndIndex">
        /// </param>
        private void Remove(TaggedLineString line, int start, int end)
        {
            for (int i = start; i < end; i++)
            {
                TaggedLineSegment seg = line.GetSegment(i);

                inputIndex.Remove(seg);
            }
        }
Beispiel #2
0
        public void Add(TaggedLineString line)
        {
            TaggedLineSegment[] segs = line.Segments;

            for (int i = 0; i < segs.Length - 1; i++)
            {
                TaggedLineSegment seg = segs[i];

                Add(seg);
            }
        }
        private void Initialize()
        {
            ICoordinateList pts    = parentLine.Coordinates;
            int             nCount = pts.Count;

            segs = new TaggedLineSegment[nCount - 1];
            for (int i = 0; i < nCount - 1; i++)
            {
                TaggedLineSegment seg = new TaggedLineSegment(pts[i],
                                                              pts[i + 1], parentLine, i);

                segs[i] = seg;
            }
        }
        /// <summary>
        /// Tests whether a segment is in a section of a TaggedLineString.
        /// </summary>
        /// <param name="line">
        /// </param>
        /// <param name="sectionIndex">
        /// </param>
        /// <param name="seg">
        /// </param>
        /// <returns>
        /// </returns>
        private static bool IsInLineSection(TaggedLineString line,
                                            int[] sectionIndex, TaggedLineSegment seg)
        {
            // not in this line
            if (seg.Parent != line.Parent)
            {
                return(false);
            }

            int segIndex = seg.Index;

            if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1])
            {
                return(true);
            }

            return(false);
        }
        private bool HasBadInputIntersection(TaggedLineString parentLine,
                                             int[] sectionIndex, LineSegment candidateSeg)
        {
            IList querySegs = inputIndex.Query(candidateSeg);

            for (IEnumerator i = querySegs.GetEnumerator(); i.MoveNext();)
            {
                TaggedLineSegment querySeg = (TaggedLineSegment)i.Current;
                if (HasInteriorIntersection(querySeg, candidateSeg))
                {
                    if (IsInLineSection(parentLine, sectionIndex, querySeg))
                    {
                        continue;
                    }
                    return(true);
                }
            }
            return(false);
        }