public class OverlayGroupManager
extends java.lang.Object
OverlayGroupManager
class can be used to save,
load, delete, and get a list of overlay groups. Bitmask overlays
need special treatment in order to correctly restore the data
source used for bitmask data. The setDataSource(noaa.coastwatch.io.EarthDataReader, java.util.List<java.lang.String>)
method
should be called to set the bitmask data source prior to loading
any overlay groups that contain bitmask overlays.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OVERLAY_GROUPS_PROPERTY
The overlay groups property.
|
Constructor and Description |
---|
OverlayGroupManager(java.io.File groupDir)
Creates a new manager to handle overlay groups in the specified
directory.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener for changes to the group list.
|
void |
deleteGroup(java.lang.String group)
Deletes the specified group.
|
java.util.List<java.lang.String> |
getGroups()
Gets the list of group names available.
|
java.util.List<EarthDataOverlay> |
loadGroup(java.lang.String group)
Loads the specified group of overlays.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener for changes to the group list.
|
void |
saveGroup(java.util.List<EarthDataOverlay> group,
java.lang.String name)
Saves the specified overlay group.
|
void |
setDataSource(EarthDataReader reader,
java.util.List<java.lang.String> variableList)
Sets the data source for bitmask grid data.
|
public static final java.lang.String OVERLAY_GROUPS_PROPERTY
public OverlayGroupManager(java.io.File groupDir)
groupDir
- the group directory used to perform all
group-related operations.public void setDataSource(EarthDataReader reader, java.util.List<java.lang.String> variableList)
reader
- the reader to use for data variables.variableList
- the list of allowed data variable names.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener to add to the list.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the listener to remove from the list.public java.util.List<java.lang.String> getGroups()
public java.util.List<EarthDataOverlay> loadGroup(java.lang.String group) throws java.io.IOException
group
- the group name, which must be a valid name obtained
from the getGroups()
method.java.io.IOException
- if an error occurred reading the group file.public void saveGroup(java.util.List<EarthDataOverlay> group, java.lang.String name) throws java.io.IOException
group
- the overlay group to save.name
- the group name. This is the name that may be used
later to retrieve the group.java.io.IOException
- if an error occurred writing the group file.public void deleteGroup(java.lang.String group) throws java.io.IOException
getGroups()
will not include thie specified name in the list.java.io.IOException
- if an error occurred deleting the group file.