Class StampDataLayerUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer, TCellData>
Provides a base class for stamp user tool state implementations that operate on cell value data layers within a hex terrain editing context. Stamping is copying cell data from a source area to a target area on the terrain.
Inheritance
Implements
Inherited Members
Namespace: Fwt.HexTerrains.UserTools.SM.States
Assembly: fwt.hexterrains.dll
Syntax
public abstract class StampDataLayerUserToolStateBase<TBrushTarget, TTerrainLayer, TDataLayer, TCellData> : StampUserToolStateBase<TBrushTarget, TTerrainLayer, TCellData>, ISmState where TBrushTarget : HexTerrainLayerGroup where TTerrainLayer : HexTerrainLayer where TDataLayer : CellValueDataLayer<TCellData> where TCellData : unmanaged
Type Parameters
| Name | Description |
|---|---|
| TBrushTarget | The type of terrain layer group that serves as the brush target for editing operations. |
| TTerrainLayer | The type of terrain layer to which cell data operations are applied. |
| TDataLayer | The type of cell value data layer that stores and manages cell-specific data. |
| TCellData | The type of data stored in each cell of the data layer. Must be an unmanaged type. |
Remarks
This class extends StampUserToolStateBase to support editing and querying cell value data layers associated with terrain layers. It provides abstract and override methods for reading and writing cell data, enabling derived classes to implement specific data layer behaviors. This base is intended for use in advanced terrain editing tools that require direct manipulation of cell-level data.
Constructors
StampDataLayerUserToolStateBase(ISmState)
Declaration
protected StampDataLayerUserToolStateBase(ISmState parent)
Parameters
| Type | Name | Description |
|---|---|---|
| ISmState | parent |
Methods
GetDataLayer(TTerrainLayer)
Retrieves the data layer associated with the specified terrain layer.
Declaration
public abstract TDataLayer GetDataLayer(TTerrainLayer terrainLayer)
Parameters
| Type | Name | Description |
|---|---|---|
| TTerrainLayer | terrainLayer | The terrain layer for which to obtain the corresponding data layer. Cannot be null. |
Returns
| Type | Description |
|---|---|
| TDataLayer | The data layer mapped to the given terrain layer. |
ReadOriginCellData(TTerrainLayer, int, out TCellData)
Attempts to read the original cell data for the specified terrain layer and cell index.
Declaration
public override bool ReadOriginCellData(TTerrainLayer terrainLayer, int cellIndex, out TCellData cellData)
Parameters
| Type | Name | Description |
|---|---|---|
| TTerrainLayer | terrainLayer | The terrain layer from which to retrieve cell data. Cannot be null. |
| int | cellIndex | The zero-based index of the cell within the terrain layer whose data is to be read. Must be within the valid range of cell indices for the specified layer. |
| TCellData | cellData | When this method returns, contains the cell data associated with the specified cell index if the operation succeeds; otherwise, contains the default value for the cell data type. |
Returns
| Type | Description |
|---|---|
| bool | true if the cell data was successfully read; otherwise, false. |
Overrides
SetCellDataToTarget(TTerrainLayer, int, TCellData)
Attempts to set the specified cell data on the target terrain layer at the given cell index.
Declaration
public override bool SetCellDataToTarget(TTerrainLayer terrainLayer, int cellIndex, TCellData cellData)
Parameters
| Type | Name | Description |
|---|---|---|
| TTerrainLayer | terrainLayer | The terrain layer on which to set the cell data. Cannot be null. |
| int | cellIndex | The zero-based index of the cell within the terrain layer to update. Must be within the valid range of cell indices for the layer. |
| TCellData | cellData | The cell data to assign to the specified cell. Cannot be null. |
Returns
| Type | Description |
|---|---|
| bool | true if the cell data was successfully set; otherwise, false. |
Overrides
Remarks
This method does not modify the terrain layer if the cell index is out of range or if the cell data is invalid. Implementations may impose additional constraints on valid cell data or indices.