Options
All
  • Public
  • Public/Protected
  • All
Menu

A model that contains LuciadRIA features.

Each model must be configured with an object Store. The Store is used to retrieve/update/... the Feature 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 the Store of the model. Users of this class should always check whether such a method is available before calling the method, as illustrated below:

  FeatureModel model = ...;
  if ( typeof model.add === "function" ){
    //add method is available and can be called
    model.add( ... );
 }

Hierarchy

Implements

Overview

Constructors

constructor

Events

on

  • (event: "ModelChanged", callback: (modelChangeType: "add" | "update" | "remove", feature: Feature, id: number | string) => void, context?: any): Handle
  • 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.

    Parameters

    • event: "ModelChanged"

      The "ModelChanged" event type

    • callback: (modelChangeType: "add" | "update" | "remove", feature: Feature, id: number | string) => void

      the feature that was added, updated or removed. In case of remove events, this may be undefined.

        • (modelChangeType: "add" | "update" | "remove", feature: Feature, id: number | string): void
        • Parameters

          • modelChangeType: "add" | "update" | "remove"
          • feature: Feature
          • id: number | string

          Returns void

    • Optional context: any

      the context in which the callback function should be invoked. implementation dependent.

      An event that is emitted when the contents of the model changes.

    Returns Handle

Accessors

bounds

  • The spatial extent of the data in this model. If the property is null, the extent is unknown.

    Returns Bounds | null

coordinateType

  • The coordinate type of geometries in this model.

    Returns CoordinateType

modelDescriptor

  • The model descriptor of this model. The model descriptor object becomes immutable (frozen) when passed to the setter.

    Returns ModelDescriptor

  • The model descriptor of this model. The model descriptor object becomes immutable (frozen) when passed to the setter.

    Parameters

    Returns any

reference

  • The spatial reference in which this object is defined. If this property is null then this object is not spatially referenced.

    Returns CoordinateReference

store

  • The store that backs this model, immutable.

    Returns Store

Methods

add

  • (feature: Feature, options?: any): string | number | Promise<string | number>
  • Add a feature to the model. Note that this function will only be available if the underlying store also provides an add function.

    Parameters

    • feature: Feature

      The feature to add to the model.

    • Optional options: any

    Returns string | number | Promise<string | number>

    Returns the identifier of the feature, or a promise for the identifier.

get

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

    Parameters

    • id: string | number

      The identifier of the object.

    Returns Feature | Promise<Feature>

    May return the feature, or a promise for the feature.

put

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

    Parameters

    • feature: Feature

      The feature to update.

    • Optional options: any

      Object literal that will be passed as is to the model's store.

    Returns string | number | Promise<string | number>

    Returns the identifier of the feature, or a promise for the identifier.

query

  • Query the model for features. Note that this function will only be available if the underlying store also provides a query function.

    Parameters

    • Optional query: any

      An 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: QueryOptions

      Object literal that will be passed as is to the model's store.

    Returns Promise<Cursor> | Cursor

    cursor or a promise for a cursor

remove

  • (id: number | string): boolean | Promise<boolean>
  • 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.

    Parameters

    • id: number | string

      The identifier of the feature.

    Returns boolean | Promise<boolean>

    true or promise for true on successful removal, otherwise false.

spatialQuery

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

    Parameters

    • Optional bounds: Bounds

      The spatial extent.

    • Optional query: any

      An 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: QueryOptions

      Object literal that will be passed as is to the model's store.

    Returns Promise<Cursor> | Cursor

    cursor or a promise for a cursor

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