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.实现的在线编 ...
随机推荐
- 在电子商务里,一般会提到这样几个词:商品、单品、SPU、SKU
简单理解一下,SPU是标准化产品单元,区分品种:SKU是库存量单位,区分单品:商品特指与商家有关的商品,可对应多个SKU. 首先,搞清楚商品与单品的区别.例如,iphone是一个单品,但是在淘宝上当很 ...
- javafx HTMLEditor
public class EffectTest extends Application { //===================== private final String INITIAL_T ...
- javafx Cursor
public class EffectTest extends Application { ObservableList cursors = FXCollections.observableArray ...
- vue2细节变化的用法
1.v-el和v-ref合并为一个属性:ref 原来:v-el:my-element 现在: ref="myElement", v-ref:my-component 变成了这样: ...
- shell项目-分发系统-expect讲解
shell项目-分发系统-expect讲解 yum install -y expect 1. 自动远程登录 #! /usr/bin/expect set host "192.168.133. ...
- netstat---显示Linux中网络系统的状态信息
netstat命令用来打印Linux中网络系统的状态信息,可让你得知整个Linux系统的网络情况. 语法 netstat(选项) 选项 -a或--all:显示所有连线中的Socket: -A<网 ...
- 用node.js从零开始去写一个简单的爬虫
如果你不会Python语言,正好又是一个node.js小白,看完这篇文章之后,一定会觉得受益匪浅,感受到自己又新get到了一门技能,如何用node.js从零开始去写一个简单的爬虫,十分钟时间就能搞定, ...
- 【开卷故意】JAVA正則表達式模版
专业既然是机器学习.那工作肯定也是继续和数据打交道,那么问题来了,非常多时候推荐算法和数据挖掘算法都是现成可用的,平台初建,重点还在数据过滤和抽取.如何高效的抽取数据? 利用往常算法比赛中经常使用的字 ...
- Android Support 包里到底有什么
大家假设喜欢我的博客,请关注一下我的微博,请点击这里(http://weibo.com/kifile),谢谢 转载请标明出处(http://blog.csdn.net/kifile),再次感谢 随着 ...
- 停止使用域名 boypay.net
停止使用域名 boypay.net boypay.net 这个域名当时注册的时候打算开发网店--" 情侣商城",表面意思是 "男生支付",情侣和婚姻是人生中必须 ...