Options
All
  • Public
  • Public/Protected
  • All
Menu

A non-persistent Store that keeps 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.

LoadSpatially as the default loading strategy, for a layer with a model that uses this store. Otherwise layer's loading strategy is defaulted to the LoadEverything strategy

Please note that MemoryStoreConstructorOptions.reference should be defined as well in order to store features in an optimized spatial cache.

As the Features are stored in memory, there is no need to convert them to a "server-specific format". As such, this Store does not use a Codec.

Hierarchy

  • MemoryStore

Implements

Overview

Constructors

Events

Accessors

Methods

Constructors

constructor

Events

on

  • (event: "StoreChanged", callback: (eventType: string, feature: Feature, id: string | number) => any, context?: any, options?: { query?: any }): Handle
  • An event that is emitted when the contents of the store changes.

    Parameters

    • event: "StoreChanged"

      the "StoreChanged" event.

    • callback: (eventType: string, feature: Feature, id: string | number) => any

      the callback to be invoked when the contents of the store changes. The callback has 3 parameters:

      • eventType: "add", "update" or "remove"
      • feature: the Feature that was added, updated or removed. In case of the "remove" event type, it may be undefined.
      • id: the identifier of the Feature.
        • (eventType: string, feature: Feature, id: string | number): any
        • Parameters

          • eventType: string
          • feature: Feature
          • id: string | number

          Returns any

    • Optional context: any

      value to use as this when executing callback

    • Optional options: { query?: any }

      An 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.

      • Optional query?: any

    Returns Handle

Accessors

spatialIndex

  • get spatialIndex(): boolean
  • States if this store instance supports spatial capabilities. If the returned value is true then MemoryStore.spatialQuery method is available.

    since

    2021.0

    Returns boolean

Methods

add

  • (feature: Feature, options?: object): number | string
  • 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.

    Parameters

    • feature: Feature

      the Feature to add.

    • Optional options: object

      Object literal containing options for the add method. The current implementation does not support any options.

    Returns number | string

    The identifier of the newly added Feature. An "add" event is triggered if adding is successful.

clear

  • (): boolean
  • Removes all Features from the store

    since

    2018.0

    Returns boolean

    True. A "remove" event is also triggered for every successful removal

get

  • (id: string | number): Feature | undefined
  • Retrieve a Feature from this store by id.

    Parameters

    • id: string | number

      The identifier of the Feature.

    Returns Feature | undefined

    The Feature with the specified id. Undefined if it does not exist.

put

  • (feature: Feature, options?: object): string | number
  • 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.

    Parameters

    • feature: Feature

      the Feature to update.

    • Optional options: object

      Object literal containing options for the put method. The current implementation does not support any options.

    Returns string | number

    The identifier of the Feature. An "update" or "add" event is triggered, depending on whether the id already exists in the Store.

query

  • Query the store for objects. The current implementation returns all Features contained in this Store.

    Parameters

    • Optional query: (feature: 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.

        • Parameters

          Returns boolean

    Returns Cursor

    A cursor for the result set.

reload

  • Clears the Features in the store and loads a new set of features

    since

    2018.0

    Parameters

    • features: Feature[]

      The new data to load.

    Returns boolean

    True. A "remove" event is triggered for every successful removal and an "add" event is triggered for every successful addition.

remove

  • (id: number | string): boolean
  • Removes a Feature from the store by id.

    Parameters

    • id: number | string

      The identifier of the Feature.

    Returns boolean

    True if removal was successful. If successful, a "remove" event is also triggered.

spatialQuery

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method