Constructs a FeatureModel.
The store that contains the elements of this model.
Optional
options: FeatureModelConstructorOptionsAn options object
The coordinate type of geometries in this model.
The model descriptor of this model. The model descriptor object becomes immutable (frozen) when passed to the setter.
An object containing metadata about this model
The spatial reference in which this object is defined. If this
property is null
then this object is not spatially
referenced.
The store that backs this model, immutable.
Add a feature to the model. Note that this function will only be available if the underlying store also provides an add function.
The feature to add to the model.
Optional
options: anyObject literal that will be passed as is to the model's store.
Returns the identifier of the feature, or a promise for the identifier.
Retrieve a feature from the model by id. Note that this function will only be available if the underlying store also provides a get function.
The identifier of the object.
May return the feature, or a promise for the feature.
Update an existing feature in the model object. Note that this function will only be available if the underlying store also provides a put function.
The feature to update.
Optional
options: anyObject literal that will be passed as is to the model's store.
Returns the identifier of the feature, or a promise for the identifier.
Query the model for features.
Optional
query: anyAn object which represents a query which may be understood and satisfied by the store. The structure of this object is dependent on the specific store.
Optional
options: QueryOptionsObject literal that will be passed as is to the model's store.
cursor or a promise for a cursor
Removes a feature from the model by id. Note that this function will only be available if the underlying store also provides a remove function.
The identifier of the feature.
true or promise for true on successful removal, otherwise false.
Query the model for features in a spatial extent. Note that this function will only be available if the underlying store also provides a spatialQuery function.
Optional
bounds: BoundsThe spatial extent.
Optional
query: anyAn object which represents a query which may be understood and satisfied by the store. The structure of this object is dependent on the specific store.
Optional
options: QueryOptionsObject literal that will be passed as is to the model's store.
cursor or a promise for a cursor
Note: the FeatureModel
requires a Store
which supports events in order
to automatically fire ModelChanged events. When the store does not support events, it is up to the user of this class
to fire those events manually.
The "ModelChanged" event type
the feature that was added, updated or removed. In case of remove events, this may be undefined.
Optional
context: anythe context in which the callback function should be invoked. implementation dependent.
An event that is emitted when the contents of the model changes.
"ModelChanged"
A model that contains LuciadRIA features.
Each model must be configured with an object Store. The
Store
is used to retrieve/update/... theFeature
instances of this model. Consult the class documentation of the Store class for more information.Each
FeatureModel
provides methods to retrieve/update/query/... the underlying data of the model. The presence of those methods is determined by the available methods in theStore
of the model. Users of this class should always check whether such a method is available before calling the method, as illustrated below: