Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a KML Model for a given URI. The KML model will be decoded asynchronously and lazily when needed. This KML Model is decoded just before it is painted. The model is read only; only the query method is supported. The FeatureModel.get, FeatureModel.add, FeatureModel.put, FeatureModel.remove and FeatureModel.spatialQuery methods are not supported.

Note that, internally, the KMLModel uses the KMLCodec.

Hierarchy

Implements

Overview

Constructors

constructor

  • Creates a KML Model.

    Parameters

    • uri: string

      An URI to the KML or KMZ file. This can be either a relative or an absolute reference.

    Returns KMLModel

Events

on

  • (event: "ModelChanged", callback: (modelChangeType: "add" | "update" | "remove", feature: Feature, id: number | string) => void, context?: object, options?: object): Handle
  • (event: "KMLNetworkLink", callback: (networkLink: KMLNetworkLinkFeature) => void, context?: object, options?: object): Handle
  • (event: "KMLTree", callback: (rootArray: KMLFeature[]) => void, context?: object, options?: object): Handle
  • (event: "KMLGroundOverlay", callback: (groundOverlay: KMLGroundOverlayFeature) => void, context?: object, options?: object): 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: object

      the context in which the callback function should be invoked.

    • Optional options: object

      that may influence the callback registration. Interpretation of this object is implementation dependent.

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

    Returns Handle

  • Registers a callback function for the "KMLNetworkLink" event to process KMLNetworkLinks.

    Parameters

    • event: "KMLNetworkLink"

      Always set to "KMLNetworkLink" for this event type.

    • callback: (networkLink: KMLNetworkLinkFeature) => void

      The callback function to be executed when the NetworkLink cursor is decoded by the KMLCodec.decode function.

    • Optional context: object

      The context in which the callback function should be invoked.

    • Optional options: object

      Options that may influence the callback registration.

    Returns Handle

    a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.

  • Registers a callback function for the "KMLTree" event. The callback function receives an array of KMLFeatures.

    Parameters

    • event: "KMLTree"

      Always set to "KMLTree" for this event type.

    • callback: (rootArray: KMLFeature[]) => void

      The callback function to be executed when the KMLCodec.decode function is called.

    • Optional context: object

      The context in which the function should be invoked.

    • Optional options: object

      Options that may influence the callback registration.

    Returns Handle

    a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.

  • Registers a callback function for the "KMLGroundOverlay" event, that allows a listener to process KML ground overlays.

    Parameters

    • event: "KMLGroundOverlay"

      Always set to "KMLGroundOverlay" for this event type.

    • callback: (groundOverlay: KMLGroundOverlayFeature) => void

      The callback function to be executed when the KMLCodec.decode function is called.

    • Optional context: object

      The context in which the function should be invoked.

    • Optional options: object

      Options that may influence the callback registration.

    Returns Handle

    a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.

Accessors

bounds

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

    Returns Bounds | null

coordinateType

modelDescriptor

reference

store

Methods

add

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

    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?: object): 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: object

      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

  • Since the URLStore does not implement feature events, the results of this query are used to provide those messages from the KMLModel

    Parameters

    • Optional query: object
    • Optional options: object

    Returns Promise<Cursor> | Cursor

remove

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

    Returns a truthy value on successful removal, or a promise for that success-value.

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: object

      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.

    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