Пример #1
0
 /// <summary>
 /// Remove the segs in the section of the line.
 /// </summary>
 /// <param name="line"></param>
 /// <param name="start"></param>
 /// <param name="end"></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);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="line"></param>
 public virtual void Add(TaggedLineString line)
 {
     TaggedLineSegment[] segs = line.Segments;
     for (int i = 0; i < segs.Length - 1; i++)
     {
         TaggedLineSegment seg = segs[i];
         Add(seg);
     }
 }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 private void Init()
 {
     ICoordinate[] pts = parentLine.Coordinates;
     segs = new TaggedLineSegment[pts.Length - 1];
     for (int i = 0; i < pts.Length - 1; i++)
     {
         TaggedLineSegment seg
                 = new TaggedLineSegment(pts[i], pts[i + 1], parentLine, i);
         segs[i] = seg;
     }
 }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parentLine"></param>
        /// <param name="sectionIndex"></param>
        /// <param name="candidateSeg"></param>
        /// <returns></returns>
        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);
        }
Пример #5
0
        /// <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);
        }