Provides the logic for the Bookmarks widget.
Constructors
-
new BookmarksViewModel(properties)
-
Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
Abilities | more details Defines the abilities of the widget. | more details | BookmarksViewModel | |
Bookmark | more details The Bookmark that is being navigated to. | more details | BookmarksViewModel | |
Collection<Bookmark> | more details A collection of Bookmarks. | more details | BookmarksViewModel | |
String | more details The name of the class. | more details | Accessor | |
BookmarkOptions | more details Specifies how new bookmarks will be created. | more details | BookmarksViewModel | |
BookmarkOptions | more details Specifies how bookmarks will be edited. | more details | BookmarksViewModel | |
GoToOverride | more details This function provides the ability to override either the MapView goTo() or SceneView goTo() methods. | more details | BookmarksViewModel | |
String | more details The view model's state. | more details | BookmarksViewModel | |
MapView | more details The view from which the widget will operate. | more details | BookmarksViewModel |
Property Details
-
abilities AbilitiesSince: ArcGIS API for JavaScript 4.22
-
Defines the abilities of the widget. This property can be used to enable or disable the time ability of the Bookmarks widget.
Example:const bookmarksVM = new BookmarksViewModel({ view: view, abilities: { time: false // disables all time ability in the Bookmarks widget } });
-
activeBookmark BookmarkreadonlySince: ArcGIS API for JavaScript 4.9
-
The Bookmark that is being navigated to.
-
bookmarks Collection<Bookmark>
-
A collection of Bookmarks.
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
defaultCreateOptions BookmarkOptionsSince: ArcGIS API for JavaScript 4.18
-
Specifies how new bookmarks will be created. Can be used to enable or disable taking screenshots or capturing the bookmark's viewpoint based on the current view when a bookmark is created. See BookmarkOptions for the full list of options.
-
defaultEditOptions BookmarkOptionsSince: ArcGIS API for JavaScript 4.18
-
Specifies how bookmarks will be edited. Can be used to enable or disable taking screenshots or capturing the bookmark's viewpoint based on the current view when a bookmark is edited. See BookmarkOptions for the full list of options.
-
goToOverride GoToOverride
-
This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.
Example:// The following snippet uses the Search widget but can be applied to any // widgets that support the goToOverride property. search.goToOverride = function(view, goToParams) { goToParams.options.duration = updatedDuration; return view.goTo(goToParams.target, goToParams.options); };
-
state Stringreadonly
-
The view model's state.
Possible Values:"loading"|"ready"
- Default Value:ready
-
view MapView
-
The view from which the widget will operate.
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
Promise<Bookmark> | more details Creates a new bookmark from the defaultCreateOptions, unless otherwise specified. | more details | BookmarksViewModel | |
Promise<Bookmark> | more details Edits the given bookmark. | more details | BookmarksViewModel | |
Promise | more details Zoom to a specific bookmark. | more details | BookmarksViewModel |
Method Details
-
Since: ArcGIS API for JavaScript 4.13
-
Creates a new bookmark from the defaultCreateOptions, unless otherwise specified.
Parameter:options BookmarkOptionsoptionalSpecifies how new bookmarks will be created. Can be used to enable/disable taking screenshots or capturing the extent when a new bookmark is added.
Returns:Type Description Promise<Bookmark> When resolved, returns the newly created Bookmark. Example:// Creates new bookmark from current view extent viewModel.createBookmark().then(function(bookmark){ // Give the bookmark a name bookmark.name = "New Bookmark"; // Add to bookmarks list viewModel.bookmarks.add(bookmark); });
-
Since: ArcGIS API for JavaScript 4.17
-
Edits the given bookmark.
Parameters:bookmark BookmarkThe bookmark to be edited.
options BookmarkOptionsoptionalSpecifies how bookmarks will be edited. Can be used to enable/disable taking screenshots or capturing the extent when a bookmark is edited. If not specified, the defaultEditOptions will be used.
Returns:Type Description Promise<Bookmark> When resolved, returns the edited Bookmark. Example:const options = { takeScreenshot: false, captureViewpoint: true }; // update the given bookmark's viewpoint without taking a new screenshot viewModel.editBookmark(bookmark, options).then(function(editedBookmark){ // the edited bookmark's viewpoint should now match the current view console.log(editedBookmark.viewpoint); console.log(view.viewpoint); })
-
goTo(bookmark){Promise}
-
Zoom to a specific bookmark.
Parameter:bookmark BookmarkThe bookmark to zoom to.
Returns:Type Description Promise Resolves after the animation to specified bookmark finishes.
Type Definitions
-
Abilities Object
-
Specifies the abilities for the Bookmarks widget.
- Property:
-
time Boolean
Indicates whether the time ability is enabled in the Bookmarks widget. Default is
true
. Whenfalse
, the timeExtent of a bookmark will not be visible or editable. Any newly created bookmarks will not capture the time extent.
-
BookmarkOptions Object
-
Specifies how bookmarks will be created or modified.
- Properties:
-
takeScreenshot Boolean
Indicates whether a screenshot is taken when a new bookmark is created. The screenshot will be set as the thumbnail in the newly created bookmark. Default is
true
.captureViewpoint BooleanSince 4.17 Indicates whether the viewpoint of the current view will become the viewpoint of a newly created or modified bookmark. Default is
true
.captureRotation BooleanSince 4.17 Indicates whether the rotation of the current view will be saved in the viewpoint of a newly created or modified bookmark. Default is
true
.captureScale BooleanSince 4.17 Indicates whether the scale of the current view will be saved in the viewpoint of a newly created or modified bookmark. Default is
true
.captureTimeExtent BooleanSince 4.22 Indicates whether the time extent of the current view will be saved in the timeExtent of a newly created or modified bookmark. Default is
true
.screenshotSettings ObjectAn object that specifies the settings of the screenshot that will be used to create the bookmark's thumbnail.
- Specification:
-
width Number
The width (in pixels) of the screenshot. Default is
128px
.height NumberThe height (in pixels) of the screenshot. Default is
128px
.area ObjectUsed to take a screenshot of a subregion of the view. Defaults to the whole view.
optional An optional list of layers to be included in the screenshot.