Class AbstractFeatureSource

java.lang.Object
noaa.coastwatch.render.feature.AbstractFeatureSource
All Implemented Interfaces:
Iterable<Feature>, FeatureSource
Direct Known Subclasses:
LineFeatureSource, PointFeatureSource

public abstract class AbstractFeatureSource extends Object implements FeatureSource
The AbstractFeatureSource class supplies default implementations for some FeatureSource methods. The class also adds the ability for any feature source to be filterable, by adding a SelectionRuleFilter. When a filter is set, the iterator only returns features that match the filter.
Since:
3.2.0
Author:
Peter Hollemans
  • Field Details

    • featureList

      protected List<Feature> featureList
      The currently selected list of features.
    • area

      protected EarthArea area
      The currently selected earth area.
  • Constructor Details

    • AbstractFeatureSource

      protected AbstractFeatureSource()
      Creates a new feature source with an empty list of features and a zero length list of attributes.
  • Method Details

    • getAttributeNameMap

      public Map<String,Integer> getAttributeNameMap()
      Gets the mapping from attribute name to index. The index can be used to retrieve the attribute value in each attribute of the features provided by this source.
      Returns:
      the attribute name to index map.
    • getFilter

      public SelectionRuleFilter getFilter()
      Gets the feature filter being used in this source.
      Returns:
      the feature filter or null for no filtering.
    • setFilter

      public void setFilter(SelectionRuleFilter filter)
      Sets the feature filter to use in this source.
      Parameters:
      filter - the feature filter or null for no filtering.
    • select

      public void select(EarthArea area) throws IOException
      Description copied from interface: FeatureSource
      Selects a set of features from the data source based on the specified area.
      Specified by:
      select in interface FeatureSource
      Parameters:
      area - the earth area for feature selection.
      Throws:
      IOException - if an error occurred accessing the data source.
    • select

      protected abstract void select() throws IOException
      Selects a set of features from the data source based on the current area.
      Throws:
      IOException - if an error occurred accessing the data source.
    • getArea

      public EarthArea getArea()
      Description copied from interface: FeatureSource
      Gets the currently selected Earth area.
      Specified by:
      getArea in interface FeatureSource
    • iterator

      public Iterator<Feature> iterator()
      Description copied from interface: FeatureSource
      Gets an iterator over all selected features.
      Specified by:
      iterator in interface FeatureSource
      Specified by:
      iterator in interface Iterable<Feature>
    • getAttributes

      public List<Attribute> getAttributes()
      Description copied from interface: FeatureSource
      Gets the list of attributes for each feature from this source.
      Specified by:
      getAttributes in interface FeatureSource
      Returns:
      the list of attributes.
    • getAttributeCount

      public int getAttributeCount()
      Description copied from interface: FeatureSource
      Gets the number of attributes in the attribute list for each feature.
      Specified by:
      getAttributeCount in interface FeatureSource
      Returns:
      the attribute count.
    • setAttributes

      protected void setAttributes(List<Attribute> attributeList)
      Sets the list of attributes in this source.
      Parameters:
      attributeList - the list of attributes.