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

📄 breaksidedlg.cpp

📁 工程测量数据处理
💻 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	
//=====================================================================================




// BreakSideDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "BreakSideDlg.h"
#include "BreakSideProject.h"
#include "ProjectDlg.h"
#include "RailServey1.h"
#include "MainFrm.h"
#include "RailServey1Doc.h"
#include "RailServey1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBreakSideDlg dialog
CBreakSideDlg BreakSideDlg;

CBreakSideDlg::CBreakSideDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CBreakSideDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CBreakSideDlg)
	m_backsight = 0.0f;
	m_distance = 0.0f;
	m_forsight = 0.0f;
	m_survey_type = 0;
	m_left = 0;
	//}}AFX_DATA_INIT
}


void CBreakSideDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CBreakSideDlg)
	DDX_Control(pDX, IDC_EDIT_FORSIGHT, m_forsight_control);
	DDX_Control(pDX, IDC_EDIT_DISTANCE, m_distance_control);
	DDX_Control(pDX, IDC_EDIT_BACKSIGHT, m_backsight_control);
	DDX_Control(pDX, IDC_COMBO_TYPE, m_type_control);
	DDX_Text(pDX, IDC_EDIT_BACKSIGHT, m_backsight);
	DDX_Text(pDX, IDC_EDIT_DISTANCE, m_distance);
	DDX_Text(pDX, IDC_EDIT_FORSIGHT, m_forsight);
	DDX_Radio(pDX, IDC_RADIO_SURVEY_POINT, m_survey_type);
	DDX_Radio(pDX, IDC_RADIO_LEFT, m_left);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CBreakSideDlg, CDialog)
	//{{AFX_MSG_MAP(CBreakSideDlg)
	ON_WM_LBUTTONDOWN()
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_RADIO_STATION_POINT, OnRadioStationPoint)
	ON_BN_CLICKED(IDC_RADIO_SURVEY_POINT, OnRadioSurveyPoint)
	ON_BN_CLICKED(IDC_BUTTON_ADD_POINT, OnButtonAddPoint)
	ON_BN_CLICKED(IDC_BUTTON_SAVE, OnButtonSave)
	ON_BN_CLICKED(IDC_BUTTON_COMPARE, OnButtonCompare)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBreakSideDlg message handlers

void CBreakSideDlg::MoveIn()
{
	if (!Initialized) return;
	if (Rect.bottom==yNormal) return ;

	Rect.bottom = yNormal;
	Rect.top    = yNormal - yNormal;
	MoveWindow(&Rect);
}

void CBreakSideDlg::MoveOut()
{
	if (!Initialized) return;
	if (Rect.bottom==yHide) return ;

	Rect.bottom = yHide;
	Rect.top    = yHide - yNormal;
	MoveWindow(&Rect);
}

BOOL CBreakSideDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	GetWindowRect(&Rect);
	yHide   = 5 ;
	yNormal = Rect.bottom - Rect.top ;
	
	Rect.bottom = yHide;
	Rect.top    = yHide - yNormal;
	MoveWindow(&Rect);

	/*int i,j,k;
	int x,y;
	for (i=0;i<4;i++) 
	{
		for (j=0;j<3;j++) 
		{
			k = i * 3 + j;
			y = 20+i*30;
			x = 130 +j*30;
			RK[k].SetRect(x,y,x+30,y+30);
		}
	}
	VK[0]='7';	VK[1]='8';	VK[2]='9'; 
	VK[3]='4';	VK[4]='5';	VK[5]='6'; 
	VK[6]='1';	VK[7]='2';	VK[8]='3'; 
	VK[9]='-';	VK[10]='0';	VK[11]=','; */

	Initialized = 1;
	m_type_control.AddString (_T("一般点"));
	m_type_control.AddString (_T("轨顶"));
	m_type_control.AddString (_T("渣肩"));
	m_type_control.AddString (_T("渣脚"));
	m_type_control.AddString (_T("转点"));
	m_type_control.AddString (_T("板底"));
	m_type_control.AddString (_T("板顶"));
	m_type_control.AddString (_T("拱底"));
	m_type_control.AddString (_T("拱顶"));
	m_type_control.AddString (_T("沟边"));
	m_type_control.AddString (_T("沟心"));
	m_type_control.AddString (_T("路边"));
	m_type_control.AddString (_T("路肩"));
	m_type_control.AddString (_T("路心"));
	m_type_control.AddString (_T("冒石顶"));
	m_type_control.AddString (_T("坡脚"));
	m_type_control.AddString (_T("水底"));
	m_type_control.AddString (_T("水面"));
	m_type_control.AddString (_T("删除点"));
	m_type_control.SetCurSel (0);
	m_backsight_control.EnableWindow (FALSE);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CBreakSideDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	MoveIn();

	/*int i;
	for (i=0;i<12;i++) {
		if (RK[i].PtInRect(point)) 
		{
			::PostMessage(::GetFocus(),WM_KEYDOWN,VK[i],0x20001);	
			break;
		}
	}*/

	CDialog::OnLButtonDown(nFlags, point);
}

