/// <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);
     }
 }
Esempio n. 2
0
 /// <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);
     }
 }
Esempio n. 3
0
 /// <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);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="coords"></param>
 /// <param name="parent"></param>
 /// <returns></returns>
 protected override IList <Coordinate> TransformCoordinates(IList <Coordinate> coords, IGeometry parent)
 {
     if (parent is LineString)
     {
         TaggedLineString taggedLine = (TaggedLineString)_container._lineStringMap[parent];
         return(taggedLine.ResultCoordinates);
     }
     // for anything else (e.g. points) just copy the coordinates
     return(base.TransformCoordinates(coords, parent));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentLine"></param>
 /// <param name="sectionIndex"></param>
 /// <param name="candidateSeg"></param>
 /// <returns></returns>
 private bool HasBadIntersection(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg)
 {
     if (HasBadOutputIntersection(candidateSeg))
     {
         return(true);
     }
     if (HasBadInputIntersection(parentLine, sectionIndex, candidateSeg))
     {
         return(true);
     }
     return(false);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="geom"></param>
 public void Filter(IGeometry geom)
 {
     if (geom is LinearRing)
     {
         TaggedLineString taggedLine = new TaggedLineString((LineString)geom, 4);
         _container._lineStringMap.Add(geom, taggedLine);
     }
     else if (geom is LineString)
     {
         TaggedLineString taggedLine = new TaggedLineString((LineString)geom, 2);
         _container._lineStringMap.Add(geom, taggedLine);
     }
 }
        /// <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);
        }
        /// <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);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="line"></param>
 public virtual void Simplify(TaggedLineString line)
 {
     _line = line;
     _linePts = line.ParentCoordinates;
     SimplifySection(0, _linePts.Count - 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>
 /// 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;
 }
 /// <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;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="parentLine"></param>
 /// <param name="sectionIndex"></param>
 /// <param name="candidateSeg"></param>
 /// <returns></returns>
 private bool HasBadIntersection(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg)
 {
     if (HasBadOutputIntersection(candidateSeg))
         return true;
     if (HasBadInputIntersection(parentLine, sectionIndex, candidateSeg))
         return true;
     return false;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="geom"></param>
 public void Filter(IGeometry geom)
 {
     if (geom is LinearRing)
     {
         TaggedLineString taggedLine = new TaggedLineString((LineString)geom, 4);
         _container._lineStringMap.Add(geom, taggedLine);
     }
     else if (geom is LineString)
     {
         TaggedLineString taggedLine = new TaggedLineString((LineString)geom, 2);
         _container._lineStringMap.Add(geom, taggedLine);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="line"></param>
 public virtual void Simplify(TaggedLineString line)
 {
     _line    = line;
     _linePts = line.ParentCoordinates;
     SimplifySection(0, _linePts.Count - 1, 0);
 }