/// <summary> 
 /// Insert an edge unless it is already in the list.
 /// </summary>
 /// <param name="e"></param>
 public void Add(Edge e)
 {
     _edges.Add(e);
     var oca = new OrientedCoordinateArray(e.Coordinates);
     _ocaMap.Add(oca, e);
     //_index.Insert(e.Envelope, e);
 }
Beispiel #2
0
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="oca"></param>
        /*/// <param name="segString"></param>*/
        /// <returns></returns>
        private ISegmentString FindMatching(OrientedCoordinateArray oca /*, ISegmentString segString*/)
        {
            ISegmentString ret;

            if (_ocaMap.TryGetValue(oca, out ret))
            {
                return(ret);
            }
            return(null);
        }
Beispiel #3
0
        /// <summary>
        /// Dissolve the given <see cref="ISegmentString" />.
        /// </summary>
        /// <param name="segString"></param>
        public void Dissolve(ISegmentString segString)
        {
            var oca      = new OrientedCoordinateArray(segString.Coordinates);
            var existing = FindMatching(oca /*, segString*/);

            if (existing == null)
            {
                Add(oca, segString);
            }
            else
            {
                if (_merger != null)
                {
                    bool isSameOrientation = CoordinateArrays.Equals(existing.Coordinates, segString.Coordinates);
                    _merger.Merge(existing, segString, isSameOrientation);
                }
            }
        }
 /// <summary>
 /// Dissolve the given <see cref="ISegmentString" />.
 /// </summary>
 /// <param name="segString"></param>
 public void Dissolve(ISegmentString segString)
 {
     OrientedCoordinateArray oca = new OrientedCoordinateArray(segString.Coordinates);
     ISegmentString existing = FindMatching(oca /*, segString*/);
     if (existing == null)
         Add(oca, segString);            
     else
     {
         if (_merger != null)
         {
             bool isSameOrientation = CoordinateArrays.Equals(existing.Coordinates, segString.Coordinates);
             _merger.Merge(existing, segString, isSameOrientation);
         }
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="oca"></param>
 /// <param name="segString"></param>
 private void Add(OrientedCoordinateArray oca, ISegmentString segString)
 {
     _ocaMap.Add(oca, segString);
 }
 ///// <summary>
 ///// 
 ///// </summary>
 ///// <param name="oca"></param>
 /*/// <param name="segString"></param>*/
 /// <returns></returns>
 private ISegmentString FindMatching(OrientedCoordinateArray oca /*, ISegmentString segString*/)
 {
     ISegmentString ret;
     if (_ocaMap.TryGetValue(oca, out ret))
         return ret;
     return null;
 }        
Beispiel #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="oca"></param>
 /// <param name="segString"></param>
 private void Add(OrientedCoordinateArray oca, ISegmentString segString)
 {
     _ocaMap.Add(oca, segString);
 }
Beispiel #8
0
        /// <summary>
        /// Compares two <see cref="OrientedCoordinateArray" />s for their relative order.
        /// </summary>
        /// <param name="o1"></param>
        /// <returns>
        /// -1 this one is smaller;<br/>
        ///  0 the two objects are equal;<br/>
        ///  1 this one is greater.
        /// </returns>
        public int CompareTo(object o1)
        {
            OrientedCoordinateArray oca = (OrientedCoordinateArray)o1;

            return(CompareOriented(_pts, _orientation, oca._pts, oca._orientation));
        }
 /// <summary>
 /// If there is an edge equal to e already in the list, return it.
 /// Otherwise return null.
 /// </summary>
 /// <param name="e"></param>
 /// <returns>  
 /// equal edge, if there is one already in the list,
 /// null otherwise.
 /// </returns>
 public Edge FindEqualEdge(Edge e)
 {
     var oca = new OrientedCoordinateArray(e.Coordinates);
     // will return null if no edge matches
     Edge matchEdge;
     _ocaMap.TryGetValue(oca, out matchEdge);
     return matchEdge;
 }