/// <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(Coordinate 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);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IntersectionAdder"/> class.
 /// </summary>
 /// <param name="li"></param>
 public IntersectionAdder(LineIntersector li)
 {
     _li = li;
 }
 /// <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)
 {
     _li = li;
     _interiorIntersections = new ArrayList();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="segStrings"></param>
 /// <param name="li"></param>
 private void SnapRound(IList segStrings, LineIntersector li)
 {
     IList intersections = FindInteriorIntersections(segStrings, li);
     ComputeSnaps(segStrings, intersections);
     ComputeVertexSnaps(segStrings);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleSnapRounder"/> class.
 /// </summary>
 /// <param name="pm">The <see cref="PrecisionModel" /> to use.</param>
 public SimpleSnapRounder(PrecisionModel pm) 
 {            
     _li = new RobustLineIntersector();
     _li.PrecisionModel = pm;
     _scaleFactor = pm.Scale;
 }
 /// <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 static IList FindInteriorIntersections(IList segStrings, LineIntersector li)
 {
     IntersectionFinderAdder intFinderAdder = new IntersectionFinderAdder(li);
     SinglePassNoder noder = new MCIndexNoder(intFinderAdder);            
     noder.ComputeNodes(segStrings);
     return intFinderAdder.InteriorIntersections;
 }
 /// <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 static bool HasInteriorIntersection(LineIntersector li, Coordinate p0, Coordinate p1)
 {
     for (int i = 0; i < li.IntersectionNum; i++)
     {
         Coordinate intPt = li.GetIntersection(i);
         if (!(intPt.Equals(p0) || intPt.Equals(p1)))
             return true;
     }
     return false;
 }
 /// <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;
         Coordinate pt = node.Coordinate;
         if (li.IsIntersection(pt)) 
             return true;
     }
     return false;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="li"></param>
 public EdgeSetNoder(LineIntersector li)
 {
     this.li = li;
 }
 /// <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 virtual 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;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="g"></param>
 /// <param name="li"></param>
 /// <param name="includeProper"></param>
 /// <returns></returns>
 public virtual 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;
 }
 /// <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="intIndex"></param>
 public void AddIntersection(LineIntersector li, int segmentIndex, int intIndex)
 {
     Coordinate intPt = new Coordinate(li.GetIntersection(intIndex));
     AddIntersection(intPt, segmentIndex);
 }
 /// <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;
 }
 /// <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;
 }
Exemple #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 virtual void AddIntersections(LineIntersector li, int segmentIndex, int geomIndex)
 {
     for (int i = 0; i < li.IntersectionNum; i++) 
         AddIntersection(li, segmentIndex, geomIndex, i);            
 }
 /// <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;
 }
Exemple #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 virtual void AddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
        {
            Coordinate intPt = new Coordinate(li.GetIntersection(intIndex));
            int normalizedSegmentIndex = segmentIndex;
            double dist = li.GetEdgeDistance(geomIndex, intIndex);        
            
            // normalize the intersection point location
            int nextSegIndex = normalizedSegmentIndex + 1;
            if (nextSegIndex < Points.Count) 
            {
                Coordinate 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);
            }            
        }
 /// <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;
 }