Class: MapModel

MapModel()

The Map Model contains all of the settings and options for a required to render a map view.

Constructor

new MapModel()

Since:
  • 2.18.0
Source:

Extends

  • Backbone.Model

Members

defaults :Object

Overrides the default Backbone.Model.defaults() function to specify default attributes for the Map
Type:
  • Object
Properties:
Name Type Attributes Default Description
[homePosition={longitude: -65, latitude: 56, height: 10000000, heading: 1, pitch: -90, roll: 0}] MapConfig#CameraPosition A set of coordinates that give the (3D) starting point of the Viewer. This position is also where the "home" button in the Cesium viewer will navigate to when clicked.
terrains MapAssets <optional>
new MapAssets() The terrain options to show in the map.
layers MapAssets <optional>
new MapAssets() The imagery and vector data to render in the map. When layerCategories exist, this property will be ignored.
layerCategories AssetCategories <optional>
new AssetCategories() A collection of layer categories to display in the tool bar. Categories wil be displayed in the order they appear. The array of the AssetCategoryConfig are passed to a AssetCategories collection. When layerCategories exist, the layers property will be ignored.
showToolbar Boolean <optional>
true Whether or not to show the side bar with layer list and other tools. True by default.
showLayerList Boolean <optional>
true Whether or not to include the layer list in the toolbar. True by default.
showHomeButton Boolean <optional>
true Whether or not to show the home button in the toolbar. True by default.
showViewfinder Boolean <optional>
false Whether or not to show the viefinder UI and viewfinder button in the toolbar. Defaults to false.
toolbarOpen Boolean <optional>
false Whether or not the toolbar is open when the map is initialized. Set to false by default, so that the toolbar is hidden by default.
showScaleBar Boolean <optional>
true Whether or not to show a scale bar.
showFeatureInfo Boolean <optional>
true Whether or not to allow users to click on map features to show more information about them.
clickFeatureAction String <optional>
"showDetails" The default action to take when a user clicks on a feature on the map. The available options are "showDetails" (show the feature details in the sidebar) or "zoom" (zoom to the feature's location).
showNavHelp Boolean <optional>
true Whether or not to show navigation instructions in the toolbar.
showFeedback Boolean <optional>
false Whether or not to show a feedback section in the toolbar.
feedbackText String <optional>
null The text to show in the feedback section.
Source:

type :String

The type of model this is.
Type:
  • String
Since:
  • 2.25.0
Default Value:
  • "MapModel"
Source:

Methods

addAsset(asset) → {MapAsset}

Add a layer or other asset to the map. This is the best way to add a layer to the map because it will ensure that this map model is set on the layer model.
Parameters:
Name Type Description
asset Object | MapAsset A map asset model or object with attributes to set on a new map asset model.
Since:
  • 2.25.0
Source:
To Do:
  • Enable adding a terrain asset.
Returns:
The new layer model.
Type
MapAsset

flyHome()

Indicate that the map widget view should navigate to the home position.
Source:

getLayerGroups() → {Array.<MapAssets>}

Source:
Returns:
When layerCategories are configured, each MapAssets represets layers from one category. When layerCategories doesn't exist, flat layers are used and the array includes exactly one MapAssets with all the layers. Returns an empty array if no layer are found.
Type
Array.<MapAssets>

getSelectedFeatures() → {Features}

Get the currently selected features on the map.
Since:
  • 2.27.0
Source:
Returns:
The selected Feature collection.
Type
Features

initialize(config)

Run when a new Map is created.
Parameters:
Name Type Description
config MapConfig An object specifying configuration options for the map. If any config option is not specified, the default will be used instead (see MapModel#defaults).
Source:

removeAsset(asset)

Remove a layer from the map.
Parameters:
Name Type Description
asset MapAsset The layer model to remove from the map.
Since:
  • 2.27.0
Source:

resetLayers() → {MapAssets}

Reset the layers to the default layers. This will set a new MapAssets collection on the layer attribute.
Since:
  • 2.25.0
Source:
Returns:
The new layers collection.
Type
MapAssets

selectFeatures(features)

Select features on the map. Updates the selectedFeatures attribute on the MapInteraction model.
Parameters:
Name Type Description
features Array.<Feature> An array of Feature models to select. since 2.28.0
Source:

setUpInteractions() → {MapInteraction}

Set or replace the MapInteraction model on the map.
Since:
  • 2.27.0
Source:
Returns:
The new interactions model.
Type
MapInteraction

zoomTo(target)

Indicate that the map widget view should navigate to a given target. This is accomplished by setting the zoom target on the MapInteraction model. The map widget listens to this change and updates the camera position accordingly.
Parameters:
Name Type Description
target Feature | MapAsset | GeoBoundingBox | Object The target to zoom to. See CesiumWidgetView#flyTo for more details on types of targets.
Source: