Interface Filter


public interface Filter
An interface for classes that select the features to be returned by a query.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    accept(Feature feature)
    Checks whether the given feature should be included in the query results.
    default boolean
    accept(Feature feature, Geometry geom)
    Checks whether the given feature should be included in the query results.
    default int
     
    default Bounds
    The maximum bounding box in which acceptable candidates can be found.
    default Filter
    filterForTile(int tileNumber, Polygon tileGeometry)
    Returns the Filter that should be used for the given tile.
    default int
    Returns zero or more bit flags specified in FilterStrategy that help the Query Engine optimize the performance of this Filter.
  • Method Details

    • strategy

      default int strategy()
      Returns zero or more bit flags specified in FilterStrategy that help the Query Engine optimize the performance of this Filter.
      Returns:
      a bit set of strategy flags
    • accept

      default boolean accept(Feature feature)
      Checks whether the given feature should be included in the query results.
      Parameters:
      feature - the feature to check
      Returns:
      `true` if this feature should be included in the results
    • accept

      default boolean accept(Feature feature, Geometry geom)
      Checks whether the given feature should be included in the query results. If `stategy()` includes `NEEDS_GEOMETRY`, `geom` must not be `null`.
      Parameters:
      feature - the feature to check
      geom - the feature's geometry
      Returns:
      `true` if this feature should be included in the results
    • filterForTile

      default Filter filterForTile(int tileNumber, Polygon tileGeometry)
      Returns the Filter that should be used for the given tile. This allows a Filter to accept all features within a certain tile, reject a tile entirely, or substitute itself with a cheaper filter. This method will only be called if `strategy()` includes `FAST_TILE_FILTER`. Note that to signal that all features should be accepted, this method returns `null` (i.e. nothing is filtered out); to reject the tile entirely, it must return `FalseFilter.INSTANCE`. It can return `this` to indicate that no shortcut filter is available for the given tile.
      Parameters:
      tileNumber - the tile number
      tileGeometry - the tile polygon (an axis-aligned square)
      Returns:
      the filter to use for this tile
    • bounds

      default Bounds bounds()
      The maximum bounding box in which acceptable candidates can be found.
      Returns:
      a bounding box, or`null` if the filter does not use the spatial index TODO: would it be easier to just return a World bbox?
    • acceptedTypes

      default int acceptedTypes()