You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.4 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// LineDesign.cpp : 实现文件
//
#include "stdafx.h"
#include "GISDlg.h"
#include "LineDesign.h"
#include "afxdialogex.h"
// CLineDesign 对话框
IMPLEMENT_DYNAMIC(CLineDesign, CDialog)
CLineDesign::CLineDesign(CWnd* pParent /*=NULL*/)
: CDialog(CLineDesign::IDD, pParent)
{
}
CLineDesign::~CLineDesign()
{
}
void CLineDesign::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST_LINE, m_list);
}
BEGIN_MESSAGE_MAP(CLineDesign, CDialog)
ON_WM_NOTIFYFORMAT(NM_RCLICK, IDC_LIST_LINE, OnRclickList)
END_MESSAGE_MAP()
// CLineDesign 消息处理程序
BOOL CLineDesign::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
//获取当前的扩展形式
DWORD dwstyle = m_list.GetExtendedStyle();
//选中某行使整行高亮report风格
dwstyle = LVS_EX_FULLROWSELECT;
//网格线report风格
dwstyle |= LVS_EX_GRIDLINES;
//单击激活
dwstyle |= LVS_EX_ONECLICKACTIVATE;
//在item之前产生checkout控件
dwstyle |= LVS_EX_CHECKBOXES;
m_list.SetExtendedStyle(dwstyle);
CRect rect;
m_list.GetWindowRect(&rect);
int listwidth = rect.Width();
m_list.InsertColumn(0,"航线号",LVCFMT_CENTER,listwidth/12,-1);
m_list.InsertColumn(1,"航点号",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(2,"经度",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(3,"纬度",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(4,"高度",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(5,"速度",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(6,"任务特征字",LVCFMT_CENTER,listwidth/8,-1);
m_list.InsertColumn(7,"航路特征字",LVCFMT_CENTER,listwidth/7,-1);
for (int i=0; i < 40; i++)
{
CString tstr;
tstr.Format("%d",i);
m_list.InsertItem(i,tstr);
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
//在表格里显示经纬度坐标
void CLineDesign::ShowLonLat(double lon, double lat)
{
CString str;
str.Format("%.6f", lon);
m_list.SetItemText(0, 2, str);
str.Format("%.6f", lat);
m_list.SetItemText(0, 3, str);
UpdateData(FALSE);
}
// void CLineDesign::InsertPt(tmpPT pData)
// {
// CString tstr;
// m_nowPt = pData.pt_id;
//
// tstr.Format("%d",m_nowPt);
// m_list.SetItemText(m_nowPt, 1, tstr);
//
// tstr.Format("%.6f", pData.pt_Lon);
// m_list.SetItemText(m_nowPt, 2, tstr);
//
// tstr.Format("%.6f", pData.pt_Lat);
// m_list.SetItemText(m_nowPt, 3, tstr);
// }
void CLineDesign::InsertPt(PtStruct pData)
{
CString tstr;
m_nowPt = pData.nPt;
tstr.Format("%d",m_nowPt);
m_list.SetItemText(m_nowPt, 1, tstr);
tstr.Format("%.6f", pData.dX);
m_list.SetItemText(m_nowPt, 2, tstr);
tstr.Format("%.6f", pData.dY);
m_list.SetItemText(m_nowPt, 3, tstr);
tstr.Format("%.6f", pData.nH);
m_list.SetItemText(m_nowPt, 4, tstr);
tstr.Format("%.6f", pData.nV);
m_list.SetItemText(m_nowPt, 5, tstr);
tstr.Format("0x%02x", pData.ch1);
m_list.SetItemText(m_nowPt, 6, tstr);
tstr.Format("0x%02x", pData.ch2);
m_list.SetItemText(m_nowPt, 7, tstr);
}
UINT CLineDesign::OnNotifyFormat(CWnd *pWnd, UINT nCommand)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
return CDialog::OnNotifyFormat(pWnd, nCommand);
}
//BOOL CLineDesign::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
//{
// // TODO: 在此添加专用代码和/或调用基类
//
// return CDialog::OnNotify(wParam, lParam, pResult);
//}