资源简介
mif 文件读取,直接通过读取文件的方式可以对mapinfo文件进行显示
代码片段和文件信息
// MapTestView.cpp : implementation of the CMapTestView class
//
#include “stdafx.h“
#include “MapTest.h“
#include “MapTestDoc.h“
#include “MapTestView.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
CMaplayer *pMapLaer;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMapTestView
IMPLEMENT_DYNCREATE(CMapTestView CView)
BEGIN_MESSAGE_MAP(CMapTestView CView)
//{{AFX_MSG_MAP(CMapTestView)
ON_COMMAND(ID_OpenMif OnOpenMif)
ON_COMMAND_RANGE(ID_ZoomInID_PanOnMapControl)
ON_WM_LBUTTONDOWN()
ON_WM_SIZE()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_UPDATE_COMMAND_UI_RANGE(ID_ZoomInID_Pan OnUpdateMapControl)
ON_COMMAND(ID_ConvFile OnConvFile)
ON_COMMAND(ID_OpenData OnOpenData)
ON_COMMAND(ID_FindPath OnFindPath)
ON_UPDATE_COMMAND_UI(ID_FindPath OnUpdateFindPath)
ON_WM_CANCELMODE()
ON_COMMAND(ID_MapClose OnMapClose)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapTestView construction/destruction
CMapTestView::CMapTestView()
{
// TODO: add construction code here
m_nMouseMode = ID_ARROW;//鼠标的当前任务
m_bMapMoving=false;
}
CMapTestView::~CMapTestView()
{
}
BOOL CMapTestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
//获得自定义光标资源
m_hcurHand = (HCURSOR)::LoadImage(cs.hInstance
MAKEINTRESOURCE(IDC_CURSOR_Pan) IMAGE_CURSOR 32 32 LR_DEFAULTCOLOR);
m_hcurZoomIn = (HCURSOR)::LoadImage(cs.hInstance
MAKEINTRESOURCE(IDC_CURSOR_ZoomIn) IMAGE_CURSOR 32 32 LR_DEFAULTCOLOR);
m_hcurZoomOut = (HCURSOR)::LoadImage(cs.hInstance
MAKEINTRESOURCE(IDC_CURSOR_ZoomOut) IMAGE_CURSOR 32 32 LR_DEFAULTCOLOR);
m_hcurCross = (HCURSOR)::LoadImage(cs.hInstance
MAKEINTRESOURCE(IDC_CURSOR_Cross) IMAGE_CURSOR 32 32 LR_DEFAULTCOLOR);
//获得光标资源的另一种方法
m_hcurArrow = AfxGetApp()->LoadCursor(IDC_CURSOR_ARROW);
///***///
// m_hcurMoving = AfxGetApp()->LoadCursor(IDC_CURSOR_MOVE);
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMapTestView drawing
void CMapTestView::OnDraw(CDC* pDC)
{
CMapTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
////////////////////
//pDoc->Drawobjects(pDC);
////////////////////
CDC* dc = GetDC();
dc->BitBlt(0 0 pDoc->m_nViewWidth pDoc->m_nVeiwHeight pDoc->m_pMemDC
0 0SRCCOPY);//
ReleaseDC(dc);
}
/////////////////////////////////////////////////////////////////////////////
// CMapTestView diagnostics
#ifdef _DEBUG
void CMapTestView::AssertValid() const
{
CView::AssertValid();
}
void CMapTestView::Dump(CDumpContext&
评论
共有 条评论