public abstract class AbstractFeatureSource extends java.lang.Object implements FeatureSource
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.Modifier and Type | Field and Description |
---|---|
protected EarthArea |
area
The currently selected earth area.
|
protected java.util.List<Feature> |
featureList
The currently selected list of features.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractFeatureSource()
Creates a new feature source with an empty list of features and a zero
length list of attributes.
|
Modifier and Type | Method and Description |
---|---|
EarthArea |
getArea()
Gets the currently selected Earth area.
|
int |
getAttributeCount()
Gets the number of attributes in the attribute list for each feature.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getAttributeNameMap()
Gets the mapping from attribute name to index.
|
java.util.List<Attribute> |
getAttributes()
Gets the list of attributes for each feature from this source.
|
SelectionRuleFilter |
getFilter()
Gets the feature filter being used in this source.
|
java.util.Iterator<Feature> |
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 |
select(EarthArea area)
Selects a set of features from the data source based on the
specified area.
|
protected void |
setAttributes(java.util.List<Attribute> attributeList)
Sets the list of attributes in this source.
|
void |
setFilter(SelectionRuleFilter filter)
Sets the feature filter to use in this source.
|
protected java.util.List<Feature> featureList
protected EarthArea area
protected AbstractFeatureSource()
public java.util.Map<java.lang.String,java.lang.Integer> getAttributeNameMap()
public SelectionRuleFilter getFilter()
public void setFilter(SelectionRuleFilter filter)
filter
- the feature filter or null for no filtering.public void select(EarthArea area) throws java.io.IOException
FeatureSource
select
in interface FeatureSource
area
- the earth area for feature selection.java.io.IOException
- if an error occurred accessing the data source.protected abstract void select() throws java.io.IOException
java.io.IOException
- if an error occurred accessing the data source.public EarthArea getArea()
FeatureSource
getArea
in interface FeatureSource
public java.util.Iterator<Feature> iterator()
FeatureSource
iterator
in interface java.lang.Iterable<Feature>
iterator
in interface FeatureSource
public java.util.List<Attribute> getAttributes()
FeatureSource
getAttributes
in interface FeatureSource
public int getAttributeCount()
FeatureSource
getAttributeCount
in interface FeatureSource
protected void setAttributes(java.util.List<Attribute> attributeList)
attributeList
- the list of attributes.