Map implements GroupContainer, PropertyBagHolder Uses PropertyBagTrait
Representation of a map inside a tmx file.
This class contains all map related data. It closely represent the map element inside of a tmx file.
Tags
Interfaces, Classes and Traits
- GroupContainer
- A group container provides different data holder objects.
- PropertyBagHolder
- Interface for all elements, which contains properties.
Table of Contents
- ORIENTATION_HEXAGONAL = 4
- Hexagonal orientation.
- ORIENTATION_ISOMETRIC = 2
- Isometric orientation.
- ORIENTATION_ORTHOGONAL = 1
- Rendering map from right / down.
- ORIENTATION_STAGGERED = 3
- Staggered orientation.
- RENDER_ORDER_LEFT_DOWN = 3
- Render the map from left / down.
- RENDER_ORDER_LEFT_UP = 4
- Render the map from left / up.
- RENDER_ORDER_RIGHT_DOWN = 1
- Rendering map from right / down.
- RENDER_ORDER_RIGHT_UP = 2
- Render the map from right / up.
- $backgroundColor : string|null
- The background color of this map.
- $compressionLevel : float|null
- The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default.
- $groups : array<string|int, mixed>
- Array of group objects.
- $height : int|null
- The height (in tiles) of this map.
- $imageLayers : array<string|int, mixed>
- Array of image layer objects.
- $infiniteMap : bool
- If the map is infinite or not.
- $layers : array<string|int, mixed>
- Array of layer objects.
- $nextLayerId : string|null
- the next id of the layer which will be added.
- $nextObjectId : string|null
- The id of the next object which will be added.
- $objectLayers : array<string|int, mixed>
- Array of layer objects.
- $orientation : int|null
- The internal representation of the orientation of the map.
- $propertyBag : PropertyBag|null
- $renderOrder : int
- Used rendering order.
- $tiledVersion : string|null
- The version of tiled, which created the map.
- $tileHeight : int|null
- The height of one tile in pixel.
- $tileSets : array<string|int, mixed>
- Array of tileSet objects.
- $tileWidth : int|null
- The width of one tile in pixel.
- $version : string|null
- The parsed version of the map.
- $width : int|null
- The width (in tiles) of this map.
- addGroup() : $this
- Add a group to this map.
- addImageLayer() : $this
- Add an image layer to this map.
- addLayer() : $this
- Add a layer to this map.
- addObjectLayer() : $this
- Add an object layer to this map.
- addTileSet() : $this
- Add a tileSet to this map.
- getBackgroundColor() : string|null
- get the background color in the format #000000.
- getCompressionLevel() : float|null
- get the compression level.
- getGroups() : array<string|int, Group>
- get all groups.
- getHeight() : int|null
- get the height in amount of tiles.
- getImageLayers() : array<string|int, ImageLayer>
- get the image layers.
- getLayers() : array<string|int, Layer>
- get all map layers of this map.
- getNextLayerId() : string|null
- get the next layer id.
- getNextObjectId() : string|null
- Get the next objectId.
- getObjectLayers() : array<string|int, ObjectLayer>
- Get all object layers as an array.
- getOrientation() : int|null
- get orientation as int.
- getOrientationAsString() : string
- Returns the orientation as a string.
- getPropertyBag() : PropertyBag|null
- getRenderOrder() : int
- Get the rendering order as an int.
- getRenderOrderAsString() : string
- Get the rendering order as a string.
- getTiledVersion() : string|null
- Get the version of the tiled editor, which saved this map.
- getTileHeight() : int|null
- get the tile height in pixel.
- getTileSets() : array<string|int, TileSet>
- get all tileSets as array.
- getTileWidth() : int|null
- get the tiles width in pixel.
- getVersion() : string|null
- Get the version of the tmx format.
- getWidth() : int|null
- get the width (in tiles) of this map.
- isInfiniteMap() : bool
- Returns true if the map is infinite.
- removeGroup() : $this
- Remove a group from this map.
- removeImageLayer() : $this
- Remove an image layer from this map.
- removeLayer() : $this
- Remove a layer from this map.
- removeObjectLayer() : $this
- Remove an object layer from this map.
- removeTileSet() : $this
- Remove a tileSet from this map.
- setBackgroundColor() : string|null
- set the background color in the format #000000.
- setCompressionLevel() : $this
- set the compression level.
- setHeight() : $this
- set the height in amount of tiles.
- setInfiniteMap() : $this
- Set if this map is infinite.
- setNextLayerId() : Map
- set the next layer id as string.
- setNextObjectId() : $this
- set the next object id.
- setOrientation() : $this
- Set the orientation as int.
- setOrientationAsString() : $this
- Set the current orientation with a string.
- setPropertyBag() : self
- setRenderOrder() : $this
- Get the rendering order as an int.
- setRenderOrderAsString() : $this
- Set the rendering order as a string.
- setTiledVersion() : $this
- Set the tiled version.
- setTileHeight() : $this
- set the tile height in pixel.
- setTileSets() : $this
- Set the tileSet.
- setTileWidth() : $this
- set the tile width in pixel.
- setVersion() : $this
- Set the version of the tmx format.
- setWidth() : $this
- set the width in amount of tiles.
Constants
ORIENTATION_HEXAGONAL
Hexagonal orientation.
public
mixed
ORIENTATION_HEXAGONAL
= 4
ORIENTATION_ISOMETRIC
Isometric orientation.
public
mixed
ORIENTATION_ISOMETRIC
= 2
ORIENTATION_ORTHOGONAL
Rendering map from right / down.
public
mixed
ORIENTATION_ORTHOGONAL
= 1
ORIENTATION_STAGGERED
Staggered orientation.
public
mixed
ORIENTATION_STAGGERED
= 3
RENDER_ORDER_LEFT_DOWN
Render the map from left / down.
public
mixed
RENDER_ORDER_LEFT_DOWN
= 3
RENDER_ORDER_LEFT_UP
Render the map from left / up.
public
mixed
RENDER_ORDER_LEFT_UP
= 4
RENDER_ORDER_RIGHT_DOWN
Rendering map from right / down.
public
mixed
RENDER_ORDER_RIGHT_DOWN
= 1
RENDER_ORDER_RIGHT_UP
Render the map from right / up.
public
mixed
RENDER_ORDER_RIGHT_UP
= 2
Properties
$backgroundColor
The background color of this map.
private
string|null
$backgroundColor
= null
The background color is in the rgb hexadecimal format (like #000000)
Tags
$compressionLevel
The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default.
private
float|null
$compressionLevel
= null
Tags
$groups
Array of group objects.
private
array<string|int, mixed>
$groups
= []
Tags
$height
The height (in tiles) of this map.
private
int|null
$height
= null
Tags
$imageLayers
Array of image layer objects.
private
array<string|int, mixed>
$imageLayers
= []
Tags
$infiniteMap
If the map is infinite or not.
private
bool
$infiniteMap
= false
Tags
$layers
Array of layer objects.
private
array<string|int, mixed>
$layers
= []
Tags
$nextLayerId
the next id of the layer which will be added.
private
string|null
$nextLayerId
= null
Tags
$nextObjectId
The id of the next object which will be added.
private
string|null
$nextObjectId
= null
Tags
$objectLayers
Array of layer objects.
private
array<string|int, mixed>
$objectLayers
= []
Tags
$orientation
The internal representation of the orientation of the map.
private
int|null
$orientation
= self::ORIENTATION_ORTHOGONAL
the orientation is internally saved as an integer: 0 (orthogonal), 1 (isometric), 2 (staggered) or 3 (hexagonal)
Tags
$propertyBag
private
PropertyBag|null
$propertyBag
= null
Tags
$renderOrder
Used rendering order.
private
int
$renderOrder
= self::RENDER_ORDER_RIGHT_DOWN
The rendering order does control how a map will be printed. The value is an integer: 0 (right-down), 1 (right-left), 2 (top-down), 3 (top-left)
Tags
$tiledVersion
The version of tiled, which created the map.
private
string|null
$tiledVersion
= null
Tags
$tileHeight
The height of one tile in pixel.
private
int|null
$tileHeight
= null
Tags
$tileSets
Array of tileSet objects.
private
array<string|int, mixed>
$tileSets
= []
Tags
$tileWidth
The width of one tile in pixel.
private
int|null
$tileWidth
= null
Tags
$version
The parsed version of the map.
private
string|null
$version
= null
Tags
$width
The width (in tiles) of this map.
private
int|null
$width
= null
Tags
Methods
addGroup()
Add a group to this map.
public
addGroup(Group $group) : $this
Parameters
- $group : Group
-
Group which should be added
Tags
Return values
$this —addImageLayer()
Add an image layer to this map.
public
addImageLayer(ImageLayer $imageLayer) : $this
Parameters
- $imageLayer : ImageLayer
-
Image layer which will be added
Tags
Return values
$this —addLayer()
Add a layer to this map.
public
addLayer(Layer $layer) : $this
Parameters
- $layer : Layer
-
layer which will be added
Tags
Return values
$this —addObjectLayer()
Add an object layer to this map.
public
addObjectLayer(ObjectLayer $objectLayer) : $this
Parameters
- $objectLayer : ObjectLayer
-
ObjectLayer which should be added
Return values
$this —addTileSet()
Add a tileSet to this map.
public
addTileSet(TileSet $tileSet) : $this
Parameters
- $tileSet : TileSet
-
TileSet which will be added
Tags
Return values
$this —getBackgroundColor()
get the background color in the format #000000.
public
getBackgroundColor() : string|null
Tags
Return values
string|null —getCompressionLevel()
get the compression level.
public
getCompressionLevel() : float|null
Tags
Return values
float|null —getGroups()
get all groups.
public
getGroups() : array<string|int, Group>
Tags
Return values
array<string|int, Group> —getHeight()
get the height in amount of tiles.
public
getHeight() : int|null
Tags
Return values
int|null —getImageLayers()
get the image layers.
public
getImageLayers() : array<string|int, ImageLayer>
Tags
Return values
array<string|int, ImageLayer> —getLayers()
get all map layers of this map.
public
getLayers() : array<string|int, Layer>
Tags
Return values
array<string|int, Layer> —getNextLayerId()
get the next layer id.
public
getNextLayerId() : string|null
Tags
Return values
string|null —getNextObjectId()
Get the next objectId.
public
getNextObjectId() : string|null
Tags
Return values
string|null —getObjectLayers()
Get all object layers as an array.
public
getObjectLayers() : array<string|int, ObjectLayer>
Tags
Return values
array<string|int, ObjectLayer> —getOrientation()
get orientation as int.
public
getOrientation() : int|null
Tags
Return values
int|null —getOrientationAsString()
Returns the orientation as a string.
public
getOrientationAsString() : string
The orientation can be: orthogonal, isometric, staggered or hexagonal.
Tags
Return values
string —getPropertyBag()
public
getPropertyBag() : PropertyBag|null
Return values
PropertyBag|null —getRenderOrder()
Get the rendering order as an int.
public
getRenderOrder() : int
Tags
Return values
int —getRenderOrderAsString()
Get the rendering order as a string.
public
getRenderOrderAsString() : string
The rendering order can either be: right-down, right-left, top-down, top-left
Tags
Return values
string —getTiledVersion()
Get the version of the tiled editor, which saved this map.
public
getTiledVersion() : string|null
Tags
Return values
string|null —getTileHeight()
get the tile height in pixel.
public
getTileHeight() : int|null
Tags
Return values
int|null —getTileSets()
get all tileSets as array.
public
getTileSets() : array<string|int, TileSet>
Tags
Return values
array<string|int, TileSet> —getTileWidth()
get the tiles width in pixel.
public
getTileWidth() : int|null
Tags
Return values
int|null —getVersion()
Get the version of the tmx format.
public
getVersion() : string|null
Tags
Return values
string|null —getWidth()
get the width (in tiles) of this map.
public
getWidth() : int|null
Tags
Return values
int|null —isInfiniteMap()
Returns true if the map is infinite.
public
isInfiniteMap() : bool
Tags
Return values
bool —removeGroup()
Remove a group from this map.
public
removeGroup(Group $group) : $this
Parameters
- $group : Group
-
Group which should be removed
Tags
Return values
$this —removeImageLayer()
Remove an image layer from this map.
public
removeImageLayer(ImageLayer $imageLayer) : $this
Parameters
- $imageLayer : ImageLayer
-
Image layer which should be removed
Tags
Return values
$this —removeLayer()
Remove a layer from this map.
public
removeLayer(Layer $layer) : $this
Parameters
- $layer : Layer
-
layer which should be removed
Tags
Return values
$this —removeObjectLayer()
Remove an object layer from this map.
public
removeObjectLayer(ObjectLayer $objectLayer) : $this
Parameters
- $objectLayer : ObjectLayer
-
ObjectLayer which should be removed
Tags
Return values
$this —removeTileSet()
Remove a tileSet from this map.
public
removeTileSet(TileSet $tileSet) : $this
Parameters
- $tileSet : TileSet
-
TileSet which will be removed
Tags
Return values
$this —setBackgroundColor()
set the background color in the format #000000.
public
setBackgroundColor(string|null $backgroundColor) : string|null
Parameters
- $backgroundColor : string|null
Tags
Return values
string|null —setCompressionLevel()
set the compression level.
public
setCompressionLevel(float|null $compressionLevel) : $this
Parameters
- $compressionLevel : float|null
Tags
Return values
$this —setHeight()
set the height in amount of tiles.
public
setHeight(int $height) : $this
Parameters
- $height : int
-
amount of tiles in the y-axis
Tags
Return values
$this —setInfiniteMap()
Set if this map is infinite.
public
setInfiniteMap(bool $infiniteMap) : $this
Parameters
- $infiniteMap : bool
Tags
Return values
$this —setNextLayerId()
set the next layer id as string.
public
setNextLayerId(string $nextLayerId) : Map
Parameters
- $nextLayerId : string
-
The next layerId as string
Tags
Return values
Map —setNextObjectId()
set the next object id.
public
setNextObjectId(string $nextObjectId) : $this
Parameters
- $nextObjectId : string
-
the next object id as string
Tags
Return values
$this —setOrientation()
Set the orientation as int.
public
setOrientation(int $orientation) : $this
Parameters
- $orientation : int
-
set the orientation as string, must be between 0-3
Tags
Return values
$this —setOrientationAsString()
Set the current orientation with a string.
public
setOrientationAsString(string $orientation) : $this
Parameters
- $orientation : string
-
string, either orthogonal, isometric, staggered or hexagonal. Ignored if string is not one of those.
Tags
Return values
$this —setPropertyBag()
public
setPropertyBag(PropertyBag|null $propertyBag) : self
Parameters
- $propertyBag : PropertyBag|null
Return values
self —setRenderOrder()
Get the rendering order as an int.
public
setRenderOrder(int $renderOrder) : $this
Parameters
- $renderOrder : int
-
Rendering order as an int, see Map::$renderOrder
Tags
Return values
$this —setRenderOrderAsString()
Set the rendering order as a string.
public
setRenderOrderAsString(string $renderOrder) : $this
Parameters
- $renderOrder : string
-
Rendering order right-down, right-left, top-down, top-left
Tags
Return values
$this —setTiledVersion()
Set the tiled version.
public
setTiledVersion(string|null $tiledVersion) : $this
Parameters
- $tiledVersion : string|null
-
the version as string
Tags
Return values
$this —setTileHeight()
set the tile height in pixel.
public
setTileHeight(int $tileHeight) : $this
Parameters
- $tileHeight : int
-
integer pixel
Tags
Return values
$this —setTileSets()
Set the tileSet.
public
setTileSets(array<string|int, mixed> $tileSets) : $this
Parameters
- $tileSets : array<string|int, mixed>
-
the tileSets as an array
Tags
Return values
$this —setTileWidth()
set the tile width in pixel.
public
setTileWidth(int $tileWidth) : $this
Parameters
- $tileWidth : int
-
integer pixel
Tags
Return values
$this —setVersion()
Set the version of the tmx format.
public
setVersion(string $version) : $this
Parameters
- $version : string
-
The version as string
Tags
Return values
$this —setWidth()
set the width in amount of tiles.
public
setWidth(int $width) : $this
Parameters
- $width : int
-
amount of tiles in the x-axis