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.
allLayers MapAssets <optional>
new MapAssets() The assets that correspond to the layers field or the layerCategories field depending upon which is used. If layerCategories, this contains a flattened list of the assets.
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 viewfinder UI and viewfinder button in the toolbar. Defaults to false.
showShareUrl boolean <optional>
false Whether or not to show the share as URL UI. 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.
globeBaseColor String <optional>
null The base color of the globe when no layer is shown.
zoomPresets ZoomPresets <optional>
null A Backbone.Collection of a predefined list of locations with an enabled list of layer IDs to be shown the zoom presets UI. Requires `showViewfinder` to be true as this UI appears within the ViewfinderView. UI appears within the ViewfinderView.
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:

resetLayerVisibility()

Reset the visibility of all layers to the value that was in the intial configuration.
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: