实现思路: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. POJ 2458 DFS+判重

    题意: 思路: 搜+判重 嗯搞定 (听说有好多人用7个for写得-.) //By SiriusRen #include <bitset> #include <cstdio>0 ...

  2. POJ 2226 二分图最小覆盖

    题意: 思路: 把横着的连通块放在一个集合 竖着的放在一个集合 如果有交 就连边 求最小覆盖即可 (数值上等于最大匹配) //By SiriusRen #include <cstdio> ...

  3. react-native React Native version mismatch

    android/app/build.gradle     file: dependencies { compile fileTree(dir: "libs", include: [ ...

  4. JavaScript学习总结(8)——JS实用技巧总结

    后退 前进 <!--<input type="button" value="后退" onClick="history.go(-1)&quo ...

  5. Qt自定义类型使用QHash等算法(Qt已经自定义了34种类型,包括int, QString, QDate等基本数据类型)

    自定义类型 #include <QCoreApplication> #include <QSet> #include <QDebug> class testCust ...

  6. [51Nod]NOIP2018提高组省一冲奖班模测训练(一)题解

    http://www.51nod.com/contest/problemList.html#!contestId=72&randomCode=147206 原题水题大赛.. A.珂朵莉的旅行 ...

  7. android.graphics.Paint方法setXfermode (Xfermode x...

    mPaint = new Paint(); mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN)); 常见的Xfermod ...

  8. php如何读写excel

    php如何读写excel 一.总结 一句话总结:PHP操作Excel最好的方法是使用PHPExcel类, 可以到官网下载PHPExcel类库 http://phpexcel.codeplex.com ...

  9. MD5和sha1加密算法--散列加密技术 MD5:128bit的大整数

    在很多电子商务和社区应用中,我们都要存放很多的客户的资料,其中包括了很多的隐私信息和客户不愿被别人看到的信息,当然好有客户执行各种操作的密码,此时就需要对客户的信息进行加密再存储,目前有两种比较好的加 ...

  10. vue打包添加样式兼容前缀

    在ios8 版本上的h5对flex的支持不太好,需要有兼容的写法. vue-cli自带了postCss autoprefixer 进行兼容处理,配置如下 在vue-loader.config.js中开 ...