Class MapUtilities
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.MapUtilities
public final class MapUtilities
extends java.lang.ObjectMethod Summary
Modifier and Type Method Description static java.awt.geom.Path2DconvertPolyshapeToPath(IMapObject mapObject)static IMapObjectfindMapObject(IMap map, int id)static ITilesetfindTileSet(IMap map, ITile tile)Searches for the tile set that contains the specified tile, identified by the grid id.static java.util.List<java.awt.geom.Point2D>getAbsolutePolyshapePoints(IMapObject mapObject)static java.awt.geom.Rectangle2DgetBounds(IMapObject... objects)static java.awt.geom.Point2DgetMapLocation(IMap map, java.awt.Point tileLocation)static intgetMaxMapId(IMap map)static java.awt.PointgetTile(IMap map, java.awt.geom.Point2D mapLocation)Get the corresponding tile for a given pixel map location.static java.awt.PointgetTile(java.awt.geom.Point2D mapLocation)Get the corresponding tile for a given pixel map location.static java.awt.geom.Rectangle2DgetTileBoundingBox(int x, int y)static java.awt.geom.Rectangle2DgetTileBoundingBox(IMap map, int x, int y)static java.awt.geom.Rectangle2DgetTileBoundingBox(IMap map, java.awt.geom.Point2D mapLocation)static java.awt.geom.Rectangle2DgetTileBoundingBox(IMap map, java.awt.geom.Rectangle2D box)static java.awt.geom.Rectangle2DgetTileBoundingBox(IMap map, java.awt.Point tile)static java.awt.geom.Rectangle2DgetTileBoundingBox(java.awt.geom.Point2D mapLocation)static java.awt.geom.Rectangle2DgetTileBoundingBox(java.awt.Point tile)static java.util.List<ITile>getTilesByPixelLocation(IMap map, java.awt.geom.Point2D location)static ITilegetTopMostTile(IMap map, java.awt.geom.Point2D location)static ITilegetTopMostTile(IMap map, java.awt.Point point)static ITilegetTopMostTile(java.awt.geom.Point2D location)static ITilegetTopMostTile(java.awt.Point point)static booleanisStaggeredRowOrColumn(StaggerIndex staggerIndex, int index)Check if the row or column with the given index is staggered.
Method Details
getBounds
getMaxMapId
getTileBoundingBox
public static java.awt.geom.Rectangle2D getTileBoundingBox(IMap map, java.awt.geom.Rectangle2D box)getTile
public static java.awt.Point getTile(java.awt.geom.Point2D mapLocation)Get the corresponding tile for a given pixel map location. This is an overload taking the Map from the current environment to calculate a tile location.- Parameters:
mapLocation- the pixel map location.- Returns:
- The x / y tile coordinate for the given location.
- See Also:
getTile(IMap, Point2D)
getTile
Get the corresponding tile for a given pixel map location.- Parameters:
map- The map on which to calculate the tile location.mapLocation- the pixel map location.- Returns:
- The x / y tile coordinate for the given mapLocation.
isStaggeredRowOrColumn
Check if the row or column with the given index is staggered.- Parameters:
staggerIndex- the staggerIndex property of the map. Every second row (or column, depending on theStaggerAxisof the map is staggered half a tile.index- the index of the current row or column for which we want to determine if it's staggered or not.- Returns:
- a boolean representing if the row or column with the given index is staggered.
getMapLocation
getTilesByPixelLocation
getTopMostTile
getTopMostTile
getTopMostTile
getTopMostTile
findTileSet
Searches for the tile set that contains the specified tile, identified by the grid id.- Parameters:
map- the maptile- the tile- Returns:
- the tileset
convertPolyshapeToPath
getAbsolutePolyshapePoints
public static java.util.List<java.awt.geom.Point2D> getAbsolutePolyshapePoints(IMapObject mapObject)findMapObject
getTileBoundingBox
public static java.awt.geom.Rectangle2D getTileBoundingBox(java.awt.geom.Point2D mapLocation)getTileBoundingBox
public static java.awt.geom.Rectangle2D getTileBoundingBox(IMap map, java.awt.geom.Point2D mapLocation)getTileBoundingBox
public static java.awt.geom.Rectangle2D getTileBoundingBox(int x, int y)getTileBoundingBox
getTileBoundingBox
public static java.awt.geom.Rectangle2D getTileBoundingBox(java.awt.Point tile)getTileBoundingBox
