This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Remove Bookmark3D from SceneBookmarks Snippet (ArcObjects .NET 10.4 SDK) |
Remove a Bookmark3D from the collection in the ISceneBookmarks by it's name.
/// <summary> /// Remove a Bookmark3D from the collection in the ISceneBookmarks by it's name. /// </summary> /// <param name="sceneBookmarks">An ISceneBookmarks interface that holds a collection of Bookmark3D objects.</param> /// <param name="bookmarkName">A System.String that is the name of tyhe BookMark3D to be removed from the ISceneBookmars collection.</param> /// <remarks>Scenebookmarks are used to store visual snapshots (orientation, zoom level, etc.) for a Scene.</remarks> public void RemoveBookmark3DFromSceneBookmarks(ESRI.ArcGIS.Analyst3D.ISceneBookmarks sceneBookmarks, System.String bookmarkName) { //Search through all the bookmarks ESRI.ArcGIS.esriSystem.IArray array=sceneBookmarks.Bookmarks; System.Int32 bookmarkIndex=0; System.Int32 i=array.Count; for (bookmarkIndex=0; bookmarkIndex < i; bookmarkIndex++) { ESRI.ArcGIS.Analyst3D.IBookmark3D bookmark3D=(ESRI.ArcGIS.Analyst3D.IBookmark3D)array.get_Element(bookmarkIndex); // Explicit Cast if (bookmark3D.Name == bookmarkName) { //Remove the bookmark sceneBookmarks.RemoveBookmark(bookmark3D); return; } } }
''' <summary> ''' Remove a Bookmark3D from the collection in the ISceneBookmarks by it's name. ''' </summary> ''' <param name="sceneBookmarks">An ISceneBookmarks interface that holds a collection of Bookmark3D objects.</param> ''' <param name="bookmarkName">A System.String that is the name of tyhe BookMark3D to be removed from the ISceneBookmars collection.</param> ''' <remarks>Scenebookmarks are used to store visual snapshots (orientation, zoom level, etc.) for a Scene.</remarks> Public Sub RemoveBookmark3DFromSceneBookmarks(ByVal sceneBookmarks As ESRI.ArcGIS.Analyst3D.ISceneBookmarks, ByVal bookmarkName As System.String) 'Search through all the bookmarks Dim array As ESRI.ArcGIS.esriSystem.IArray=sceneBookmarks.Bookmarks Dim bookmarkIndex As System.Int32 For bookmarkIndex=0 To array.Count - 1 Dim bookmark3D As ESRI.ArcGIS.Analyst3D.IBookmark3D=CType(array.Element(bookmarkIndex), ESRI.ArcGIS.Analyst3D.IBookmark3D) ' Explicit Cast If bookmark3D.Name=bookmarkName Then 'Remove the bookmark sceneBookmarks.RemoveBookmark(bookmark3D) Exit Sub End If Next End Sub