예제 #1
0
        // called when there is a graphCache[graphFamily] item to process
        // called only through currentOutputAction or the output actions menu
        public void ProcessGraph(string graphFamily)
        {
            var execution = Exec.lastExecution; // atomically copy it

            if (execution == null)
            {
                return;                    // something's wrong
            }
            lock (Exec.exporterMutex) { GraphLayoutHandler.SetGraphLayout(GraphLayout.MessageGraph("...", "... working ...", "...")); plot.DoInvalidate(); }
            Dictionary <string, object> layoutCache = execution.layoutCache; // Dictionary<string, GraphLayout>
            GraphLayout layout;

            if (layoutCache.ContainsKey(graphFamily))
            {
                layout = (GraphLayout)layoutCache[graphFamily];
            }
            else
            {
                var graph = execution.graphCache[graphFamily];
                if (graph.VertexCount == 0 || graph.EdgeCount == 0) // GraphSharp crashes in these cases
                {
                    layout = GraphLayout.MessageGraph("...", "...", "... empty .");
                }
                else
                {
                    try { layout = new GraphLayout("Graph Layout", graph); }
                    catch { layout = GraphLayout.MessageGraph("...", "...", "... failed !!!"); }
                }
            }
            execution.layoutCache[graphFamily] = layout;
            lock (Exec.exporterMutex) { GraphLayoutHandler.SetGraphLayout(layout); plot.DoInvalidate(); }
        }
예제 #2
0
 public void OutputClear()   // external call, wait until we switch to this page
 {
     if (MainTabbedPage.theMainTabbedPage.CurrentPage == MainTabbedPage.theOutputPageNavigation)
     {
         SetText("");
         lock (Exec.exporterMutex) { GraphLayoutHandler.SetGraphLayout(GraphLayout.MessageGraph("Preparing ...", "...", "...")); plot.DoInvalidate(); }
     }
 }