Public Function GetBookmarks() As ReadOnlyObservableCollection(Of Bookmark)
public ReadOnlyObservableCollection<Bookmark> GetBookmarks()
Return Value
The collection of bookmarks for the map.
Public Function GetBookmarks() As ReadOnlyObservableCollection(Of Bookmark)
public ReadOnlyObservableCollection<Bookmark> GetBookmarks()
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
{
//Create a map frame and set its camera by zooming to the extent of an existing bookmark.
//Construct on the worker thread
//Build 2D envelope geometry
Coordinate2D mf_ll = new Coordinate2D(6.0, 8.5);
Coordinate2D mf_ur = new Coordinate2D(8.0, 10.5);
Envelope mf_env = EnvelopeBuilderEx.CreateEnvelope(mf_ll, mf_ur);
//Reference map, create MF and add to layout
MapProjectItem mapPrjItem = Project.Current.GetItems<MapProjectItem>()
.FirstOrDefault(item => item.Name.Equals("Map"));
Map mfMap = mapPrjItem.GetMap();
Bookmark bookmark = mfMap.GetBookmarks().FirstOrDefault(
b => b.Name == "Great Lakes");
MapFrame mfElm = ElementFactory.Instance.CreateMapFrameElement(
layout, mf_env, mfMap, "New Map Frame");
//Zoom to bookmark
mfElm.SetCamera(bookmark);
}
{
// Note: Needs QueuedTask to run
{
//Return the collection of bookmarks for the map.
var result = mapView.Map.GetBookmarks();
// Use the bookmarks (if any)
}
}
{
// Note: Needs QueuedTask to run
{
//Get the first bookmark with the given name.
var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
if (bookmark == null)
{
// Manage the error - bookmark not found
}
//Zoom the view to the bookmark.
mapView.ZoomTo(bookmark);
}
}
{
// Note: Needs QueuedTask to run
//Get the first bookmark with the given name.
var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
if (bookmark == null)
{
// Manage the error - bookmark not found
}
//Zoom the view to the bookmark.
mapView.ZoomToAsync(bookmark, TimeSpan.FromSeconds(2));
}
{
//Get the collection of bookmarks for the project.
var result = Project.Current.GetBookmarks();
// Use the bookmarks (if any)
}
{
// Note: Needs QueuedTask to run
{
//Find the first bookmark with the name
var bookmark = mapView.Map.GetBookmarks().FirstOrDefault(b => b.Name == bookmarkName);
if (bookmark == null)
{
//Bookmark not found
}
//Remove the bookmark
mapView.Map.RemoveBookmark(bookmark);
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)