ArcGlobe三维开发之十九——GlobeControl与MapControl的二三维联动
实现思路: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的二三维联动的更多相关文章
- 仿酷狗音乐播放器开发日志十九——CTreeNodeUI的bug修复二(附源码)
转载请说明原出处,谢谢 今天本来打算把仿酷狗播放列表的子控件拖动插入功能做一下,但是仔细使用播放列表控件时发现了几个逻辑错误,由于我的播放 列表控件是基于CTreeViewUI和CTreeNodeUI ...
- 【Visual C++】游戏开发五十六 浅墨DirectX教程二十三 打造游戏GUI界面(一)
本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接:http://blog.csdn.net/poem_qianmo/article/details/16384009 作者:毛星云 ...
- Kinect for Windows SDK开发入门(十九):Kinect Fusion
Kinect for Windows SDK1.7中引入了Kinect Fusion功能.在1.8的SDK中对该功能进行了改进和强化,Kinect Fusion能够使得我们使用Kinect f ...
- BizTalk开发系列(十九) BizTalk命名规范
目前BizTalk项目的开发人员比较少,但是在开发过程中还是需要命名规范的约束.根据以往BizTalk项目的经验,整理了BizTalk命 名规范.包括:BizTalk Application, Sch ...
- 从零开始学ios开发(十九):Application Settings and User Defaults(上)
在iphone和ipad中,有一个东西大家一定很熟悉,那个东西就是Settings. 这次要学习的东西说白了很简单,就是学习如何在Settings中对一个app的某些属性进行设置,反过来,在app中更 ...
- Android UI开发第二十九篇——Android中五种常用的menu(菜单)
Android Menu在手机的应用中起着导航的作用,作者总结了5种常用的Menu. 1.左右推出的Menu 前段时间比较流行,我最早是在海豚浏览器中看到的,当时耳目一新.最早使用左右推出菜单的,听说 ...
- 自己主动生成材质Material(Unity3D开发之十九)
猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/46854411 ...
- 自动生成材质Material(Unity3D开发之十九)
猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/46854411 ...
- arcgis api for js入门开发系列十九图层在线编辑
本篇主要讲述的是利用arcgis api实现图层在线编辑功能模块,效果图如下: 实现思路: 1.arcgis server发布的FeatureServer服务提供的图层在线编辑能力: 2.实现的在线编 ...
随机推荐
- Linux下ping命令、traceroute命令、tracert命令的使用
Linux系统的ping命令是常用的网络命令,它通常用来测试与目标主机的连通性,我们经常会说“ping一下某机器,看是不是开着”.不能打开网页时会说“你先ping网关地址192.168.1.1试试”. ...
- Model、ModelMap、ModelAndView的作用及区别
Model.ModelMap.ModelAndView的作用及区别 对于MVC框架,控制器controller执行业务逻辑 用于产生模型数据Model 视图view用来渲染模型数据 Model和Mod ...
- Java-Spring-WebService最基础的配置示例
很早很早之前,就初步学习了WebService,感觉还是比较"好"的. 使用Web服务,感觉就像普通API一样,和HTTP接口比较起来. WebService有个很大的局限,就 ...
- 洛谷 P2108 学英语
P2108 学英语 题目描述 为了适应紧张的大学学习生活,小Z发愤图强开始复习巩固英语. 由于小Z对数学比较有好感,他首先复习了数词.小Z花了一整天的时间,终于把关于基数词的知识都搞懂了.于是小Z非常 ...
- 电商系统Broadleaf文档翻译(六) - 主要实体main entities
主要实体 原文标题:main entities 原文出处:http://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/d ...
- $routeParams 实现路由指定参数
[摘要]后台管理系统权限控制到按钮级别,将每一个资源的key绑定在url中,渲染页面的时候去根据key来获取当前页面的按钮列表. router.js angular.module("app. ...
- servlet、filter、listener继承的基类和获得作用域的方式
一.servlet: 1.servlet属于j2ee的组件,构建servlet的web project不需要导入项目框架jar包 2.servlet的体系结构: 在j2ee API中,提供给serv ...
- Akka边学边写(4)-- MiniRPG
前面几篇文章用Akka写了HelloWorld和EchoServer,为了更进一步学习Akka,本文将会实现一个非常小的RPG游戏server:MiniRPG. 游戏逻辑 由于是迷你RPG,所以逻辑非 ...
- 在linux环境下增加别名
编辑.cshrc文件:gvim ~/.cshrc 增加要添加的别名,例如:alias la 'ls -a' qw保存退出 source ~/.cshrc即可生效
- apache+nginx 实现动静分离
apache+nginx 实现动静分离 http://blog.csdn.net/xysoul/article/details/50347971