Example #1
0
        private WordRectangle PutNextWord(SizedWord sizedWord)
        {
            var rectangleSize    = sizedWord.WordSize;
            var point            = layoutAlgorithm.GetNextPoint();
            var checkedRectangle = new RectangleF(point, rectangleSize);

            while (!IsCorrectToPlace(checkedRectangle))
            {
                point            = layoutAlgorithm.GetNextPoint();
                checkedRectangle = new RectangleF(point, rectangleSize);
            }

            var adjustedRectangle = AdjustRectangle(checkedRectangle);
            var wordRectangle     = new WordRectangle(sizedWord, adjustedRectangle);

            wordRectangles.Add(wordRectangle);
            return(wordRectangle);
        }
        public Rectangle PutNextRectangle(Size rectangleSize)
        {
            while (true)
            {
                var point     = layoutAlgorithm.GetNextPoint();
                var rectangle = new Rectangle(point, rectangleSize);

                if (rectangle.IntersectsWith(rectangles))
                {
                    continue;
                }

                rectangles.Add(rectangle);
                return(rectangle);
            }
        }