Ejemplo n.º 1
0
        private int depthDelta = 0;   // the change in area depth from the R to Curve side of this edge

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="label"></param>
        public Edge(ICoordinate[] pts, Label label)
        {
            eiList = new EdgeIntersectionList(this);

            this.pts = pts;
            this.label = label;
        }
Ejemplo n.º 2
0
        private int depthDelta  = 0;  // the change in area depth from the R to Curve side of this edge

        /// <summary>
        ///
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="label"></param>
        public Edge(ICoordinate[] pts, Label label)
        {
            eiList = new EdgeIntersectionList(this);

            this.pts   = pts;
            this.label = label;
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Check that a ring does not self-intersect, except at its endpoints.
 /// Algorithm is to count the number of times each node along edge occurs.
 /// If any occur more than once, that must be a self-intersection.
 /// </summary>
 private void CheckNoSelfIntersectingRing(EdgeIntersectionList eiList)
 {
     ISet nodeSet = new ListSet();    
     bool isFirst = true;
     foreach(EdgeIntersection ei in eiList)
     {                
         if (isFirst)
         {
             isFirst = false;
             continue;
         }
         if (nodeSet.Contains(ei.Coordinate))
         {
             validErr = new TopologyValidationError(TopologyValidationErrors.RingSelfIntersection, ei.Coordinate);
             return;
         }
         else nodeSet.Add(ei.Coordinate);
     }
 }