From 8942dacbc2bfaf8aec6a360671de20b0fbf32273 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 26 三月 2025 13:43:32 +0800
Subject: [PATCH] 1.Equipment属性页对话框,准备用于展示Equipment数据,里面的Glass等。

---
 SourceCode/Bond/Servo/CGlass.cpp |   50 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index e9847f9..a21bd7b 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -5,12 +5,18 @@
 namespace SERVO {
 	CGlass::CGlass()
 	{
-
+		m_pPath = nullptr;
 	}
 
 	CGlass::~CGlass()
 	{
-
+		CPath* pPath = m_pPath;
+		while (pPath != nullptr) {
+			CPath* pTemp = pPath->getNext();
+			delete pPath;
+			pPath = pTemp;
+		}
+		m_pPath = nullptr;
 	}
 
 	std::string& CGlass::getClassName()
@@ -39,18 +45,58 @@
 		return m_strID;
 	}
 
+	CPath* CGlass::getPathWithSiteID(unsigned int nSiteId)
+	{
+		CPath* pPath = m_pPath;
+		while (pPath != nullptr) {
+			if (nSiteId == pPath->getSiteID()) {
+				return pPath;
+			}
+			pPath = pPath->getNext();
+		}
+
+		return nullptr;
+	}
+
+	CPath* CGlass::getPath()
+	{
+		return m_pPath;
+	}
+
+	void CGlass::addPath(unsigned int nSiteId)
+	{
+		CPath* pPath = new CPath(nSiteId);
+		if (m_pPath == nullptr) {
+			m_pPath = pPath;
+		}
+		else {
+			m_pPath->addPath(pPath);
+		}
+	}
+
 	void CGlass::serialize(CArchive& ar)
 	{
 		if (ar.IsStoring())
 		{
 			Lock();
 			WriteString(ar, m_strID);
+			ar << (ULONGLONG)m_pPath;
+			if (m_pPath != nullptr) {
+				m_pPath->serialize(ar);
+			}
 			Unlock();
 		}
 		else
 		{
 			Lock();
 			ReadString(ar, m_strID);
+			ULONGLONG ullPath;
+			ar >> ullPath;
+			if (ullPath != 0) {
+				m_pPath = new CPath();
+				m_pPath->serialize(ar);
+			}
+
 			Unlock();
 		}
 	}

--
Gitblit v1.9.3