实现思路:2D—>3D,将当前MapControl的可视范围设置为GlobeControl中Extent属性的值;3D--->2D。获取当前GlobeControl的target和observer的Camera的BLH以及当前的图形显示范围,并将其设置为Mapcontrol的显示范围。

中心点可取observer、target或者二者的中心点均可。

所有代码例如以下:

   #region 二三维切换及联动

        //3D视图
private void tabItem_3D_Click (object sender,EventArgs e)
{
axToolbarControl_Map.Visible = false;
axToolbarControl_Globe.Visible = true;
axTOCControl_Globe.Visible = true;
axTOCControl_Map.Visible = false; statusStripXYZ.Visible = true;
statusStripXY.Visible = false; //2D—>3D联动
IActiveView avtiveView = m_globeControl.Globe as IActiveView;
avtiveView.Extent = axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds;
avtiveView.Refresh(); }
//2D视图
private void tabItem_2D_Click (object sender,EventArgs e)
{
axToolbarControl_Globe.Visible = false;
axToolbarControl_Map.Visible = true;
axTOCControl_Globe.Visible = false;
axTOCControl_Map.Visible = true;
statusStripXYZ.Visible = false;
statusStripXY.Visible = true; Synchronization_3DTo2D(); }
//3D—>2D
private void Synchronization_3DTo2D ()
{
IScene scene = m_globeControl.Globe.GlobeDisplay.Scene;
ISceneViewer sceneViewer = m_globeControl.GlobeDisplay.ActiveViewer;
IGlobeCamera globeCamera = sceneViewer.Camera as IGlobeCamera;
IGlobeViewUtil globeViewUtil = globeCamera as IGlobeViewUtil; IEnvelope pEnv = new EnvelopeClass();
globeViewUtil.QueryVisibleGeographicExtent(pEnv);//得到GlobeControl的Extent
if(pEnv == null)
{
return;
} IPoint observerPoint = new PointClass();
IPoint targetPoint = new PointClass();
//获取Target和observer的坐标
GetObserverTarget(out observerPoint,out targetPoint);
IPoint point = new PointClass();
(point as IZAware).ZAware = true;
point.X = (observerPoint.X + targetPoint.X) / 2;
point.Y = (observerPoint.Y + targetPoint.Y) / 2;
point.Z = (observerPoint.Z + targetPoint.Z) / 2; pEnv.CenterAt(point); axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds = pEnv;
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null); }
//获取target和observer的坐标
private void GetObserverTarget (out IPoint ObserverPoint,out IPoint TargetPoint)
{
IGlobeDisplay m_GlobeDisplay = m_globeControl.Globe.GlobeDisplay;
ISceneViewer pSceneViewer = m_GlobeDisplay.ActiveViewer;
ICamera pCamera = pSceneViewer.Camera;
IGlobeCamera pGlobeCamera = m_GlobeDisplay.ActiveViewer.Camera as IGlobeCamera; ObserverPoint = null;
TargetPoint = null; //获取observer的BLH
double obsLat,obsLon,obsAltKms;
pGlobeCamera.GetObserverLatLonAlt(out obsLat,out obsLon,out obsAltKms); //获取target的BLH
double tgtLat,tgtLon,tgtAltKms;
pGlobeCamera.GetTargetLatLonAlt(out tgtLat,out tgtLon,out tgtAltKms); ObserverPoint = new PointClass();
(ObserverPoint as IZAware).ZAware = true;
ObserverPoint.PutCoords(obsLon,obsLat);
ObserverPoint.Z = obsAltKms; TargetPoint = new PointClass();
(TargetPoint as IZAware).ZAware = true;
TargetPoint.PutCoords(tgtLon,tgtLat);
TargetPoint.Z = tgtAltKms;
}
#endregion

