Package noaa.coastwatch.render.feature
Class FeatureGroupFilter
java.lang.Object
noaa.coastwatch.render.feature.FeatureGroupFilter
- All Implemented Interfaces:
Cloneable
A
FeatureGroupFilter
filters a set of Feature
objects
using a grouping concept. Features are grouped by an attribute value they
have in common -- in the case of point features that represent measurements
made over time, this could by the ID of the platform making the measurement.
The group is then filtered by only selecting the single feature in the
group whose attribute value is closest to a specified value. For example,
suppose that we have features with "id" and "time" attributes as follows:
- id=BUOY1, time=1985-10-26T01:20:00
- id=BUOY1, time=1985-10-26T01:21:00
- id=BUOY1, time=1985-10-26T01:22:00
- id=BUOY2, time=1985-10-26T01:20:00
- id=BUOY2, time=1985-10-26T01:21:00
- id=BUOY2, time=1985-10-26T01:22:00
- id=BUOY1, time=1985-10-26T01:21:00
- id=BUOY2, time=1985-10-26T01:21:00
- Since:
- 3.3.2
- Author:
- Peter Hollemans
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Filters a collection of features using the algorithm in this filter for matching.Gets the filter attribute name.Gets the grouping attribute name.Gets the target value.static void
Tests this class.void
setFilterAttribute
(String filterAttName) Sets the filtering attribute.void
setGroupAttribute
(String groupAttName) Sets the grouping attribute.void
setTargetValue
(Object targetAttValue) Sets the target attribute value The target value is used to filter each feature group.toString()
-
Field Details
-
nameMap
The map to use to translate name to index for attributes.
-
-
Constructor Details
-
FeatureGroupFilter
public FeatureGroupFilter(String groupAttName, Map<String, Integer> nameMap, String filterAttName, Object targetAttValue) Creates a new group filter with the specified properties.- Parameters:
groupAttName
- the name of the attribute to use for creating groups of features.nameMap
- the name to index mapping.filterAttName
- the name of the attribute to use for filtering.targetAttValue
- the target attribute value to filter for.
-
-
Method Details
-
clone
-
filter
Filters a collection of features using the algorithm in this filter for matching.- Parameters:
features
- the features to filter.- Returns:
- the list of the matching features.
-
setGroupAttribute
Sets the grouping attribute. During filtering, features will be grouped according to the value of their grouping attribute (according to Object.equals()) and then filtered by target value.- Parameters:
groupAttName
- the name of the grouping attribute to use while filtering.
-
getGroupAttribute
Gets the grouping attribute name.- Returns:
- grouping attribute name.
- See Also:
-
setFilterAttribute
Sets the filtering attribute. The filtering attribute is used to search for the feature in each group with closest attribute value to a target value.- Parameters:
filterAttName
- the name of the filtering attribute to use.
-
getFilterAttribute
Gets the filter attribute name.- Returns:
- filter attribute name.
- See Also:
-
setTargetValue
Sets the target attribute value The target value is used to filter each feature group. Only the feature from each group with the closest value to the target value is retained.- Parameters:
targetAttValue
- the target value to use for measuring distance.
-
getTargetValue
Gets the target value.- Returns:
- target value object.
- See Also:
-
toString
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-