Class AbstractDrawLayers
-
- All Implemented Interfaces:
-
it.unibo.alchemist.boundary.swingui.effect.api.DrawLayers
,it.unibo.alchemist.boundary.swingui.effect.api.Effect
,java.io.Serializable
public abstract class AbstractDrawLayers extends AbstractDrawOnce implements DrawLayers
This class collects the following responsibilities: - it manages to draw layers only when necessary (as the apply method will be called for every node). Every subclass must only define the drawLayers method, which is guaranteed to be called only when necessary. - it declares gui controls for the selection of the color to use - it declares gui controls for the selection of a filter, used to filter the layers to draw. In particular, it allows the user to specify a molecule, meaning that only the layer containing such molecule will be drawn (otherwise the effect is applied to all layers)
-
-
Field Summary
Fields Modifier and Type Field Description public String
molString
public RangedInteger
alpha
public RangedInteger
red
public RangedInteger
green
public RangedInteger
blue
public Integer
markerNodeID
-
Constructor Summary
Constructors Constructor Description AbstractDrawLayers()
-
Method Summary
Modifier and Type Method Description String
getMolString()
void
setMolString(String molString)
RangedInteger
getAlpha()
void
setAlpha(RangedInteger alpha)
RangedInteger
getRed()
void
setRed(RangedInteger red)
RangedInteger
getGreen()
void
setGreen(RangedInteger green)
RangedInteger
getBlue()
void
setBlue(RangedInteger blue)
Color
getColorSummary()
abstract <T, P extends Position2D<P>> void
drawLayers(Collection<Layer<T, P>> toDraw, Environment<T, P> environment, Graphics2D graphics, Wormhole2D<P> wormhole)
Effectively draw the layers. boolean
isLayerFilter()
void
setLayerFilter(boolean layerFilter)
-
Methods inherited from class it.unibo.alchemist.boundary.swingui.effect.impl.AbstractDrawOnce
apply, getMarkerNodeID
-
Methods inherited from class it.unibo.alchemist.boundary.swingui.effect.api.Effect
apply, apply, equals, hashCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getMolString
String getMolString()
- Returns:
a string representing the current molecule
-
setMolString
void setMolString(String molString)
- Parameters:
molString
- a string representing the molecule to use
-
getAlpha
RangedInteger getAlpha()
- Returns:
alpha channel
-
setAlpha
void setAlpha(RangedInteger alpha)
- Parameters:
alpha
- alpha channel
-
getRed
RangedInteger getRed()
- Returns:
red channel
-
setRed
void setRed(RangedInteger red)
- Parameters:
red
- red channel
-
getGreen
RangedInteger getGreen()
- Returns:
green channel
-
setGreen
void setGreen(RangedInteger green)
- Parameters:
green
- green channel
-
getBlue
RangedInteger getBlue()
- Returns:
blue channel
-
setBlue
void setBlue(RangedInteger blue)
- Parameters:
blue
- blue channel
-
getColorSummary
Color getColorSummary()
-
drawLayers
abstract <T, P extends Position2D<P>> void drawLayers(Collection<Layer<T, P>> toDraw, Environment<T, P> environment, Graphics2D graphics, Wormhole2D<P> wormhole)
Effectively draw the layers.
-
isLayerFilter
boolean isLayerFilter()
- Returns:
a boolean representing whether or not layer filter is on
-
setLayerFilter
void setLayerFilter(boolean layerFilter)
- Parameters:
layerFilter
- a boolean representing whether or not layer filter must be on
-
-
-
-