110 lines
3.2 KiB
C++
110 lines
3.2 KiB
C++
#pragma once
|
|
#include "resource.h"
|
|
#include <vector>
|
|
#include "XListCtrl.h"
|
|
#include "ParamEquJson.h"
|
|
|
|
class CParaDesignDlg : public CDialog
|
|
{
|
|
DECLARE_DYNAMIC(CParaDesignDlg)
|
|
|
|
typedef CEquJsonObject Object;
|
|
typedef CEquJsonObject::Param Param;
|
|
typedef CEquJsonObject::Params Params;
|
|
typedef JsonObjects Objects;
|
|
|
|
public:
|
|
CParaDesignDlg(LPCTSTR pszType, LPCTSTR pszName, const int &idx = 0, CWnd* pParent = NULL);
|
|
CParaDesignDlg(CEquJsonObject *pObj, CWnd* pParent = NULL);
|
|
virtual ~CParaDesignDlg();
|
|
|
|
enum { IDD = IDD_DLG_PARADESIGN };
|
|
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX);
|
|
virtual BOOL OnInitDialog();
|
|
void initCtrls();
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
afx_msg void OnPaint();
|
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
|
afx_msg void OnBnClickedOk();
|
|
afx_msg void OnBnClickedButton1();
|
|
afx_msg void OnCbnSelchangeType();
|
|
afx_msg void OnBnClickedButton2();
|
|
afx_msg void OnBnClickedButton3();
|
|
afx_msg void OnBnClickedButton4();
|
|
afx_msg LRESULT OnComboSelection(WPARAM, LPARAM);
|
|
afx_msg LRESULT OnEditEnd(WPARAM, LPARAM);
|
|
afx_msg void OnNMClkList1(NMHDR *pNMHDR, LRESULT *pResult);
|
|
void refreshListCtrl(Object &obj);
|
|
|
|
public:
|
|
static void start(LPCTSTR objType, LPCTSTR objName, const int &idx = 0);
|
|
|
|
static AcDbEntity* startForPipeValve(LPCTSTR objType
|
|
, LPCTSTR objName
|
|
, const double &dDN
|
|
, const double &dPN
|
|
, bool &bHasFlange
|
|
, const int &idx = 0
|
|
, const AecDbObjXDataMap *pSrcData = NULL );
|
|
|
|
static AcDbEntity* startForHvacValve(LPCTSTR objType
|
|
, LPCTSTR objName
|
|
, const int &nShape
|
|
, const double &dDN
|
|
, const double &dW
|
|
, const double &dH
|
|
, const double &dFlT // 法兰厚
|
|
, const double &dFlE // 法兰卷边
|
|
, bool &bHasFlange
|
|
, const int &idx = 0 );
|
|
|
|
static void inplace(AcDbObjectId &id);
|
|
static void inplace(AcDbObjectId &id, AcDbObjectIdArray &ar);
|
|
|
|
bool isInplace() { return m_bInplace; }
|
|
bool getParamByKey(LPCTSTR psz, double &v);
|
|
bool getParamByKey(LPCTSTR psz, int &n);
|
|
bool getParamByKey(LPCTSTR psz, CString &v);
|
|
bool getCombolIdx(LPCTSTR psz, int &idx);
|
|
const std::vector<std::pair<CString, CString>>& getBims() { return m_Bims; }
|
|
int getColor();
|
|
CString getEquDesc();
|
|
void modifyParams(const int &idx, LPCTSTR key, LPCTSTR v);
|
|
void modifyParams(const int &idx, std::map<CString, CString> &kv);
|
|
void modifyParams(const std::map<CString, CString> &kv);
|
|
void hideParam(const int &idxObj, LPCTSTR key, const bool &bHide);
|
|
CString getCurrentObjValve(LPCTSTR key);
|
|
CString getObjType() { return m_objType; }
|
|
CString getEquType() { return m_equType; }
|
|
Objects &getObjects() { return m_objs; }
|
|
public:
|
|
std::map<CString, CString> m_datas; // 为所有参数做 k-v 映射,方便绘制实体时查询
|
|
std::vector<std::pair<CString, CString>> m_Bims; // 所有参数打包,创建实体用
|
|
Object *m_pCurObj;
|
|
|
|
private:
|
|
Objects m_objs;
|
|
bool m_bShowPIC;
|
|
bool m_bInplace;
|
|
int m_iFstObj;
|
|
CString m_sErr;
|
|
CString m_equType; // 下拉列表中的设备类型
|
|
CString m_objName; // 对象大类名称
|
|
CString m_objType; // json文件中的对象大类
|
|
std::vector<CStringArray*> m_strArrs; // 缓存,存放XListctrl中combobox的字符串
|
|
|
|
CFont m_fontBtn;
|
|
CFont m_fontList;
|
|
HBITMAP m_hBitmap;
|
|
CXListCtrl m_wndListCtrl;
|
|
CStatic m_wndPIC;
|
|
CButton m_btnShowPIC;
|
|
CButton m_btnAdd;
|
|
CButton m_btnModify;
|
|
CButton m_btnDel;
|
|
CComboBox m_wndComboType;
|
|
};
|