コード例 #1
0
ファイル: Edge.cs プロジェクト: lishxi/_SharpMap
        /// <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);
            }            
        }
コード例 #2
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;
 }
コード例 #3
0
ファイル: SegmentString.cs プロジェクト: lishxi/_SharpMap
 /// <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);
 }