Files
envi-code/SourceCode/Code2026/ThunderProof/FoldLayPinDlg.h
T
2026-09-28 15:28:50 +08:00

259 lines
6.3 KiB
C++

#ifndef AFX_CFOLDLAYPINDLG_H_
#define AFX_CFOLDLAYPINDLG_H_
#if _MSC_VER > 1000
#pragma once
#endif //_MSC_VER > 1000
#include "resource.h"
#include "afxwin.h"
#include "ThunderXData.h"
#include "DrawThunder2D.h"
#include "ThunderDbReactor.h"
#include "FoldPinRelation.h"
#include "UIIListCtrl.h"
#define GRADENUM 4
#define COLWIDTH 60
#define SPNMIN 1
#define SPNMAX 1000
#define ERR_VALUE 256
// CFoldLayPinDlg 对话框
class CFoldLayPinDlg : public CDialog
{
DECLARE_DYNAMIC(CFoldLayPinDlg)
public:
// 构造
CFoldLayPinDlg(const AcDbObjectId& entId = AcDbObjectId::kNull,BOOL bIsModel = FALSE,CWnd* pParent = NULL);
virtual ~CFoldLayPinDlg();
enum UpdateStyle
{
UpdateNone = 0, // 不做更新
UpdateAllTH = 1, // 更新所有字高
UpdateCurTH = 2, // 更新当前字高
UpdateAllSc = 3, // 更新所有图块系数
UpdateCurSc = 4, // 更新当前图块系数
UpdateAllTHAndSc = 5, // 更新所有 字高 和 图块系数
UpdateCurTHAndSc = 6, // 更新当前字高 和 图块系数
};
// 对话框数据
//{{AFX_DATA(CFoldLayPinDlg)
enum { IDD = IDD_FOLD_LAYPIN };
CButton m_wndRadShowType; //2D 2D类型切换
CEdit m_edtProHt;
CString m_csRadius; // "滚球"半径 ? "折线"
CString m_csGroupNo; // 组号
CSpinButtonCtrl m_wndSpnGroupNo; // 组号微调控件
CButton m_wndBtnGroupExp; //?? 组号解释
CEdit m_wndEdtNumber; // 编号控件
CSpinButtonCtrl m_wndSpnNumber; // 编号微调控件
CString m_csTxtHight; // 编号字高
CSpinButtonCtrl m_wndSpnHT; // 编号字高微调控件
CString m_csBlkScale; // 图块系数
CString m_csPinHeight; // 针高
CEdit m_wndEdtHeight; // 针高控件
CButton m_wndBtnTipExp; // 针高解释
CUIIListCtrl m_LstData; // 保护高度表格控件
CButton m_wndBtnUpdate; // 更新
CButton m_wndBtnCancel; // 取消
CStatic m_wndStcNumCue; // 静态文本控件
UpdateStyle m_eUs; // 类型更新
CButton m_wndChkHillSile; // 支持山地坡地计算 2012/3/21
//}}AFX_DATA
// 重写
//{{AFX_VIRTUAL(CFoldLayPinDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
protected:
// 消息映射
//{{AFX_MSG(CFoldLayPinDlg)
virtual BOOL OnInitDialog();
afx_msg void OnClose();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnBtnUpdate();
afx_msg void OnBtnCancel();
afx_msg void OnChangeEditNum();
afx_msg void OnLayer2d();
afx_msg void OnLayer3d();
afx_msg void OnThunderHeightTip();
afx_msg void OnDestroy();
afx_msg void OnChangeGroupNo();
afx_msg void OnGroupExplain();
LONG_PTR OnAcadKeepFocus(UINT_PTR, LONG_PTR);
afx_msg void OnBnClickedChkHillHillside();
afx_msg void OnAddHeight();
afx_msg void OnRemoveHeight();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
// 对话框的非模式形式
BOOL DoModeless();
// 添加扩展数据
BOOL SetCurrentExData(const AcDbObjectId& idEnt);
// 读取扩展数据
BOOL GetCurrentExData(const AcDbObjectId& idEnt);
// 插入避雷针
BOOL InsertFoldThunder(AcDbObjectId& idEnt,const AcGePoint3d& ptIns);
// 设置绘画指针
void SetThunderDraw2d(CDrawThunderTools* pThundDraw);
// 更新字体高度 和 图块系数
void UpdateTHAndBkSc(UpdateStyle us);
// 得到所有避雷针图块
void GetAllInsert(AcDbObjectIdArray& arcId);
// 得到指定块参照的属性字的内容
void GetBlkAttrText(AcDbObjectId oid,LPCTSTR pszTag,CString& strBlkTest);
// 得到指定块参照的属性字的插入点
void GetBlkAttrPos(AcDbObjectId oid,LPCTSTR pszTag,AcGePoint3d& ptPos);
// 更新指定避雷器的字体高度 如果 IsUpdataAll 为 TRUE 更新全部,为 FALSE 更新当前
void UpdateTextHeight(BOOL IsUpdataAll = TRUE);
// 修改扩展数据-字体高度
void ModifyTHChanged(const AcDbObjectIdArray& arcId);
// 修改扩展数据- 图块系数
void ModifyBlkScaleChanged(const AcDbObjectIdArray& arcId);
// 更新指定避雷器缩放比例 如果 IsUpdataAll 为 TRUE 更新全部,为 FALSE 更新当前
void UpdateBlkScale(BOOL IsUpdataAll = TRUE);
// 设置指定块参照,指定Tag 的属性字 位置
Acad::ErrorStatus SetAttrPos(AcDbBlockReference* pRef,LPCTSTR pszTag,const AcGePoint3d& pt);
void UpdateThunderByProtectHeight();
double GetThunderHeight() const;
// 是否响应动态更新
BOOL IsDynamicUpdate() const;
//读写设置
void UpdateDlgData(BOOL ReadOrWrite);
// 获取数据
BOOL GetDlgData(BOOL bIsUpdate = FALSE);
//高亮保护圆
void HighlightSubEnt(double dProheight);
void UnHighlightSubEnt();
void SetDbReactorPtr(CThunderDbReactor* pRector);
void GetThunderProHeight(AcGeDoubleArray& arPro);
double GetThunderRadius() const;
void GetCurrentData(CStringArray& arData);
void SetBlkName(const CString& sBlkName);
//获取图块系数
double GetBlkScale();
//获取组号
CString GetGroupNo();
//获取编号
CString GetNo();
void SetNo(LPCTSTR pszNo);
//获取针高
CString GetPinHeight();
//获取字高
double GetTextHeight();
//获取保护高度
void GetDlgProHT(AcGeDoubleArray& arProHTs);
private:
// 初始化模式对话框
void InitModalDlg();
// 初始化非模式对话框
void InitModalessDlg();
// 显示或隐藏控件
void DisplayOrHideBtn(BOOL bIsHide = FALSE);
// 编号错误提示
void PostErrorToCue(CString& strError);
// 将圆和避雷针生成组并添加到有名对象字典的组字典中
AcDbObjectId AddCurGroup(const AcDbObjectIdArray& arIds, LPCTSTR pszGroupName);
// 避雷针保护高度
BOOL GetProtectHeightFromReg(CStringArray& arProHeight);
BOOL SetProtectHeightToReg(const CStringArray& arProHeight);
BOOL GetProtectHeightFromObj(const AcDbObjectId& idThunder, CStringArray& arProHeight);
BOOL SetProtectHeightToObj(LPCTSTR pszGNo, const CStringArray& arProHeight);
BOOL SplitValue(LPCTSTR pszSrc, LPCTSTR pszSplitCh, CStringArray& arValue);
BOOL SplitString(CString& sSrc, LPCTSTR pszSplitCh, CString& sValue);
CString ConvertToCString(const CStringArray& arValue, LPCTSTR pszSplitCh);
CString TrimDoubleString(LPCTSTR pszSrc);
BOOL AssertProtectHeight(BOOL bBoxTip = TRUE);
AcGePoint3d GetThunderInsertPosition(const AcDbObjectId& id);
void SaveDlgData();
void ReadDlgData();
private:
AcDbObjectId m_idThunder; // 避雷针ID
BOOL m_bIsModel; // 模式显示或者非模式显示
BOOL m_bTipChange; // 提示内容是否改变,用于更改字体颜色
BOOL m_bValid;
CDrawThunderTools* m_pDrawThunder;
CThunderDbReactor* m_pReactor;
CStringArray m_arsXData; // 扩展数据
AcGeDoubleArray m_arProHeight; // 保护高度
CBitmap m_bitTip;
AcDbObjectIdArray m_arHlEnt; // 用于高亮显示实体
CString m_sBlkName; //避雷针图块名称
};
#endif // AFX_CFOLDLAYPINDLG_H_