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 ImmutableEnvelopeThe envelope, computed when first needed and cached for reuse.private booleanWhetherenvelopehas been computed.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAggregatedFeatureSet(StoreListeners parent) Creates a new aggregated feature set. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClears any cache in this resource, forcing the data to be recomputed when needed again.protected org.opengis.metadata.MetadataInvoked 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 booleangetEnvelopes(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, getIdentifierMethods inherited from class org.apache.sis.storage.AbstractResource
addListener, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sis.storage.FeatureSet
features, getType, subsetMethods 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 isEnvelopeComputedWhetherenvelopehas been computed. The result may still be null.
-
-
Constructor Details
-
AggregatedFeatureSet
Creates a new aggregated feature set.- Parameters:
parent- listeners of the parent resource, ornullif none. This is usually the listeners of theDataStorethat 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:
falseif 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 otherAggregatedFeatureSetinstances. If we wish to allow overrides in a future version, we would need to revisitgetEnvelopes(List)first.- Specified by:
getEnvelopein interfaceDataSet- Overrides:
getEnvelopein 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:
createMetadatain classAbstractFeatureSet- Returns:
- the newly created metadata, or
nullif 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:
clearCachein classAbstractResource
-