199 lines
4.3 KiB
C++
199 lines
4.3 KiB
C++
#ifndef __OPENING_LABEL_DATA_H
|
||||
|
|
#define __OPENING_LABEL_DATA_H
|
|||
|
|
|
|||
|
|
|
|||
|
|
// Key、Value结构体
|
|||
|
|
struct TARCH_EXP SOpeningLabelPair
|
|||
|
|
{
|
|||
|
|
SOpeningLabelPair() {
|
|||
|
|
sPurpose = _T("");
|
|||
|
|
sSerialNum = _T("");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
SOpeningLabelPair(const CString &_sType, const CString &_sSerialNum) {
|
|||
|
|
sPurpose = _sType;
|
|||
|
|
sSerialNum = _sSerialNum;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CString sPurpose; // 用途
|
|||
|
|
CString sSerialNum; // 编号
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
typedef CArray<SOpeningLabelPair, SOpeningLabelPair&> ArLabelPair;
|
|||
|
|
|
|||
|
|
// Section和内容
|
|||
|
|
struct TARCH_EXP SOpeningLabelGroup
|
|||
|
|
{
|
|||
|
|
SOpeningLabelGroup() {
|
|||
|
|
sLabel = _T("");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
CString sLabel; // 标签,Sort,Door,DoorWin......
|
|||
|
|
ArLabelPair arLabelPair; // 内容
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
typedef CArray<SOpeningLabelGroup*, SOpeningLabelGroup*&> ArLabelData;
|
|||
|
|
|
|||
|
|
// 数据表
|
|||
|
|
// 关联文件的格式,以及各种数据的转化
|
|||
|
|
class TARCH_EXP TLabelSetDataTable
|
|||
|
|
{
|
|||
|
|
friend class TOpeningLabelData;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
TLabelSetDataTable () {}
|
|||
|
|
~TLabelSetDataTable() {Clear();}
|
|||
|
|
|
|||
|
|
enum ESerialRule {
|
|||
|
|
eAccordSize = 0,
|
|||
|
|
eAccordNum = 1};
|
|||
|
|
|
|||
|
|
enum ECalWidthRule {
|
|||
|
|
eWallInboard = 0,
|
|||
|
|
eWallMiddle = 1,
|
|||
|
|
eWallOutboard = 2};
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
// 用等号对字符串执行拆分,并且去除空格,TAB
|
|||
|
|
static BOOL Split(const CString &sOri, CString &sLeft, CString &sRight);
|
|||
|
|
|
|||
|
|
void AddLabel(SOpeningLabelGroup *pLabel);
|
|||
|
|
void Clear();
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
BOOL SetHyphenRule(const CString &sHyphen);
|
|||
|
|
BOOL GetHyphenRule() const {
|
|||
|
|
return m_bHyphen;
|
|||
|
|
}
|
|||
|
|
void SetHyphenRuleDirect(BOOL bTrue){
|
|||
|
|
m_bHyphen = bTrue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BOOL SetSerialRule(const CString &sRule);
|
|||
|
|
ESerialRule GetSerialRule() const {
|
|||
|
|
return m_eSerialRule;
|
|||
|
|
}
|
|||
|
|
void SetSerialRuleDirect(ESerialRule eRule) {
|
|||
|
|
m_eSerialRule = eRule;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BOOL SetRoundRule(const CString &sRound);
|
|||
|
|
BOOL GetRoundRule() const {
|
|||
|
|
return m_bTgRound;
|
|||
|
|
}
|
|||
|
|
void SetRoundRuleDirect(BOOL bTrue){
|
|||
|
|
m_bTgRound = bTrue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
BOOL SetCalWidthRule(const CString &sRule);
|
|||
|
|
ECalWidthRule GetCalWidthRule() const {
|
|||
|
|
return m_eCalWidthRule;
|
|||
|
|
}
|
|||
|
|
void SetCalWidthDirect(ECalWidthRule eRule) {
|
|||
|
|
m_eCalWidthRule = eRule;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ArLabelData& GetLableData() {
|
|||
|
|
return m_arLabelData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
// label=>SLabelGroup
|
|||
|
|
SOpeningLabelGroup *GetLabelContent(const CString &sLabel) const;
|
|||
|
|
|
|||
|
|
// 把dataTable中的数据拷贝到自己这里
|
|||
|
|
void CopyFrom(const TLabelSetDataTable& dataTable);
|
|||
|
|
|
|||
|
|
// 覆盖对应label中对应的数据
|
|||
|
|
void CoverLabelData(const CString &sLabel, const ArLabelPair &arLabelPair);
|
|||
|
|
|
|||
|
|
// 获取对应label中的数据
|
|||
|
|
void GetLabelData(const CString &sLabel, ArLabelPair &arLabelPair) const;
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
int Read(const CString &sFile);
|
|||
|
|
void Write(const CString &sFile) const;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
ArLabelData m_arLabelData; // 当前所读取的编号
|
|||
|
|
ESerialRule m_eSerialRule; // 编号规则
|
|||
|
|
BOOL m_bHyphen; // 连字符
|
|||
|
|
BOOL m_bReaded;
|
|||
|
|
BOOL m_bTgRound; // 四舍五入
|
|||
|
|
ECalWidthRule m_eCalWidthRule; // 窗宽计算位置
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 门窗编号配置文件OpeningLabel.ini的读写程序
|
|||
|
|
class TARCH_EXP TOpeningLabelData
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
TOpeningLabelData();
|
|||
|
|
~TOpeningLabelData();
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
enum ESerialRule {
|
|||
|
|
kSize = 0,
|
|||
|
|
kNum = 1,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
enum ECalWidthRule {
|
|||
|
|
kInboard = 0,
|
|||
|
|
kMiddle = 1,
|
|||
|
|
kOutboard = 2};
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
CString m_csPrompt; // 错误提示信息,正确情况下为空
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
CString m_sFileName; // 文件名
|
|||
|
|
TLabelSetDataTable m_allDatas; // 内容
|
|||
|
|
|
|||
|
|
|
|||
|
|
public: // 提供下列公有接口
|
|||
|
|
// 获得所有标签名称(不包括Sort)
|
|||
|
|
bool GetLabelArray(CStringArray &arLabel) const;
|
|||
|
|
|
|||
|
|
// 根据给出的标签名称,获得子类型(即:用途,KEY)
|
|||
|
|
bool GetSubType(const CString &csKind, CStringArray &arSubType) const;
|
|||
|
|
|
|||
|
|
// 根据给出的标签名称,获得子类型的编号(VAULE)
|
|||
|
|
bool GetSubLabelPrefix(const CString &csKind, CStringArray &arLabelPrefix) const;
|
|||
|
|
|
|||
|
|
// 获得是否添加连字符
|
|||
|
|
bool HasHypen() const;
|
|||
|
|
|
|||
|
|
// 获得编号原则,按尺寸或者按数序
|
|||
|
|
ESerialRule GetNumRule();
|
|||
|
|
|
|||
|
|
// 获得是否四舍五入
|
|||
|
|
bool IsRound() const;
|
|||
|
|
|
|||
|
|
// 获得窗宽计算位置的原则
|
|||
|
|
ECalWidthRule GetCalWidthRule();
|
|||
|
|
|
|||
|
|
// 获得一个具体的标注值
|
|||
|
|
bool GetOpeningLabel(const CString &csKind, const CString &csSubKind, CString &csLabel);
|
|||
|
|
|
|||
|
|
// 根据编号,获得大类型(即:标签)和子类型(即:用途)
|
|||
|
|
void GetTypeByLabel(const CString &csPrefix, CStringArray &arCsLabel, CStringArray &ArCsSubType);
|
|||
|
|
|
|||
|
|
// 获得所有类型,按顺序输出
|
|||
|
|
bool GetAllOpeningType(CStringArray &aryAllSubType);
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
// 由门窗类型名返回对应的label标记
|
|||
|
|
static CString TypeToLabel(const CString &sType);
|
|||
|
|
static int GetLabelIndex(const CString &sLabel);
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
// 控制读写
|
|||
|
|
BOOL Read(TLabelSetDataTable &dataTable);
|
|||
|
|
BOOL Write(const TLabelSetDataTable &dataTable) const;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif
|