Class DefaultFeatureResults

    • Field Detail

      • query

        protected Query query
        Query used to define this subset of features from the feature source
      • featureSource

        protected SimpleFeatureSource featureSource
        Feature source used to aquire features, note we are only a "view" of this FeatureSource, its contents, transaction and events need to be forwarded through this collection api to simplier code such as renderers.
    • Constructor Detail

      • DefaultFeatureResults

        public DefaultFeatureResults​(SimpleFeatureSource source,
                                     Query query)
                              throws IOException
        FeatureResults query against featureSource.

        Please note that is object will not be valid after the transaction has closed.

        Really? I think it would be, it would just reflect the same query against the SimpleFeatureSource using AUTO_COMMIT.

        Throws:
        IOException
    • Method Detail

      • getSchema

        public SimpleFeatureType getSchema()
        FeatureSchema for provided query.

        If query.retrieveAllProperties() is true the FeatureSource getSchema() will be returned.

        If query.getPropertyNames() is used to limit the result of the Query a sub type will be returned based on FeatureSource.getSchema().

        Specified by:
        getSchema in interface FeatureCollection<SimpleFeatureType,​SimpleFeature>
        Overrides:
        getSchema in class DataFeatureCollection
        Returns:
        FeatureType describing the "common" schema to all child features of this collection
      • getTransaction

        protected Transaction getTransaction()
        Returns transaction from SimpleFeatureSource (if it is a FeatureStore), or Transaction.AUTO_COMMIT if it is not.
        Returns:
        Transacstion this FeatureResults opperates against
      • boundsReader

        protected FeatureReader<SimpleFeatureType,​SimpleFeature> boundsReader()
                                                                             throws IOException
        Retrieve a FeatureReader for the geometry attributes only, designed for bounds computation
        Throws:
        IOException
      • getBounds

        public ReferencedEnvelope getBounds()
        Returns the bounding box of this FeatureResults

        This implementation will generate the correct results from reader() if the provided SimpleFeatureSource does not provide an optimized result via FeatureSource.getBounds( Query ). If the feature has no geometry, then an empty envelope is returned.

        Specified by:
        getBounds in interface FeatureCollection<SimpleFeatureType,​SimpleFeature>
        Specified by:
        getBounds in class DataFeatureCollection
        Returns:
        An Envelope containing the total bounds of this collection.
        Throws:
        DataSourceException - See IOException
        See Also:
        org.geotools.data.FeatureResults#getBounds()
      • getCount

        public int getCount()
                     throws IOException
        Number of Features in this query.

        This implementation will generate the correct results from reader() if the provided SimpleFeatureSource does not provide an optimized result via FeatureSource.getCount( Query ).

        Specified by:
        getCount in class DataFeatureCollection
        Throws:
        IOException - If feature could not be read
        DataSourceException - See IOException
        See Also:
        org.geotools.data.FeatureResults#getCount()