?? simplemapdoc.cpp
字號:
// SimpleMapDoc.cpp : implementation of the CSimpleMapDoc class
//
#include "stdafx.h"
#include "SimpleMap.h"
#include "SimpleMapDoc.h"
#include "Mainfrm.h"
#include "SimpleMapView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSimpleMapDoc
IMPLEMENT_DYNCREATE(CSimpleMapDoc, CDocument)
BEGIN_MESSAGE_MAP(CSimpleMapDoc, CDocument)
//{{AFX_MSG_MAP(CSimpleMapDoc)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSimpleMapDoc construction/destruction
CSimpleMapDoc::CSimpleMapDoc()
{
// TODO: add one-time construction code here
}
CSimpleMapDoc::~CSimpleMapDoc()
{
}
BOOL CSimpleMapDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSimpleMapDoc serialization
void CSimpleMapDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CSimpleMapDoc diagnostics
#ifdef _DEBUG
void CSimpleMapDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CSimpleMapDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSimpleMapDoc commands
void CSimpleMapDoc::OnFileOpen()
{
CString csFileName;
CMainFrame *pFrame;
CSimpleMapView *pMapView;
CString csFilter = " shp Files (*.shp)|*.shp||";
CFileDialog fDlg(TRUE,0,0,OFN_HIDEREADONLY|OFN_FILEMUSTEXIST,(LPCTSTR)csFilter
,NULL);
pFrame = (CMainFrame*)AfxGetMainWnd();
if( fDlg.DoModal() != IDCANCEL )
{
csFileName = fDlg.GetPathName();
CMapLayer* pLayer = new CMapLayer;
pLayer->SetLayerName(csFileName);
if ( pLayer->LoadData(csFileName) > 0 )
{
m_MapLayers.Add(pLayer);
m_MapLayers.GetAllExtent(m_AllExtent);
if ( m_MapLayers.GetCount() == 1 )
{
pMapView = (CSimpleMapView*)pFrame->GetActiveView();
pMapView->InitScale();
}
}
else
{
::MessageBox(NULL,L"Load File Failed!",L"Tips",MB_OK);
delete pLayer;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -