// 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();
}