Package civquest.util

Examples of civquest.util.Rectangle


      }
      if (edge.y > largestY) {
        largestY = edge.y;
      }     
    }
    return new Rectangle(smallestX, smallestY, largestX, largestY);
  }
View Full Code Here


    public Iterator getAbsRectFieldIterator(Coordinate coord1, Coordinate coord2) {
        return new AbsRectFieldIterator(coord1, coord2);
    }

    public Rectangle getAbsImagePaintRectangle(Coordinate coord) {
        return new Rectangle(getAbsImagePaintCoord(coord),
                             getAbsImagePaintCoord(coord).add(cellWidth, cellHeight));
    }
View Full Code Here

        retValue[3] = base.add(0, cellHeight);
        return retValue;
    }

    public Rectangle getFieldRectangle(int x1, int y1, int x2, int y2) {
    return new Rectangle(getUnscrolledArrayCoord(x1, y1),
               getUnscrolledArrayCoord(x2, y2));
    }
View Full Code Here

   *         inside
   */
  public Rectangle getBoundingRect() {
    if (p1.x < p2.x) {
      if (p1.y < p2.y) {
                return new Rectangle(p1.x, p1.y, p2.x, p2.y);
      } else {
                return new Rectangle(p1.x, p2.y, p2.x, p1.y);
      }
    } else {
      if (p1.y < p2.y) {
                return new Rectangle(p2.x, p1.y, p1.x, p2.y);
      } else {
                return new Rectangle(p2.x, p2.y, p1.x, p1.y);
      }      
    }       
  }
View Full Code Here

   *  inside this GeoPrimitive).
   * @return smallest Rectangle where the whole GeoPrimitive is
   *         inside
   */
  public Rectangle getBoundingRect() {
        return new Rectangle(x, y, x + width, y + height);
    }
View Full Code Here

    public Iterator getAbsRectFieldIterator(Coordinate coord1, Coordinate coord2) {
    return new AbsRectFieldIterator(coord1, coord2);
    }

    public Rectangle getAbsImagePaintRectangle(Coordinate coord) {
    return new Rectangle(getAbsImagePaintCoord(coord),
               getAbsImagePaintCoord(coord).add(2 * halfCellWidth, 4 * halfCellHeight));
    }
View Full Code Here

    Coordinate upperLeft = getUnscrolledArrayCoord(x1, y1);
    Coordinate upperRight = getUnscrolledArrayCoord(x2, y1);
    Coordinate bottomLeft = getUnscrolledArrayCoord(x1, y2);
    Coordinate bottomRight = getUnscrolledArrayCoord(x2, y2);

    return new Rectangle(upperLeft.x, upperRight.y, bottomRight.x, bottomLeft.y);
    }
View Full Code Here

   */
  public void updateDirtyFields(Buffer buffer, BufferManager bufferManager)
    throws InvalidImageException {
    MapData mapData = Game.getMapData();

    Rectangle fieldRect = buffer.getFieldRect();

    Coordinate fieldStart = fieldRect.getTopLeftCorner();
    boolean[][] markedFields = buffer.getMarkedFields();

    Graphics2D graphics = buffer.getGraphics();
    Shape oldClip = graphics.getClip();            // Is this really necessary?

    int arSize = fieldRect.getWidth() + 1 + fieldRect.getHeight() + 1;
   
    boolean[][] markedSections = calculateMarkedSections(markedFields, arSize);

    int startx = fieldRect.getHeight();
    int endx = startx + 1;
    int startDX = -1;
    int endDX = 1;

    // THINK ABOUT the tries to draw non-existent fields - at moment they
View Full Code Here

  }

  /**
   */
  public void drawGeoPrimitive(Graphics g, GeoPrimitive geoPrim) {
    Rectangle boundingRect = geoPrim.getBoundingRect();

    // Do this in a more efficient way
    Rectangle viewRect = new Rectangle(quadMap.getViewportPosition(),
                       quadMap.getViewportPosition().add(quadMap.getViewportSize()));
    Properties properties = quadMap.getProperties();
    Coordinate dScroll = new Coordinate(properties.getScrollSize().x , 0);

    // The leftmost coordinate we want to use for testing if viewRect
    // contains it.       
    Coordinate testCoord = geoPrim.getBoundingRect().getTopLeftCorner();       

    while (testCoord.x <= viewRect.getX2()) {
            geoPrim.paint(g, (Coordinate)(viewRect.getTopLeftCorner().clone()));
            testCoord = testCoord.add(dScroll);
            geoPrim.addOffset(dScroll);
        }
  }
View Full Code Here

  }


  public void paintBuffers(Graphics graphics, Rectangle rect,
               Coordinate negativeOffset) {
    Rectangle bufferRect = getBuffers(rect);

    if (bufferRect != null) {
      Coordinate start = bufferRect.getTopLeftCorner();
      Coordinate end = bufferRect.getBottomRightCorner();
   
      for (int x = start.x; x <= end.x; x++) {
        for (int y = start.y; y <= end.y; y++) {
          BufferedImage image = getBufferImage(x, y);
          Coordinate bufferPos = getBufferPos(x, y);
View Full Code Here

TOP

Related Classes of civquest.util.Rectangle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.