示例#1
0
 public void AddAll(EdgeCollection edgeColl)
 {
     for (IEdgeEnumerator i = edgeColl.GetEnumerator(); i.MoveNext();)
     {
         Add(i.Current);
     }
 }
示例#2
0
 public void ComputeSplitEdges(EdgeCollection edgelist)
 {
     for (IEdgeEnumerator i = edges.GetEnumerator(); i.MoveNext();)
     {
         Edge e = i.Current;
         e.eiList.AddSplitEdges(edgelist);
     }
 }
示例#3
0
        /// <summary>
        ///		Initializes a new instance of the <c>EdgeCollection</c> class
        ///		that contains elements copied from the specified <c>EdgeCollection</c>.
        /// </summary>
        /// <param name="edges">The <c>EdgeCollection</c> whose elements are copied to the new collection.</param>
        public EdgeCollection(EdgeCollection edges)
        {
            if (edges == null)
            {
                throw new ArgumentNullException("edges");
            }

            m_array = new Edge[edges.Count];
            AddRange(edges);
        }
示例#4
0
        /// <summary>
        ///		Creates a shallow copy of the <see cref="EdgeCollection"/>.
        /// </summary>
        public object Clone()
        {
            EdgeCollection newColl = new EdgeCollection(m_count);

            Array.Copy(m_array, 0, newColl.m_array, 0, m_count);
            newColl.m_count   = m_count;
            newColl.m_version = m_version;

            return(newColl);
        }
示例#5
0
        /// <summary>
        ///		Adds the elements of another <c>EdgeCollection</c> to the current <c>EdgeCollection</c>.
        /// </summary>
        /// <param name="x">The <c>EdgeCollection</c> whose elements should be added to the end of the current <c>EdgeCollection</c>.</param>
        /// <returns>The new <see cref="EdgeCollection.Count"/> of the <c>EdgeCollection</c>.</returns>
        public int AddRange(EdgeCollection x)
        {
            if (m_count + x.Count >= m_array.Length)
            {
                EnsureCapacity(m_count + x.Count);
            }

            Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
            m_count += x.Count;
            m_version++;

            return(m_count);
        }
示例#6
0
        /// <summary>
        /// Add a set of edges to the graph.  For each edge two DirectedEdges
        /// will be created.  DirectedEdges are NOT linked by this method.
        /// </summary>
        public void AddEdges(EdgeCollection edgesToAdd)
        {
            // create all the nodes for the edges
            for (IEdgeEnumerator it = edgesToAdd.GetEnumerator();
                 it.MoveNext();)
            {
                Edge e = it.Current;

                edges.Add(e);

                DirectedEdge de1 = new DirectedEdge(e, true);
                DirectedEdge de2 = new DirectedEdge(e, false);
                de1.Sym = de2;
                de2.Sym = de1;

                Add(de1);
                Add(de2);
            }
        }
示例#7
0
        /// <summary> Creates new edges for all the edges that the intersections in this
        /// list split the parent edge into.
        /// Adds the edges to the input list (this is so a single list
        /// can be used to accumulate all split edges for a Geometry).
        /// </summary>
        /// <param name="edgeList">a list of EdgeIntersections
        /// </param>
        public void AddSplitEdges(EdgeCollection edgeList)
        {
            // ensure that the list has entries for the first and last point of the edge
            AddEndpoints();

            IEnumerator it = Iterator();

            // there should always be at least two entries in the list
            it.MoveNext();                //TODO--PAUL
            EdgeIntersection eiPrev = (EdgeIntersection)it.Current;

            while (it.MoveNext())
            {
                EdgeIntersection ei      = (EdgeIntersection)it.Current;
                Edge             newEdge = CreateSplitEdge(eiPrev, ei);
                edgeList.Add(newEdge);

                eiPrev = ei;
            }
        }
示例#8
0
 public PlanarGraph()
 {
     edges       = new EdgeCollection();
     edgeEndList = new ArrayList();
     m_objNodes  = new NodeMap(new NodeFactory());
 }
示例#9
0
 /// <summary>
 ///		Initializes a new instance of the <c>EdgeEnumerator</c> class.
 /// </summary>
 /// <param name="tc"></param>
 internal EdgeEnumerator(EdgeCollection tc)
 {
     m_collection = tc;
     m_index      = -1;
     m_version    = tc.m_version;
 }
示例#10
0
 public EdgeList()
 {
     edges = new EdgeCollection();
     index = new Quadtree();
 }