/// <summary> /// Handles the actual graphing. /// </summary> /// <param name="work">The work item to graph.</param> /// <returns>A new <see cref="Graph" />.</returns> private GraphingResult HandleGraphing(GraphingWorkItem work) { if (work.TreeGrapher == null || work.ParseTree == null) { return(new GraphingResult()); } var graph = work.TreeGrapher.CreateGraph(work.ParseTree, work.ParserRules); graph.LayoutAlgorithmSettings = new SugiyamaLayoutSettings(); return(new GraphingResult(graph, work.ParseTree)); }
/// <inheritdoc /> public void Graph(IParseTreeGrapher grapher, ITree tree, IList <string> parserRules) { lock (_Padlock) { var nextRun = CalculateNextRunTime( _PreviousNodeQty, _Settings.NodeThresholdCountForThrottling, _Settings.MillisecondsToDelayPerNodeWhenThrottling, _Settings.MaximumRenderShortDelay); var work = new GraphingWorkItem(tree, parserRules, grapher, nextRun); QueuedWork.Enqueue(work); _LastQueuedTime = DateTime.Now; if (GraphingTask.IsCompleted) { GraphingTask = new Task(GraphingWorkLoop); } if (GraphingTask.Status != TaskStatus.Running) { GraphingTask.Start(); } } }