Beispiel #1
0
        public static Rectangle GetCircumscribedSquare(this CircularCloudLayoutCreator layoutCreator)
        {
            var width = Math.Max(Math.Abs(layoutCreator.GetMinXCoordinate() - layoutCreator.GetMinXCoordinate()),
                                 Math.Abs(layoutCreator.GetMaxYCoordinate() - layoutCreator.GetMinYCoordinate()));
            var height = width;

            return(new Rectangle(layoutCreator.Center.X - width / 2, layoutCreator.Center.Y - height / 2, width,
                                 height));
        }
Beispiel #2
0
 public new void SetUp()
 {
     CloudLayoutCreator =
         new CircularCloudLayoutCreator(
             new CircularCLoudLayouterSettings(TestingDegenerateSize.CenterPoint, 0.5));
     tiledRectangles = Enumerable
                       .Range(0, ElementsAmount)
                       .Select(number => CloudLayoutCreator.PutNextRectangle(TestingDegenerateSize.SingleSize))
                       .ToList();
 }
Beispiel #3
0
        public void Should_LocateFirstRectangleCenter_OnSpecifiedPoint(Point center)
        {
            var layoutCreator = new CircularCloudLayoutCreator(new CircularCLoudLayouterSettings(center, 1));
            var rect          = layoutCreator.PutNextRectangle(new Size(2, 2));

            (rect.X + rect.Width / 2)
            .Should()
            .Be(center.X, "X coords not equal");
            (rect.Y + rect.Height / 2)
            .Should()
            .Be(center.Y, "X coords not equal");
        }
Beispiel #4
0
        public Drawer(Size imgSize)
        {
            stringFormat = new StringFormat
            {
                LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Center
            };
            brush         = Brushes.Bisque;
            layoutCreator = new CircularCloudLayoutCreator(
                new CircularCLoudLayouterSettings(
                    new Point(imgSize.Width / 2, imgSize.Height / 2),
                    1));

            bitmap = new Bitmap(imgSize.Width, imgSize.Height);
            Graphics.FromImage(bitmap).Clear(Color.Black);
        }
        public void Should_CreateCircleShape_With1000RandomGeneratedRectangles(string fileName)
        {
            var cloudLayoutCreator =
                new CircularCloudLayoutCreator(new CircularCLoudLayouterSettings(new Point(600, 600), 1));
            var rnd = new Random();

            OnFailDrawer.DrawOriginOrientedRectangles(
                new Size(1200, 1200),
                Enumerable
                .Range(0, 100)
                .Select(num => new Size(rnd.Next(30, 100), rnd.Next(30, 100)))
                .Select(size => cloudLayoutCreator.PutNextRectangle(size)),
                fileName
                );
        }
Beispiel #6
0
 public void SetUp()
 {
     CloudLayoutCreator = new CircularCloudLayoutCreator(
         new CircularCLoudLayouterSettings(TestingDegenerateSize.CenterPoint, 1));
 }
Beispiel #7
0
 private static int GetMaxYCoordinate(this CircularCloudLayoutCreator layoutCreator)
 {
     return(layoutCreator.GetAllRectangles().Max(r => r.Y + r.Height));
 }