示例#1
0
        public static void Main(string[] args)
        {
            var rnd      = new Random();
            var layouter = new CircularCloudLayouter(new Point(500, 500));

            for (var i = 0; i < 100; i++)
            {
                layouter.PutNextRectangle(new Size(10 + rnd.Next(100),
                                                   10 + rnd.Next(100)));
            }

            TagCloudVisualizer.Visualize(layouter, new Size(1000, 1000))
            .Save("result.png", ImageFormat.Png);

            Process.Start("result.png");
        }
示例#2
0
        public void CreateImageOnFail()
        {
            if (TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Failed)
            {
                return;
            }

            var path = Path.Combine(
                Directory.GetCurrentDirectory(),
                "TestOutput",
                $"{TestContext.CurrentContext.Test.Name}.png"
                );
            var bmp = TagCloudVisualizer.Visualize(layouter, new Size(1000, 1000));

            bmp.Save(path, ImageFormat.Png);
            TestContext.WriteLine($"Tag cloud visualization saved to file {path}");
        }