public class ExpressionMaskOverlay extends MaskOverlay implements GridContainerOverlay
ExpressionMaskOverlay
class uses a mathematical
expression to compute a data mask. If the expression evaluates to
true or non-zero, then the data is masked, otherwise the data is
left visible. An ExpressionMaskOverlay
is thus a more
general type of BitmaskOverlay
.cwmath
,
Serialized Formalpha, lastTrans, prepared
Constructor and Description |
---|
ExpressionMaskOverlay(java.awt.Color color,
EarthDataReader reader,
java.util.List variableList,
java.lang.String expression)
Constructs a new overlay.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getExpression()
Gets the current expression.
|
java.util.List<Grid> |
getGridList()
Gets the active list of grid variables.
|
protected boolean |
isCompatible(EarthDataView view)
Determines if the data view is compatible with this overlay.
|
boolean |
isMasked(DataLocation loc,
boolean isNavigated)
Determines if the data location should be masked.
|
void |
setDataSource(EarthDataReader reader,
java.util.List variableList)
Sets the data source for grid data.
|
void |
setExpression(java.lang.String newExpression)
Sets the expression used by the mask.
|
createColorModel, draw, getInverse, invalidate, prepare, prepareData, setColor, setInverse, setTransparency
clone, compareTo, getAlphaVersion, getColor, getColors, getColorWithAlpha, getLayer, getMetadataAtPoint, getName, getTransparency, getVisible, hasMetadata, isPrepared, needsPrepare, render, setLayer, setName, setVisible
public ExpressionMaskOverlay(java.awt.Color color, EarthDataReader reader, java.util.List variableList, java.lang.String expression)
color
- the overlay color.reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.expression
- the mask expression. Variables names in
the expression must have corresponding grids in the list.public void setDataSource(EarthDataReader reader, java.util.List variableList)
setDataSource
in interface GridContainerOverlay
reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.public void setExpression(java.lang.String newExpression)
newExpression
- the new math expression.java.lang.IllegalArgumentException
- is the expression has a
parsing error or contains variables that are not available
in the current list of variables.public java.lang.String getExpression()
public boolean isMasked(DataLocation loc, boolean isNavigated)
MaskOverlay
isMasked
in class MaskOverlay
loc
- the data location in question.isNavigated
- the navigated flag, true if the data
location is pre-navigatedprotected boolean isCompatible(EarthDataView view)
MaskOverlay
isCompatible
in class MaskOverlay
view
- the data view in question.MaskOverlay.isMasked(noaa.coastwatch.util.DataLocation, boolean)
method, or false if not.public java.util.List<Grid> getGridList()
GridContainerOverlay
getGridList
in interface GridContainerOverlay