/// <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); } }
/// <summary> /// /// </summary> /// <param name="coords"></param> /// <param name="parent"></param> /// <returns></returns> protected override ICoordinateSequence TransformCoordinates(ICoordinateSequence coords, IGeometry parent) { if (parent is LineString) { 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)); }
/// <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 virtual 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) { this.line = line; linePts = line.ParentCoordinates; SimplifySection(0, linePts.Length - 1, 0); }