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 IMapObject
Constructor Summary
Constructors Constructor Description MapObject()
Instantiates a newMapObject
instance.MapObject(MapObject original)
Instantiates a newMapObject
instance by copying the specified original instance.MapObject(MapObject original, boolean keepID)
Instantiates a newMapObject
instance by copying the specified original instance.MapObject(MapObject original, int id)
Instantiates a newMapObject
instance by copying the specified original instance.MapObject(java.lang.String type)
Instantiates a newMapObject
instance.Method Summary
Modifier and Type Method Description java.awt.geom.Rectangle2D
getBoundingBox()
Gets the hit box.static java.awt.geom.Rectangle2D
getBounds(IMapObject... objects)
static java.awt.geom.Rectangle2D
getBounds(java.lang.Iterable<IMapObject> objects)
java.awt.geom.Ellipse2D
getEllipse()
int
getGridId()
Gets the grid id.float
getHeight()
int
getId()
Gets the id.IMapObjectLayer
getLayer()
java.awt.geom.Point2D
getLocation()
Gets the location.java.lang.String
getName()
Gets the name.IPolyShape
getPolygon()
IPolyShape
getPolyline()
IMapObjectText
getText()
ITilesetEntry
getTile()
java.lang.String
getType()
Gets the type.float
getWidth()
float
getX()
float
getY()
boolean
isEllipse()
boolean
isPoint()
boolean
isPolygon()
boolean
isPolyline()
void
setGridId(int gid)
void
setHeight(float height)
void
setId(int id)
protected void
setLayer(MapObjectLayer layer)
void
setLocation(float x, float y)
void
setLocation(java.awt.geom.Point2D location)
void
setName(java.lang.String name)
void
setPolygon(IPolyShape polygon)
void
setPolyline(IPolyShape polyline)
void
setType(java.lang.String type)
void
setWidth(float width)
void
setX(float x)
void
setY(float y)
java.lang.String
toString()
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, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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 newMapObject
instance.MapObject
public MapObject(java.lang.String type)Instantiates a newMapObject
instance.- Parameters:
type
- The type of this map object.
MapObject
Instantiates a newMapObject
instance 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 newMapObject
instance 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 newMapObject
instance 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:IMapObject
Gets the grid id.- Specified by:
getGridId
in interfaceIMapObject
- Returns:
- the grid id
getTile
- Specified by:
getTile
in interfaceIMapObject
getBoundingBox
public java.awt.geom.Rectangle2D getBoundingBox()Description copied from interface:IMapObject
Gets the hit box.- Specified by:
getBoundingBox
in interfaceIMapObject
- Returns:
- the hit box
getId
public int getId()Description copied from interface:IMapObject
Gets the id.- Specified by:
getId
in interfaceIMapObject
- Returns:
- the id
getLocation
public java.awt.geom.Point2D getLocation()Description copied from interface:IMapObject
Gets the location.- Specified by:
getLocation
in interfaceIMapObject
- Returns:
- the location
getName
public java.lang.String getName()Description copied from interface:Resource
Gets the name.getType
public java.lang.String getType()Gets the type.- Specified by:
getType
in interfaceIMapObject
- Returns:
- the type
getPolyline
- Specified by:
getPolyline
in interfaceIMapObject
getPolygon
- Specified by:
getPolygon
in interfaceIMapObject
getEllipse
public java.awt.geom.Ellipse2D getEllipse()- Specified by:
getEllipse
in interfaceIMapObject
getText
- Specified by:
getText
in interfaceIMapObject
setGridId
public void setGridId(int gid)- Specified by:
setGridId
in interfaceIMapObject
setHeight
public void setHeight(float height)- Specified by:
setHeight
in interfaceIMapObject
setId
public void setId(int id)- Specified by:
setId
in interfaceIMapObject
setName
public void setName(java.lang.String name)setType
public void setType(java.lang.String type)- Specified by:
setType
in interfaceIMapObject
setWidth
public void setWidth(float width)- Specified by:
setWidth
in interfaceIMapObject
setX
public void setX(float x)- Specified by:
setX
in interfaceIMapObject
setY
public void setY(float y)- Specified by:
setY
in interfaceIMapObject
setLocation
public void setLocation(java.awt.geom.Point2D location)- Specified by:
setLocation
in interfaceIMapObject
setLocation
public void setLocation(float x, float y)- Specified by:
setLocation
in interfaceIMapObject
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
getX
public float getX()- Specified by:
getX
in interfaceIMapObject
getY
public float getY()- Specified by:
getY
in interfaceIMapObject
setPolyline
- Specified by:
setPolyline
in interfaceIMapObject
setPolygon
- Specified by:
setPolygon
in interfaceIMapObject
getWidth
public float getWidth()- Specified by:
getWidth
in interfaceIMapObject
getHeight
public float getHeight()- Specified by:
getHeight
in interfaceIMapObject
getLayer
- Specified by:
getLayer
in interfaceIMapObject
isPolyline
public boolean isPolyline()- Specified by:
isPolyline
in interfaceIMapObject
isPolygon
public boolean isPolygon()- Specified by:
isPolygon
in interfaceIMapObject
isPoint
public boolean isPoint()- Specified by:
isPoint
in interfaceIMapObject
isEllipse
public boolean isEllipse()- Specified by:
isEllipse
in interfaceIMapObject
setLayer