ArcObjects Library Reference

Add Bookmark3D to SceneBookmarks Snippet

Add a Bookmark3D to the collection of SceneBookmarks.

[C#]
/// <summary>
/// Add a Bookmark3D to the collection of SceneBookmarks. 
/// </summary>
/// <param name="bookmarkName">A System.String that is the name of the bookmark to add to the collecton.</param>
/// <param name="camera">The ICamera interface used in setting up the Bookmark3D.</param>
/// <param name="scene">The IScene interface used in setting up the Bookmark3D.</param>
/// <returns>An ISceneBookmarks interface. </returns>
/// <remarks>Scenebookmarks are used to store visual snapshots (orientation, zoom level, etc.) for a Scene.</remarks>
public ESRI.ArcGIS.Analyst3D.ISceneBookmarks AddBookmark3DToSceneBookmarks(System.String bookmarkName, ESRI.ArcGIS.Analyst3D.ICamera camera, ESRI.ArcGIS.Analyst3D.IScene scene)
{

  //Create the bookmark
  ESRI.ArcGIS.Analyst3D.IBookmark3D bookmark3D = new ESRI.ArcGIS.Analyst3D.Bookmark3DClass();
  bookmark3D.Name = bookmarkName;
  bookmark3D.Capture(camera);

  //Add the bookmark to the sceneBookmarks
  ESRI.ArcGIS.Analyst3D.ISceneBookmarks sceneBookmarks = (ESRI.ArcGIS.Analyst3D.ISceneBookmarks)scene;
  sceneBookmarks.AddBookmark(bookmark3D);

  return sceneBookmarks;

}
[Visual Basic .NET]
''' <summary>
''' Add a Bookmark3D to the collection of SceneBookmarks. 
''' </summary>
''' <param name="bookmarkName">A System.String that is the name of the bookmark to add to the collecton.</param>
''' <param name="camera">The ICamera interface used in setting up the Bookmark3D.</param>
''' <param name="scene">The IScene interface used in setting up the Bookmark3D.</param>
''' <returns>An ISceneBookmarks interface. </returns>
''' <remarks>Scenebookmarks are used to store visual snapshots (orientation, zoom level, etc.) for a Scene.</remarks>
Public Function AddBookmark3DToSceneBookmarks(ByVal bookmarkName As System.String, ByVal camera As ESRI.ArcGIS.Analyst3D.ICamera, ByVal scene As ESRI.ArcGIS.Analyst3D.IScene) As ESRI.ArcGIS.Analyst3D.ISceneBookmarks

  'Create the bookmark
  Dim bookmark3D As ESRI.ArcGIS.Analyst3D.IBookmark3D = New ESRI.ArcGIS.Analyst3D.Bookmark3DClass
  bookmark3D.Name = bookmarkName
  bookmark3D.Capture(camera)

  'Add the bookmark to the sceneBookmarks
  Dim sceneBookmarks As ESRI.ArcGIS.Analyst3D.ISceneBookmarks = CType(scene, ESRI.ArcGIS.Analyst3D.ISceneBookmarks)
  sceneBookmarks.AddBookmark(bookmark3D)

  Return sceneBookmarks

End Function


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.3DAnalyst
  • ESRI.ArcGIS.Animation
  • ESRI.ArcGIS.System