Class: Feature

Feature()

A Feature Model organizes information about a single feature of a vector layer in a map.

Constructor

new Feature()

Since:
  • 2.18.0
Source:

Extends

  • Backbone.Model

Members

defaults :Object

Default attributes for Feature models
Type:
  • Object
Properties:
Name Type Description
properties Object Property names (keys) and property values (values) for properties set on this feature. For example, the properties that would be in an attributes table for a shapefile.
mapAsset MapAsset If the feature is part of a Map Asset, then the model for that asset. For example, if this is a feature if a 3D tileset, then the Cesium3DTileset map asset model.
featureID string | number An ID that's used to identify this feature in the map. It should be unique among all map features. (In Cesium, this is the Pick ID key.)
featureObject * The object that a Map widget uses to represent this feature in the map. For example, in Cesium this could be a Cesium.Cesium3DTileFeature or a Cesium.Entity.
label string An optional friendly label or name for this feature.
Source:

type :string

The name of this type of model
Type:
  • string
Source:

Methods

attrsFromFeatureObject(feature, assets) → {object}

Given an map-widget-specific-object representing a feature, and a MapAssets collection, this function will attempt to find the corresponding MapAsset model in the collection, and extract the feature attributes from that model.
Parameters:
Name Type Description
feature * An object representing a feature in the map. For example, in Cesium this could be a Cesium.Cesium3DTileFeature or a Cesium.Entity.
assets MapAssets A MapAssets collection to use to extract feature attributes from a feature object.
Since:
  • 2.27.0
Source:
Returns:
- The JSON object of all the Feature attributes
Type
object

isDefault() → {boolean}

Checks if the attributes for this model are only the default attributes.
Source:
Returns:
Returns true if all of the attributes are equal to the default attributes, false otherwise.
Type
boolean

parse(input, optionsopt) → {object}

Parses the given input into a JSON object to be set on the model. If passed a MapAssets collection as an option, and the input includes an assets property, then the parse function will attempt to find the feature object's corresponding MapAsset model in the collection, and extract the feature attributes from that model.
Parameters:
Name Type Attributes Description
input object The raw response object
options object <optional>
Options for the parse function
Properties:
Name Type Attributes Description
options.assets MapAssets <optional>
A MapAssets collection to use to extract feature attributes from a feature object.
Source:
Returns:
- The JSON object of all the Feature attributes
Type
object

setToDefault()

Clears all the model attributes and sets them to the default values. This will trigger a change event. No event is triggered if all of the value are already set to default.
Source: