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

📄 dlgselectlayer.cpp

📁 Embedded vc++下开发的可编辑地图程序
💻 CPP
字号:
// DlgSelectLayer.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "DlgSelectLayer.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgSelectLayer dialog


CDlgSelectLayer::CDlgSelectLayer(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSelectLayer::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgSelectLayer)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_pMapWnd = NULL;
	m_strLayerName = _T("");
}


void CDlgSelectLayer::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgSelectLayer)
	DDX_Control(pDX, IDC_COMBO_LAYERNAME, m_cmLayerName);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgSelectLayer, CDialog)
	//{{AFX_MSG_MAP(CDlgSelectLayer)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSelectLayer message handlers
void CDlgSelectLayer::SetLayerName()
{//将数据源中的图层名加到对话框图层列表中
	CString strLayerName;
	m_cmLayerName.ResetContent();
	if (m_pMapWnd!=NULL)
	{
		int nLayerCount=m_pMapWnd->GetLayerCount();
		for(int i=0;i<m_pMapWnd->GetLayerCount();i++)
		{
			CSeLayer *pLayer=m_pMapWnd->GetLayerAt(i);
			strLayerName=pLayer->m_strLayerName;
			//去掉"@+数据源名"
			int nPos=strLayerName.Find(_T("@"));
			strLayerName=strLayerName.Left(nPos);
			m_cmLayerName.InsertString(i,strLayerName);
		}
		m_cmLayerName.SetCurSel(0);
	}		
}

CString CDlgSelectLayer::GetLayerName()
{//获得对话框中的图层名
	CString strLayerName;
	int nSelItem=m_cmLayerName.GetCurSel();
	if (m_pMapWnd!=NULL)
	{
		CSeLayer *pLayer=m_pMapWnd->GetLayerAt(nSelItem);
		strLayerName = pLayer->m_strLayerName;
	}
	return strLayerName;
}

BOOL CDlgSelectLayer::OnInitDialog() 
{//初始化
	CDialog::OnInitDialog();
	//将图层名添加到下拉列表中
	SetLayerName();
	return TRUE;  
}

void CDlgSelectLayer::OnOK() 
{
	m_strLayerName = GetLayerName();
	CDialog::OnOK();
}

void CDlgSelectLayer::OnCancel() 
{	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -