public class TiledObject
extends java.lang.Object
TiledMap
Constructor and Description |
---|
TiledObject(int id,
float x,
float y,
float width,
float height) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperty(java.lang.String propertyName)
Returns if the object contains the specified property
|
int |
getGid()
Returns the Tile GID of this object
|
float |
getHeight()
Returns the height of this object in pixels
|
int |
getId()
Returns the ID of this object
|
java.lang.String |
getName()
Returns the name of this object
|
TiledObjectShape |
getObjectShape()
Returns the
TiledObjectShape of this object |
java.lang.String |
getPolyline() |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns this object's properties
|
java.lang.String |
getProperty(java.lang.String propertyName)
Returns the value of a specified property
|
java.lang.String |
getText() |
java.lang.String |
getType()
Returns the type of this object
|
float |
getWidth()
Returns the width of this object in pixels
|
float |
getX()
Returns the x coordinate of this object in pixels
|
float |
getY()
Returns the y coordinate of this object in pixels
|
boolean |
isGidFlipDiagonally() |
boolean |
isGidFlipHorizontally() |
boolean |
isGidFlipVertically() |
boolean |
isVisible() |
boolean |
isWrapText() |
void |
setAsEllipse()
Marks this object as a
TiledObjectShape.ELLIPSE |
void |
setAsPoint()
Marks this object as a
TiledObjectShape.POINT |
void |
setAsPolygon(java.lang.String points)
Marks this object as a
TiledObjectShape.POLYGON |
void |
setAsText(java.lang.String text,
boolean wrapText)
Marks this object as a
TiledObjectShape.TEXT |
void |
setGid(int gid)
Sets the Tile GID of this object
|
void |
setGidFlipDiagonally(boolean gidFlipDiagonally) |
void |
setGidFlipHorizontally(boolean gidFlipHorizontally) |
void |
setGidFlipVertically(boolean gidFlipVertically) |
void |
setName(java.lang.String name)
Sets the name of this object
|
void |
setPolyline(java.lang.String polyline) |
void |
setProperty(java.lang.String propertyName,
java.lang.String value)
Sets the value of a specified property
|
void |
setType(java.lang.String type)
Sets the type of this object
|
void |
setVisible(boolean visible) |
Circle |
toCircle()
Creates a new
Circle from this object. |
Point |
toPoint()
Creates a new
Point from this object. |
Polygon |
toPolygon()
Creates a new
Polygon from this object. |
Rectangle |
toRectangle()
Creates a new
Rectangle from this object. |
public TiledObject(int id, float x, float y, float width, float height)
public java.util.Map<java.lang.String,java.lang.String> getProperties()
public boolean containsProperty(java.lang.String propertyName)
propertyName
- The property name to search forpublic java.lang.String getProperty(java.lang.String propertyName)
propertyName
- The property name to search forpublic void setProperty(java.lang.String propertyName, java.lang.String value)
propertyName
- The property name to set the value forvalue
- The value of the property to setpublic int getId()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name to setpublic java.lang.String getType()
public void setType(java.lang.String type)
type
- public float getX()
public float getY()
public float getWidth()
public float getHeight()
public int getGid()
public void setGid(int gid)
gid
- public boolean isGidFlipHorizontally()
public void setGidFlipHorizontally(boolean gidFlipHorizontally)
public boolean isGidFlipVertically()
public void setGidFlipVertically(boolean gidFlipVertically)
public boolean isGidFlipDiagonally()
public void setGidFlipDiagonally(boolean gidFlipDiagonally)
public TiledObjectShape getObjectShape()
TiledObjectShape
of this objectTiledObjectShape.RECTANGLE
public void setAsEllipse()
TiledObjectShape.ELLIPSE
public void setAsPoint()
TiledObjectShape.POINT
public void setAsPolygon(java.lang.String points)
TiledObjectShape.POLYGON
points
- The points in the format x1,y1 x2,y2 per the Tiled specificationpublic void setAsText(java.lang.String text, boolean wrapText)
TiledObjectShape.TEXT
text
- The text to displaywrapText
- True if the text wrapspublic java.lang.String getPolyline()
public void setPolyline(java.lang.String polyline)
public boolean isVisible()
public void setVisible(boolean visible)
public Point toPoint()
Point
from this object.
Warning: If this object's shape is not TiledObjectShape.POINT
, an exception will be thrown.Point
public Circle toCircle()
Circle
from this object.
Warning: If this object's shape is not TiledObjectShape.ELLIPSE
, an exception will be thrown.Circle
public Rectangle toRectangle()
Rectangle
from this object.
Warning: If this object's shape is not TiledObjectShape.RECTANGLE
, an exception will be thrown.Rectangle
public Polygon toPolygon()
Polygon
from this object.
Warning: If this object's shape is not TiledObjectShape.POLYGON
, an exception will be thrown.Polygon
public java.lang.String getText()
public boolean isWrapText()