This document is archived and information here might be outdated.  Recommended version.


How to zoom to a layer in globe (ArcObjects .NET 10.5 SDK)

How to zoom to a layer in globe


Zooming to a layer in globe

To zoom to a layer in globe, perform the following steps:
  1. Get a handle to the layer as shown in the following code example. To get a handle to a specific layer, pass in the layer index.
[C#]
ESRI.ArcGIS.Analyst3D.IScene scene=(ESRI.ArcGIS.Analyst3D.IScene)globe; 
    // Explicit cast.

ESRI.ArcGIS.Carto.ILayer layer=scene.get_Layer(layerIndex);
[VB.NET]
Dim scene As ESRI.ArcGIS.Analyst3D.IScene=CType(globe, ESRI.ArcGIS.Analyst3D.IScene) ' Explicit Cast
Dim layer As ESRI.ArcGIS.Carto.ILayer=scene.Layer(layerIndex)
  1. Get the extent of the layer using the following code example:
[C#]
ESRI.ArcGIS.Geometry.IEnvelope envelope=layer.AreaOfInterest.Envelope;
[VB.NET]
Dim envelope As ESRI.ArcGIS.Geometry.IEnvelope=layer.AreaOfInterest.Envelope
  1. Use the IGlobeCamera.SetToZoomToExtents method to zoom to the extent of the layer. See the following code example:
[C#]
ESRI.ArcGIS.Analyst3D.ICamera camera=globeDisplay.ActiveViewer.Camera;
ESRI.ArcGIS.GlobeCore.IGlobeCamera globeCamera=(ESRI.ArcGIS.GlobeCore.IGlobeCamera)
    camera; // Explicit cast.


ESRI.ArcGIS.Analyst3D.ISceneViewer sceneViewer=globeDisplay.ActiveViewer;
globeCamera.SetToZoomToExtents(envelope, globe, sceneViewer);
[VB.NET]
Dim camera As ESRI.ArcGIS.Analyst3D.ICamera=sceneViewer.Camera
Dim globeCamera As ESRI.ArcGIS.GlobeCore.IGlobeCamera=CType(camera, ESRI.ArcGIS.GlobeCore.IGlobeCamera) ' Explicit Cast

Dim sceneViewer As ESRI.ArcGIS.Analyst3D.ISceneViewer=globeDisplay.ActiveViewer
globeCamera.SetToZoomToExtents(envelope, globe, sceneViewer)






Development licensing Deployment licensing
Engine Developer Kit Engine: 3D Analyst
ArcGIS Desktop Basic: 3D Analyst ArcGIS Desktop Basic: 3D Analyst
ArcGIS Desktop Standard: 3D Analyst ArcGIS Desktop Standard: 3D Analyst
ArcGIS Desktop Advanced: 3D Analyst ArcGIS Desktop Advanced: 3D Analyst