Пример #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="precisionModel"></param>
 /// <param name="quadrantSegments"></param>
 public OffsetCurveBuilder(IPrecisionModel precisionModel, int quadrantSegments)
 {
     this.precisionModel = precisionModel;
     // compute intersections in full precision, to provide accuracy
     // the points are rounded as they are inserted into the curve line
     li = new RobustLineIntersector();
     var limitedQuadSegs = quadrantSegments < 1 ? 1 : quadrantSegments;
     filletAngleQuantum = Math.PI / 2.0 / limitedQuadSegs;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HotPixel"/> class.
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="li"></param>
 public HotPixel(ICoordinate pt, double scaleFactor, LineIntersector li)
 {
     originalPt = pt;
     this.pt = pt;
     this.scaleFactor = scaleFactor;
     this.li = li;            
     if (scaleFactor != 1.0)
     {
         this.pt = new Coordinate(Scale(pt.X), Scale(pt.Y));
         p0Scaled = new Coordinate();
         p1Scaled = new Coordinate();
     }
     InitCorners(this.pt);
 }
Пример #3
0
 /// <summary>
 /// Computes all interior intersections in the collection of <see cref="SegmentString" />s,
 /// and returns their <see cref="Coordinate" />s.
 ///
 /// Does NOT node the segStrings.
 /// </summary>
 /// <param name="segStrings"></param>
 /// <param name="li"></param>
 /// <returns>A list of Coordinates for the intersections.</returns>
 private IList FindInteriorIntersections(IList segStrings, LineIntersector li)
 {
     IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li);
     noder.SegmentIntersector = intFinderAdder;
     noder.ComputeNodes(segStrings);
     return intFinderAdder.InteriorIntersections;
 }
