/// <summary> /// Initializes a new instance of the DOTDumper. /// </summary> /// <param name="filename">Destination file.</param> /// <param name="graphname">Name of the host graph.</param> /// <param name="flags">Flags to control the dumper's behavior.</param> /// <exception cref="IOException">Thrown when the destination cannot be created.</exception> /// TODO: replace VCGFlags by generic GrFlags (to be introduced and mapped to VCG and DOT) public DOTDumper(String filename, String graphname, VCGFlags flags) { groupNodesToCharacteristicContainedNode = new Dictionary <INode, INode>(); groupNesting = new Stack <INode>(); sw = new StreamWriter(filename, false); WriteLine("digraph {0} {{", graphname); Indent(); WriteLine("splines={0};", (flags & VCGFlags.Splines) != 0 ? "true" : "false"); WriteLine("rankdir={0};", orientation[(int)(flags & VCGFlags.OrientMask)]); WriteLine("compound=true;"); // suggested layouters mapping in case the layout would not be specified by the "dot" or "neato" viewer parameter: // - "Organic", "Random" -> neato // - "Circular" -> circo // - "Hierarchic", "Orthogonal", "Tree", "Diagonal", "Incremental Hierarchic", "Compilergraph" -> dot }
/// <summary> /// Initializes a new instance of VCGDump. /// </summary> /// <param name="filename">Destination file.</param> /// <param name="flags">Flags to control the dumper's behavior.</param> /// <param name="layouter">Specifies the yComp layouter to be used.</param> /// <exception cref="IOException">Thrown when the destination cannot be created.</exception> /// <remarks>Currently (YComp 1.3.9) valid layouters are: /// - "Random" /// - "Hierarchic" /// - "Organic" /// - "Orthogonal" /// - "Circular" /// - "Tree" /// - "Diagonal" /// - "Incremental Hierarchic" /// - "Compilergraph" /// </remarks> public VCGDumper(String filename, VCGFlags flags, String layouter) { sw = new StreamWriter(filename, false); WriteLine("graph:{{"); indent++; WriteLine("infoname 1: \"Attributes\""); WriteLine("display_edge_labels: {0}", (flags & VCGFlags.EdgeLabels) != 0 ? "yes" : "no"); WriteLine("layoutalgorithm: normal //$ \"{0}\"", layouter); WriteLine("port_sharing: {0}", (flags & VCGFlags.PortSharing) != 0 ? "yes" : "no"); WriteLine("splines: {0}", (flags & VCGFlags.Splines) != 0 ? "yes" : "no"); WriteLine("manhattan_edges: {0}", (flags & VCGFlags.ManhattanEdges) != 0 ? "yes" : "no"); WriteLine("smanhattan_edges: {0}", (flags & VCGFlags.SManhattanEdges) != 0 ? "yes" : "no"); WriteLine("orientation: {0}", orientation[(int)(flags & VCGFlags.OrientMask)]); WriteLine("edges: {0}", (flags & VCGFlags.SuppressEdges) != 0 ? "no" : "yes"); WriteLine("nodes: {0}", (flags & VCGFlags.SuppressNodes) != 0 ? "no" : "yes"); WriteLine("classname 1: \"normal\""); WriteLine("classname 2: \"matches\""); WriteLine("classname 3: \"hidden\""); }