GoogleEarthView

// GooleEarthView.cpp : implementation file
//

#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "iDART_UI.h"
#endif
#include "iDART_UIDoc.h"
#include "GooleEarthView.h"
#include "KMLSettingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


static const CLSID CLSID_ApplicationGE = {0x8097D7E9,0xDB9E,0x4AEF, {0x9B,0x28,0x61,0xD8,0x2A,0x1D,0xF7,0x84}};
/
// CGooleEarthView
IMPLEMENT_DYNCREATE(CGooleEarthView, CView)

CGooleEarthView::CGooleEarthView()
{
 m_hMainWnd = NULL;
 m_renderhwnd = 0;
}

CGooleEarthView::~CGooleEarthView()
{
}

BEGIN_MESSAGE_MAP(CGooleEarthView, CView)

 // 标准打印命令
 ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
 ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
 ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CGooleEarthView::OnFilePrintPreview)
 ON_COMMAND(ID_KMLSETTINGTOOL, &CGooleEarthView::OnKmlsettingtool)
 ON_COMMAND(ID_ESCP_DLH, &CGooleEarthView::OnEscpDlh)
 ON_COMMAND(ID_AMR_UE_FSGLDLH, &CGooleEarthView::OnAmrUeFsgldlh)
 ON_COMMAND(ID_EcIo_DLH, &CGooleEarthView::OnEcioDlh)
 ON_COMMAND(ID_RSCP_FBDLH, &CGooleEarthView::OnRscpFbdlh)
 ON_COMMAND(ID_ZFWXQ_EcIo, &CGooleEarthView::OnZfwxqEcio)
 ON_WM_CREATE()
 ON_WM_SIZE()
END_MESSAGE_MAP()

 

BOOL CGooleEarthView::PreCreateWindow(CREATESTRUCT& cs)
{
 // TODO: 在此处通过修改
 //  CREATESTRUCT cs 来修改窗口类或样式
 
 return CView::PreCreateWindow(cs);
}

void CGooleEarthView::OnDraw(CDC* pDC)
{


 // TODO: 在此处为本机数据添加绘制代码
}
// CiDART_UIView 打印
void CGooleEarthView::OnFilePrintPreview()
{
#ifndef SHARED_HANDLERS
 AFXPrintPreview(this);
#endif
}

BOOL CGooleEarthView::OnPreparePrinting(CPrintInfo* pInfo)
{
 // 默认准备
 return DoPreparePrinting(pInfo);
}

void CGooleEarthView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: 添加额外的打印前进行的初始化过程
}

void CGooleEarthView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
 // TODO: 添加打印后进行的清理过程
}


#ifdef _DEBUG
void CGooleEarthView::AssertValid() const
{
 CView::AssertValid();
}

void CGooleEarthView::Dump(CDumpContext& dc) const
{
 CView::Dump(dc);
}

#endif //_DEBUG
void CGooleEarthView::OnKmlsettingtool()
{
 // TODO: Add your command handler code here
 KMLSettingDlg dlg;
 if (dlg.DoModal() == IDOK)
 {
  MessageBox("是否确认生成KML");
 }
}


void CGooleEarthView::OnEscpDlh()
{
 // TODO: Add your command handler code here
 MessageBox("ESCP地理化");
}


void CGooleEarthView::OnAmrUeFsgldlh()
{
 // TODO: Add your command handler code here
 MessageBox(" AMR UE发射功率地理化");

}


void CGooleEarthView::OnEcioDlh()
{
 // TODO: Add your command handler code here
 MessageBox(" EcIo分布地理化");
}


void CGooleEarthView::OnRscpFbdlh()
{
 // TODO: Add your command handler code here
 MessageBox(" 主服务小区 RSCP分布地理化");
}


void CGooleEarthView::OnZfwxqEcio()
{
 // TODO: Add your command handler code here
 MessageBox("主服务小区 EcIo分布地理化");
}


void CGooleEarthView::OnDestroy()
{
 CView::OnDestroy();
 theApp.m_bPrjIsCreated = FALSE;

 if (!theApp.m_pMainWnd)
 {
  MessageBox("goole earth没有启动");
  return;
 }
 if(m_hMainWnd!=NULL)
 {
  ::SetParent((HWND)m_renderhwnd,m_hMainWnd);
 }

 if (!theApp.m_pMainWnd->GetSafeHwnd())
 {
  return;
 }
 theApp.m_pMainWnd->SendMessage(MYWM_RAWDATATREE,0,0);
 theApp.m_pMainWnd->SendMessage(MYWM_NETWORKTREE,0,0);
 
}

void CGooleEarthView::ResizeGooleEarth(void)
{
 if (GetSafeHwnd() == NULL)
 {
  return;
 }
 HWND hwnd;
 hwnd = (HWND)theApp.m_geApplication.GetMainHwnd();
 if (!hwnd)
 {
  MessageBox("goole earth没有启动");
  return;
 }
 CRect rectClient;
 GetClientRect(rectClient);

 ::SetWindowPos((HWND)m_renderhwnd,
  GetSafeHwnd(),
  rectClient.left + 1,
  rectClient.top  + 1,
  rectClient.Width() - 2,
  rectClient.Height()  - 2,
  SWP_NOACTIVATE | SWP_NOZORDER);
}


int CGooleEarthView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CView::OnCreate(lpCreateStruct) == -1)
  return -1;
 
 // TODO:  Add your specialized creation code here
 //检测goole earth 是否已经启动
 HWND hwnd;
 hwnd = (HWND)theApp.m_geApplication.GetMainHwnd();
 if (!hwnd)
 {
  MessageBox("goole earth没有启动");
  return 0;
 }
 //获取客户端框架窗口句柄
 m_hMainWnd =(HWND) theApp.m_geApplication.GetMainHwnd();
 CRect rect;
 GetClientRect(rect);
 ::SetWindowPos(m_hMainWnd, HWND_BOTTOM, 0, 0,
  rect.Width(), rect.Height(), SWP_NOSIZE | SWP_HIDEWINDOW);
 m_renderhwnd = theApp.m_geApplication.GetRenderHwnd();

 HWND GEParentHrender = ::GetParent((HWND)m_renderhwnd);
 //(考虑到GE地图控件可能被其他程序截获,加上这一句以应万全)
 ::ShowWindow(GEParentHrender, SW_HIDE);
 ::SetParent((HWND)m_renderhwnd, GetSafeHwnd());

 ResizeGooleEarth();
 return 0;
}


void CGooleEarthView::OnSize(UINT nType, int cx, int cy)
{
 CView::OnSize(nType, cx, cy);

 // TODO: Add your message handler code here
 ResizeGooleEarth();
}


void CGooleEarthView::OnInitialUpdate()
{
 CView::OnInitialUpdate();

 GetParent()->SetWindowText(GE_TITLE);  

}

void CGooleEarthView::OnClose()
{
 // TODO: Add your message handler code here and/or call default
 CView::OnClose();
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云雨巫山

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值