Ejemplo n.º 1
0
 /// <summary>
 /// Gets an edge from the given graph taking into account 'can have duplicates'.
 /// </summary>
 /// <param name="graph"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <param name="existingData"></param>
 /// <param name="shape"></param>
 /// <returns></returns>
 private bool GetEdge(GraphBase <TEdgeData> graph, uint from, uint to, out TEdgeData existingData, out ICoordinateCollection shape)
 {
     if (!graph.CanHaveDuplicates)
     {
         graph.GetEdgeShape(from, to, out shape);
         return(graph.GetEdge(from, to, out existingData));
     }
     else
     {
         var edges = graph.GetEdges(from, to);
         while (edges.MoveNext())
         {
             if (edges.Neighbour == to)
             {
                 existingData = edges.EdgeData;
                 shape        = edges.Intermediates;
                 return(true);
             }
         }
         existingData = default(TEdgeData);
         shape        = null;
         return(false);
     }
 }