Пример #4
0
 /// <summary>
 /// Computes all interior intersections in the collection of <see cref="SegmentString" />s,
 /// and returns their <see cref="Coordinate" />s.
 /// Does NOT node the segStrings.
 /// </summary>
 /// <param name="segStrings"></param>
 /// <param name="li"></param>
 /// <returns>A list of <see cref="Coordinate" />s for the intersections.</returns>
 private IList FindInteriorIntersections(IList segStrings, LineIntersector li)
 {
     IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li);
     SinglePassNoder noder = new MCIndexNoder(intFinderAdder);            
     noder.ComputeNodes(segStrings);
     return intFinderAdder.InteriorIntersections;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IteratedNoder"/> class.
 /// </summary>
 /// <param name="pm"></param>
 public IteratedNoder(PrecisionModel pm)
 {
     li = new RobustLineIntersector();
     li.PrecisionModel = pm;
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IntersectionAdder"/> class.
 /// </summary>
 /// <param name="li"></param>
 public IntersectionAdder(LineIntersector li)
 {
     this.li = li;
 }
Пример #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 /// <param name="includeProper"></param>
 /// <param name="recordIsolated"></param>
 public SegmentIntersector(LineIntersector li, bool includeProper, bool recordIsolated)
 {
     this.li = li;
     this.includeProper = includeProper;
     this.recordIsolated = recordIsolated;
 }
Пример #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 /// <param name="p0"></param>
 /// <param name="p1"></param>
 /// <returns><c>true</c> if there is an intersection point which is not an endpoint of the segment p0-p1.</returns>
 private bool HasInteriorIntersection(LineIntersector li, ICoordinate p0, ICoordinate p1)
 {
     for (int i = 0; i < li.IntersectionNum; i++)
     {
         ICoordinate intPt = li.GetIntersection(i);
         if (!(intPt.Equals(p0) || 
               intPt.Equals(p1)))
             return true;
     }
     return false;
 }
Пример #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 /// <param name="bdyNodes"></param>
 /// <returns></returns>
 private bool IsBoundaryPoint(LineIntersector li, ICollection[] bdyNodes)
 {
     if (bdyNodes == null) 
         return false;
     if (IsBoundaryPoint(li, bdyNodes[0]))
         return true;
     if (IsBoundaryPoint(li, bdyNodes[1])) 
         return true;
     return false;
 }
Пример #10
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 /// <param name="bdyNodes"></param>
 /// <returns></returns>
 private bool IsBoundaryPoint(LineIntersector li, ICollection bdyNodes)
 {
     for (IEnumerator i = bdyNodes.GetEnumerator(); i.MoveNext(); )
     {
         Node node = (Node) i.Current;
         ICoordinate pt = node.Coordinate;
         if (li.IsIntersection(pt)) 
             return true;
     }
     return false;
 }
Пример #11
0
 /// <summary>
 /// Creates an intersection finder which finds all proper intersections.
 /// </summary>
 /// <param name="li">The <see cref="LineIntersector" /> to use.</param>
 public IntersectionFinderAdder(LineIntersector li)
 {
     this.li = li;
     interiorIntersections = new ArrayList();
 }
Пример #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="g"></param>
 /// <param name="li"></param>
 /// <param name="includeProper"></param>
 /// <returns></returns>
 public SegmentIntersector ComputeEdgeIntersections(GeometryGraph g, 
     LineIntersector li, bool includeProper)
 {
     SegmentIntersector si = new SegmentIntersector(li, includeProper, true);
     si.SetBoundaryNodes(BoundaryNodes, g.BoundaryNodes);
     EdgeSetIntersector esi = CreateEdgeSetIntersector();
     esi.ComputeIntersections(edges, g.edges, si);        
     return si;
 }
Пример #13
0
 /// <summary>
 /// Compute self-nodes, taking advantage of the Geometry type to
 /// minimize the number of intersection tests.  (E.g. rings are
 /// not tested for self-intersection, since they are assumed to be valid).
 /// </summary>
 /// <param name="li">The <c>LineIntersector</c> to use.</param>
 /// <param name="computeRingSelfNodes">If <c>false</c>, intersection checks are optimized to not test rings for self-intersection.</param>
 /// <returns>The SegmentIntersector used, containing information about the intersections found.</returns>
 public SegmentIntersector ComputeSelfNodes(LineIntersector li, bool computeRingSelfNodes)
 {
     SegmentIntersector si = new SegmentIntersector(li, true, false);
     EdgeSetIntersector esi = CreateEdgeSetIntersector();
     // optimized test for Polygons and Rings
     if (!computeRingSelfNodes &&
        (parentGeom is ILinearRing || parentGeom is IPolygon || parentGeom is IMultiPolygon))
          esi.ComputeIntersections(edges, si, false);            
     else esi.ComputeIntersections(edges, si, true);      
     AddSelfIntersectionNodes(argIndex);
     return si;
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MCIndexSnapRounder"/> class.
 /// </summary>
 /// <param name="pm">The <see cref="PrecisionModel" /> to use.</param>
 public MCIndexSnapRounder(PrecisionModel pm) 
 {
     li = new RobustLineIntersector();
     li.PrecisionModel = pm;
     scaleFactor = pm.Scale;
 }
Пример #15
0
 /// <summary>
 /// Adds EdgeIntersections for one or both
 /// intersections found for a segment of an edge to the edge intersection list.
 /// </summary>
 /// <param name="li"></param>
 /// <param name="segmentIndex"></param>
 /// <param name="geomIndex"></param>
 public void AddIntersections(LineIntersector li, int segmentIndex, int geomIndex)
 {
     for (var i = 0; i < li.IntersectionNum; i++) 
         AddIntersection(li, segmentIndex, geomIndex, i);            
 }
Пример #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="segStrings"></param>
 /// <param name="li"></param>
 private void SnapRound(IList segStrings, LineIntersector li)
 {
     IList intersections = FindInteriorIntersections(segStrings, li);
     ComputeIntersectionSnaps(intersections);
     ComputeVertexSnaps(segStrings);        
 }
Пример #17
0
        /// <summary>
        /// Add an EdgeIntersection for intersection intIndex.
        /// An intersection that falls exactly on a vertex of the edge is normalized
        /// to use the higher of the two possible segmentIndexes.
        /// </summary>
        /// <param name="li"></param>
        /// <param name="segmentIndex"></param>
        /// <param name="geomIndex"></param>
        /// <param name="intIndex"></param>
        public void AddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
        {
            ICoordinate intPt = new Coordinate(li.GetIntersection(intIndex));
            var normalizedSegmentIndex = segmentIndex;
            var dist = li.GetEdgeDistance(geomIndex, intIndex);        
            
            // normalize the intersection point location
            var nextSegIndex = normalizedSegmentIndex + 1;
            if (nextSegIndex < Points.Length) 
            {
                var nextPt = Points[nextSegIndex];        

                // Normalize segment index if intPt falls on vertex
                // The check for point equality is 2D only - Z values are ignored
                if (intPt.Equals2D(nextPt)) 
                {       
                    normalizedSegmentIndex = nextSegIndex;
                    dist = 0.0;
                }
                // Add the intersection point to edge intersection list.                
                EdgeIntersectionList.Add(intPt, normalizedSegmentIndex, dist);
            }            
        }
Пример #18
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 public EdgeSetNoder(LineIntersector li)
 {
     this.li = li;
 }
Пример #19
0
 /// <summary>
 /// Add an <see cref="SegmentNode" /> for intersection intIndex.
 /// An intersection that falls exactly on a vertex
 /// of the <see cref="SegmentString" /> is normalized
 /// to use the higher of the two possible segmentIndexes.
 /// </summary>
 /// <param name="li"></param>
 /// <param name="segmentIndex"></param>
 /// <param name="geomIndex"></param>
 /// <param name="intIndex"></param>
 public void AddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
 {
     ICoordinate intPt = new Coordinate(li.GetIntersection(intIndex));
     AddIntersection(intPt, segmentIndex);
 }