ViewGrid

floodsim.view.component.ViewGrid
class ViewGrid(gridSize: Int)(using imageCache: ImageCache[CellType], weatherImageCache: ImageCache[Weather]) extends UIComponent[JPanel]

Interactive grid view composed of ViewGridCell panels. Features:

Attributes

Graph
Supertypes
trait UIComponent[JPanel]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def component: JPanel

Returns the underlying Swing component.

Returns the underlying Swing component.

Attributes

def setCellOverlay(row: Int, col: Int, color: Color, intensity: Double): Unit

Sets a color overlay on the cell at the specified position with given intensity.

Sets a color overlay on the cell at the specified position with given intensity.

Value parameters

col

the column index of the cell

color

the Color of the overlay

intensity

the intensity of the overlay (0.0 to 1.0)

row

the row index of the cell

Attributes

Sets the listener to be notified when a cell's type is changed by user interaction.

Sets the listener to be notified when a cell's type is changed by user interaction.

Value parameters

listener

the SimulationListener to notify

Attributes

def setCurrentCellType(cellType: CellType): Unit

Sets the current CellType to be applied when cells are clicked or dragged over.

Sets the current CellType to be applied when cells are clicked or dragged over.

Value parameters

cellType

the CellType to set

Attributes

def setInteractionEnabled(enabled: Boolean): Unit

Enables or disables user interaction with the grid.

Enables or disables user interaction with the grid.

Value parameters

enabled

true to enable interaction, false to disable

Attributes

def setShowWeather(show: Boolean): Unit

Shows or hides the weather overlay on all cells.

Shows or hides the weather overlay on all cells.

Value parameters

show

true to show weather, false to hide

Attributes

def showCellLabel(row: Int, col: Int, text: String): Unit

Shows a text label on the cell at the specified position.

Shows a text label on the cell at the specified position.

Value parameters

col

the column index of the cell

row

the row index of the cell

text

the text to display

Attributes

def updateCellType(row: Int, col: Int, cellType: CellType): Unit

Updates the CellType of the cell at the specified position.

Updates the CellType of the cell at the specified position.

Value parameters

cellType

the new CellType to set

col

the column index of the cell

row

the row index of the cell

Attributes

def updateCellWeather(row: Int, col: Int, weather: Weather): Unit

Updates the Weather overlay of the cell at the specified position.

Updates the Weather overlay of the cell at the specified position.

Value parameters

col

the column index of the cell

row

the row index of the cell

weather

the new Weather to set

Attributes