public class FlatteningDimension extends RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
Dimension
which combines multiple layered Dimensions
s into one, returning data from the first
dimension in which the chunk is present (it exists and is not marked NotPresent or ReadOnly).
Global settings and settings for singleton layers such as caves, resources, etc. are copied from the first dimension; those settings are ignored from the other dimensions.
Note that not all operations are implemented. Only those needed for exporting are guaranteed to
be implemented. Others may throw an UnsupportedOperationException
.
Dimension.Anchor, Dimension.Border, Dimension.LayerAnchor, Dimension.Listener, Dimension.Role, Dimension.TileVisitationBuilder, Dimension.TileVisitor, Dimension.WallType
InstanceKeeper.InstantiationListener<T>
dimension, tileCache
POSSIBLE_AUTO_BIOMES
Constructor and Description |
---|
FlatteningDimension(Dimension... dimensions) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsOneOf(Layer... layers) |
protected Tile |
doGetTile(java.awt.Point coords) |
java.util.Set<Layer> |
getAllLayers(boolean applyCombinedLayers)
Returns the set of all layers currently in use on the world, optionally
including layers that are included in combined layers.
|
java.util.Set<Terrain> |
getAllTerrains() |
boolean |
getBitLayerValueAt(Layer layer,
int x,
int y) |
float |
getDistanceToEdge(Layer layer,
int x,
int y,
float maxDistance)
Get the distance from the specified coordinate to the nearest pixel where
the specified layer is not set.
|
java.awt.Rectangle |
getExtent() |
int |
getFloodedCount(int x,
int y,
int r,
boolean lava)
Count the number of blocks that are flooded in a square around a
particular location
|
int |
getHeight() |
float |
getHeightAt(int x,
int y)
Get the terrain height at the specified coordinates, if a tile exists in the specified location.
|
int |
getHighestX() |
int |
getHighestY() |
int |
getIntHeightAt(int x,
int y,
int defaultValue)
Get the terrain height at the specified coordinates, rounded to the nearest integer, if a tile exists in the
specified location.
|
java.util.Map<Layer,java.lang.Integer> |
getLayersAt(int x,
int y)
Gets all layers that are set at the specified location, along with their intensities or values.
|
int |
getLayerValueAt(Layer layer,
int x,
int y) |
int |
getLowestX() |
int |
getLowestY() |
int |
getRawHeightAt(int x,
int y)
Get the raw height value.
|
float |
getSlope(int x,
int y) |
java.util.Set<java.awt.Point> |
getTileCoords() |
int |
getTileCount() |
int |
getWaterLevelAt(int x,
int y) |
int |
getWidth() |
boolean |
isBorderTile(int x,
int y)
Indicates whether the specified tile is a border tile.
|
Dimension.TileVisitationBuilder |
visitTilesForEditing()
Visit the tiles in this dimension, optionally constraining the visited
tiles according to some basic constraints.
|
addDimensionListener, addOverlay, addPropertyChangeListener, addPropertyChangeListener, addTile, allBitLayerDataChanged, allNonBitlayerDataChanged, applyTheme, applyTheme, armSavePoint, changed, clearLayerData, clearRedo, clearUndo, getAllLayerSettings, getAnchor, getBorder, getBorderLevel, getBorderSize, getChangeNo, getContourSeparation, getCustomBiomes, getGarden, getGridSize, getHeightAt, getIntHeightAt, getIntHeightAt, getLastViewPosition, getLayerSettings, getLayerValueAt, getMaxHeight, getMinecraftSeed, getMinimumLayers, getName, getOverlays, getRawHeightAt, getRoofType, getSeed, getSnapshot, getSubsurfaceMaterial, getTerrainAt, getTile, getTile, getTileFactory, getTiles, getTopLayerDepth, getTopLayerMinDepth, getTopLayerVariation, getWallType, getWaterLevelAt, getWorld, heightMapChanged, isBottomless, isContoursEnabled, isEventsInhibited, isGridEnabled, isOverlaysEnabled, isPopulate, isTilePresent, isUndoAvailable, layerDataChanged, registerUndoManager, removeDimensionListener, removeOverlay, removePropertyChangeListener, removePropertyChangeListener, removeTile, removeTile, removeTile, seedsChanged, setBitLayerValueAt, setBorder, setBorderLevel, setBorderSize, setBottomless, setContoursEnabled, setContourSeparation, setCustomBiomes, setEventsInhibited, setGridEnabled, setGridSize, setHeightAt, setHeightAt, setLastViewPosition, setLayerSettings, setLayerValueAt, setMaxHeight, setMinecraftSeed, setOverlaysEnabled, setPopulate, setRawHeightAt, setRawHeightAt, setRoofType, setSubsurfaceMaterial, setTerrainAt, setTerrainAt, setTopLayerMinDepth, setTopLayerVariation, setWallType, setWaterLevelAt, terrainChanged, transform, undoChanges, unregisterUndoManager, waterLevelChanged, wrapTile
clearLayerData, doGetDistanceToEdge, doGetFloodedCount, doGetSlope, getAttribute, getAutoBiome, getAutoBiome, getAutoBiome, getAutoBiome, getBitLayerCount, getCeilingHeight, getCustomLayers, getCustomLayers, getDistancesToEdge, getExportSettings, getGenerator, getHeightRange, getHiddenPalettes, getHighestHeight, getHighestIntHeight, getHighestRawHeight, getId, getIntHeightRange, getLowestHeight, getLowestIntHeight, getLowestRawHeight, getMinHeight, getMostPrevalentBiome, getRawHeightRange, getScale, getSoloedPalette, getSubsurfaceLayerAnchor, getTileForEditing, getTileForEditing, getTopLayerAnchor, getUndergroundBiome, isCoverSteepTerrain, isFixOverlayCoords, rememberChanges, save, setAttribute, setCeilingHeight, setCoverSteepTerrain, setCustomLayers, setExportSettings, setFixOverlayCoords, setGenerator, setHiddenPalettes, setMinHeight, setName, setScale, setSoloedPalette, setSubsurfaceLayerAnchor, setTopLayerAnchor, setUndergroundBiome, setWorld, visitTiles
setInstantiationListener
public FlatteningDimension(Dimension... dimensions)
public int getTileCount()
getTileCount
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getIntHeightAt(int x, int y, int defaultValue)
Dimension
getIntHeightAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
x
- The X coordinate to query.y
- The Y coordinate to query.defaultValue
- The value to return if there is no tile at the specified coordinates.defaultHeight
if there is no tile at the specified coordinates.public float getHeightAt(int x, int y)
Dimension
getHeightAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
x
- The X coordinate to query.y
- The Y coordinate to query.-Float.MAX_VALUE
if there is
no tile at the specified coordinates.public int getRawHeightAt(int x, int y)
Dimension
minHeight
.getRawHeightAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public java.util.Set<Terrain> getAllTerrains()
getAllTerrains
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getWaterLevelAt(int x, int y)
getWaterLevelAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getLayerValueAt(Layer layer, int x, int y)
getLayerValueAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public boolean getBitLayerValueAt(Layer layer, int x, int y)
getBitLayerValueAt
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public float getDistanceToEdge(Layer layer, int x, int y, float maxDistance)
Dimension
getDistanceToEdge
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
layer
- The layer for which to find the distance to the nearest
edge.x
- The X coordinate of the location towards which to determine the distance.y
- The Y coordinate of the location towards which to determine the distance.maxDistance
- The maximum distance to return. If the actual distance is further, this value will be returned.public java.util.Set<Layer> getAllLayers(boolean applyCombinedLayers)
Dimension
getAllLayers
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
applyCombinedLayers
- Whether to include layers from combined layers
which are not used independently in the dimension.public boolean containsOneOf(Layer... layers)
containsOneOf
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getHeight()
getHeight
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getHighestX()
getHighestX
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getHighestY()
getHighestY
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getLowestX()
getLowestX
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getLowestY()
getLowestY
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getFloodedCount(int x, int y, int r, boolean lava)
Dimension
getFloodedCount
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
x
- The global X coordinate of the location around which to count
flooded blocks.y
- The global Y coordinate of the location around which to count
flooded blocks.r
- The radius of the square.lava
- Whether to check for lava (when true
) or water
(when false
).public float getSlope(int x, int y)
getSlope
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public java.util.Set<java.awt.Point> getTileCoords()
getTileCoords
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public int getWidth()
getWidth
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>
public boolean isBorderTile(int x, int y)
Dimension
isBorderTile
in class Dimension
x
- The X coordinate of the tile for which to check whether it is a border tile.y
- The Y coordinate of the tile for which to check whether it is a border tile.true
if it is a border tile.public java.awt.Rectangle getExtent()
getExtent
in interface TileProvider
getExtent
in class Dimension
public java.util.Map<Layer,java.lang.Integer> getLayersAt(int x, int y)
Dimension
getLayersAt
in class Dimension
x
- The X location for which to retrieve all layers.y
- The Y location for which to retrieve all layers.null
or an empty map if no layers are present.public Dimension.TileVisitationBuilder visitTilesForEditing()
Dimension
visitTiles().andDo(tile -> { /* process tile */ });
To restrict to a filter:
visitTiles().forFilter(filter).andDo(tile -> { /* process tile */ });
To restrict to a brush:
visitTiles().forBrush(brush, x, y).andDo(tile -> { /* process tile */ });
To restrict to the selection:
visitTiles().forSelection().andDo(tile -> { /* process tile */ });
You can combine constraints:
visitTiles().forFilter(filter).forBrush(brush, x, y).andDo(tile -> { /* process tile */ });
visitTilesForEditing
in class Dimension
protected Tile doGetTile(java.awt.Point coords)
doGetTile
in class RODelegatingDimension<org.pepsoft.worldpainter.exporting.FlatteningDimension.FlatteningTile>