Package noaa.coastwatch.render.feature
Class AbstractFeatureSource
java.lang.Object
noaa.coastwatch.render.feature.AbstractFeatureSource
- All Implemented Interfaces:
Iterable<Feature>
,FeatureSource
- Direct Known Subclasses:
LineFeatureSource
,PointFeatureSource
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 Summary
Modifier and TypeFieldDescriptionprotected EarthArea
The currently selected earth area.The currently selected list of features. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a new feature source with an empty list of features and a zero length list of attributes. -
Method Summary
Modifier and TypeMethodDescriptiongetArea()
Gets the currently selected Earth area.int
Gets the number of attributes in the attribute list for each feature.Gets the mapping from attribute name to index.Gets the list of attributes for each feature from this source.Gets the feature filter being used in this source.iterator()
Gets an iterator over all selected features.protected abstract void
select()
Selects a set of features from the data source based on the current area.void
Selects a set of features from the data source based on the specified area.protected void
setAttributes
(List<Attribute> attributeList) Sets the list of attributes in this source.void
setFilter
(SelectionRuleFilter filter) Sets the feature filter to use in this source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
featureList
The currently selected list of features. -
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
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
Gets the feature filter being used in this source.- Returns:
- the feature filter or null for no filtering.
-
setFilter
Sets the feature filter to use in this source.- Parameters:
filter
- the feature filter or null for no filtering.
-
select
Description copied from interface:FeatureSource
Selects a set of features from the data source based on the specified area.- Specified by:
select
in interfaceFeatureSource
- Parameters:
area
- the earth area for feature selection.- Throws:
IOException
- if an error occurred accessing the data source.
-
select
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
Description copied from interface:FeatureSource
Gets the currently selected Earth area.- Specified by:
getArea
in interfaceFeatureSource
-
iterator
Description copied from interface:FeatureSource
Gets an iterator over all selected features.- Specified by:
iterator
in interfaceFeatureSource
- Specified by:
iterator
in interfaceIterable<Feature>
-
getAttributes
Description copied from interface:FeatureSource
Gets the list of attributes for each feature from this source.- Specified by:
getAttributes
in interfaceFeatureSource
- 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 interfaceFeatureSource
- Returns:
- the attribute count.
-
setAttributes
Sets the list of attributes in this source.- Parameters:
attributeList
- the list of attributes.
-