Package noaa.coastwatch.render
Class ExpressionMaskOverlay
java.lang.Object
noaa.coastwatch.render.EarthDataOverlay
noaa.coastwatch.render.MaskOverlay
noaa.coastwatch.render.ExpressionMaskOverlay
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
,GridContainerOverlay
,TransparentOverlay
The
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
.- Since:
- 3.2.1
- Author:
- Peter Hollemans
- See Also:
-
Field Summary
Fields inherited from class noaa.coastwatch.render.EarthDataOverlay
alpha, lastTrans, prepared
-
Constructor Summary
ConstructorDescriptionExpressionMaskOverlay
(Color color, EarthDataReader reader, List variableList, String expression) Constructs a new overlay. -
Method Summary
Modifier and TypeMethodDescriptionGets the current expression.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, List variableList) Sets the data source for grid data.void
setExpression
(String newExpression) Sets the expression used by the mask.Methods inherited from class noaa.coastwatch.render.MaskOverlay
createColorModel, draw, getInverse, invalidate, prepare, prepareData, setColor, setInverse, setTransparency
Methods inherited from class noaa.coastwatch.render.EarthDataOverlay
clone, compareTo, getAlphaVersion, getColor, getColors, getColorWithAlpha, getLayer, getMetadataAtPoint, getName, getTransparency, getVisible, hasMetadata, isPrepared, needsPrepare, render, setLayer, setName, setVisible
-
Constructor Details
-
ExpressionMaskOverlay
public ExpressionMaskOverlay(Color color, EarthDataReader reader, List variableList, String expression) Constructs a new overlay. The layer number is initialized to 0.- Parameters:
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.
-
-
Method Details
-
setDataSource
Sets the data source for grid data. The reader and variable list must contain data grids with the current set of expression variables.- Specified by:
setDataSource
in interfaceGridContainerOverlay
- Parameters:
reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.
-
setExpression
Sets the expression used by the mask.- Parameters:
newExpression
- the new math expression.- Throws:
IllegalArgumentException
- is the expression has a parsing error or contains variables that are not available in the current list of variables.
-
getExpression
Gets the current expression. -
isMasked
Description copied from class:MaskOverlay
Determines if the data location should be masked.- Specified by:
isMasked
in classMaskOverlay
- Parameters:
loc
- the data location in question.isNavigated
- the navigated flag, true if the data location is pre-navigated- Returns:
- true if the data should be masked at the location or false if not.
-
isCompatible
Description copied from class:MaskOverlay
Determines if the data view is compatible with this overlay. If so, then the precomputed view coordinate cache tables will be used to determine data locations for each view point. If not, then each view point is transformed individually using the view's image transform.- Specified by:
isCompatible
in classMaskOverlay
- Parameters:
view
- the data view in question.- Returns:
- true if the view has compatible data coordinate
caches for the data used to create the mask values in the
MaskOverlay.isMasked(noaa.coastwatch.util.DataLocation, boolean)
method, or false if not.
-
getGridList
Description copied from interface:GridContainerOverlay
Gets the active list of grid variables.- Specified by:
getGridList
in interfaceGridContainerOverlay
-