ArcGlobe三维开发之十九——GlobeControl与MapControl的二三维联动的更多相关文章

  1. 仿酷狗音乐播放器开发日志十九——CTreeNodeUI的bug修复二(附源码)

    转载请说明原出处,谢谢 今天本来打算把仿酷狗播放列表的子控件拖动插入功能做一下,但是仔细使用播放列表控件时发现了几个逻辑错误,由于我的播放 列表控件是基于CTreeViewUI和CTreeNodeUI ...

  2. 【Visual C++】游戏开发五十六 浅墨DirectX教程二十三 打造游戏GUI界面(一)

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接:http://blog.csdn.net/poem_qianmo/article/details/16384009 作者:毛星云 ...

  3. Kinect for Windows SDK开发入门(十九):Kinect Fusion

        Kinect for Windows SDK1.7中引入了Kinect Fusion功能.在1.8的SDK中对该功能进行了改进和强化,Kinect Fusion能够使得我们使用Kinect f ...

  4. BizTalk开发系列(十九) BizTalk命名规范

    目前BizTalk项目的开发人员比较少,但是在开发过程中还是需要命名规范的约束.根据以往BizTalk项目的经验,整理了BizTalk命 名规范.包括:BizTalk Application, Sch ...

  5. 从零开始学ios开发(十九):Application Settings and User Defaults(上)

    在iphone和ipad中,有一个东西大家一定很熟悉,那个东西就是Settings. 这次要学习的东西说白了很简单,就是学习如何在Settings中对一个app的某些属性进行设置,反过来,在app中更 ...

  6. Android UI开发第二十九篇——Android中五种常用的menu(菜单)

    Android Menu在手机的应用中起着导航的作用,作者总结了5种常用的Menu. 1.左右推出的Menu 前段时间比较流行,我最早是在海豚浏览器中看到的,当时耳目一新.最早使用左右推出菜单的,听说 ...

  7. 自己主动生成材质Material(Unity3D开发之十九)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/46854411 ...

  8. 自动生成材质Material(Unity3D开发之十九)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/46854411 ...

  9. arcgis api for js入门开发系列十九图层在线编辑

    本篇主要讲述的是利用arcgis api实现图层在线编辑功能模块,效果图如下: 实现思路: 1.arcgis server发布的FeatureServer服务提供的图层在线编辑能力: 2.实现的在线编 ...

随机推荐

  1. 洛谷P2251 质量检测

    题目背景 无 题目描述 为了检测生产流水线上总共N件产品的质量,我们首先给每一件产品打一个分数A表示其品质,然后统计前M件产品中质量最差的产品的分值Q[m] = min{A1, A2, ... Am} ...

  2. 动态引入js代码

    var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = & ...

  3. linux操作指令:

    系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS ...

  4. 用VXE保护Linux系统安全

      本文被转载在:http://www.linuxso.com/a/linuxxitongguanli/161.html 650) this.width=650;" onclick=&quo ...

  5. golang 写文件

    package main import ( "bufio" "fmt" "io" "os" ) func main() ...

  6. arm-linux-gcc 命令未找到问题

    解决方法: 1.先打开一个超级用户权限的shell: 命令: ubuntu :sudo –s centos :su - 2.在当前shell下,设置环境变量: 命令:gedit /etc/profil ...

  7. C# json 总结

    json格式字符串转换为实体类,大括号 {} 表示对象,[] 数组表示列表. json文件读取到内存中就是字符串,.NET操作json就是生成与解析json字符串. 添加引用:using Newton ...

  8. Vue Cli 打包之后静态资源路径不对的解决方法

    cli2版本: 将 config/index.js 里的 assetsPublicPath 的值改为 './' . build: { ... assetsPublicPath: './', ... } ...

  9. Android Studio中怎样引用图片资源

    随着不断接触Android Studio,越来越发现和Eclipse有着巨大的差别. 不管是表面的目录结构,还是内在对各种资源的管理. 本篇就来聊聊Android Studio中怎样来显示图片. 以及 ...

  10. Linux 网卡驱动学习(九)(层二转发)

    1.mac 地址表的自学习过程 port1上的A计算机要与port2上的B计算机通信时,A发到交换机上,交换机收到信息后,交换机先记录发port1所相应的a的mac地址并记录在自己的mac表中,然后再 ...