Class OverlayGroupManager

java.lang.Object
noaa.coastwatch.render.OverlayGroupManager

public class OverlayGroupManager extends Object
The 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.
Since:
3.1.7
Author:
Peter Hollemans
  • Field Details

    • OVERLAY_GROUPS_PROPERTY

      public static final String OVERLAY_GROUPS_PROPERTY
      The overlay groups property.
      See Also:
  • Constructor Details

    • OverlayGroupManager

      public OverlayGroupManager(File groupDir)
      Creates a new manager to handle overlay groups in the specified directory.
      Parameters:
      groupDir - the group directory used to perform all group-related operations.
  • Method Details

    • setDataSource

      public void setDataSource(EarthDataReader reader, List<String> variableList)
      Sets the data source for bitmask grid data.
      Parameters:
      reader - the reader to use for data variables.
      variableList - the list of allowed data variable names.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a listener for changes to the group list.
      Parameters:
      listener - the listener to add to the list.
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a listener for changes to the group list.
      Parameters:
      listener - the listener to remove from the list.
    • getGroups

      public List<String> getGroups()
      Gets the list of group names available.
    • loadGroup

      public List<EarthDataOverlay> loadGroup(String group) throws IOException
      Loads the specified group of overlays.
      Parameters:
      group - the group name, which must be a valid name obtained from the getGroups() method.
      Returns:
      the list of overlays in the group.
      Throws:
      IOException - if an error occurred reading the group file.
    • saveGroup

      public void saveGroup(List<EarthDataOverlay> group, String name) throws IOException
      Saves the specified overlay group.
      Parameters:
      group - the overlay group to save.
      name - the group name. This is the name that may be used later to retrieve the group.
      Throws:
      IOException - if an error occurred writing the group file.
    • deleteGroup

      public void deleteGroup(String group) throws IOException
      Deletes the specified group. A subsequent call to getGroups() will not include thie specified name in the list.
      Throws:
      IOException - if an error occurred deleting the group file.
    • signalGroupsChanged

      public void signalGroupsChanged()
      Signals all listeners that the overlay groups have changed. This is useful when some other class has changed the overlay groups and we need to force an update.
      Since:
      3.8.1