示例#1
0
 public static void ShowMsaglGraph <TVertex, TEdge>(
     this IEdgeListGraph <TVertex, TEdge> visitedGraph,
     MsaglVertexNodeEventHandler <TVertex> nodeAdded,
     MsaglEdgeAction <TVertex, TEdge> edgeAdded
     )
     where TEdge : IEdge <TVertex>
 {
     ShowDialog(ToMsaglGraph(visitedGraph, nodeAdded, edgeAdded));
 }
示例#2
0
        public static Microsoft.Msagl.Drawing.Graph ToIdentifiableMsaglGraph <TVertex, TEdge>(
#if !NET20
            this
#endif
            IEdgeListGraph <TVertex, TEdge> visitedGraph,
            VertexIdentity <TVertex> vertexIdentities,
            MsaglVertexNodeEventHandler <TVertex> nodeAdded,
            MsaglEdgeAction <TVertex, TEdge> edgeAdded
            )
            where TEdge : IEdge <TVertex>
        {
            Contract.Requires(visitedGraph != null);
            Contract.Requires(vertexIdentities != null);

            var populator = CreateIdentifiableMsaglPopulator(visitedGraph, vertexIdentities);

            try
            {
                if (nodeAdded != null)
                {
                    populator.NodeAdded += nodeAdded;
                }
                if (edgeAdded != null)
                {
                    populator.EdgeAdded += edgeAdded;
                }

                populator.Compute();
                return(populator.MsaglGraph);
            }
            finally
            {
                if (nodeAdded != null)
                {
                    populator.NodeAdded -= nodeAdded;
                }
                if (edgeAdded != null)
                {
                    populator.EdgeAdded -= edgeAdded;
                }
            }
        }
示例#3
0
        public static Microsoft.Msagl.Drawing.Graph ToMsaglGraph <TVertex, TEdge>(
            this IEdgeListGraph <TVertex, TEdge> visitedGraph,
            MsaglVertexNodeEventHandler <TVertex> nodeAdded,
            MsaglEdgeAction <TVertex, TEdge> edgeAdded
            )
            where TEdge : IEdge <TVertex>
        {
            Contract.Requires(visitedGraph != null);

            var populator = CreateMsaglPopulator(visitedGraph);

            try
            {
                if (nodeAdded != null)
                {
                    populator.NodeAdded += nodeAdded;
                }
                if (edgeAdded != null)
                {
                    populator.EdgeAdded += edgeAdded;
                }

                populator.Compute();
                return(populator.MsaglGraph);
            }
            finally
            {
                if (nodeAdded != null)
                {
                    populator.NodeAdded -= nodeAdded;
                }
                if (edgeAdded != null)
                {
                    populator.EdgeAdded -= edgeAdded;
                }
            }
        }