Class WangColor
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
de.gurkenlabs.litiengine.environment.tilemap.xml.WangColor
- All Implemented Interfaces:
ICustomPropertyProvider, ITerrain
One terrain material (a Tiled wangcolor) within a WangSet.
The representative tile and probability guide terrain painting; tile references use local
tileset IDs and -1 means that no representative tile is configured.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColor()Gets the color associated with the terrain.getName()Gets the name of the terrain.doubleGets the probability value associated with the terrain.intReturns the local ID of the representative tile.voidSets the editor display color.voidSets the terrain name; blank values are normalized tonull.voidsetProbability(double probability) Sets the relative probability used by terrain painting tools.voidsetTileId(int tileId) Sets the representative local tile ID.toString()Methods inherited from class CustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getCharValue, getCharValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getMapObjectId, getProperties, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, hasCustomProperty, removeProperty, setProperties, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
-
Constructor Details
-
WangColor
public WangColor()Creates a white terrain namedTerrainwithout a representative tile. -
WangColor
-
WangColor
Creates a copy, including custom properties.- Parameters:
original- The terrain to copy.
-
-
Method Details
-
getName
-
setName
Sets the terrain name; blank values are normalized tonull.- Parameters:
name- The new name.
-
getColor
-
setColor
Sets the editor display color.- Parameters:
color- The non-null color.- Throws:
NullPointerException- ifcolorisnull.
-
getTileId
public int getTileId()Returns the local ID of the representative tile.- Returns:
- The tile ID, or
-1when none is configured.
-
setTileId
public void setTileId(int tileId) Sets the representative local tile ID.- Parameters:
tileId- The tile ID, or-1for none.- Throws:
IllegalArgumentException- iftileIdis less than-1.
-
getProbability
public double getProbability()Description copied from interface:ITerrainGets the probability value associated with the terrain.
The probability value is used in automatic mapping processes to indicate the likelihood or preference of using this terrain in specific contexts. Higher probability values may suggest a higher preference for automatic mapping.
- Specified by:
getProbabilityin interfaceITerrain- Returns:
- A
doublerepresenting the probability value of the terrain.
-
setProbability
public void setProbability(double probability) Sets the relative probability used by terrain painting tools.- Parameters:
probability- A finite, non-negative weight.- Throws:
IllegalArgumentException- if the value is negative or not finite.
-
toString
-