Package noaa.coastwatch.render
Class BitmaskOverlay
java.lang.Object
noaa.coastwatch.render.EarthDataOverlay
noaa.coastwatch.render.MaskOverlay
noaa.coastwatch.render.BitmaskOverlay
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable
,GridContainerOverlay
,TransparentOverlay
A
BitmaskOverlay
annotates a data view using a
data grid and an integer bit mask. The mask is computed by
logically anding the bit mask value with each integer-cast
data value in the grid. If the result is non-zero at a given
location, the data is masked. The bit mask is effectively a
selection mechanism for byte or integer valued data that
allows certain bits in the data values to act as overlay
graphics planes.- Since:
- 3.1.1
- Author:
- Peter Hollemans
- See Also:
-
Field Summary
Fields inherited from class noaa.coastwatch.render.EarthDataOverlay
alpha, lastTrans, prepared
-
Constructor Summary
ConstructorDescriptionBitmaskOverlay
(Color color, EarthDataReader reader, List variableList, String gridName, int mask) Constructs a new bitmask overlay.BitmaskOverlay
(Color color, Grid grid, int mask) Constructs a new bitmask overlay. -
Method Summary
Modifier and TypeMethodDescriptiongetGrid()
Gets the active grid variable.Gets the active list of grid variables.Gets the grid variable name.Gets the possible grid variable names, or null if no list was explicitly given to the constructor.int
getMask()
Gets the bit mask value.Gets the reader used to fetch the data for this bitmask, or null if no reader was explicitly given to the constructor.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.protected void
Prepares any data structures that may be necessary for computing the mask values prior to runningMaskOverlay.prepare(java.awt.Graphics2D, noaa.coastwatch.render.EarthDataView)
.void
setDataSource
(EarthDataReader reader, List variableList) Sets the data source for grid data.void
setGridName
(String name) Sets the grid variable based on the name.void
setMask
(int mask) Sets the bit mask value.Methods inherited from class noaa.coastwatch.render.MaskOverlay
createColorModel, draw, getInverse, invalidate, prepare, 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, toString
-
Constructor Details
-
BitmaskOverlay
Constructs a new bitmask overlay. The layer number is initialized to 0. If this constructor is used, then thesetGridName(java.lang.String)
method performs no operation andgetGridNameValues()
returns null.- Parameters:
color
- the overlay color.grid
- the grid to use for data.mask
- the bit mask value.
-
BitmaskOverlay
public BitmaskOverlay(Color color, EarthDataReader reader, List variableList, String gridName, int mask) Constructs a new bitmask 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.gridName
- the initial grid name from the list.mask
- the bit mask value.
-
-
Method Details
-
setDataSource
Sets the data source for grid data. The reader and variable list must contain a data grid with the current grid name.- Specified by:
setDataSource
in interfaceGridContainerOverlay
- Parameters:
reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.
-
getMask
public int getMask()Gets the bit mask value. -
setMask
public void setMask(int mask) Sets the bit mask value. -
getReader
Gets the reader used to fetch the data for this bitmask, or null if no reader was explicitly given to the constructor. -
getGridName
Gets the grid variable name. -
getGridNameValues
Gets the possible grid variable names, or null if no list was explicitly given to the constructor. -
setGridName
Sets the grid variable based on the name. This method may only be used if the overlay was constructed using a reader and grid name list. -
getGrid
Gets the active grid variable. -
prepareData
protected void prepareData()Description copied from class:MaskOverlay
Prepares any data structures that may be necessary for computing the mask values prior to runningMaskOverlay.prepare(java.awt.Graphics2D, noaa.coastwatch.render.EarthDataView)
. This should be overrideen in the child class if anything needs to be done.- Overrides:
prepareData
in classMaskOverlay
-
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
-