Class TLcdDimensionFilter

java.lang.Object
com.luciad.multidimensional.TLcdDimensionFilter

public class TLcdDimensionFilter extends Object
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:
  • Field Details

    • EMPTY_FILTER

      public static final TLcdDimensionFilter EMPTY_FILTER
      A constant defining the empty filter.
  • Method Details

    • getAxes

      public Set<TLcdDimensionAxis<?>> 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

      public TLcdDimensionInterval<?> getInterval(TLcdDimensionAxis<?> aAxis)
      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

      public TLcdDimensionFilter.Builder 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

      public boolean equals(Object aObject)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newBuilder

      public static TLcdDimensionFilter.Builder newBuilder()
      Creates a new builder with empty initial values.
      Returns:
      a new builder with empty initial values, never null
    • getAndConvertInterval

      public TLcdDimensionInterval<?> getAndConvertInterval(TLcdDimensionAxis<?> aAxis)
      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.
      Using this method, you'll be able to match the dimension interval. The resulting interval will have been converted to the unit of measure of the given axis.

      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) for Number and Date types, as given by TLcdDimensionAxis.getType(). In case the filtered dimension is not one of these types, the behavior reverts to NEXT.
      • null: no snapping.
      Snapping is useful when you're implementing a time slider over a continuous time range for example, but your models only offer discrete times as singular intervals, you typically want to snap to the one of the model's discrete times.

      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 of getInterval(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 applyDimensionFilter does. Any snap mode except null enables it.

      Advantages When you create a snapping filter and invoke 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 not ILcdMultiDimensionalModel Not supported Checks instance of ILcdMultiDimensionalModel, leaves others alone
      Parameters:
      aModel - an ILcdMultiDimensionalModel instance, never null
      aSnapMode - a snap mode, which may be null 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