Package org.apache.sis.storage.aggregate
Class AggregatedFeatureSet
java.lang.Object
org.apache.sis.storage.AbstractResource
org.apache.sis.storage.AbstractFeatureSet
org.apache.sis.storage.aggregate.AggregatedFeatureSet
- All Implemented Interfaces:
DataSet
,FeatureSet
,Resource
- Direct Known Subclasses:
ConcatenatedFeatureSet
,JoinFeatureSet
A feature set made from the aggregation of other feature sets. The features may be aggregated in different ways,
depending on the subclass. The aggregation may be all features from one set followed by all features from another set,
or it may be features of the two sets merged together in a way similar to SQL JOIN statement.
This class provides default implementations of getEnvelope()
and AbstractResource.getMetadata()
.
Subclasses need to implement dependencies()
.
- Since:
- 1.0
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ImmutableEnvelope
The envelope, computed when first needed and cached for reuse.private boolean
Whetherenvelope
has been computed.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AggregatedFeatureSet
(StoreListeners parent) Creates a new aggregated feature set. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Clears any cache in this resource, forcing the data to be recomputed when needed again.protected org.opengis.metadata.Metadata
Invoked in a synchronized block the first time thatgetMetadata()
is invoked.(package private) abstract Collection<FeatureSet>
Returns all feature set used by this aggregation.final Optional<org.opengis.geometry.Envelope>
Returns the union of the envelopes in all aggregated feature sets.private boolean
getEnvelopes
(List<org.opengis.geometry.Envelope> addTo) Adds the envelopes of the aggregated feature sets in the given list.Methods inherited from class org.apache.sis.storage.AbstractFeatureSet
getFeatureCount, getIdentifier
Methods inherited from class org.apache.sis.storage.AbstractResource
addListener, getMetadata, getSynchronizationLock, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sis.storage.FeatureSet
features, getType, subset
Methods inherited from interface org.apache.sis.storage.Resource
addListener, getMetadata, removeListener
-
Field Details
-
envelope
The envelope, computed when first needed and cached for reuse.- See Also:
-
isEnvelopeComputed
private boolean isEnvelopeComputedWhetherenvelope
has been computed. The result may still be null.
-
-
Constructor Details
-
AggregatedFeatureSet
Creates a new aggregated feature set.- Parameters:
parent
- listeners of the parent resource, ornull
if none. This is usually the listeners of theDataStore
that created this resource.
-
-
Method Details
-
dependencies
Returns all feature set used by this aggregation. This method is invoked for implementation ofgetEnvelope()
and#createMetadata(MetadataBuilder)
.- Returns:
- all feature sets in this aggregation.
-
getEnvelopes
Adds the envelopes of the aggregated feature sets in the given list. If some of the feature sets are themselves aggregated feature sets, then this method traverses them recursively. We compute the union of all envelopes at once after we got all envelopes.If any source has an absent value, then this method stops the collect immediately and returns
false
. The rational is that if at least one source has unknown location, providing a location based on other sources may be misleading since they may be very far from the missing resource location.- Returns:
false
if the collect has been interrupted because an envelope is absent.- Throws:
DataStoreException
-
getEnvelope
Returns the union of the envelopes in all aggregated feature sets. This method tries to find a CRS common to all feature sets. If no common CRS can be found, then the envelope is absent.Implementation note: this method is final because overriding it would invalidate the unwrapping of otherAggregatedFeatureSet
instances. If we wish to allow overrides in a future version, we would need to revisitgetEnvelopes(List)
first.- Specified by:
getEnvelope
in interfaceDataSet
- Overrides:
getEnvelope
in classAbstractResource
- Returns:
- union of envelopes from all dependencies.
- Throws:
DataStoreException
- if an error occurred while computing the envelope.
-
createMetadata
Invoked in a synchronized block the first time thatgetMetadata()
is invoked. The default implementation adds the information documented in the parent class, then adds the dependencies as lineages.- Overrides:
createMetadata
in classAbstractFeatureSet
- Returns:
- the newly created metadata, or
null
if unknown. - Throws:
DataStoreException
- if an error occurred while reading metadata from the data stores.
-
clearCache
protected void clearCache()Clears any cache in this resource, forcing the data to be recomputed when needed again. This method should be invoked if the data in underlying data store changed.- Overrides:
clearCache
in classAbstractResource
-