///<summary> ///</summary> ///<param name="graph"></param> ///<param name="outputFile"></param> public static void WriteAllExceptEdges(Graph graph, string outputFile) { using (var stream = File.Create(outputFile)) { var writer = new SvgGraphWriter(stream, graph) { Precision = 4, IgnoreEdges = true }; writer.Write(); } }
///<summary> ///</summary> ///<param name="graph"></param> ///<param name="outputFile"></param> ///<param name="nodeSanitizer"></param> ///<param name="attrSanitizer"></param> ///<param name="precision"></param> public static void Write(Graph graph, string outputFile, Func<string, string> nodeSanitizer, Func<string, string> attrSanitizer, int precision) { using (var stream = File.Create(outputFile)) { var writer = new SvgGraphWriter(stream, graph) { Precision = precision, NodeSanitizer = nodeSanitizer ?? (t => t), AttrSanitizer = attrSanitizer ?? (t => t) }; writer.Write(); } }
int ProcessDotFile(string inputFile) { Graph graph; int i = CreateGraphFromDotFile(inputFile, out graph); graph.Attr.LayerDirection = GetLayerDirection(); if (i != 0) return i; graph.LayoutAlgorithmSettings = PickLayoutAlgorithmSettings(graph.EdgeCount, graph.NodeCount); if (argsParser.OptionIsUsed(NoArrowheads)) RemoveArrowheadsFromGraph(graph); EnlargeLabelMargins(graph); SetConsolasFontAndSize(graph, 13); // rendering var renderer = new GraphRenderer(graph); renderer.CalculateLayout(); SetBoxRadiuses(graph); var outputFile = Path.ChangeExtension(inputFile, ".svg"); string outputDir = argsParser.GetValueOfOptionWithAfterString(OutputDirOption); if (outputDir != null) { var name = Path.GetFileName(outputFile); if (name != null) outputFile = Path.Combine(outputDir, name); } SetConsolasFontAndSize(graph, 11); if (argsParser.OptionIsUsed(NoLabelsOption)) RemoveLabelsFromGraph(graph); var svgWriter = new SvgGraphWriter(File.Create(outputFile), graph) { NodeSanitizer = AntiXss.HtmlAttributeEncode, AttrSanitizer = AntiXss.HtmlAttributeEncode, Precision = precision, AllowedToWriteUri = !argsParser.OptionIsUsed(NoUrls)}; svgWriter.Write(); DumpFileToConsole(outputFile); if(msaglOutput) { outputFile = SetMsaglOutputFileName(inputFile); var geomGraph = graph.GeometryGraph; WriteGeomGraph(outputFile, geomGraph); } return 0; }