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

📄 layerquerydlg.cpp

📁 vc 和mapobjects地理信息系统组件开发 很有启发意义和参考价值
💻 CPP
字号:
// LayerQueryDlg.cpp : implementation file
//

#include "stdafx.h"
#include "mapper.h"
#include "LayerQueryDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CLayerQueryDlg dialog


CLayerQueryDlg::CLayerQueryDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CLayerQueryDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLayerQueryDlg)
	m_sLayer = _T("");
	m_sText = _T("");
	//}}AFX_DATA_INIT
}


void CLayerQueryDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLayerQueryDlg)
	DDX_Control(pDX, IDC_FIELDS, m_oFields);
	DDX_Text(pDX, IDC_LAYER, m_sLayer);
	DDX_Text(pDX, IDC_TEXT, m_sText);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CLayerQueryDlg message handlers

BOOL CLayerQueryDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	GetField();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CLayerQueryDlg::GetField()
{
/*
	CLayerFieldArray lf;
	Eng_GetLayerField(theApp.GetMapPane()->m_map,m_nLayer,lf);

	int i,count=lf.GetSize();
	CString s;
	for(i=0;i<count;i++)
	{
		s.Format("%s   [%s]",lf[i].szField,lf[i].szDataType);
		m_oField.AddString(s);
	}
*/

	m_oFields.DeleteAllItems();

	CLayerFieldArray lf;
	Eng_GetLayerField(theApp.GetMapPane()->m_map,m_nLayer,lf);
	CStringArray dp;
	Eng_GetLayerDataPara(theApp.GetMapPane()->m_map,m_nLayer,dp);

	int i,count=lf.GetSize();
	HTREEITEM hItem;
	CString s;
	for(i=0;i<count;i++)
	{
		s.Format("%s   [%s]",lf[i].szField,lf[i].szDataType);
		hItem=m_oFields.InsertItem(s);

		s=lf[i].szDataType;
		if((s!="长整数")&&(s!="双精度"))
			continue;
	
		s.Format("最小:%19.6lf",lf[i].min);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
		s.Format("最大:%19.6lf",lf[i].max);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
		s.Format("均值:%19.6lf",lf[i].mean);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
		s.Format("总和:%19.6lf",lf[i].sum);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
		s.Format("方差:%19.6lf",lf[i].dev);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
		s.Format("个数:%12ld",lf[i].count);
		m_oFields.InsertItem(s,NULL,NULL,hItem);
	}

}

⌨️ 快捷键说明

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