实现思路: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. Domino系统从UNIX平台到windows平台的迁移及备份

    单位机房的一台服务机器到折旧期了,换成了新购IBM机器X3950,而且都预装了windows 2003 server 标准版,所以只有把以前在Unix平台下跑的OA系统迁移到新的windows 200 ...

  2. Kinect 开发 —— 进阶指引 (下)

    运动识别 利用运动识别(motion detection)来进行近景识别是最有意思的一种方式.实现运动识别的基本原理是设置一个起始的基准RGB图像,然后将从摄像头获取的每一帧影像和这个基准图像进行比较 ...

  3. C/C++(基础-常量,类型转换)

    字符 char ascII码表 #include<stdio.h> int main() { unsigned char ch; for(ch = 0;ch < 128;ch++) ...

  4. FreeModbus TCP

    一.Modbus TCP协议格式 Modbus TCP协议数据格式如下图所示: MBAP报文头: Modbus TCP与Modbus RTU相比,没有检验码,也没有所谓的地址码,并且在RTU协议的基础 ...

  5. 将已有的Eclipse项目转化为Maven项目

    将已有的Eclipse项目转化为Maven项目 我们之前在Eclipse IDE完成的Java命令行项目.Java Web项目也使用了构建工具--Ant,它帮助我们编译.运行Java源代码(无需我们自 ...

  6. hdu5308 I Wanna Become A 24-Point Master(构造)

    题目:pid=5308" target="_blank">http://acm.hdu.edu.cn/showproblem.php? pid=5308 题意:给定 ...

  7. 从头认识Spring-2.3 注解装配-@autowired(4)-required(1)

    这一章节我们来具体讨论一下@autowired里面的參数required. 1.domain(重点) 蛋糕类: package com.raylee.my_new_spring.my_new_spri ...

  8. TextView -无法调节字体、边框的距离

    今天调节一个字体边框距离,结果一直都实现不了,布局如下 <RelativeLayout xmlns:android="http://schemas.android.com/apk/re ...

  9. 1.3 Quick Start中 Step 6: Setting up a multi-broker cluster官网剖析(博主推荐)

    不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 6: Setting up a multi-broker cluster ...

  10. Android 使用AIDL实现进程间的通信

    在Android中,如果我们需要在不同进程间实现通信,就需要用到AIDL技术去完成. AIDL(android Interface Definition Language)是一种接口定义语言,编译器通 ...