Class ExtractBoundsFilterVisitor

  • All Implemented Interfaces:
    ExpressionVisitor, FilterVisitor

    public class ExtractBoundsFilterVisitor
    extends NullFilterVisitor
    Extract a maximal envelope from the provided Filter.

    The maximal envelope is generated from:

    • all the literal geometry instances involved if spatial operations - using geom.getEnvelopeInternal().
    • Filter.EXCLUDES will result in an empty envelope
    • Filter.INCLUDES will result in a "world" envelope with range Double.NEGATIVE_INFINITY to Double.POSITIVE_INFINITY for each axis.
    • all other non spatial filters will result in a world envelope
    • combinations in and will return the intersection of the envelopes, or an empty envelope if an exclude is in the mix, or null if the and is mixing non spatial filters
    • combinations in or will return the intersection of
    Since geometry literals do not contains CRS information we can only produce a ReferencedEnvelope without CRS information. You can call this function with an existing ReferencedEnvelope or with your data CRS to correct for this limitation. ReferencedEnvelope example:
    
     ReferencedEnvelope bbox = (ReferencedEnvelope)
         filter.accepts(new ExtractBoundsFilterVisitor(), dataCRS );
     
    You can also call this function with an existing Envelope; if you are building up bounds based on several filters.

    This is a replacement for FilterConsumer.

    Author:
    Jody Garnett