1081 lines
30 KiB
C++
1081 lines
30 KiB
C++
#include "stdafx.h"
|
|
#include "HorizontalSectionDlg.h"
|
|
#include "AttachmentPrototype.h"
|
|
#include "DbPipe.h"
|
|
#include "TImageDrawDCEx.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
extern AcDbArc* FormatArc(const AcGePoint3d& ptGe1, const AcGePoint3d& ptGe2, const AcGePoint3d& ptGe3);
|
|
extern AcDbObjectId InitLayer(const TCHAR *szLayer, AcDbDatabase *pDb);
|
|
|
|
CRoadGrid::CRoadGrid()
|
|
{
|
|
|
|
}
|
|
|
|
CRoadGrid::~CRoadGrid()
|
|
{
|
|
|
|
}
|
|
|
|
bool CRoadGrid::OnModified(WDGridCell&cell, CString &text)
|
|
{
|
|
if (cell.GetCol().GetIndex() == 3)
|
|
{
|
|
double dVal = _tstof(text);
|
|
if (dVal > 5 || dVal < -5)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
cell.SetText(text);
|
|
UpdateData(FALSE);
|
|
if (m_pWnddlg != NULL)
|
|
{
|
|
m_pWnddlg->UpdateInfo();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
CHorizontalSectionDlg::CHorizontalSectionDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CHorizontalSectionDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CHorizontalSectionDlg)
|
|
m_bWndChkGrad = FALSE;
|
|
//}}AFX_DATA_INIT
|
|
m_dScaleX = 100;
|
|
m_dScaleY = 50;
|
|
m_dHeight1 = 0.18;
|
|
m_dHeight2 = 0.18;
|
|
m_dRoadEle = 8.0;
|
|
m_dCarWidth = 6.0;
|
|
m_dMenWidth = 5.0;
|
|
m_dNoCarWidth = 6.0;
|
|
m_dGreenWidth1 = 3.0;
|
|
m_dGreenWidth2 = 1.0;
|
|
m_pSecDraw = new CDrawSectionSymbol();
|
|
m_pPreviewDb = new AcDbDatabase;
|
|
}
|
|
|
|
CHorizontalSectionDlg::~CHorizontalSectionDlg()
|
|
{
|
|
m_PreviewCtrl.clearAll();
|
|
if (m_pSecDraw != NULL)
|
|
{
|
|
delete m_pSecDraw;
|
|
m_pSecDraw = NULL;
|
|
}
|
|
|
|
// cet 2010.7.21 add
|
|
if (m_pPreviewDb != NULL)
|
|
{
|
|
delete m_pPreviewDb;
|
|
m_pPreviewDb = NULL;
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CHorizontalSectionDlg)
|
|
DDX_Control(pDX, IDC_CMB_TYPE, m_wndCmbType);
|
|
DDX_Control(pDX, IDC_LIST_ROADDATA, m_wndLstRoadData);
|
|
DDX_Check(pDX, IDC_CHECK_GRAD, m_bWndChkGrad);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CHorizontalSectionDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CHorizontalSectionDlg)
|
|
ON_BN_CLICKED(IDC_CHECK_GRAD, OnCheckGrad)
|
|
ON_CBN_SELCHANGE(IDC_CMB_TYPE, OnSelchangeCmbType)
|
|
ON_WM_PAINT()
|
|
ON_EN_KILLFOCUS(IDC_EDT_SCALEX, OnKillfocusEdt)
|
|
ON_EN_CHANGE(IDC_EDT_HEIGHT1, OnChangeEdtHeight1)
|
|
ON_EN_CHANGE(IDC_EDT_HEIGHT2, OnChangeEdtHeight2)
|
|
ON_EN_SETFOCUS(IDC_EDT_HEIGHT1, OnSetfocusEdtHeight1)
|
|
ON_EN_SETFOCUS(IDC_EDT_HEIGHT2, OnSetfocusEdtHeight2)
|
|
ON_EN_KILLFOCUS(IDC_EDT_HEIGHT1, OnKillfocusEdt)
|
|
ON_EN_KILLFOCUS(IDC_EDT_HEIGHT2, OnKillfocusEdt)
|
|
ON_EN_KILLFOCUS(IDC_EDT_ROADELE, OnKillfocusEdt)
|
|
ON_EN_KILLFOCUS(IDC_EDT_SCALEY, OnKillfocusEdt)
|
|
ON_BN_CLICKED(IDC_STATIC_PREVIEW, OnStaticPreview)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CHorizontalSectionDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
UpdateData(TRUE);
|
|
ReadOrWriteData(true);
|
|
|
|
CWnd *pWnd = NULL;
|
|
CString strText;
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEX);
|
|
if (pWnd != NULL)
|
|
{
|
|
strText.Format(_T("%.0f"), m_dScaleX);
|
|
pWnd->SetWindowText(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEY);
|
|
if (pWnd != NULL)
|
|
{
|
|
strText.Format(_T("%.0f"), m_dScaleY);
|
|
pWnd->SetWindowText(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_ROADELE);
|
|
if (pWnd != NULL)
|
|
{
|
|
strText.Format(_T("%.3f"), m_dRoadEle);
|
|
pWnd->SetWindowText(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT1);
|
|
if (pWnd != NULL)
|
|
{
|
|
strText.Format(_T("%.3f"), m_dHeight1);
|
|
pWnd->SetWindowText(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT2);
|
|
if (pWnd != NULL)
|
|
{
|
|
strText.Format(_T("%.3f"), m_dHeight2);
|
|
pWnd->SetWindowText(strText);
|
|
}
|
|
|
|
m_wndCmbType.SetCurSel(3);
|
|
|
|
CRect rect;
|
|
m_wndLstRoadData.GetWindowRect(&rect);
|
|
ScreenToClient(&rect);
|
|
|
|
m_wndLstRoadData.Clear();
|
|
m_wndLstRoadData.Create(this, IDC_LIST_ROADDATA);
|
|
|
|
m_wndLstRoadData.SetNoDefaultMenu();
|
|
m_wndLstRoadData.SetNoAppendButton();
|
|
|
|
long nWidth = rect.Width() / 4;
|
|
m_wndLstRoadData.AppendCol(_T("序号"), nWidth / 2);
|
|
m_wndLstRoadData.AppendCol(_T("板块名称"), nWidth);
|
|
m_wndLstRoadData.AppendCol(_T("宽度(m)"), nWidth);
|
|
m_wndLstRoadData.AppendCol(_T("坡度(%)"), nWidth);
|
|
m_wndLstRoadData.FitLastCol();
|
|
|
|
int nIndex = m_wndCmbType.GetCurSel();
|
|
CString strCarWidth, strCarGrad, strNoCarWidth, strNoCarGrad, strMenWidth, strMenGrad,
|
|
strGreenWidth1, strGreenGrad1, strGreenWidth2, strGreenGrad2;
|
|
double dGrad = -1.5;
|
|
|
|
if (m_bWndChkGrad)
|
|
{
|
|
dGrad = 0.0;
|
|
}
|
|
strCarWidth.Format(_T("%.3f"), m_dCarWidth);
|
|
strCarGrad.Format(_T("%.1f"), dGrad);
|
|
strNoCarWidth.Format(_T("%.3f"), m_dNoCarWidth);
|
|
strNoCarGrad.Format(_T("%.1f"), dGrad);
|
|
strMenWidth.Format(_T("%.3f"), m_dMenWidth);
|
|
strMenGrad.Format(_T("%.1f"), dGrad);
|
|
strGreenWidth1.Format(_T("%.3f"), m_dGreenWidth1);
|
|
strGreenGrad1.Format(_T("%.1f"), dGrad);
|
|
strGreenWidth2.Format(_T("%.3f"), m_dGreenWidth1);
|
|
strGreenGrad2.Format(_T("%.1f"), dGrad);
|
|
|
|
|
|
if (nIndex == 0) // 简绘道路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
}
|
|
else if (nIndex == 1) // 单块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 2) // 两块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(_T("1.000"));
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 3) // 三块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strGreenWidth1);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("非机动车道"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(strNoCarWidth);
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strNoCarGrad);
|
|
m_wndLstRoadData.GetCell(3, 0).SetText(_T("4"));
|
|
m_wndLstRoadData.GetCell(3, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(3, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(3, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 4) // 四块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(_T("1.000")); ///////////////
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(_T("1.000"));
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strGreenGrad2);
|
|
m_wndLstRoadData.GetCell(3, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(3, 1).SetText(_T("非机动车道"));
|
|
m_wndLstRoadData.GetCell(3, 2).SetText(strNoCarWidth);
|
|
m_wndLstRoadData.GetCell(3, 3).SetText(strNoCarGrad);
|
|
m_wndLstRoadData.GetCell(4, 0).SetText(_T("4"));
|
|
m_wndLstRoadData.GetCell(4, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(4, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(4, 3).SetText(strMenGrad);
|
|
}
|
|
|
|
m_wndLstRoadData.GetCol(0).SetReadOnly();
|
|
m_wndLstRoadData.GetCol(1).SetReadOnly();
|
|
|
|
UpdateData(FALSE);
|
|
|
|
if (!m_PreviewCtrl.SubclassDlgItem(IDC_STATIC_PREVIEW, this))
|
|
return FALSE;
|
|
m_PreviewCtrl.SetOrbitFlag(OBF_ZOOM | OBF_PAN);
|
|
|
|
InitDataContainer();
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
|
|
m_wndLstRoadData.SetDlg(this);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnOK()
|
|
{
|
|
UpdateData(TRUE);
|
|
int nIndex = m_wndCmbType.GetCurSel();
|
|
if (nIndex == 0) // 简绘道路
|
|
{
|
|
m_dCarWidth = _tstof(m_wndLstRoadData.GetCell(0, 2).GetText());
|
|
m_dCarGrad = _tstof(m_wndLstRoadData.GetCell(0, 3).GetText());
|
|
}
|
|
else if (nIndex == 1) // 单块板路
|
|
{
|
|
m_dCarWidth = _tstof(m_wndLstRoadData.GetCell(0, 2).GetText());
|
|
m_dCarGrad = _tstof(m_wndLstRoadData.GetCell(0, 3).GetText());
|
|
m_dMenWidth = _tstof(m_wndLstRoadData.GetCell(1, 2).GetText());
|
|
m_dMenGrad = _tstof(m_wndLstRoadData.GetCell(1, 3).GetText());
|
|
}
|
|
else if (nIndex == 2) // 两块板路
|
|
{
|
|
m_dGreenWidth1 = _tstof(m_wndLstRoadData.GetCell(0, 2).GetText());
|
|
m_dGreenGrad1 = _tstof(m_wndLstRoadData.GetCell(0, 3).GetText());
|
|
m_dCarWidth = _tstof(m_wndLstRoadData.GetCell(1, 2).GetText());
|
|
m_dCarGrad = _tstof(m_wndLstRoadData.GetCell(1, 3).GetText());
|
|
m_dMenWidth = _tstof(m_wndLstRoadData.GetCell(2, 2).GetText());
|
|
m_dMenGrad = _tstof(m_wndLstRoadData.GetCell(2, 3).GetText());
|
|
}
|
|
else if (nIndex == 3) // 三块板路
|
|
{
|
|
m_dCarWidth = _tstof(m_wndLstRoadData.GetCell(0, 2).GetText());
|
|
m_dCarGrad = _tstof(m_wndLstRoadData.GetCell(0, 3).GetText());
|
|
m_dGreenWidth1 = _tstof(m_wndLstRoadData.GetCell(1, 2).GetText());
|
|
m_dGreenGrad1 = _tstof(m_wndLstRoadData.GetCell(1, 3).GetText());
|
|
m_dNoCarWidth = _tstof(m_wndLstRoadData.GetCell(2, 2).GetText());
|
|
m_dNoCarGrad = _tstof(m_wndLstRoadData.GetCell(2, 3).GetText());
|
|
m_dMenWidth = _tstof(m_wndLstRoadData.GetCell(3, 2).GetText());
|
|
m_dMenGrad = _tstof(m_wndLstRoadData.GetCell(3, 3).GetText());
|
|
}
|
|
else if (nIndex == 4) // 四块板路
|
|
{
|
|
m_dGreenWidth1 = _tstof(m_wndLstRoadData.GetCell(0, 2).GetText());
|
|
m_dGreenGrad1 = _tstof(m_wndLstRoadData.GetCell(0, 3).GetText());
|
|
m_dCarWidth = _tstof(m_wndLstRoadData.GetCell(1, 2).GetText());
|
|
m_dCarGrad = _tstof(m_wndLstRoadData.GetCell(1, 3).GetText());
|
|
m_dGreenWidth2 = _tstof(m_wndLstRoadData.GetCell(2, 2).GetText());
|
|
m_dGreenGrad2 = _tstof(m_wndLstRoadData.GetCell(2, 3).GetText());
|
|
m_dNoCarWidth = _tstof(m_wndLstRoadData.GetCell(3, 2).GetText());
|
|
m_dNoCarGrad = _tstof(m_wndLstRoadData.GetCell(3, 3).GetText());
|
|
m_dMenWidth = _tstof(m_wndLstRoadData.GetCell(4, 2).GetText());
|
|
m_dMenGrad = _tstof(m_wndLstRoadData.GetCell(4, 3).GetText());
|
|
}
|
|
|
|
CWnd *pWnd = NULL;
|
|
CString strText;
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEX);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_dScaleX = _tstof(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEY);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_dScaleY = _tstof(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_ROADELE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_dRoadEle = _tstof(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT1);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_dHeight1 = _tstof(strText);
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT2);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_dHeight2 = _tstof(strText);
|
|
}
|
|
|
|
m_nRoadType = m_wndCmbType.GetCurSel();
|
|
ReadOrWriteData(false);
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::initLstData()
|
|
{
|
|
int nIndex = m_wndCmbType.GetCurSel();
|
|
CString strCarWidth, strCarGrad, strNoCarWidth, strNoCarGrad, strMenWidth, strMenGrad,
|
|
strGreenWidth1, strGreenGrad1, strGreenWidth2, strGreenGrad2;
|
|
double dGrad = -1.5;
|
|
|
|
UpdateData(TRUE);
|
|
if (m_bWndChkGrad)
|
|
{
|
|
dGrad = 0.0;
|
|
}
|
|
strCarWidth.Format(_T("%.3f"), m_dCarWidth);
|
|
strCarGrad.Format(_T("%.1f"), dGrad);
|
|
strNoCarWidth.Format(_T("%.3f"), m_dNoCarWidth);
|
|
strNoCarGrad.Format(_T("%.1f"), dGrad);
|
|
strMenWidth.Format(_T("%.3f"), m_dMenWidth);
|
|
strMenGrad.Format(_T("%.1f"), dGrad);
|
|
strGreenWidth1.Format(_T("%.3f"), m_dGreenWidth1);
|
|
strGreenGrad1.Format(_T("%.1f"), dGrad);
|
|
strGreenWidth2.Format(_T("%.3f"), m_dGreenWidth1);
|
|
strGreenGrad2.Format(_T("%.1f"), dGrad);
|
|
|
|
|
|
m_wndLstRoadData.Clear();
|
|
if (nIndex == 0) // 简绘道路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
}
|
|
else if (nIndex == 1) // 单块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 2) // 两块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(_T("1.000"));
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 3) // 三块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strGreenWidth1);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("非机动车道"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(strNoCarWidth);
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strNoCarGrad);
|
|
m_wndLstRoadData.GetCell(3, 0).SetText(_T("4"));
|
|
m_wndLstRoadData.GetCell(3, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(3, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(3, 3).SetText(strMenGrad);
|
|
}
|
|
else if (nIndex == 4) // 四块板路
|
|
{
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
m_wndLstRoadData.AppendRow();
|
|
|
|
m_wndLstRoadData.GetCell(0, 0).SetText(_T("1"));
|
|
m_wndLstRoadData.GetCell(0, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(0, 2).SetText(_T("1.000")); ///////////////
|
|
m_wndLstRoadData.GetCell(0, 3).SetText(strGreenGrad1);
|
|
m_wndLstRoadData.GetCell(1, 0).SetText(_T("2"));
|
|
m_wndLstRoadData.GetCell(1, 1).SetText(_T("车行道"));
|
|
m_wndLstRoadData.GetCell(1, 2).SetText(strCarWidth);
|
|
m_wndLstRoadData.GetCell(1, 3).SetText(strCarGrad);
|
|
m_wndLstRoadData.GetCell(2, 0).SetText(_T("3"));
|
|
m_wndLstRoadData.GetCell(2, 1).SetText(_T("绿化带"));
|
|
m_wndLstRoadData.GetCell(2, 2).SetText(_T("1.000"));
|
|
m_wndLstRoadData.GetCell(2, 3).SetText(strGreenGrad2);
|
|
m_wndLstRoadData.GetCell(3, 0).SetText(_T("4"));
|
|
m_wndLstRoadData.GetCell(3, 1).SetText(_T("非机动车道"));
|
|
m_wndLstRoadData.GetCell(3, 2).SetText(strNoCarWidth);
|
|
m_wndLstRoadData.GetCell(3, 3).SetText(strNoCarGrad);
|
|
m_wndLstRoadData.GetCell(4, 0).SetText(_T("5"));
|
|
m_wndLstRoadData.GetCell(4, 1).SetText(_T("人行道"));
|
|
m_wndLstRoadData.GetCell(4, 2).SetText(strMenWidth);
|
|
m_wndLstRoadData.GetCell(4, 3).SetText(strMenGrad);
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnCheckGrad()
|
|
{
|
|
UpdateData(TRUE);
|
|
initLstData();
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnSelchangeCmbType()
|
|
{
|
|
m_wndLstRoadData.Clear();
|
|
initLstData();
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::ReadOrWriteData(bool bVal)
|
|
{
|
|
//CRegProperty regProp(GetRegLocation(), _T("HorzontalSection"));
|
|
//regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
//if (bVal) // 读
|
|
//{
|
|
// if (!regProp.GetValue(_T("dScaleX"), m_dScaleX))
|
|
// {
|
|
// m_dScaleX = 100.0;
|
|
// }
|
|
|
|
// if (!regProp.GetValue(_T("dScaleY"), m_dScaleY))
|
|
// {
|
|
// m_dScaleY = 50.0;
|
|
// }
|
|
|
|
// if (!regProp.GetValue(_T("dRoadEle"), m_dRoadEle))
|
|
// {
|
|
// m_dRoadEle = 0.0;
|
|
// GetMaxEleByPipe(m_dRoadEle);
|
|
// m_dRoadEle += 2.0;
|
|
// }
|
|
|
|
// if (!regProp.GetValue(_T("bGrad"), m_bWndChkGrad))
|
|
// {
|
|
// m_bWndChkGrad = false;
|
|
// }
|
|
//}
|
|
//else // 写
|
|
//{
|
|
// regProp.SetValue(_T("dScaleX"), m_dScaleX);
|
|
// regProp.SetValue(_T("dScaleY"), m_dScaleY);
|
|
// regProp.SetValue(_T("dRoadEle"), m_dRoadEle);
|
|
// regProp.SetValue(_T("bGrad"), m_bWndChkGrad);
|
|
//}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::UpdateImage()
|
|
{
|
|
if (m_pPreviewDb == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
m_PreviewCtrl.clearAll();
|
|
m_PreviewCtrl.init(true);
|
|
AcDbBlockTable* pBlockTab = NULL;
|
|
if (m_pPreviewDb->getSymbolTable(pBlockTab, AcDb::kForWrite) != Acad::eOk)
|
|
return;
|
|
AcDbBlockTableRecord* pBlockTabRecord = new AcDbBlockTableRecord;
|
|
pBlockTabRecord->setName(_T("*U"));
|
|
pBlockTab->add(pBlockTabRecord);
|
|
pBlockTab->close();
|
|
DrawPreviewEntity(pBlockTabRecord, m_pPreviewDb);
|
|
AcDbExtents extents;
|
|
GetRecordExtents(pBlockTabRecord, extents);
|
|
double dWidth = extents.maxPoint().x - extents.minPoint().x;
|
|
double dHigh = extents.maxPoint().y - extents.minPoint().y;
|
|
|
|
AcGePoint3d ptCenter;
|
|
ptCenter.x = extents.minPoint().x + 0.5 * dWidth;
|
|
ptCenter.y = extents.minPoint().y + 0.5 * dHigh;
|
|
AcGePoint3d ptEye(ptCenter.x, ptCenter.y, 1);
|
|
AcGsView* pView = m_PreviewCtrl.view();
|
|
AcGeVector3d vtView = GlobalFunc::Ucs2Wcs(AcGeVector3d::kYAxis);
|
|
pView->setView(ptEye, ptCenter, vtView, 1.1 * dWidth, 1.1 * dHigh);
|
|
pView->add(pBlockTabRecord, m_PreviewCtrl.model());
|
|
pBlockTabRecord->close();
|
|
m_PreviewCtrl.Invalidate();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::GetRecordExtents(AcDbBlockTableRecord *pBlockTabRecord, AcDbExtents &extents)
|
|
{
|
|
AcDbBlockTableRecordIterator *pIterator = NULL;
|
|
if (Acad::eOk != pBlockTabRecord->newIterator(pIterator))
|
|
return;
|
|
|
|
BOOL bInit = TRUE;
|
|
AcGePoint3d ptMin, ptMax;
|
|
for (pIterator->start(); !pIterator->done(); pIterator->step())
|
|
{
|
|
AcDbEntity *pEnt = NULL;
|
|
if (Acad::eOk != pIterator->getEntity(pEnt, AcDb::kForRead))
|
|
continue;
|
|
|
|
AcDbExtents ext;
|
|
if (Acad::eOk == pEnt->getGeomExtents(ext))
|
|
{
|
|
if (bInit)
|
|
{
|
|
ptMin = ext.minPoint();
|
|
ptMax = ext.maxPoint();
|
|
bInit = FALSE;
|
|
}
|
|
else
|
|
{
|
|
ptMin.x = min(ptMin.x, ext.minPoint().x);
|
|
ptMin.y = min(ptMin.y, ext.minPoint().y);
|
|
ptMax.x = max(ptMax.x, ext.maxPoint().x);
|
|
ptMax.y = max(ptMax.y, ext.maxPoint().y);
|
|
}
|
|
}
|
|
pEnt->close();
|
|
}
|
|
delete pIterator;
|
|
extents.set(ptMin, ptMax);
|
|
}
|
|
|
|
void CHorizontalSectionDlg::DrawPreviewEntity(AcDbBlockTableRecord *&pBlockTableRecord, AcDbDatabase* pDb)
|
|
{
|
|
if (m_pSecDraw != NULL && pBlockTableRecord != NULL && pDb != NULL)
|
|
{
|
|
m_pSecDraw->SetDataContainer(&m_mapData);
|
|
//绘制道路线
|
|
AcDbPolyline *pOutLine = NULL;
|
|
AcDbVoidPtrArray arSplitLine, arSubPtr;
|
|
m_pSecDraw->DrawRoadway(pOutLine, arSplitLine, arSubPtr, true);
|
|
if (pOutLine != NULL)
|
|
{
|
|
pOutLine->setColorIndex(1);
|
|
pOutLine->setLayer(InitLayer(_T("TWT_室外"), pDb));
|
|
pBlockTableRecord->appendAcDbEntity(pOutLine);
|
|
pOutLine->close();
|
|
}
|
|
|
|
for (int i = 0; i < arSplitLine.length(); i++)
|
|
{
|
|
AcDbEntity *pEnt = (AcDbEntity *)arSplitLine.at(i);
|
|
if (pEnt != NULL)
|
|
{
|
|
pEnt->setLayer(InitLayer(_T("TWT_室外"), pDb));
|
|
Acad::ErrorStatus es = pBlockTableRecord->appendAcDbEntity(pEnt);
|
|
pEnt->close();
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < arSubPtr.length(); i++)
|
|
{
|
|
AcDbEntity *pEnt = (AcDbEntity *)arSubPtr.at(i);
|
|
if (pEnt != NULL)
|
|
{
|
|
pEnt->setLayer(InitLayer(_T("TWT_室外"), pDb));
|
|
pBlockTableRecord->appendAcDbEntity(pEnt);
|
|
pEnt->close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::UpdateXDataMap()
|
|
{
|
|
UpdateData(TRUE);
|
|
int nIndex = m_wndCmbType.GetCurSel();
|
|
if (nIndex == 0) // 简绘道路
|
|
{
|
|
m_mapData.SetData(_T("CarRoadWidth"), _tstof(m_wndLstRoadData.GetCell(0, 2).GetText()));
|
|
m_mapData.SetData(_T("CarRoadGradient"), _tstof(m_wndLstRoadData.GetCell(0, 3).GetText()));
|
|
}
|
|
else if (nIndex == 1) // 单块板路
|
|
{
|
|
m_mapData.SetData(_T("CarRoadWidth"), _tstof(m_wndLstRoadData.GetCell(0, 2).GetText()));
|
|
m_mapData.SetData(_T("CarRoadGradient"), _tstof(m_wndLstRoadData.GetCell(0, 3).GetText()));
|
|
m_mapData.SetData(_T("MenRoadWidth"), _tstof(m_wndLstRoadData.GetCell(1, 2).GetText()));
|
|
m_mapData.SetData(_T("MenRoadGrad"), _tstof(m_wndLstRoadData.GetCell(1, 3).GetText()));
|
|
}
|
|
else if (nIndex == 2) // 两块板路
|
|
{
|
|
m_mapData.SetData(_T("GreenWidth"), _tstof(m_wndLstRoadData.GetCell(0, 2).GetText()));
|
|
m_mapData.SetData(_T("GreenGrad"), _tstof(m_wndLstRoadData.GetCell(0, 3).GetText()));
|
|
m_mapData.SetData(_T("CarRoadWidth"), _tstof(m_wndLstRoadData.GetCell(1, 2).GetText()));
|
|
m_mapData.SetData(_T("CarRoadGradient"), _tstof(m_wndLstRoadData.GetCell(1, 3).GetText()));
|
|
m_mapData.SetData(_T("MenRoadWidth"), _tstof(m_wndLstRoadData.GetCell(2, 2).GetText()));
|
|
m_mapData.SetData(_T("MenRoadGrad"), _tstof(m_wndLstRoadData.GetCell(2, 3).GetText()));
|
|
}
|
|
else if (nIndex == 3) // 三块板路
|
|
{
|
|
m_mapData.SetData(_T("CarRoadWidth"), _tstof(m_wndLstRoadData.GetCell(0, 2).GetText()));
|
|
m_mapData.SetData(_T("CarRoadGradient"), _tstof(m_wndLstRoadData.GetCell(0, 3).GetText()));
|
|
m_mapData.SetData(_T("GreenWidth"), _tstof(m_wndLstRoadData.GetCell(1, 2).GetText()));
|
|
m_mapData.SetData(_T("GreenGrad"), _tstof(m_wndLstRoadData.GetCell(1, 3).GetText()));
|
|
m_mapData.SetData(_T("NoCarWidth"), _tstof(m_wndLstRoadData.GetCell(2, 2).GetText()));
|
|
m_mapData.SetData(_T("NoCarGrad"), _tstof(m_wndLstRoadData.GetCell(2, 3).GetText()));
|
|
m_mapData.SetData(_T("MenRoadWidth"), _tstof(m_wndLstRoadData.GetCell(3, 2).GetText()));
|
|
m_mapData.SetData(_T("MenRoadGrad"), _tstof(m_wndLstRoadData.GetCell(3, 3).GetText()));
|
|
}
|
|
else if (nIndex == 4) // 四块板路
|
|
{
|
|
m_mapData.SetData(_T("GreenWidth"), _tstof(m_wndLstRoadData.GetCell(0, 2).GetText()));
|
|
m_mapData.SetData(_T("GreenGrad"), _tstof(m_wndLstRoadData.GetCell(0, 3).GetText()));
|
|
m_mapData.SetData(_T("CarRoadWidth"), _tstof(m_wndLstRoadData.GetCell(1, 2).GetText()));
|
|
m_mapData.SetData(_T("CarRoadGradient"), _tstof(m_wndLstRoadData.GetCell(1, 3).GetText()));
|
|
m_mapData.SetData(_T("GreenWidth2"), _tstof(m_wndLstRoadData.GetCell(2, 2).GetText()));
|
|
m_mapData.SetData(_T("GreenGrad2"), _tstof(m_wndLstRoadData.GetCell(2, 3).GetText()));
|
|
m_mapData.SetData(_T("NoCarWidth"), _tstof(m_wndLstRoadData.GetCell(3, 2).GetText()));
|
|
m_mapData.SetData(_T("NoCarGrad"), _tstof(m_wndLstRoadData.GetCell(3, 3).GetText()));
|
|
m_mapData.SetData(_T("MenRoadWidth"), _tstof(m_wndLstRoadData.GetCell(4, 2).GetText()));
|
|
m_mapData.SetData(_T("MenRoadGrad"), _tstof(m_wndLstRoadData.GetCell(4, 3).GetText()));
|
|
}
|
|
|
|
CWnd *pWnd = NULL;
|
|
CString strText;
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEX);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_mapData.SetData(_T("ScaleX"), _tstof(strText));
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_SCALEY);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_mapData.SetData(_T("ScaleY"), _tstof(strText));
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_ROADELE);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_mapData.SetData(_T("RoadEle"), _tstof(strText));
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT1);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_mapData.SetData(_T("SplitHeight"), _tstof(strText));
|
|
}
|
|
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT2);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(strText);
|
|
m_mapData.SetData(_T("MenHeight"), _tstof(strText));
|
|
}
|
|
|
|
m_mapData.SetData(_T("BlockType"), m_wndCmbType.GetCurSel()); // 板块类型
|
|
m_mapData.SetData(_T("Type"), 1); // 道路类型
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this);
|
|
|
|
CWnd* pImageBox = GetDlgItem(IDC_STATIC_PREVIEW);
|
|
if (pImageBox)
|
|
{
|
|
CRect rect;
|
|
pImageBox->GetClientRect(rect);
|
|
|
|
CDC* pDC = pImageBox->GetDC();
|
|
TImageDrawDCEx imgDc;
|
|
imgDc.InitDC(pDC, rect, GlobalFunc::GetAcadBackColor());
|
|
imgDc.Redraw();
|
|
imgDc.SetDC(NULL);
|
|
pImageBox->ReleaseDC(pDC);
|
|
}
|
|
}
|
|
|
|
bool CHorizontalSectionDlg::InitDataContainer()
|
|
{
|
|
// 求剖切线与道路中线的交点
|
|
AcDbEntity *pEnt = NULL;
|
|
acdbOpenObject(pEnt, m_idMidLine, AcDb::kForRead);
|
|
if (pEnt == NULL)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
AcDbArc *pArc = AcDbArc::cast(pEnt);
|
|
AcDbLine *pLine = AcDbLine::cast(pEnt);
|
|
AcDbPolyline *pPoly = AcDbPolyline::cast(pEnt);
|
|
AcGePoint3d ptS = m_ptS, ptE = m_ptE;
|
|
ptS.z = 0.0;
|
|
ptE.z = 0.0;
|
|
AcDbLine line(ptS, ptE);
|
|
AcGePoint3dArray arPt;
|
|
if (pLine != NULL)
|
|
{
|
|
AcGePoint3d pt1, pt2;
|
|
pt1 = pLine->startPoint();
|
|
pt2 = pLine->endPoint();
|
|
pEnt->close();
|
|
|
|
pt1.z = 0.0;
|
|
pt2.z = 0.0;
|
|
AcDbLine line2(pt1, pt2);
|
|
line2.intersectWith(&line, AcDb::kExtendBoth, arPt);
|
|
}
|
|
else if (pArc != NULL)
|
|
{
|
|
double dRadius = pArc->radius();
|
|
double dStartAngle = pArc->startAngle();
|
|
double dEndAngle = pArc->endAngle();
|
|
AcGePoint3d ptCenter = pArc->center();
|
|
pEnt->close();
|
|
|
|
|
|
ptCenter.z = 0.0;
|
|
AcDbArc arc(ptCenter, dRadius, dStartAngle, dEndAngle);
|
|
arc.intersectWith(&line, AcDb::kExtendBoth, arPt);
|
|
|
|
}
|
|
else if (pPoly != NULL)
|
|
{
|
|
AcDbPolyline poly;
|
|
AcGePoint2d pt;
|
|
for (int i = 0; i < pPoly->numVerts(); i++)
|
|
{
|
|
pPoly->getPointAt(i, pt);
|
|
poly.addVertexAt(i, pt);
|
|
}
|
|
pEnt->close();
|
|
poly.intersectWith(&line, AcDb::kExtendBoth, arPt);
|
|
}
|
|
else
|
|
{
|
|
|
|
CString sClassName = pEnt->isA()->name();
|
|
if (sClassName.CompareNoCase(_T("AecDb3dRoad")) == 0)
|
|
{
|
|
AcDbCurve* pRoad = AcDbCurve::cast(pEnt);
|
|
if (pRoad != NULL)
|
|
{
|
|
AcGePoint3d ptSta, ptEnd;
|
|
pRoad->getStartPoint(ptSta);
|
|
pRoad->getEndPoint(ptEnd);
|
|
|
|
double dSta = 0.0, dEnd = 0.0;
|
|
pRoad->getStartParam(dSta);
|
|
pRoad->getEndParam(dEnd);
|
|
|
|
AcGeVector3d vtDir = ptEnd - ptSta;
|
|
vtDir.normalize();
|
|
|
|
AcGePoint3d ptMid;
|
|
pRoad->getPointAtParam((dSta + dEnd) / 2.0, ptMid);
|
|
|
|
AcGeVector3d vtMid = ptMid - ptEnd;
|
|
if (vtMid.isParallelTo(vtDir))//LINE
|
|
{
|
|
ptSta.z = 0.0;
|
|
ptEnd.z = 0.0;
|
|
AcDbLine line2(ptSta, ptEnd);
|
|
line2.intersectWith(&line, AcDb::kExtendBoth, arPt);
|
|
}
|
|
else//ARC
|
|
{
|
|
ptSta.z = 0.0;
|
|
ptEnd.z = 0.0;
|
|
ptMid.z = 0.0;
|
|
|
|
AcDbArc* pArc = FormatArc(ptSta, ptMid, ptEnd);
|
|
if (pArc != NULL)
|
|
{
|
|
pArc->intersectWith(&line, AcDb::kExtendBoth, arPt);
|
|
delete pArc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (arPt.length() != 1)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
arPt[0].z = m_dRoadEle;
|
|
|
|
if (!GlobalFunc::DocGetMeterUnitDraw())
|
|
{
|
|
arPt[0].z = m_dRoadEle * 1000;
|
|
}
|
|
|
|
m_mapData.SetData(_T("CutS"), m_ptS); // 剖切起点
|
|
m_mapData.SetData(_T("CutE"), m_ptE); // 剖切终点
|
|
m_mapData.SetData(_T("vtView"), m_vt); // 剖切方向
|
|
m_mapData.SetData(_T("RoadMidPt"), arPt[0]); // 道路中心点
|
|
|
|
return true;
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnKillfocusEdt()
|
|
{
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::UpdateInfo()
|
|
{
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnChangeEdtHeight1()
|
|
{
|
|
CWnd *pWnd = NULL;
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT1);
|
|
if (pWnd != NULL)
|
|
{
|
|
CString strText;
|
|
pWnd->GetWindowText(strText);
|
|
double dVal = _tstof(strText);
|
|
if (dVal > 5 || dVal < -5)
|
|
{
|
|
pWnd->SetWindowText(m_strHeight1);
|
|
OnKillfocusEdt();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnChangeEdtHeight2()
|
|
{
|
|
CWnd *pWnd = NULL;
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT2);
|
|
if (pWnd != NULL)
|
|
{
|
|
CString strText;
|
|
pWnd->GetWindowText(strText);
|
|
double dVal = _tstof(strText);
|
|
if (dVal > 5 || dVal < -5)
|
|
{
|
|
pWnd->SetWindowText(m_strHeight2);
|
|
OnKillfocusEdt();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnSetfocusEdtHeight1()
|
|
{
|
|
CWnd *pWnd = NULL;
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT1);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(m_strHeight1);
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnSetfocusEdtHeight2()
|
|
{
|
|
CWnd *pWnd = NULL;
|
|
pWnd = GetDlgItem(IDC_EDT_HEIGHT2);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->GetWindowText(m_strHeight2);
|
|
}
|
|
}
|
|
|
|
void CHorizontalSectionDlg::OnStaticPreview()
|
|
{
|
|
UpdateXDataMap();
|
|
UpdateImage();
|
|
}
|
|
|
|
void CHorizontalSectionDlg::GetMaxEleByPipe(double &dMax)
|
|
{
|
|
// 剖切线
|
|
AcGePoint3d pt1 = m_ptS;
|
|
AcGePoint3d pt2 = m_ptE;
|
|
pt1.z = 0.0;
|
|
pt2.z = 0.0;
|
|
AcDbLine line(pt1, pt2);
|
|
|
|
std::vector<AcDbObjectId>::iterator it;
|
|
AcGePoint3d ptS, ptE;
|
|
AcGePoint3dArray arPt;
|
|
for (it = m_vecPipeId.begin(); it != m_vecPipeId.end(); it++)
|
|
{
|
|
// 求管线与剖切线的交点
|
|
CDbPipe *pPipe = NULL;
|
|
AcGePoint3d ptS, ptE;
|
|
acdbOpenObject(pPipe, *it, AcDb::kForRead);
|
|
if (pPipe != NULL)
|
|
{
|
|
pPipe->getStartPoint(ptS);
|
|
pPipe->getEndPoint(ptE);
|
|
pPipe->close();
|
|
}
|
|
else
|
|
{
|
|
continue;
|
|
}
|
|
ptS.z = 0;
|
|
ptE.z = 0;
|
|
|
|
AcDbLine line2(ptS, ptE);
|
|
arPt.setLogicalLength(0);
|
|
line.intersectWith(&line2, AcDb::kOnBothOperands, arPt);
|
|
if (arPt.length() != 1)
|
|
{
|
|
continue;
|
|
}
|
|
XPoint ptIns = arPt[0];
|
|
|
|
// 求交点出管线顶外侧标高
|
|
acdbOpenObject(pPipe, *it, AcDb::kForRead);
|
|
if (pPipe != NULL)
|
|
{
|
|
double dI = pPipe->GetPipeGradient();
|
|
double dn = GlobalFunc::GetPipeOutDByDn(pPipe->GetMaterial(), pPipe->GetDnDiameter()); // 外经
|
|
|
|
if (GlobalFunc::DocGetMeterUnitDraw())
|
|
{
|
|
dn = dn / 1000;
|
|
}
|
|
TPipeSys::FlowDirection dir = pPipe->GetFlowDir();
|
|
XPoint ptWell;
|
|
double dEle = 0.0;
|
|
ptS = pPipe->StartPoint();
|
|
ptE = pPipe->EndPoint();
|
|
if (dir == TPipeSys::kFromStart)
|
|
{
|
|
dEle = pPipe->StartPoint().z + dn / 2;
|
|
ptWell = pPipe->StartPoint();
|
|
}
|
|
else
|
|
{
|
|
dEle = pPipe->EndPoint().z + dn / 2;
|
|
ptWell = pPipe->EndPoint();
|
|
}
|
|
pPipe->close();
|
|
ptWell.z = 0;
|
|
double dDistWell = ads_distance(ptIns, ptWell);
|
|
dEle = dEle - dDistWell * dI;
|
|
|
|
if (dMax < dEle)
|
|
{
|
|
dMax = dEle;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!GlobalFunc::DocGetMeterUnitDraw())
|
|
{
|
|
dMax /= 1000;
|
|
}
|
|
} |