BOOL CBreakSideDlg::PreTranslateMessage(MSG* pMsg) 
{
	// 屏蔽 回车键 和 ESC键
	if (pMsg->message==WM_KEYDOWN)
	{
		if (pMsg->wParam==27) return TRUE;
		if (pMsg->wParam==13) return TRUE;
	}	
	return CDialog::PreTranslateMessage(pMsg);
}

void CBreakSideDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	/*int i;

	for (i=0;i<12;i++)
	{
		dc.Rectangle(&RK[i]);
		dc.DrawText (VK[i],&RK[i],DT_CENTER|DT_VCENTER);
	}*/
	
	// Do not call CDialog::OnPaint() for painting messages
}

void CBreakSideDlg::OnRadioStationPoint() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	if(m_survey_type==1)
	{
		m_backsight_control.EnableWindow (TRUE);
		m_distance_control.EnableWindow (FALSE);
	}	
}

void CBreakSideDlg::OnRadioSurveyPoint() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	if(m_survey_type==0)
	{
		m_backsight_control.EnableWindow (FALSE);
		m_distance_control.EnableWindow (TRUE);
	}
}

void CBreakSideDlg::OnButtonAddPoint() 
{
	// TODO: Add your control notification handler code here
	if(CurrentBreakside<0) 
	{
		MessageBox(TEXT("请先选择要编辑的断面"),TEXT("提示"),MB_OK);
		return ;
	}
	CBreakSidePoint *BP;
	CStationPoint *SP;
	if(CurrentBreakside<0) return ;
	int index_type=-1;//用于存储测点类型的索引值
	index_type=m_type_control.GetCurSel();
	UpdateData();

	//获得当前视图类对象指针
	CMainFrame *pFrame = (CMainFrame *)AfxGetApp()->m_pMainWnd ;
	ASSERT(pFrame);
	CRailServey1View *pView=(CRailServey1View *)pFrame->GetActiveView ();
	ASSERT(pView);

	//定义测点的位置,当left=-1时为左侧,当left=1时为右侧
	int left; 
	if(m_left==0)
	{
		left=-1;
	}
	else
	{
		left=1;
	}

	if(m_survey_type==0)//增加新测量点
	{
		BP = new CBreakSidePoint;
		
		BP->Type          = ++index_type ;  //点类型
		BP->Distance      = m_distance*left;  //水平距离
		BP->Height        = 0 ;  //高差(相对于断面零点)
		BP->Foresight     = m_forsight ;  //前视读数
		BP->StationNumber =BSPrj.BS [CurrentBreakside]->StationCount-1 ;  //测站点号
		BSPrj.BS [CurrentBreakside]->AddPoint (BP);
		
		//当前点居中
		int xRate;
		float x;
		x = BP->Distance;

		x += float(BreakSideWidth/2.0/10.0);
		xRate = int( x * 1000.0 / BreakSideWidth*10.0);

		//要当前点居中
		pView->CenterPoint(xRate);

	}
	else//增加新的测站
	{
		SP = new CStationPoint;
		BP = new CBreakSidePoint;
	
		BP->Type          = 5 ;  //点类型
		BP->Foresight     = m_forsight ;  //前视读数
		BP->StationNumber =BSPrj.BS [CurrentBreakside]->StationCount -1;  //测站点号
		BSPrj.BS [CurrentBreakside]->AddPoint (BP);
		SP->Height		= 0;	//高差(相对于断面零点)
		SP->Backsight	= m_backsight;	//后视读数
		SP->PointNumber	= BSPrj.BS [CurrentBreakside]->PointCount-1;	//转点号
		BSPrj.BS [CurrentBreakside]->AddStation(SP);
	}
	int k=BSPrj.BS [CurrentBreakside]->PointCount;
	CString s;
	s.Format(_T("断面:%d,共有%d个点"),CurrentBreakside,k);
	pFrame->SetStatusBar(s);

	pView->Invalidate(TRUE);
}

void CBreakSideDlg::OnButtonSave() 
{
	// TODO: Add your control notification handler code here
	CFileDialog dlgFile(FALSE,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,TEXT("导线工程(*.led)|*.led"));
	dlgFile.m_ofn.lpstrTitle =TEXT("保存工程");
	int resault=dlgFile.DoModal();
	CString filename=dlgFile.GetPathName( ) ;
	BSPrj.SetFileName (filename);
	BSPrj.Save ();		
}

void CBreakSideDlg::OnButtonCompare() 
{

	CBreakSideProject P2;
	P2.Clear ();
	P2.SetFileName (_T("My Documents\\a.dmp"));
	P2.Load ();
	if(BSPrj.Compare (&P2))
		MessageBox(TEXT("一样"),NULL,MB_OK);
	else
		MessageBox(TEXT("不一样"),NULL,MB_OK);
}

⌨️ 快捷键说明

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