Interface IMapOrientation


public interface IMapOrientation
  • Method Summary

    Modifier and TypeMethodDescription
    java.awt.geom.Rectangle2DgetBounds​(int x, int y, IMap map)
    Determines the bounding box for the tile at the given coordinates.
    java.awt.geom.Rectangle2DgetBounds​(java.awt.Point tile, IMap map)
    Determines the bounding box for the tile at the given coordinates.
    java.awt.geom.Rectangle2DgetEnclosingTileBounds​(double x, double y, IMap map)
    Returns the bounding box of the tile containing the given coordinates.
    java.awt.geom.Rectangle2DgetEnclosingTileBounds​(java.awt.geom.Point2D location, IMap map)
    Returns the bounding box of the tile containing the given coordinates.
    java.awt.ShapegetEnclosingTileShape​(double x, double y, IMap map)
    Returns the shape of the tile containing the given coordinates.
    java.awt.ShapegetEnclosingTileShape​(java.awt.geom.Point2D location, IMap map)
    Returns the shape of the tile containing the given coordinates.
    java.awt.PointgetLocation​(int x, int y, IMap map)
    Determines the rendered location of a tile within the given IMap, given the saved coordinates of the tile.
    java.awt.PointgetLocation​(java.awt.Point tile, IMap map)
    Determines the rendered location of a tile within the given IMap, given the saved coordinates of the tile.
    java.lang.StringgetName()
    Gets the name of this IMapOrientation.
    java.awt.ShapegetShape​(int x, int y, IMap map)
    Creates a Shape for the tile at the given coordinates.
    java.awt.ShapegetShape​(java.awt.Point tile, IMap map)
    Creates a Shape for the tile at the given coordinates.
    java.awt.DimensiongetSize​(IMap map)
    Determines the size required for all tiles within the given map to be drawn into an image.
    java.awt.PointgetTile​(double x, double y, IMap map)
    Determines the coordinates of the tile containing the given point, as determined by getShape(int, int, IMap).
    java.awt.PointgetTile​(java.awt.geom.Point2D location, IMap map)
    Determines the coordinates of the tile containing the given point, as determined by getShape(int, int, IMap).
  • Method Details

    • getName

      java.lang.String getName()
      Gets the name of this IMapOrientation.
      Returns:
      The name of this orientation
    • getSize

      java.awt.Dimension getSize​(IMap map)
      Determines the size required for all tiles within the given map to be drawn into an image. Tiles larger than the map's tile size may not fit within this size.
      Parameters:
      map - The IMap to measure
      Returns:
      The required image size
    • getLocation

      java.awt.Point getLocation​(int x, int y, IMap map)
      Determines the rendered location of a tile within the given IMap, given the saved coordinates of the tile. The coordinates of the point returned are those of the bottom-left corner of the tile's image relative to the top-left corner of the rectangle in which tiles in the given map are drawn. The point returned by this method will not necessarily be contained inside the shape returned by getShape.
      Parameters:
      x - The saved X coordinate of the tile
      y - The saved Y coordinate of the tile
      map - The IMap that the tile is in
      Returns:
      The location of a tile for the given map and coordinates
    • getLocation

      java.awt.Point getLocation​(java.awt.Point tile, IMap map)
      Determines the rendered location of a tile within the given IMap, given the saved coordinates of the tile. The coordinates of the point returned are those of the bottom-left corner of the tile's image relative to the top-left corner of the rectangle in which tiles in the given map are drawn. The point returned by this method will not necessarily be contained inside the shape returned by getShape.
      Parameters:
      tile - The saved location of the tile
      map - The IMap that the tile is in
      Returns:
      The location of a tile for the given map and coordinates
    • getShape

      java.awt.Shape getShape​(int x, int y, IMap map)
      Creates a Shape for the tile at the given coordinates. The shapes returned by this method should reflect the intended shape of a tile in this orientation, and in general should not overlap.
      Parameters:
      x - The X coordinate of the tile
      y - The Y coordinate of the tile
      map - The IMap that the tile is in
      Returns:
      The shape of the tile
    • getShape

      java.awt.Shape getShape​(java.awt.Point tile, IMap map)
      Creates a Shape for the tile at the given coordinates. The shapes returned by this method should reflect the intended shape of a tile in this orientation, and in general should not overlap.
      Parameters:
      tile - The location of the tile
      map - The IMap that the tile is in
      Returns:
      The shape of the tile
    • getBounds

      java.awt.geom.Rectangle2D getBounds​(int x, int y, IMap map)
      Determines the bounding box for the tile at the given coordinates. A call to this method is equivalent to calling orientation.getShape(x, y, map).getBounds2D().
      Parameters:
      x - The X coordinate of the tile
      y - The Y coordinate of the tile
      map - The IMap that the tile is in
      Returns:
      The bounding box of the tile
    • getBounds

      java.awt.geom.Rectangle2D getBounds​(java.awt.Point tile, IMap map)
      Determines the bounding box for the tile at the given coordinates. A call to this method is equivalent to calling orientation.getShape(tile, map).getBounds2D().
      Parameters:
      tile - The location of the tile
      map - The IMap that the tile is in
      Returns:
      The bounding box of the tile
    • getEnclosingTileShape

      java.awt.Shape getEnclosingTileShape​(double x, double y, IMap map)
      Returns the shape of the tile containing the given coordinates. A call to this method is equivalent to calling orientation.getShape(orientation.getTile(x, y, map), map).
      Parameters:
      x - The X coordinate to contain
      y - The Y coordinate to contain
      map - The IMap containing the tile
      Returns:
      The shape of the tile containing the given point
    • getEnclosingTileShape

      java.awt.Shape getEnclosingTileShape​(java.awt.geom.Point2D location, IMap map)
      Returns the shape of the tile containing the given coordinates. A call to this method is equivalent to calling orientation.getShape(orientation.getTile(location, map), map).
      Parameters:
      location - The point to contain
      map - The IMap containing the tile
      Returns:
      The shape of the tile containing the given point
    • getEnclosingTileBounds

      java.awt.geom.Rectangle2D getEnclosingTileBounds​(double x, double y, IMap map)
      Returns the bounding box of the tile containing the given coordinates. A call to this method is equivalent to calling orientation.getShape(orientation.getTile(x, y, map), map).getBounds2D().
      Parameters:
      x - The X coordinate to contain
      y - The Y coordinate to contain
      map - The IMap containing the tile
      Returns:
      The bounding box of the tile containing the given point
    • getEnclosingTileBounds

      java.awt.geom.Rectangle2D getEnclosingTileBounds​(java.awt.geom.Point2D location, IMap map)
      Returns the bounding box of the tile containing the given coordinates. A call to this method is equivalent to calling orientation.getShape(orientation.getTile(location, map), map).getBounds2D().
      Parameters:
      location - The point to contain
      map - The IMap containing the tile
      Returns:
      The bounding box of the tile containing the given point
    • getTile

      java.awt.Point getTile​(double x, double y, IMap map)
      Determines the coordinates of the tile containing the given point, as determined by getShape(int, int, IMap).
      Parameters:
      x - The X coordinate to contain
      y - The Y coordinate to contain
      map - The IMap containing the tile
      Returns:
      The tile coordinates of the tile containing the point.
      Throws:
      java.lang.ArithmeticException - if the tiles are packed too tightly to resolve
    • getTile

      java.awt.Point getTile​(java.awt.geom.Point2D location, IMap map)
      Determines the coordinates of the tile containing the given point, as determined by getShape(int, int, IMap).
      Parameters:
      location - The point to contain
      map - The IMap containing the tile
      Returns:
      The tile coordinates of the tile containing the point.
      Throws:
      java.lang.ArithmeticException - if the tiles are packed too tightly to resolve