Files
envi-code/SourceCode/Code2026/tg_shs/shs_outdoor/VerticalSectionSettingDlg.cpp
T

247 lines
6.6 KiB
C++
Raw Normal View History

2026-09-28 15:28:50 +08:00
// VerticalSectionSettingDlg.cpp : implementation file
//
#include "stdafx.h"
#include <DbVerticalSection.h>
#include <DbVerticalSectionFeed.h>
#include "twtdef.h"
#include "VerticalSectionSettingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//***************************************************************************************************
// 设置表头
//***************************************************************************************************
void SetVerticalSectionHead()
{
TCHAR szText[256];
BOOL bIsFeedSys = FALSE;
ads_getstring(0, _T("\n设置纵断面图表头1:雨污系统 2:给水系统<雨污系统>:"), szText);
if(_tcsicmp(szText, _T("2")) == 0)
bIsFeedSys = TRUE;
CTemporaryResourceOverride vTemp;
CVerticalSectionSettingDlg dlg;
CRegProperty regProp(GetRegLocation(), _T("TWTConfig"));
regProp.SetTopRootKey(HKEY_CURRENT_USER);
regProp.GetValue(_T("VerticalSectionHead"), g_csVerticalSectionHead);
regProp.GetValue(_T("VerticalSectionHeadFeed"), g_csVerticalSectionHeadFeed);
CString csHead = g_csVerticalSectionHead;
if(bIsFeedSys)
csHead = g_csVerticalSectionHeadFeed;
int idx(1);
while(1){
TCHAR sBuf[256]=_T("");
CT_strnth(csHead, idx, sBuf);
if(_tcsicmp(sBuf, _T("")) == 0)
break;
dlg.m_lstSel.Append(tstrnew(sBuf));
idx++;
}
if(dlg.DoModal() != IDOK)
return;
if(bIsFeedSys)
g_csVerticalSectionHeadFeed = dlg.m_csRet;
else
g_csVerticalSectionHead = dlg.m_csRet;
regProp.SetValue(_T("VerticalSectionHead"), g_csVerticalSectionHead);
regProp.SetValue(_T("VerticalSectionHeadFeed"), g_csVerticalSectionHeadFeed);
}
//***************************************************************************************************
// 修改表头
//***************************************************************************************************
void ModifyVerticalSectionHead()
{
RBList rbMask(RTDXF0, _T("ATS_VERTICALSECTION,ATS_VERTICALSECTION_FEED"), 8, _T("*"), NULL);
Entity ent;
CTemporaryResourceOverride vTemp;
CVerticalSectionSettingDlg dlg;
if(SelectEntity(_T("\n请选择要修改表头的纵断面图<退出>:"), ent, rbMask) != RTNORM)
return;
CString csHead;
if(ent.Is(_T("ATS_VERTICALSECTION")))
{
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbVerticalSection, pVt);
if(pVt){
csHead = pVt->GetSheetHead();
}
OPENOBJ_END();
}
else
{
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbVerticalSectionFeed, pVt);
if(pVt){
csHead = pVt->GetSheetHead();
}
OPENOBJ_END();
}
int idx(1);
while(1){
TCHAR sBuf[256]=_T("");
CT_strnth(csHead, idx, sBuf);
if(_tcsicmp(sBuf, _T("")) == 0)
break;
dlg.m_lstSel.Append(tstrnew(sBuf));
idx++;
}
if(dlg.DoModal() != IDOK)
return;
if(ent.Is(_T("ATS_VERTICALSECTION")))
{
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbVerticalSection, pVt);
if(pVt){
pVt->SetSheetHead(dlg.m_csRet);
}
OPENOBJ_END();
}
else
{
OPENOBJ_BEGIN(ent, AcDb::kForWrite, TDbVerticalSectionFeed, pVt);
if(pVt){
pVt->SetSheetHead(dlg.m_csRet);
}
OPENOBJ_END();
}
}
/////////////////////////////////////////////////////////////////////////////
// CVerticalSectionSettingDlg dialog
CVerticalSectionSettingDlg::CVerticalSectionSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CVerticalSectionSettingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CVerticalSectionSettingDlg)
m_iSelAll = 0;
m_iSelSel = 0;
//}}AFX_DATA_INIT
}
void CVerticalSectionSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVerticalSectionSettingDlg)
DDX_Control(pDX, IDC_LIST_SEL, m_listSel);
DDX_Control(pDX, IDC_LIST_ALL, m_listAll);
DDX_LBIndex(pDX, IDC_LIST_ALL, m_iSelAll);
DDX_LBIndex(pDX, IDC_LIST_SEL, m_iSelSel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVerticalSectionSettingDlg, CDialog)
//{{AFX_MSG_MAP(CVerticalSectionSettingDlg)
ON_BN_CLICKED(IDC_BUT_ADD, OnButAdd)
ON_BN_CLICKED(IDC_BUT_REMOVE, OnButRemove)
ON_BN_CLICKED(IDC_BUTTON_UP, OnButtonUp)
ON_BN_CLICKED(IDC_BUTTON_DOWN, OnButtonDown)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVerticalSectionSettingDlg message handlers
BOOL CVerticalSectionSettingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_lstAll.Append(tstrnew(_T("井编号")));
m_lstAll.Append(tstrnew(_T("自然地面标高(m)")));
m_lstAll.Append(tstrnew(_T("设计地面标高(m)")));
m_lstAll.Append(tstrnew(_T("埋设深度(m)")));
m_lstAll.Append(tstrnew(_T("覆土厚度(m)")));
m_lstAll.Append(tstrnew(_T("管标高(m)")));
m_lstAll.Append(tstrnew(_T("管道基础")));
m_lstAll.Append(tstrnew(_T("管材和接口形式")));
m_lstAll.Append(tstrnew(_T("桩号")));
m_lstAll.Append(tstrnew(_T("管道长度(m)")));
m_lstAll.Append(tstrnew(_T("管径(mm)")));
m_lstAll.Append(tstrnew(_T("管道坡度")));
m_lstAll.Append(tstrnew(_T("管线平面")));
m_lstAll.Append(tstrnew(_T("井径(mm)")));
m_lstAll.Append(tstrnew(_T("备注")));
for(int i=0;i<m_lstAll.Length();i++){
m_listAll.AddString(m_lstAll[i]);
}
ResetList();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CVerticalSectionSettingDlg::ResetList()
{
m_listSel.ResetContent();
for(int i=0;i<m_lstSel.Length();i++){
m_listSel.AddString(m_lstSel[i]);
}
}
void CVerticalSectionSettingDlg::OnButAdd()
{
UpdateData(TRUE);
if(m_iSelAll < 0)
return;
CString csSel = m_lstAll[m_iSelAll];
if(m_lstSel.Index((const TCHAR*)csSel) > -1)
return;
m_lstSel.Append(tstrnew(csSel));
ResetList();
}
void CVerticalSectionSettingDlg::OnButRemove()
{
UpdateData(TRUE);
if(m_iSelSel < 0)
return;
m_lstSel.Remove(m_iSelSel);
ResetList();
}
void CVerticalSectionSettingDlg::OnButtonUp()
{
UpdateData(TRUE);
if(m_iSelSel < 1)
return;
m_lstSel.Swap(m_iSelSel, m_iSelSel-1);
int old = m_iSelSel - 1;
ResetList();
m_iSelSel = old;
UpdateData(FALSE);
}
void CVerticalSectionSettingDlg::OnButtonDown()
{
UpdateData(TRUE);
if(m_iSelSel < 0 || m_iSelSel == m_lstSel.Length()-1)
return;
int old = m_iSelSel + 1;
m_lstSel.Swap(m_iSelSel, m_iSelSel+1);
ResetList();
m_iSelSel = old;
UpdateData(FALSE);
}
void CVerticalSectionSettingDlg::OnOK()
{
UpdateData(TRUE);
for(int i=0;i<m_lstSel.Length();i++){
m_csRet = m_csRet + _T(" ") + m_lstSel[i];
}
CDialog::OnOK();
}