public static PlotResult CalculatePlot(double aspectRatio, DependencyGraph <string> graph, AssemblyFilterPreferences filterPreferences)
        {
            const double widthInches  = 100;
            var          heightInches = (double)(int)(widthInches / aspectRatio);

            // node [color=lightblue2, style=filled];
            // page=""8.5,11""
            // size=""7.5, 10""
            // ratio=All
            //                widthInches = 75;
            //                heightInches = 100;

            var extraCommands = $"size=\"{widthInches},{heightInches}\"\r\n    center=\"\"\r\n    ratio=All\r\n    node[width=.25,hight=.375,fontsize=12,color=lightblue2,style=filled]";
            var dotCommand    = DotCommandBuilder.Generate(graph, filterPreferences, extraCommands);

            // a temp file to store image
            var tempFile = TemporaryFileManager.CreateTemporaryFile();

            // generate dot image
            var dot = new DOTClass();

            dot.ToPNG(dotCommand).Save(tempFile);
            var dotImage = Image.FromFile(tempFile);

            // generate SVG
            var svgXml = dot.ToSvg(dotCommand);

            return(new PlotResult {
                DotCommand = dotCommand, Image = dotImage, SvgXml = svgXml
            });
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }

            // delete up our temporary files
            TemporaryFileManager.DeleteAllTemporaryFiles();

            base.Dispose(disposing);
        }
Exemple #3
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);

            TemporaryFileManager.DeleteAllTemporaryFiles();
        }