📄 testside3dlg.cpp
字号:
// Curve.h: interface for the CCurve class.
// Copyright 济南路通科技开发有限责任公司
// mailto: lutong_jn@sina.com
//=====================================================================================
// 说明:曲线测设类
// 包括:
// 1. 曲线放样点结构类
// 2. 曲线基类
// 3. 圆曲线类
// 4. 缓和曲线类
// 5. 副交点类
// 6. 曲线工程管理类
//
// 将原定义的全局函数_CStringToFile(CFile *fp) 和 _CStringFromFile(CFile *fp)
// 删除。将曲线基类中的DmsToRad(...)和RadToDms(...)成员函数去掉。
// 修改了各类中的成员变量名。
//=====================================================================================
// 编写人:张玉生、秦涛
// 日期: 2002-10-15
// 版本: 1.0
//=====================================================================================
// TestSide3Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "TestSide3.h"
#include "TestSide3Dlg.h"
#include "BreakSide.h"
#include "BreakSideProject.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTestSide3Dlg dialog
CTestSide3Dlg::CTestSide3Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CTestSide3Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTestSide3Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_Msg = _T("");
}
void CTestSide3Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTestSide3Dlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTestSide3Dlg, CDialog)
//{{AFX_MSG_MAP(CTestSide3Dlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_CLEAR, OnButtonClear)
ON_BN_CLICKED(IDC_BUTTON_GEN_DATA, OnButtonGenData)
ON_BN_CLICKED(IDC_BUTTON_CLEAR_DATA, OnButtonClearData)
ON_BN_CLICKED(IDC_BUTTON_READ_FILE, OnButtonReadFile)
ON_BN_CLICKED(IDC_BUTTON_WRITE_FILE, OnButtonWriteFile)
ON_BN_CLICKED(IDC_BUTTON_PRINT_DATA, OnButtonPrintData)
ON_BN_CLICKED(IDC_BUTTON_GEN_DRAWDATA, OnButtonGenDrawdata)
ON_BN_CLICKED(IDC_BUTTON_TEST, OnButtonTest)
ON_BN_CLICKED(IDC_BUTTON_NEWPROJECT, OnButtonNewproject)
ON_BN_CLICKED(IDC_BUTTON_PRINT_PROJECTDATA, OnButtonPrintProjectdata)
ON_BN_CLICKED(IDC_BUTTON_WRITERPROJECTFILE, OnButtonWriterprojectfile)
ON_BN_CLICKED(IDC_BUTTON_READPROJECTFILE, OnButtonReadprojectfile)
ON_BN_CLICKED(IDC_BUTTON_COMPARE, OnButtonCompare)
ON_BN_CLICKED(IDC_BUTTON_RECALLDATA, OnButtonRecalldata)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTestSide3Dlg message handlers
BOOL CTestSide3Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CTestSide3Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CTestSide3Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CTestSide3Dlg::SetMsg(CString s)
{
CEdit *pEdit=(CEdit *)this->GetDlgItem(IDC_EDIT1);
m_Msg = s;
pEdit->SetWindowText(m_Msg);
}
void CTestSide3Dlg::AddMsg(CString s)
{
int k;
CEdit *pEdit=(CEdit *)this->GetDlgItem(IDC_EDIT1);
m_Msg += s;
m_Msg += _T("\r\n");
pEdit->SetWindowText(m_Msg);
k=pEdit->GetLineCount()-pEdit->GetFirstVisibleLine() - 30;
if (k>0) pEdit->LineScroll(k);
}
void CTestSide3Dlg::OnButtonClear()
{
SetMsg(_T(""));
}
CBreakSide B1;
CBreakSideProject P1,P2;
CBreakSide *B2,*B3;
void CTestSide3Dlg::OnButtonGenData()
{
CString M ;
CString Property ;
float Foresight ;
CString DotName ;
float Height ;
float Backsight ;
CBreakSidePoint *BP;
CStationPoint *SP;
M = _T("K100+100") ;
Property = _T("Z001") ;
Foresight = 3;
DotName = _T("基准点");
Height = 10.0;
Backsight = 5;
B1.Clear();
B1.SetBaseData(M,Property,Foresight,DotName,Height,Backsight);
//测量点 1
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = -5; //水平距离
BP->Foresight = 4 ; //前视读数
BP->StationNumber = 0 ; //测站点号
B1.AddPoint(BP);
//测量点 2
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = -8 ; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 3 ; //前视读数
BP->StationNumber = 0 ; //测站点号
B1.AddPoint(BP);
//测量点 3
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = -10; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 5 ; //前视读数
BP->StationNumber = 0 ; //测站点号
B1.AddPoint(BP);
//测量点 4
BP = new CBreakSidePoint;
BP->Type = 5 ; //点类型
BP->Distance = -110; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 1 ; //前视读数
BP->StationNumber = 0 ; //测站点号
B1.AddPoint(BP);
SP = new CStationPoint;
SP->Height = 0; //本测站的仪器高,为本测站的高程+本测站的后视读数
SP->Backsight = 3; //后视读数
SP->PointNumber = 4; //转点号
B1.AddStation(SP);
//测量点 5
BP = new CBreakSidePoint;
BP->Type = 1 ; //点类型
BP->Distance = 15; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 9 ; //前视读数
BP->StationNumber = 1 ; //测站点号
B1.AddPoint(BP);
//测量点 6
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = 10; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 7 ; //前视读数
BP->StationNumber = 1 ; //测站点号
B1.AddPoint(BP);
//测量点 7
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = 7; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 5 ; //前视读数
BP->StationNumber = 1 ; //测站点号
B1.AddPoint(BP);
//测量点 8
BP = new CBreakSidePoint;
BP->Type = 2 ; //点类型
BP->Distance = 4; //水平距离
//BP->Height = 0 ; //高差(相对于断面零点)
BP->Foresight = 10 ; //前视读数
BP->StationNumber = 1 ; //测站点号
B1.AddPoint(BP);
B1.DelPoint(5);
}
void CTestSide3Dlg::OnButtonClearData()
{
B1.Clear();
}
void CTestSide3Dlg::OnButtonReadFile()
{
CLTFile File;
File.Open(_T("A.dat"),CFile::modeRead);
B1.LoadFromFile(&File);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -