Constructor
new MapInteraction()
- Since:
- Source:
Extends
Members
type :String
The type of model this is.
Type:
- Source:
Methods
connectEvents()
Connects the MapInteraction model to events from the map widget.
- Source:
defaults() → {Object}
Overrides the default Backbone.Model.defaults() function to specify
default attributes for the Map.
Properties:
Name |
Type |
Description |
mousePosition |
GeoPoint
|
The current position of the mouse
on the map. Updated by the map widget to show the longitude, latitude,
and height (elevation) at the position of the mouse on the map. |
clickedPosition |
GeoPoint
|
The position on the map that the
user last clicked. |
scale |
GeoScale
|
The current scale of the map in
pixels:meters, i.e. The number of pixels on the screen that equal the
number of meters on the map/globe. Updated by the map widget. |
viewExtent |
GeoBoundingBox
|
The extent of the currently
visible area in the map widget. Updated by the map widget. |
hoveredFeatures |
Features
|
The feature that the mouse is
currently hovering over. Updated by the map widget with a Feature model
when a user hovers over a geographical feature on the map. |
clickedFeatures |
Features
|
The feature that the user last
clicked. Updated by the map widget with a Feature model when a user
clicks on a geographical feature on the map. |
selectedFeatures |
Features
|
Features from one or more
layers that are highlighted or selected on the map. Updated by the map
widget with a Feature model when a user selects a geographical feature
on the map (e.g. by clicking) |
firstInteraction |
Boolean
|
Whether or not the user has
interacted with the map yet. This is set to true when the user has
clicked, hovered, panned, or zoomed the map. The only action that is
ignored is mouse movement over the map. |
previousAction |
String
|
The previous action that was
performed on the map. This may be any of the labels in the Cesium
ScreenSpaceEventType enumeration:
https://cesium.com/learn/cesiumjs/ref-doc/global.html#ScreenSpaceEventType |
zoomTarget |
Feature
|
MapAsset
|
GeoBoundingBox
|
The feature or
map asset that the map should zoom to. The map widget should listen to
this property and zoom to the specified feature or map asset when this
property is set. The property should be cleared after the map widget
has zoomed to the specified feature or map asset. |
- Source:
Returns:
The default attributes for the Map.
-
Type
-
Object
handleClick(m, action)
Handles a mouse click on the map. If the user has clicked on a feature,
the feature is set as the 'clickedFeatures' attribute. If the map or layer is
configured to show details when a feature is clicked, the feature is
also set as the 'selectedFeatures' attribute.
Parameters:
Name |
Type |
Description |
m |
MapInteraction
|
The MapInteraction model. |
action |
String
|
The type of mouse click event that occurred.
All except LEFT_CLICK are ignored. |
- Source:
initialize(attrs)
Run when a new Map is created.
Parameters:
Name |
Type |
Description |
attrs |
MapConfig
|
An object specifying configuration options
for the map. If any config option is not specified, the default will be
used instead (see MapInteraction#defaults). |
- Source:
listenForFirstInteraction()
Listens for the first interaction with the map (click, hover, pan, or
zoom) and sets the 'firstInteraction' attribute to true when it occurs.
- Source:
Expands the camera events that are passed to the MapInteraction model
from the map widget by creating a 'moveStartAndChanged' event. This
event is triggered after the camera starts moving if and only if the
camera position changes enough to trigger a 'cameraChanged' event. This
event is useful for triggering actions that should only occur after the
camera has moved and the camera position has changed.
- Since:
- Source:
selectFeatures(features)
Set the feature that is currently selected.
Parameters:
Name |
Type |
Description |
features |
Cesium.Entity
|
Cesium.Cesium3DTileFeature
|
Feature
|
Array.<Object>
|
An array of feature objects selected directly from the map
view. |
- Source:
setClickedFeatures(features)
Set the feature that the user last clicked.
Parameters:
Name |
Type |
Description |
features |
Cesium.Entity
|
Cesium.Cesium3DTileFeature
|
Array.<Feature>
|
Array.<Object>
|
An array of feature objects selected directly from the map
view. |
- Source:
setClickedPosition(position) → {GeoPoint}
Sets the position on the map that the user last clicked.
Parameters:
Name |
Type |
Description |
position |
Object
|
An object with 'longitude' and 'latitude'
properties. |
- Source:
Returns:
The clicked position as a GeoPoint model.
-
Type
-
GeoPoint
setClickedPositionFromMousePosition()
Sets the clicked position to the current mouse position.
- Source:
setFeatures(features, type, replaceopt)
Set features on either the hoveredFeatures, clickedFeatures, or
selectedFeatures attribute. If the replace parameter is true, then the
features will replace the current features on the attribute.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
features |
Cesium.Entity
|
Cesium.Cesium3DTileFeature
|
Array.<Feature>
|
Array.<Object>
|
|
|
An array of feature objects selected directly from the map
view. |
type |
'hoveredFeatures'
|
'clickedFeatures'
|
'selectedFeatures'
|
|
|
The type of feature to set. |
replace |
Boolean
|
<optional>
|
true
|
Whether or not to replace the current
features on the attribute with the new features. |
- Source:
setHoveredFeatures(features)
Set the feature that the mouse is currently hovering over.
Parameters:
Name |
Type |
Description |
features |
Cesium.Entity
|
Cesium.Cesium3DTileFeature
|
Array.<Feature>
|
An array of feature objects selected directly from the map view. |
- Source:
setMousePosition(position) → {GeoPoint}
Sets the position of the mouse on the map.
Parameters:
Name |
Type |
Description |
position |
Object
|
An object with 'longitude' and 'latitude'
properties. |
- Source:
Returns:
The mouse position as a GeoPoint model.
-
Type
-
GeoPoint
setPosition(attributeName, position) → {GeoPoint}
Set the position for either the mousePosition or clickedPosition
attribute. Creates a new GeoPoint model if one doesn't already exist
on the attribute.
Parameters:
Name |
Type |
Description |
attributeName |
'mousePosition'
|
'clickedPosition'
|
The name of
the attribute to set. |
position |
Object
|
An object with 'longitude' and 'latitude'
properties. |
- Source:
Returns:
The corresponding position as a GeoPoint model.
-
Type
-
GeoPoint
setScale(scale) → {GeoScale}
Set the pixel:meter scale of the map. Creates a new GeoScale model if
one doesn't already exist on the scale attribute.
Parameters:
Name |
Type |
Description |
scale |
Object
|
An object with 'meters' and 'pixels'
properties. |
- Source:
Returns:
The scale as a GeoScale model.
-
Type
-
GeoScale
Set the extent of the map view. Creates a new GeoBoundingBox model if
one doesn't already exist on the viewExtent attribute.
Parameters:
Name |
Type |
Description |
extent |
Object
|
An object with 'north', 'east', 'south', and
'west' properties. |
- Source:
Returns:
The view extent as a GeoBoundingBox model.
-
Type
-
GeoBoundingBox