public HashSet <Rectangle> Centering() { var centeringCloudLayout = new CircularCloudLayouter(center); var newRectangles = new HashSet <Rectangle>(); foreach (var rectangle in rectangles.OrderBy(x => - x.Width * x.Height)) { newRectangles.Add(centeringCloudLayout.PutNextRectangle(rectangle.Size)); } return(newRectangles); }
public static Bitmap DrawRectangles(CircularCloudLayouter ccl, int bitmapWidth = 4000, int bitmapHeight = 4000) { var bitmap = new Bitmap(bitmapWidth, bitmapHeight); var graphics = Graphics.FromImage(bitmap); var brush = new SolidBrush(Color.Black); var pen = new Pen(Color.Red, 10); graphics.Clear(Color.White); graphics.FillRectangles(brush, ccl.RectanglesList.ToArray()); graphics.DrawRectangles(pen, ccl.RectanglesList.ToArray()); return(bitmap); }
public void SetUp() { ccl = new CircularCloudLayouter(new Point(0, 0), true, new SpiralPointsGenerator()); }