Package org.geotools.feature.visitor
Class NearestVisitor
Object
NearestVisitor
- All Implemented Interfaces:
FeatureVisitor,FeatureAttributeVisitor,FeatureCalc
Finds the nearest value to the provided one in the attribute domain.
- Author:
- Andrea Aime - GeoSolutions, Ilkka Rinne / Spatineo Inc for the Finnish Meteorological Institute
-
Constructor Summary
ConstructorsConstructorDescriptionNearestVisitor(Expression expression, Object valueToMatch) Creates a NearestVisitor instance for the given attribute and a value to match. -
Method Summary
Modifier and TypeMethodDescriptionExpression used to access collection content.List of expressions used by visitor.Returns the match aftervisit(org.geotools.api.feature.Feature).Returns the result of the calculation as a handy object which can be merged and modified.getResultType(List<Class> inputTypes) Returns the expected output type given the input type.Provided value to match against.voidreset()voidsetValue(Comparable nearest) voidsetValue(Comparable maxBelow, Comparable minAbove) voidVisitor function, which looks at each feature and finds the value of the attribute given attribute nearest to the given comparison value.
-
Constructor Details
-
NearestVisitor
Creates a NearestVisitor instance for the given attribute and a value to match.- Parameters:
valueToMatch- The target value to match
-
-
Method Details
-
visit
Visitor function, which looks at each feature and finds the value of the attribute given attribute nearest to the given comparison value.- Specified by:
visitin interfaceFeatureVisitor- Parameters:
feature- the feature to be visited
-
reset
public void reset() -
setValue
-
setValue
-
getNearestMatch
Returns the match aftervisit(org.geotools.api.feature.Feature).- Throws:
IllegalStateException
-
getResult
Description copied from interface:FeatureCalcReturns the result of the calculation as a handy object which can be merged and modified.- Specified by:
getResultin interfaceFeatureCalc- Returns:
- the results of the calculation
-
getExpression
Expression used to access collection content.- Returns:
- expr used to access collection
-
getValueToMatch
Provided value to match against.- Returns:
- value to match against.
-
getExpressions
Description copied from interface:FeatureAttributeVisitorList of expressions used by visitor.- Specified by:
getExpressionsin interfaceFeatureAttributeVisitor
-
getResultType
Description copied from interface:FeatureAttributeVisitorReturns the expected output type given the input type.- Specified by:
getResultTypein interfaceFeatureAttributeVisitor- Parameters:
inputTypes- The type of the input expressions
-