Interface IMapOrientation
public interface IMapOrientation
Method Summary
Modifier and Type Method Description java.awt.geom.Rectangle2D
getBounds(int x, int y, IMap map)
Determines the bounding box for the tile at the given coordinates.java.awt.geom.Rectangle2D
getBounds(java.awt.Point tile, IMap map)
Determines the bounding box for the tile at the given coordinates.java.awt.geom.Rectangle2D
getEnclosingTileBounds(double x, double y, IMap map)
Returns the bounding box of the tile containing the given coordinates.java.awt.geom.Rectangle2D
getEnclosingTileBounds(java.awt.geom.Point2D location, IMap map)
Returns the bounding box of the tile containing the given coordinates.java.awt.Shape
getEnclosingTileShape(double x, double y, IMap map)
Returns the shape of the tile containing the given coordinates.java.awt.Shape
getEnclosingTileShape(java.awt.geom.Point2D location, IMap map)
Returns the shape of the tile containing the given coordinates.java.awt.Point
getLocation(int x, int y, IMap map)
Determines the rendered location of a tile within the givenIMap
, given the saved coordinates of the tile.java.awt.Point
getLocation(java.awt.Point tile, IMap map)
Determines the rendered location of a tile within the givenIMap
, given the saved coordinates of the tile.java.lang.String
getName()
Gets the name of thisIMapOrientation
.java.awt.Shape
getShape(int x, int y, IMap map)
Creates aShape
for the tile at the given coordinates.java.awt.Shape
getShape(java.awt.Point tile, IMap map)
Creates aShape
for the tile at the given coordinates.java.awt.Dimension
getSize(IMap map)
Determines the size required for all tiles within the given map to be drawn into an image.java.awt.Point
getTile(double x, double y, IMap map)
Determines the coordinates of the tile containing the given point, as determined bygetShape(int, int, IMap)
.java.awt.Point
getTile(java.awt.geom.Point2D location, IMap map)
Determines the coordinates of the tile containing the given point, as determined bygetShape(int, int, IMap)
.
Method Details
getName
java.lang.String getName()Gets the name of thisIMapOrientation
.- Returns:
- The name of this orientation
getSize
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
- TheIMap
to measure- Returns:
- The required image size
getLocation
Determines the rendered location of a tile within the givenIMap
, 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 bygetShape
.- Parameters:
x
- The saved X coordinate of the tiley
- The saved Y coordinate of the tilemap
- TheIMap
that the tile is in- Returns:
- The location of a tile for the given map and coordinates
getLocation
Determines the rendered location of a tile within the givenIMap
, 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 bygetShape
.- Parameters:
tile
- The saved location of the tilemap
- TheIMap
that the tile is in- Returns:
- The location of a tile for the given map and coordinates
getShape
Creates aShape
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 tiley
- The Y coordinate of the tilemap
- TheIMap
that the tile is in- Returns:
- The shape of the tile
getShape
Creates aShape
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 tilemap
- TheIMap
that the tile is in- Returns:
- The shape of the tile
getBounds
Determines the bounding box for the tile at the given coordinates. A call to this method is equivalent to callingorientation.getShape(x, y, map).getBounds2D()
.- Parameters:
x
- The X coordinate of the tiley
- The Y coordinate of the tilemap
- TheIMap
that the tile is in- Returns:
- The bounding box of the tile
getBounds
Determines the bounding box for the tile at the given coordinates. A call to this method is equivalent to callingorientation.getShape(tile, map).getBounds2D()
.- Parameters:
tile
- The location of the tilemap
- TheIMap
that the tile is in- Returns:
- The bounding box of the tile
getEnclosingTileShape
Returns the shape of the tile containing the given coordinates. A call to this method is equivalent to callingorientation.getShape(orientation.getTile(x, y, map), map)
.- Parameters:
x
- The X coordinate to containy
- The Y coordinate to containmap
- TheIMap
containing the tile- Returns:
- The shape of the tile containing the given point
getEnclosingTileShape
Returns the shape of the tile containing the given coordinates. A call to this method is equivalent to callingorientation.getShape(orientation.getTile(location, map), map)
.- Parameters:
location
- The point to containmap
- TheIMap
containing the tile- Returns:
- The shape of the tile containing the given point
getEnclosingTileBounds
Returns the bounding box of the tile containing the given coordinates. A call to this method is equivalent to callingorientation.getShape(orientation.getTile(x, y, map), map).getBounds2D()
.- Parameters:
x
- The X coordinate to containy
- The Y coordinate to containmap
- TheIMap
containing the tile- Returns:
- The bounding box of the tile containing the given point
getEnclosingTileBounds
Returns the bounding box of the tile containing the given coordinates. A call to this method is equivalent to callingorientation.getShape(orientation.getTile(location, map), map).getBounds2D()
.- Parameters:
location
- The point to containmap
- TheIMap
containing the tile- Returns:
- The bounding box of the tile containing the given point
getTile
Determines the coordinates of the tile containing the given point, as determined bygetShape(int, int, IMap)
.- Parameters:
x
- The X coordinate to containy
- The Y coordinate to containmap
- TheIMap
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
Determines the coordinates of the tile containing the given point, as determined bygetShape(int, int, IMap)
.- Parameters:
location
- The point to containmap
- TheIMap
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