public abstract class ReadOnlyTile extends Tile
UnsupportedOperationException
. All methods concerning listeners, undo support, etc. do nothing.Tile.Listener, Tile.TileBuffer
InstanceKeeper.InstantiationListener<T>
bitLayerData, heightMap, layerData, tallHeightMap, tallWaterLevel, terrain, waterLevel
Modifier | Constructor and Description |
---|---|
protected |
ReadOnlyTile(int x,
int y,
int minHeight,
int maxHeight,
boolean init) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Tile.Listener listener) |
void |
bufferChanged(org.pepsoft.util.undo.BufferKey<?> key) |
void |
clearLayerData(int x,
int y,
java.util.Set<Layer> excludedLayers)
Clear all layer data at a particular location (by resetting to the
layer's default value), possibly with the exception of certain layers.
|
void |
clearLayerData(Layer layer) |
protected void |
ensureReadable(Tile.TileBuffer buffer) |
void |
inhibitEvents()
Stop firing events when the tile is modified, until
Tile.releaseEvents() is invoked. |
boolean |
isEventsInhibited() |
boolean |
plantSeed(Seed seed) |
void |
redoPerformed() |
void |
register(org.pepsoft.util.undo.UndoManager undoManager) |
void |
releaseEvents()
Release an inhibition on firing events.
|
void |
removeListener(Tile.Listener listener) |
void |
removeSeed(Seed seed) |
boolean |
repair(int minHeight,
int maxHeight,
java.io.PrintStream out) |
void |
savePointArmed() |
void |
savePointCreated() |
void |
setBitLayerValue(Layer layer,
int x,
int y,
boolean value) |
void |
setHeight(int x,
int y,
float height) |
void |
setLayerValue(Layer layer,
int x,
int y,
int value) |
void |
setMinMaxHeight(int minHeight,
int maxHeight,
HeightTransform heightTransform) |
void |
setRawHeight(int x,
int y,
int rawHeight)
Set the raw height value.
|
void |
setTerrain(int x,
int y,
Terrain terrain) |
void |
setWaterLevel(int x,
int y,
int waterLevel) |
java.lang.String |
toString() |
Tile |
transform(CoordinateTransform transform)
Create a new tile based on this one but horizontally transformed according to some transformation.
|
void |
undoPerformed() |
void |
unregister() |
containsOneOf, doGetLayers, doGetSlope, equals, getActiveLayers, getAllTerrains, getBitLayerCount, getBitLayerValue, getDistanceToEdge, getFloodedCount, getHeight, getHighestHeight, getHighestIntHeight, getHighestRawHeight, getHighestWaterLevel, getIntHeight, getLayers, getLayers, getLayersAt, getLayerValue, getLowestHeight, getLowestIntHeight, getLowestRawHeight, getMaxHeight, getMinHeight, getRawHeight, getRawHeightRange, getSeeds, getSlope, getTerrain, getWaterLevel, getX, getY, hashCode, hasLayer
setInstantiationListener
protected ReadOnlyTile(int x, int y, int minHeight, int maxHeight, boolean init)
public final void addListener(Tile.Listener listener)
addListener
in class Tile
public final void unregister()
unregister
in class Tile
public final void setMinMaxHeight(int minHeight, int maxHeight, HeightTransform heightTransform)
setMinMaxHeight
in class Tile
public final void setRawHeight(int x, int y, int rawHeight)
Tile
minHeight
.setRawHeight
in class Tile
public final void clearLayerData(Layer layer)
clearLayerData
in class Tile
public final void clearLayerData(int x, int y, java.util.Set<Layer> excludedLayers)
Tile
clearLayerData
in class Tile
x
- The X coordinate of the location to clear of layer data.y
- The Y coordinate of the location to clear of layer data.excludedLayers
- The layers to exclude, if any. May be
null
.public final void removeSeed(Seed seed)
removeSeed
in class Tile
public final void removeListener(Tile.Listener listener)
removeListener
in class Tile
public final Tile transform(CoordinateTransform transform)
Tile
public boolean repair(int minHeight, int maxHeight, java.io.PrintStream out)
public final void savePointArmed()
savePointArmed
in interface org.pepsoft.util.undo.UndoListener
savePointArmed
in class Tile
public final void savePointCreated()
savePointCreated
in interface org.pepsoft.util.undo.UndoListener
savePointCreated
in class Tile
public final void undoPerformed()
undoPerformed
in interface org.pepsoft.util.undo.UndoListener
undoPerformed
in class Tile
public final void redoPerformed()
redoPerformed
in interface org.pepsoft.util.undo.UndoListener
redoPerformed
in class Tile
public final void bufferChanged(org.pepsoft.util.undo.BufferKey<?> key)
bufferChanged
in interface org.pepsoft.util.undo.UndoListener
bufferChanged
in class Tile
protected final void ensureReadable(Tile.TileBuffer buffer)
ensureReadable
in class Tile
public final boolean isEventsInhibited()
isEventsInhibited
in class Tile
public final void register(org.pepsoft.util.undo.UndoManager undoManager)
public final void setBitLayerValue(Layer layer, int x, int y, boolean value)
setBitLayerValue
in class Tile
public final void inhibitEvents()
Tile
Tile.releaseEvents()
is invoked. Make sure that
releaseEvents()
is always invoked, even if an exception is thrown, by using a try-finally statement:
tile.inhibitEvents();
try {
// modify the tile
} finally {
tile.releaseEvents();
}
Note that calls to these methods may be nested, and if so, events will only be released after
the final invocation of releaseEvents()
.
inhibitEvents
in class Tile
public final void releaseEvents()
Tile
Tile.inhibitEvents()
, but only if this is the last invocation of
releaseEvents()
in a nested set.releaseEvents
in class Tile
public final void setHeight(int x, int y, float height)
public final void setLayerValue(Layer layer, int x, int y, int value)
setLayerValue
in class Tile
public final void setTerrain(int x, int y, Terrain terrain)
setTerrain
in class Tile
public final void setWaterLevel(int x, int y, int waterLevel)
setWaterLevel
in class Tile