public void Relayout(IGraphPresentation presentation) { var layoutAlgorithm = presentation.GetModule <IGraphLayoutModule>().Algorithm; var writer = new DotWriter(myDotFile.FullName); writer.FastRenderingNodeCountLimit = FastRenderingNodeCountLimit; writer.IgnoreStyle = true; if (layoutAlgorithm == LayoutAlgorithm.Flow) { writer.Settings = DotPresets.Flow; } var writtenNodesCount = writer.Write(presentation.GetModule <ITransformationModule>().Graph, presentation.Picking, presentation); myConverter.Algorithm = layoutAlgorithm == LayoutAlgorithm.Auto && writtenNodesCount > FastRenderingNodeCountLimit ? LayoutAlgorithm.Sfdp : presentation.GetModule <IGraphLayoutModule>().Algorithm; myConverter.Convert(myDotFile, myPlainFile); // if converter changed algo (e.g. because of issues) we want to re-apply it to the presentation presentation.GetModule <IGraphLayoutModule>().Algorithm = myConverter.Algorithm; var nodeLayouts = new List <NodeLayout>(); var edgeLayouts = new List <EdgeLayout>(); ParsePlainFile(nodeLayouts, edgeLayouts, presentation.GetPropertySetFor <Caption>()); var module = presentation.GetModule <IGraphLayoutModule>(); module.Set(nodeLayouts, edgeLayouts); }
public WriteAction(DotWriter owner, IGraph graph, IGraphPicking picking, IModuleRepository modules) { myOwner = owner; myGraph = graph; myPicking = picking; myCaptions = modules.GetPropertySetFor <Caption>(); myNodeStyles = modules.GetPropertySetFor <NodeStyle>(); myEdgeStyles = modules.GetPropertySetFor <EdgeStyle>(); }