AbstractCreates a new store.
Represents the type of Feature instances that are handled by the store.
Adds a Feature to the store.
Throws a ProgrammingError. Override this method to support the operation, and report
"add" from Store.isOperationSupported. LuciadRIA never calls an operation that the
store does not report as supported.
When the addition is successful, the Store must:
Update the ID of the Feature to reflect the ID assigned by the server,
if the Feature's ID was undefined prior to addition. If an ID was already defined,
the Store should respect the provided ID unless overridden by the server.
Emit a "StoreChanged" event with:
eventType: "add"feature: The added Feature, including its updated ID.id: The updated identifier of the Feature.Failure to do so will result in a map not displaying newly added features.
The Feature to add.
Optionaloptions: any
An optional object for additional implementation-specific parameters.
Returns the identifier of the Feature on success, or a promise that resolves to the identifier.
ProgrammingError if this store does not support the "add" operation, as reported by
Store.isOperationSupported.
ProtectedemitRetrieves a Feature by id from the data provider.
Throws a ProgrammingError. Override this method to support the operation, and report
"get" from Store.isOperationSupported. LuciadRIA never calls an operation that the
store does not report as supported.
The identifier of the Feature.
Optionaloptions: any
An optional object that can be used in a specific implementation of the method.
May return the Feature, or a promise for the Feature.
When no feature with that id exists, the returned value must be undefined, whether the implementation is
synchronous or asynchronous (a promise resolving to undefined). Reject the promise only for an actual
failure, such as a network or parsing error.
ProgrammingError if this store does not support the "get" operation, as reported by
Store.isOperationSupported.
Indicates whether the given store operation is supported.
LuciadRIA uses this method to determine whether an operation can be called.
A Store defines all operations, so the presence of a method does not imply that it is supported.
Return true for each supported operation and false otherwise.
Calling an unsupported operation throws a ProgrammingError.
The result must remain stable for the lifetime of the store. A FeatureLayer reads it when it is added to a map, and does not pick up later changes.
Returns false for every operation. Override this method to report the operations that this
store implements.
The operation to report on.
true if methodName can be called on this store.
Updates an existing Feature in the store or adds it if it does not already exist.
Throws a ProgrammingError. Override this method to support the operation, and report
"put" from Store.isOperationSupported. LuciadRIA never calls an operation that the
store does not report as supported.
When the operation is successful, the Store must emit a "StoreChanged" event.
The event should contain:
eventType: "update" if an existing feature is updated, or "add" if a new feature is added.feature: The updated or newly added Feature.id: The identifier of the affected Feature.Failure to do so will result in a map not displaying updated features.
The implementation of this method may follow the semantics of an HTTP PUT request. This means that if the feature does not already exist in the store, it may be added as a new entry.
The Feature to update or add.
Optionaloptions: any
An optional object for additional implementation-specific parameters.
Returns the identifier of the Feature on success, or a promise that resolves to the identifier.
ProgrammingError if this store does not support the "put" operation, as reported by
Store.isOperationSupported.
AbstractqueryQueries the store for objects.
Every Store must implement this operation, so callers can invoke it without checking
Store.isOperationSupported first.
Optionalquery: any
An object that represents a query filter that is understood by the underlying data provider. The structure of this object depends on a specific store implementation.
Optionaloptions: QueryOptions
An optional object that can be used in a specific implementation of the method.
A Cursor over a set of Feature
instances or a promise for that Cursor.
Removes a Feature from the store by its ID.
Throws a ProgrammingError. Override this method to support the operation, and report
"remove" from Store.isOperationSupported. LuciadRIA never calls an operation that the
store does not report as supported.
When the removal is successful, the Store must emit a "StoreChanged" event,
which contains an eventType of "remove" and the ID of the removed Feature.
If the Store does not emit the "StoreChanged" event, the map visualization will not reflect the removal of the feature.
The identifier of the Feature to be removed.
Returns true on successful removal, or a promise that resolves to true.
ProgrammingError if this store does not support the "remove" operation, as reported by
Store.isOperationSupported.
Queries the store for objects within a spatial extent.
Throws a ProgrammingError. Override this method to support the operation, and report
"spatialQuery" from Store.isOperationSupported. LuciadRIA never calls an operation
that the store does not report as supported.
Note:
LuciadRIA determines the layer's default loading strategy
based on whether the store reports "spatialQuery" as supported. If it does, the default
loading strategy is LoadSpatially. Otherwise it is LoadEverything.
Note: When the map reference and the model reference are incompatible, for example a Cartesian reference and a geodetic reference, the layer falls back to LoadEverything.
Note:
WFSFeatureStore implements this operation
by creating an OGC BBOX filter based on the bounds parameter.
Optionalbounds: Bounds
The spatial extent to return features for.
Optionalquery: any
An object that represents a query filter that is understood by the underlying data provider. The structure of this object depends on a specific store implementation.
Optionaloptions: QueryOptions
An optional object that can be used in a specific implementation of the method.
A Cursor.
ProgrammingError if this store does not support the "spatialQuery" operation, as reported by
Store.isOperationSupported.
An event that is emitted when the contents of the store change. A store that performs create, update, or delete operations must report them with Store.emitStoreChangedEvent, to ensure that changes are communicated properly to listeners.
The "StoreChanged" event.
The callback to be invoked when the contents of the store change. The callback has three parameters:
Optionalcontext: any
An optional value used as the this context when executing the callback.
Optionaloptions: StoreChangedOptions
An optional object specifying additional options for the event listener. The inherited implementation ignores StoreChangedOptions.query: override this method to filter the events that this store reports. StoreChanged
The store object provides the link between the FeatureModel and the data provider. The function of the store is to query the server for data, convert the response of the server to LuciadRIA Feature instances, and to perform optional CRUD operations:
get,create,updateanddelete.Most of the
Storeimplementations separate the communication with a data provider (e.g., a WFS service) from the actual parsing of the server response. The conversion of the server response to LuciadRIAFeatureinstances is left to a Codec. For example, theWFSFeatureStorecan be configured with a dedicatedCodecif your WFS server, which the WFSFeatureStore connects to, does not support GeoJson as an output format.A typical sequence of method calls on a set of a
FeatureModel-Store-Codecis the following (without considering the asynchronous nature of those methods):FeatureModel#querygets called to perform the query on the server side.FeatureModelpasses the query parameters to theStore#querymethod.Storeperforms the query and passes the response value to theCodecfor decoding.Codecreturns theFeatureinstances to theStore, which passes them back to theFeatureModel.Note: Every
Storesupports Store.query. The other operations - the ones thatisOperationSupportedcan be asked about - are declared by everyStorebut do not have to be supported: aStorecan supportgetbut notadd,putandremove, for example. Calling an unsupported operation throws a ProgrammingError. Which operations aStoresupports also affects the functionality of the FeatureModel paired with it, as explained in the documentation of that class.Users of this class can call
queryunconditionally, but should always check any other operation with Store.isOperationSupported before calling it, as illustrated below:To create a custom store, extend
Storeand implement Store.query: it is the only abstract operation. Every other operation is implemented as unsupported - it throws a ProgrammingError when called, and Store.isOperationSupported returnsfalsefor it - so a store that only reads data needs nothing else. Override an operation to support it, override Store.isOperationSupported to report it, and report the changes it makes with Store.emitStoreChangedEvent.Note: overriding an operation without reporting it from Store.isOperationSupported leaves the operation unused: LuciadRIA never calls an operation that the store does not report as supported.