Exemplo n.º 1
0
 public override WordRectangle PutNextWord(string word, Size rectangleSize)
 {
     while (true)
     {
         var currentPoint      = curve.CurrentPoint;
         var possibleRectangle = new Rectangle(currentPoint, rectangleSize);
         curve.Next();
         if (!CanFit(possibleRectangle))
         {
             continue;
         }
         var wordRectangle = new WordRectangle(possibleRectangle, word);
         WordRectangles.Add(wordRectangle);
         return(wordRectangle);
     }
 }
Exemplo n.º 2
0
 public override WordRectangle PutNextWord(string word, Size rectangleSize)
 {
     while (true)
     {
         var currentPoint      = curve.CurrentPoint;
         var possibleRectangle = new Rectangle(currentPoint, rectangleSize);
         var canFit            = WordRectangles.All(rect => !rect.Rectangle.IntersectsWith(possibleRectangle));
         curve.Next();
         if (!canFit)
         {
             continue;
         }
         var wordRectangle = new WordRectangle(possibleRectangle, word);
         WordRectangles.Add(wordRectangle);
         return(wordRectangle);
     }
 }
Exemplo n.º 3
0
 private bool CanFit(Rectangle rectangle)
 {
     return(WordRectangles.All(rect => !rect.Rectangle.IntersectsWith(rectangle)));
 }