public class BitmaskOverlay extends MaskOverlay implements GridContainerOverlay
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.alpha, lastTrans, prepared
Constructor and Description |
---|
BitmaskOverlay(java.awt.Color color,
EarthDataReader reader,
java.util.List variableList,
java.lang.String gridName,
int mask)
Constructs a new bitmask overlay.
|
BitmaskOverlay(java.awt.Color color,
Grid grid,
int mask)
Constructs a new bitmask overlay.
|
Modifier and Type | Method and Description |
---|---|
Grid |
getGrid()
Gets the active grid variable.
|
java.util.List<Grid> |
getGridList()
Gets the active list of grid variables.
|
java.lang.String |
getGridName()
Gets the grid variable name.
|
java.util.List |
getGridNameValues()
Gets the possible grid variable names, or null if no list was
explicitly given to the constructor.
|
int |
getMask()
Gets the bit mask value.
|
EarthDataReader |
getReader()
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 |
prepareData()
Prepares any data structures that may be necessary for
computing the mask values prior to running
MaskOverlay.prepare(java.awt.Graphics2D, noaa.coastwatch.render.EarthDataView) . |
void |
setDataSource(EarthDataReader reader,
java.util.List variableList)
Sets the data source for grid data.
|
void |
setGridName(java.lang.String name)
Sets the grid variable based on the name.
|
void |
setMask(int mask)
Sets the bit mask value.
|
createColorModel, draw, getInverse, invalidate, prepare, setColor, setInverse, setTransparency
clone, compareTo, getAlphaVersion, getColor, getColors, getColorWithAlpha, getLayer, getMetadataAtPoint, getName, getTransparency, getVisible, hasMetadata, isPrepared, needsPrepare, render, setLayer, setName, setVisible
public BitmaskOverlay(java.awt.Color color, Grid grid, int mask)
setGridName(java.lang.String)
method performs no operation and getGridNameValues()
returns null.color
- the overlay color.grid
- the grid to use for data.mask
- the bit mask value.public BitmaskOverlay(java.awt.Color color, EarthDataReader reader, java.util.List variableList, java.lang.String gridName, int mask)
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.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 int getMask()
public void setMask(int mask)
public EarthDataReader getReader()
public java.lang.String getGridName()
public java.util.List getGridNameValues()
public void setGridName(java.lang.String name)
public Grid getGrid()
protected void prepareData()
MaskOverlay
MaskOverlay.prepare(java.awt.Graphics2D, noaa.coastwatch.render.EarthDataView)
.
This should be overrideen in the child class if anything
needs to be done.prepareData
in class MaskOverlay
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