www.pudn.com > VC+mapX开发GPS车辆监控的源码.zip > GeoSetDlg.cpp


// GeoSetDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "MapDemo.h" 
#include "GeoSetDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CGeoSetDlg dialog 
 
 
CGeoSetDlg::CGeoSetDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CGeoSetDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CGeoSetDlg) 
	m_strName = _T(""); 
	//}}AFX_DATA_INIT 
	m_pMapX=NULL; 
} 
 
CGeoSetDlg::CGeoSetDlg(CMapX* pMapX,CWnd* pParent /*=NULL*/) 
	: CDialog(CGeoSetDlg::IDD, pParent) 
{ 
    m_pMapX=pMapX; 
	m_strName = _T(""); 
} 
void CGeoSetDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CGeoSetDlg) 
	DDX_Control(pDX, IDC_COMBO_GEOSETNAME, m_ctlGeoSet); 
	DDX_CBString(pDX, IDC_COMBO_GEOSETNAME, m_strName); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CGeoSetDlg, CDialog) 
	//{{AFX_MSG_MAP(CGeoSetDlg) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CGeoSetDlg message handlers 
 
BOOL CGeoSetDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	if(m_pMapX==NULL) return TRUE; 
	CMapXGeosets newGeo=m_pMapX->GetGeosets(); 
	 
	CString strCurName=m_pMapX->GetGeoSet(); 
	int nIndex=-1; 
	for(int i=0;i<newGeo.GetCount();i++){ 
      CMapXGeoset tempGeo=newGeo.Item(i+1); 
	  CString strGeo=tempGeo.GetUserName(); 
	  if(strGeo==strCurName) nIndex=i; 
	  m_ctlGeoSet.AddString (strGeo);  
	} 
	UpdateData(FALSE); 
	m_ctlGeoSet.SetCurSel (nIndex-1); 
 
		 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CGeoSetDlg::OnOK()  
{ 
	 
	CDialog::OnOK(); 
    if(m_pMapX!=NULL) m_pMapX->SetGeoSet(m_strName); 
 
}