From de48fffe117c465d1ecdc9464e45ff3c083cdb71 Mon Sep 17 00:00:00 2001 From: mzh Date: Thu, 7 Nov 2024 16:50:06 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=8C=E6=88=90=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E5=B1=9E=E6=80=A7item=EF=BC=8C=E6=95=B0=E6=8D=AE=E4=BB=8Ejson?= =?UTF-8?q?=E4=B8=AD=E8=AF=BB=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tructDataSolverSportsAttributesManager.cpp | 28 +++++++++++++++++++ ...DStructDataSolverSportsAttributesManager.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp index d96fc07..2d70baf 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp @@ -33,6 +33,34 @@ void CFDStructDataSolverSportsAttributesItemManager::saveDataToDom(rapidjson::Do jsonAdd(dom, m_RotationSpeed, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "speed"}); } +void CFDStructDataSolverSportsAttributesItemManager::readDataFromDom(rapidjson::Document &dom) { + QVariant temp; + + // id应该是在读取之前就由manager创建 + // jsonAdd(dom, m_id, {"region", 0, "motion", this->getId(), "id"}); + + jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "name"}); + if (temp != QVariant()) { + m_MotionName = temp.toString(); + } + jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "MotionType"}); + if (temp != QVariant()) { + m_MotionType = temp.toInt(); + } + jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin"}); + if (temp != QVariant()) { + m_RotationAxisOrigin = temp.toString(); + } + jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial"}); + if (temp != QVariant()) { + m_RotationAxisDirection = temp.toString(); + } + jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "speed"}); + if (temp != QVariant()) { + m_RotationSpeed = temp.toDouble(); + } +} + CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genMovingFrameModeUIConfig() { return new CUIConfig({ {"type", "Widget"}, diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h index 2668cdd..c0fb547 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h @@ -17,6 +17,8 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager CUIConfig *getParamUIConfig(); void saveDataToDom(rapidjson::Document &dom); + void readDataFromDom(rapidjson::Document &dom); + private: // 生成运动坐标系的界面配置 CUIConfig *genMovingFrameModeUIConfig();