Package com.luciad.multidimensional
Class TLcdDimensionFilter
java.lang.Object
com.luciad.multidimensional.TLcdDimensionFilter
An abstraction of a dimensional filter, to be applied to multi-dimensional models.
A filter is immutable, and typically consists of a single interval per axis.
Filterable models are models implementing the
ILcdMultiDimensionalModel
interface.
For example, if there is a time dimension and a level dimension, a dimensional filter will contain a single possible
value for time and level.- Since:
- 2016.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A builder for filters which reuses filter instances as much as possible.static enum
The snap mode to use when snapping arbitrary intervals to model intervals:TLcdDimensionFilter.SnapMode.PREVIOUS
TLcdDimensionFilter.SnapMode.NEXT
TLcdDimensionFilter.SnapMode.NEAREST
null
indicates no snapping, in which case the model's value needs to match the filter exactly. -
Field Summary
Modifier and TypeFieldDescriptionstatic final TLcdDimensionFilter
A constant defining the empty filter. -
Method Summary
Modifier and TypeMethodDescriptionReturns a builder filled in with the values of this filter.createSnappingFilter
(ILcdMultiDimensionalModel aModel, TLcdDimensionFilter.SnapMode aSnapMode) Returns an exact matching filter value in the given model depending on the value of aSnapMode.boolean
getAndConvertInterval
(TLcdDimensionAxis<?> aAxis) Gets the interval matching a given axis, converting the resulting interval to the given axis' unit if necessary.Set
<TLcdDimensionAxis<?>> getAxes()
Gets the axes defined by this filter as an unmodifiable set.getInterval
(TLcdDimensionAxis<?> aAxis) Gets the interval for a given axis defined by this filter.int
hashCode()
static TLcdDimensionFilter.Builder
Creates a new builder with empty initial values.toString()
-
Field Details
-
EMPTY_FILTER
A constant defining the empty filter.
-
-
Method Details
-
getAxes
Gets the axes defined by this filter as an unmodifiable set.- Returns:
- the axes defined by this filter, possible empty but never
null
- See Also:
-
getInterval
Gets the interval for a given axis defined by this filter.- Parameters:
aAxis
- the axis to get the interval for defined by this filter- Returns:
- the interval for a given axis defined by this filter, possibly
null
-
asBuilder
Returns a builder filled in with the values of this filter.- Returns:
- a new builder filled in with the values of this filter, never
null
-
equals
-
hashCode
public int hashCode() -
toString
-
newBuilder
Creates a new builder with empty initial values.- Returns:
- a new builder with empty initial values, never
null
-
getAndConvertInterval
Gets the interval matching a given axis, converting the resulting interval to the given axis' unit if necessary. This method matches an axis based on type, direction (positive or negative) and measure type code, rather than equality. This is less strict than matching axis based on equality. This allows for example to match time dimensions that have a different display name, or vertical positions with a different unit of measure but the same measure type code. This is useful for example when:- You're developing a slider UI for the vertical position in the atmosphere that uses meters.
- You have two models in your view which need to respond the filter defined by the slider, but one model is in ft and the other in km.
Values can only be converted if the values of the dimension in the filter are
TLcdISO19103Measure
. If not, they remain unconverted.- Parameters:
aAxis
- the axis to match the interval for defined by this filter- Returns:
- the interval for a given axis defined by this filter, converted to the unit of the given axis, possibly
null
- See Also:
-
createSnappingFilter
public TLcdDimensionFilter createSnappingFilter(ILcdMultiDimensionalModel aModel, TLcdDimensionFilter.SnapMode aSnapMode) Returns an exact matching filter value in the given model depending on the value of aSnapMode. You can use different snap modes:NEXT
: snaps to the next element.PREVIOUS
: snaps to the previous element.NEAREST
: snaps to the nearest element (next or previous) forNumber
andDate
types, as given byTLcdDimensionAxis.getType()
. In case the filtered dimension is not one of these types, the behavior reverts toNEXT
.null
: no snapping.
Snapping does not happen for dimensions which have regular intervals.
This method also uses the non-strict matching of axis given by
getAndConvertInterval(TLcdDimensionAxis)
, rather than the strict match ofgetInterval(TLcdDimensionAxis)
. Any snap mode except null enables non-strict axis matching.This method preserves the values of undefined dimensions to their current setting, rather than resetting them to the default as
Advantages When you create a snapping filter and invokeapplyDimensionFilter
does. Any snap mode except null enables it.ILcdMultiDimensionalModel.applyDimensionFilter
with it, you have the advantages below:Behavior applyDimensionFilter
createSnappingFilter -> applyDimensionFilter
Snapping Never, possibly resulting in no matches Snaps to intervals defined by the model if needed, such that there is always at least one match Supported snap modes None Nearest, previous, next, or none ( null
)Filter has less axes than supported by model Reset to default for those axes Keep the last current filter value for those axes, so that there are minimal model changes Empty filter Reset to default filter Keep current filter, so that there are no model changes ILcdModel
which is notILcdMultiDimensionalModel
Not supported Checks instance of ILcdMultiDimensionalModel
, leaves others alone- Parameters:
aModel
- anILcdMultiDimensionalModel
instance, nevernull
aSnapMode
- a snap mode, which may benull
to indicate no snapping- Returns:
- the closest filter value in the given model depending on the value of aSnapMode. if snap mode is null or the dimension has regular intervals, returns the actual filter value without snapping
-