Represents the type of Feature instances that are handled by the store. The default type is inferred from features passed in MemoryStoreConstructorOptions.data, if the field is provided, otherwise the type is Feature without restrictions on shape and properties.
// Creates a new MemoryStore that type-guards its feature instances.
// Here the store will accept features that have a polyline or a polygon shape only.
const store1 = new MemoryStore<Feature<Polyline | Polygon>>();
// Here the feature type is inferred from the initial data.
const store2 = new MemoryStore({ data: [featureWithPolyline, featureWithPolygon] });
// In both cases TypeScript will complain if you try to insert a feature that has a shape different than a polyline or a polygon.
// You can still relax the type
// Here the store will accept features with all kind of shapes.
const store3 = new MemoryStore<Feature>({ data: [featureWithPolyline, featureWithPolygon] });
Creates a new MemoryStore instance.
Optional
options: MemoryStoreConstructorOptions<TFeature>options for the new store instance
States if this store instance supports spatial capabilities.
If the returned value is true
then MemoryStore.spatialQuery method is available.
2021.0
Add a new Feature
to the store. If an id is present on the feature, the Store
may not
yet contain a Feature
with that same ID.
the Feature
to add.
Optional
options: objectObject literal containing options for the add method. The current implementation does not support any options.
The identifier of the newly added Feature
. An "add" event is triggered if adding is successful.
Update an existing Feature
in the store. If an object with the same identifier does not exist yet,
the object will be added to the store. A corresponding StoreChanged
will be fired.
the Feature
to update.
Optional
options: objectObject literal containing options for the put method. The current implementation does not support any options.
The identifier of the Feature
. An "update" or "add" event is triggered, depending on whether the id already exists in the Store.
Query the store for objects. The current implementation returns all Feature
s contained in
this Store
.
Optional
query: ((feature) => boolean)An optional function that is used to filter the results of the query. The supplied function will receive an individual feature as parameter and should return a truthy value to indicate that that feature should be included in the cursor. If the function returns a falsy value then the feature will be excluded from the cursor. If no function is specified, then all features will be returned.
A cursor for the result set.
Clears the Features
in the store and loads a new set of features
The new data to load.
True. A "remove" event is triggered for every successful removal and an "add" event is triggered for every successful addition.
2018.0
Removes a Feature
from the store by id.
The identifier of the Feature
.
True if removal was successful. If successful, a "remove" event is also triggered.
Queries the store for objects within a spatial extent. This method is available only when the store is created with spatial index. Please see MemoryStoreConstructorOptions.spatialIndex property for more details.
Optional
bounds: BoundsThe spatial extent to return features for.
Optional
query: FilterPredicateTypeAn object which represents a predicate function that filters features.
A Cursor.
2021.0
An event that is emitted when the contents of the store changes.
the "StoreChanged" event.
the callback to be invoked when the contents of the store changes. The callback has 3 parameters:
Optional
context: anyvalue to use as this when executing callback
Optional
options: StoreChangedOptionsAn option object which has a 'query' property, which represents a query which may be understood and satisfied by the store. The structure of this object is dependent on the specific store. If specified, the listener function must only be invoked for features that match the query. "StoreChanged"
A non-persistent Feature instances in memory.
The store can be created with spatial capabilities by setting MemoryStoreConstructorOptions.spatialIndex property to
true
. LuciadRIA will choose a default loading strategy for a layer with this store depending if the store supports spatial capabilities or not.Please note that MemoryStoreConstructorOptions.reference should be defined in order to store features in an optimized spatial cache.
As the
Feature
s are stored in memory, there is no need to convert them to a "server-specific format". As such, thisStore
does not use a Codec.