您的位置:首页 > 其它

如何在ArcGlobe中实现zoomtolayer (How to zoom to layer in globe)

2008-01-14 16:01 573 查看

Zooming to a layer in globe


1.To zoom to a layer in globe 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.

在globe中聚焦到一个图层,就像以下代码实例所显示的那样得到该图层的句柄。通过传递图层的索引来得到一个具体图层的句柄。

[C#]

ESRI.ArcGIS.Analyst3D.IScene scene = (ESRI.ArcGIS.Analyst3D.IScene)globe; // Explicit cast.


ESRI.ArcGIS.Carto.ILayer layer = scene.get_Layer(layerIndex);

     当然,ILayer不一定要通过图层的索引来获得,也可以通过图层名称等来获取。

2.Now, get the extent of the layer using the following code example: 

  现在,使用下列代码实例来获得图层的范围。
[C#]


[code]


ESRI.ArcGIS.Geometry.IEnvelope envelope = layer.AreaOfInterest.Envelope;


3.After getting the extent, the IGlobeCamera.SetToZoomToExtents method can be used to zoom to the extent of the layer. See the following code example:

在得到图层的范围之后,IGlobeCamera.SetToZoomToExtents的方法可以用来聚焦到该图层的范围。看下列代码实例。
[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);

以上代码都经过测试完全可用(废话,易水的帮助还有错吗...)~嘿嘿~[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