⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simplemapdoc.cpp

📁 windows mobile gis system
💻 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 + -