Documentation

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
see
https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map

Documentation

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

$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
see
Map::getOrientationAsString()

Returns orientation as string

see
Map::setOrientationAsString()

Sets the orientation as string

see
Map::getOrientation()

Returns the orientation as int

see
Map::setOrientation()

Sets the orientation as int

Methods

addGroup()

Add a group to this map.

public addGroup(Group $group) : $this
Parameters
$group : Group

Group which should be added

Tags
see
Map::$groups
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
see
Map::$imageLayers
Return values
$this

addLayer()

Add a layer to this map.

public addLayer(Layer $layer) : $this
Parameters
$layer : Layer

layer which will be added

Tags
see
Map::$layers
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
see
Map::$tileSets
Return values
$this

getBackgroundColor()

get the background color in the format #000000.

public getBackgroundColor() : string|null
Tags
see
Map::$backgroundColor
Return values
string|null

getCompressionLevel()

get the compression level.

public getCompressionLevel() : float|null
Tags
see
Map::$compressionLevel
Return values
float|null

getGroups()

get all groups.

public getGroups() : array<string|int, Group>
Tags
see
Map::$groups
Return values
array<string|int, Group>

getHeight()

get the height in amount of tiles.

public getHeight() : int|null
Tags
see
Map::$height
Return values
int|null

getLayers()

get all map layers of this map.

public getLayers() : array<string|int, Layer>
Tags
see
Map::$layers
Return values
array<string|int, Layer>

getNextLayerId()

get the next layer id.

public getNextLayerId() : string|null
Tags
see
Map::$nextLayerId
Return values
string|null

getNextObjectId()

Get the next objectId.

public getNextObjectId() : string|null
Tags
see
Map::$nextObjectId
Return values
string|null

getOrientation()

get orientation as int.

public getOrientation() : int|null
Tags
see
Map::$orientation
Return values
int|null

getOrientationAsString()

Returns the orientation as a string.

public getOrientationAsString() : string

The orientation can be: orthogonal, isometric, staggered or hexagonal.

Tags
see
Map::$orientation
Return values
string

getRenderOrder()

Get the rendering order as an int.

public getRenderOrder() : int
Tags
see
Map::$renderOrder
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
see
Map::$renderOrder
Return values
string

getTiledVersion()

Get the version of the tiled editor, which saved this map.

public getTiledVersion() : string|null
Tags
see
Map::$tiledVersion
Return values
string|null

getTileHeight()

get the tile height in pixel.

public getTileHeight() : int|null
Tags
see
Map::$tileHeight
Return values
int|null

getTileSets()

get all tileSets as array.

public getTileSets() : array<string|int, TileSet>
Tags
see
Map::$tileSets
Return values
array<string|int, TileSet>

getTileWidth()

get the tiles width in pixel.

public getTileWidth() : int|null
Tags
see
Map::$tileWidth
Return values
int|null

getVersion()

Get the version of the tmx format.

public getVersion() : string|null
Tags
see
Map::$version
Return values
string|null

getWidth()

get the width (in tiles) of this map.

public getWidth() : int|null
Tags
see
Map::$width
Return values
int|null

isInfiniteMap()

Returns true if the map is infinite.

public isInfiniteMap() : bool
Tags
see
Map::$infiniteMap
Return values
bool

removeGroup()

Remove a group from this map.

public removeGroup(Group $group) : $this
Parameters
$group : Group

Group which should be removed

Tags
see
Map::$groups
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
see
Map::$imageLayers
Return values
$this

removeLayer()

Remove a layer from this map.

public removeLayer(Layer $layer) : $this
Parameters
$layer : Layer

layer which should be removed

Tags
see
Map::$layers
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
see
Map::$objectLayers
Return values
$this

removeTileSet()

Remove a tileSet from this map.

public removeTileSet(TileSet $tileSet) : $this
Parameters
$tileSet : TileSet

TileSet which will be removed

Tags
see
Map::$tileSets
Return values
$this

setBackgroundColor()

set the background color in the format #000000.

public setBackgroundColor(string|null $backgroundColor) : string|null
Parameters
$backgroundColor : string|null
Tags
see
Map::$backgroundColor
Return values
string|null

setCompressionLevel()

set the compression level.

public setCompressionLevel(float|null $compressionLevel) : $this
Parameters
$compressionLevel : float|null
Tags
see
Map::$compressionLevel
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
see
Map::$height
Return values
$this

setInfiniteMap()

Set if this map is infinite.

public setInfiniteMap(bool $infiniteMap) : $this
Parameters
$infiniteMap : bool
Tags
see
Map::$infiniteMap
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
see
Map::$nextLayerId
Return values
Map

setNextObjectId()

set the next object id.

public setNextObjectId(string $nextObjectId) : $this
Parameters
$nextObjectId : string

the next object id as string

Tags
see
Map::$nextObjectId
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
see
Map::$orientation
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
see
Map::$orientation
Return values
$this

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
see
Map::$renderOrder
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
see
Map::$renderOrder
Return values
$this

setTiledVersion()

Set the tiled version.

public setTiledVersion(string|null $tiledVersion) : $this
Parameters
$tiledVersion : string|null

the version as string

Tags
see
Map::$tiledVersion
Return values
$this

setTileHeight()

set the tile height in pixel.

public setTileHeight(int $tileHeight) : $this
Parameters
$tileHeight : int

integer pixel

Tags
see
Map::$tileHeight
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
see
Map::$tileSets
Return values
$this

setTileWidth()

set the tile width in pixel.

public setTileWidth(int $tileWidth) : $this
Parameters
$tileWidth : int

integer pixel

Tags
see
Map::$tileWidth
Return values
$this

setVersion()

Set the version of the tmx format.

public setVersion(string $version) : $this
Parameters
$version : string

The version as string

Tags
see
Map::$version
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

Tags
see
Map::$width
Return values
$this

Search results