コード例 #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);
     }
 }
コード例 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="line"></param>
 public 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>
 /// <param name="line"></param>
 public void Add(TaggedLineString line)
 {
     TaggedLineSegment[] segs = line.Segments;
     for (int i = 0; i < segs.Length - 1; i++)
     {
         TaggedLineSegment seg = segs[i];
         Add(seg);
     }
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="coords"></param>
 /// <param name="parent"></param>
 /// <returns></returns>
 protected override ICoordinateSequence TransformCoordinates(ICoordinateSequence coords, IGeometry parent)
 {
     if (parent is ILineString)
     {
         TaggedLineString taggedLine = (TaggedLineString)container.lineStringMap[parent];
         return(CreateCoordinateSequence(taggedLine.ResultCoordinates));
     }
     // for anything else (e.g. points) just copy the coordinates
     return(base.TransformCoordinates(coords, parent));
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="geom"></param>
 public void Filter(IGeometry geom)
 {
     if (geom is ILinearRing)
     {
         TaggedLineString taggedLine = new TaggedLineString((ILineString)geom, 4);
         container.lineStringMap.Add(geom, taggedLine);
     }
     else if (geom is ILineString)
     {
         TaggedLineString taggedLine = new TaggedLineString((ILineString)geom, 2);
         container.lineStringMap.Add(geom, taggedLine);
     }
 }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geom"></param>
 public void Filter(IGeometry geom)
 {
     if (geom is ILinearRing) 
     {
         TaggedLineString taggedLine = new TaggedLineString((ILineString) geom, 4);
         container.lineStringMap.Add(geom, taggedLine);
     }
     else if (geom is ILineString) 
     {
         TaggedLineString taggedLine = new TaggedLineString((ILineString) geom, 2);
         container.lineStringMap.Add(geom, taggedLine);
     }
 }
コード例 #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="line"></param>
 public void Simplify(TaggedLineString line)
 {
     this.line = line;
     linePts = line.ParentCoordinates;
     SimplifySection(0, linePts.Length - 1, 0);
 }
コード例 #11
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);
     }
 }
コード例 #12
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;
 }
コード例 #13
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;
 }
コード例 #14
0
 /// <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;
 }
コード例 #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="line"></param>
 public void Simplify(TaggedLineString line)
 {
     this.line = line;
     linePts   = line.ParentCoordinates;
     SimplifySection(0, linePts.Length - 1, 0);
 }