Class MapObject
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject
- All Implemented Interfaces:
ICustomPropertyProvider,IMapObject,Resource,java.lang.Comparable<Resource>
- Direct Known Subclasses:
Blueprint
public class MapObject
extends CustomPropertyProvider
implements IMapObjectConstructor Summary
Constructors Constructor Description MapObject()Instantiates a newMapObjectinstance.MapObject(MapObject original)Instantiates a newMapObjectinstance by copying the specified original instance.MapObject(MapObject original, boolean keepID)Instantiates a newMapObjectinstance by copying the specified original instance.MapObject(MapObject original, int id)Instantiates a newMapObjectinstance by copying the specified original instance.MapObject(java.lang.String type)Instantiates a newMapObjectinstance.Method Summary
Modifier and Type Method Description java.awt.geom.Rectangle2DgetBoundingBox()Gets the hit box.static java.awt.geom.Rectangle2DgetBounds(IMapObject... objects)static java.awt.geom.Rectangle2DgetBounds(java.lang.Iterable<IMapObject> objects)java.awt.geom.Ellipse2DgetEllipse()intgetGridId()Gets the grid id.floatgetHeight()intgetId()Gets the id.IMapObjectLayergetLayer()java.awt.geom.Point2DgetLocation()Gets the location.java.lang.StringgetName()Gets the name.IPolyShapegetPolygon()IPolyShapegetPolyline()IMapObjectTextgetText()ITilesetEntrygetTile()java.lang.StringgetType()Gets the type.floatgetWidth()floatgetX()floatgetY()booleanisEllipse()booleanisPoint()booleanisPolygon()booleanisPolyline()voidsetGridId(int gid)voidsetHeight(float height)voidsetId(int id)protected voidsetLayer(MapObjectLayer layer)voidsetLocation(float x, float y)voidsetLocation(java.awt.geom.Point2D location)voidsetName(java.lang.String name)voidsetPolygon(IPolyShape polygon)voidsetPolyline(IPolyShape polyline)voidsetType(java.lang.String type)voidsetWidth(float width)voidsetX(float x)voidsetY(float y)java.lang.StringtoString()Methods inherited from class de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getProperties, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, getTypeOfProperty, hasCustomProperty, removeProperty, setProperties, setTypeOfProperty, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.gurkenlabs.litiengine.environment.tilemap.ICustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getProperties, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, getTypeOfProperty, hasCustomProperty, removeProperty, setProperties, setTypeOfProperty, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
Constructor Details
MapObject
public MapObject()Instantiates a newMapObjectinstance.MapObject
public MapObject(java.lang.String type)Instantiates a newMapObjectinstance.- Parameters:
type- The type of this map object.
MapObject
Instantiates a newMapObjectinstance by copying the specified original instance.This variant of the constructor will assign an entirely new ID to the newly created MapObject.
- Parameters:
original- the MapObject we want to copy
MapObject
Instantiates a newMapObjectinstance by copying the specified original instance.This variant of the constructor lets you decide if the copy instance will get the same ID as the old MapObject or get a new ID.
- Parameters:
original- the MapObject we want to copykeepID- decide if the new instance will adopt the old MapObject's ID or get a new, unique one.
MapObject
Instantiates a newMapObjectinstance by copying the specified original instance.- Parameters:
original- the MapObject we want to copyid- The id of this instance.
Method Details
getBounds
getBounds
getGridId
public int getGridId()Description copied from interface:IMapObjectGets the grid id.- Specified by:
getGridIdin interfaceIMapObject- Returns:
- the grid id
getTile
- Specified by:
getTilein interfaceIMapObject
getBoundingBox
public java.awt.geom.Rectangle2D getBoundingBox()Description copied from interface:IMapObjectGets the hit box.- Specified by:
getBoundingBoxin interfaceIMapObject- Returns:
- the hit box
getId
public int getId()Description copied from interface:IMapObjectGets the id.- Specified by:
getIdin interfaceIMapObject- Returns:
- the id
getLocation
public java.awt.geom.Point2D getLocation()Description copied from interface:IMapObjectGets the location.- Specified by:
getLocationin interfaceIMapObject- Returns:
- the location
getName
public java.lang.String getName()Description copied from interface:ResourceGets the name.getType
public java.lang.String getType()Gets the type.- Specified by:
getTypein interfaceIMapObject- Returns:
- the type
getPolyline
- Specified by:
getPolylinein interfaceIMapObject
getPolygon
- Specified by:
getPolygonin interfaceIMapObject
getEllipse
public java.awt.geom.Ellipse2D getEllipse()- Specified by:
getEllipsein interfaceIMapObject
getText
- Specified by:
getTextin interfaceIMapObject
setGridId
public void setGridId(int gid)- Specified by:
setGridIdin interfaceIMapObject
setHeight
public void setHeight(float height)- Specified by:
setHeightin interfaceIMapObject
setId
public void setId(int id)- Specified by:
setIdin interfaceIMapObject
setName
public void setName(java.lang.String name)setType
public void setType(java.lang.String type)- Specified by:
setTypein interfaceIMapObject
setWidth
public void setWidth(float width)- Specified by:
setWidthin interfaceIMapObject
setX
public void setX(float x)- Specified by:
setXin interfaceIMapObject
setY
public void setY(float y)- Specified by:
setYin interfaceIMapObject
setLocation
public void setLocation(java.awt.geom.Point2D location)- Specified by:
setLocationin interfaceIMapObject
setLocation
public void setLocation(float x, float y)- Specified by:
setLocationin interfaceIMapObject
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
getX
public float getX()- Specified by:
getXin interfaceIMapObject
getY
public float getY()- Specified by:
getYin interfaceIMapObject
setPolyline
- Specified by:
setPolylinein interfaceIMapObject
setPolygon
- Specified by:
setPolygonin interfaceIMapObject
getWidth
public float getWidth()- Specified by:
getWidthin interfaceIMapObject
getHeight
public float getHeight()- Specified by:
getHeightin interfaceIMapObject
getLayer
- Specified by:
getLayerin interfaceIMapObject
isPolyline
public boolean isPolyline()- Specified by:
isPolylinein interfaceIMapObject
isPolygon
public boolean isPolygon()- Specified by:
isPolygonin interfaceIMapObject
isPoint
public boolean isPoint()- Specified by:
isPointin interfaceIMapObject
isEllipse
public boolean isEllipse()- Specified by:
isEllipsein interfaceIMapObject
setLayer
