15,979
社区成员
发帖
与我相关
我的任务
分享
// MapNavigateView.cpp : implementation of the CMapNavigateView class
//
#include "stdafx.h"
#include "MapNavigate.h"
#include "MapNavigateDoc.h"
#include "MapNavigateView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView
IMPLEMENT_DYNCREATE(CMapNavigateView, CView)
BEGIN_MESSAGE_MAP(CMapNavigateView, CView)
//{{AFX_MSG_MAP(CMapNavigateView)
ON_WM_CREATE()
ON_WM_SIZE()
ON_COMMAND(ID_BUTTON32774, OnButton32774)
ON_COMMAND(ID_BUTTON32775, OnButton32775)
ON_COMMAND(ID_BUTTON32776, OnButton32776)
ON_COMMAND(ID_BUTTON32777, OnButton32777)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
BEGIN_EVENTSINK_MAP(CMapNavigateView, CView)
ON_EVENT(CMapNavigateView, IDC_MAP, 6 /* MapViewChanged */, OnMapViewChangedMap, VTS_NONE)
END_EVENTSINK_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView construction/destruction
CMapNavigateView::CMapNavigateView()
{
// TODO: add construction code here
pEyeDlg = NULL;
m_Created = 0;
}
CMapNavigateView::~CMapNavigateView()
{
if(pEyeDlg!=NULL)
{
delete pEyeDlg;
}
}
BOOL CMapNavigateView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView drawing
void CMapNavigateView::OnDraw(CDC* pDC)
{
CMapNavigateDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView printing
BOOL CMapNavigateView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMapNavigateView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMapNavigateView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView diagnostics
#ifdef _DEBUG
void CMapNavigateView::AssertValid() const
{
CView::AssertValid();
}
void CMapNavigateView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMapNavigateDoc* CMapNavigateView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMapNavigateDoc)));
return (CMapNavigateDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMapNavigateView message handlers
int CMapNavigateView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CRect rec;
GetClientRect(rec);
m_ctrlMapX.SetGeoSet("map\\西安.gst");
if(m_map.Create(NULL,WS_VISIBLE,rec,this,IDC_MAP))
{
m_Created = 1;
}
else
return -1;
return 0;
}
void CMapNavigateView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
m_map.MoveWindow(0,0,cx,cy);
// TODO: Add your message handler code here
}
void CMapNavigateView::OnButton32774()
{
// TODO: Add your command handler code here
if(pEyeDlg==NULL)
{
pEyeDlg = new CEyeMap(this);
}
CString str[6];
str[0] = m_tempclientpath+"\\map\\城墙.tab";
str[1] = m_tempclientpath+"\\map\\铁路.tab";
str[2] = m_tempclientpath+"\\map\\主要街道.tab";
str[3] = m_tempclientpath+"\\map\\次要街道.tab";
str[4] = "-1";
pEyeDlg->strMap = str;
pEyeDlg->InitMap(&m_map);
pEyeDlg->m_backcolor = RGB(0,0,0);
if(pEyeDlg->GetSafeHwnd()==0)
{
BOOL a = pEyeDlg->Create();
}
else
{
return;
}
CRect rec1;
pEyeDlg->GetWindowRect(rec1);
CRect rec;
this->GetWindowRect(rec);
pEyeDlg->SetWindowPos(&wndTop,rec.right-rec1.right+rec1.left,rec.bottom-rec1.bottom+rec1.top,rec1.right-rec1.left,rec1.bottom-rec1.top,SWP_SHOWWINDOW);
pEyeDlg->ShowWindow(SW_SHOWNORMAL);
}
void CMapNavigateView::OnMapViewChangedMap()
{
if(m_Created==1)
{
CWnd* pWnd = (CWnd*)pEyeDlg;
if(pWnd->GetSafeHwnd()!=0)
{
pWnd->PostMessage(WM_MAPCHANGING,0,0);
}
}
}
void CMapNavigateView::OnButton32775()
{
// TODO: Add your command handler code here
m_map.SetCurrentTool(1003);
}
void CMapNavigateView::OnButton32776()
{
// TODO: Add your command handler code here
m_map.SetCurrentTool(1004);
}
void CMapNavigateView::OnButton32777()
{
// TODO: Add your command handler code here
m_map.SetCurrentTool(1001);
}