LuciadCPillar 2024.0.04
|
A feature model allows to uniformly access vector data. More...
#include <luciad/models/features/IFeatureModel.h>
Public Member Functions | |
~IFeatureModel () override=default | |
virtual void | addObserver (std::shared_ptr< IFeatureModelObserver > modelObserver)=0 |
Adds an observer that allows to receive change events from this feature model. More... | |
virtual FeatureModelMetadata | getFeatureModelMetadata () const =0 |
Returns the feature model meta data. More... | |
virtual std::shared_ptr< FeatureModelPersistenceManager > | getPersistenceManager ()=0 |
Returns the luciad::FeatureModelPersistenceManager that is used to persist in-memory changes made through luciad::IFeatureModelUpdater . More... | |
virtual std::shared_ptr< IFeatureModelUpdater > | getUpdater ()=0 |
Returns the IFeatureModelUpdater that is used to make changes to the model. More... | |
virtual void | query (const FeatureQuery &query, IFeatureQueryCallback &callback) const =0 |
Queries the model, and passes the result to the given callback. More... | |
virtual void | removeObserver (const std::shared_ptr< IFeatureModelObserver > &modelObserver)=0 |
Removes the given observer. More... | |
Public Member Functions inherited from luciad::Model | |
virtual | ~Model ()=default |
virtual ModelMetadata | getModelMetadata () const =0 |
Returns the meta data for this model. More... | |
virtual std::shared_ptr< Bounds > | queryBounds () const =0 |
Returns the bounds of this model, if available. More... | |
A feature model allows to uniformly access vector data.
See article for more details on how to use and how to implement this class.
A user of a model:
The model implementation has multiple responsibilities.
Feature models can add support for persisting model changes. See this article for more information.
In order to optimize feature loading, it is recommended to follow these rules when creating a model:
|
overridedefault |
|
pure virtual |
Adds an observer that allows to receive change events from this feature model.
Adding the same observer twice is forbidden, and will cause an exception to be thrown.
modelObserver | an observer |
InvalidArgumentException | when the observer was already added. |
|
pure virtual |
Returns the feature model meta data.
It provides information about the types of features one can expect within the model.
|
pure virtual |
Returns the luciad::FeatureModelPersistenceManager
that is used to persist in-memory changes made through luciad::IFeatureModelUpdater
.
When a model doesn't support (or doesn't need) saving functionality, nullptr
must be returned.
If persisting changes is not supported by the model, or if it is not needed because luciad::IFeatureModelUpdater
already automatically persists its changes, this method must return nullptr
.
|
pure virtual |
Returns the IFeatureModelUpdater
that is used to make changes to the model.
When a model can't be updated, nullptr
must be returned.
Typically, IFeatureModel implementations implement these changes as in-memory changes. FeatureModelPersistenceManager
can then be used to persist those changes (if persisting changes is supported). An IFeatureModel can however choose to immediately persist any of these changes immediately, if persisting changes doesn't imply a large performance overhead for example. In that case a FeatureModelPersistenceManager
is not needed, and getPersistenceManager
must return nullptr
.
|
pure virtual |
Queries the model, and passes the result to the given callback.
The callback can return false to indicate that the query can stop. This method passes Feature instances to the given callback. These instances contain a copy of the original data (structured according to the DataModel of this model). The ownership of these features is passed to the caller of this method (through the callback). This means that the model is not allowed to modify/deleted these Feature instances, once they are passed to the callback function.
This method is thread-safe, and can be called on any thread.
This method is synchronous and blocking. In other words, as soon as this function returns
Implementations of this method have the responsibilities described in the class documentation.
When implementing this method you may want to use the existing evaluation support which you can find in FeatureExpressionEvaluator and FeatureExpressionEvaluatorFactory.
Example to query the model for a Feature with a specific id.
query | the query |
callback | a callback which can handle the result of the query operation |
|
pure virtual |
Removes the given observer.
If the given observer was never added, an exception is thrown.
modelObserver | an observer |
InvalidArgumentException | when the observer is not known. |