From 7c61eaef24f766cc60f79dd4928fd1111a6123ab Mon Sep 17 00:00:00 2001 From: mzh Date: Thu, 7 Nov 2024 15:02:16 +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=A7=E9=83=A8=E5=88=86=E7=9A=84=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?item=E5=87=BD=E6=95=B0=202=E3=80=81=E8=BF=90=E5=8A=A8=E5=B1=9E?= =?UTF-8?q?=E6=80=A7item=E6=B7=BB=E5=8A=A0id=E5=B1=9E=E6=80=A7=203?= =?UTF-8?q?=E3=80=81=E5=AE=8C=E6=88=90=E8=BF=90=E5=8A=A8=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=92=8C=E8=BF=90=E5=8A=A8=E5=B1=9E=E6=80=A7item=E7=9A=84?= =?UTF-8?q?=E5=86=99=E5=85=A5json=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tructDataSolverSportsAttributesManager.cpp | 61 +++++++++++-------- ...DStructDataSolverSportsAttributesManager.h | 57 +++++++++-------- Resources/case-01.json | 16 ++++- 3 files changed, 82 insertions(+), 52 deletions(-) diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp index 278ac12..d96fc07 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.cpp @@ -1,23 +1,20 @@ +#include "CFDStructDataSolverSportsAttributesManager.h" #include "CFDStructDataSolverTimeModeManager.h" -#include "CUIProperty/CUIConfig.h" #include "CFDStructMain/CFDStructDefine.h" #include "CFDStructSigsCenter.h" +#include "CUIProperty/CUIConfig.h" #include "CUIProperty/CUISigsCenter.h" #include -#include "CFDStructDataSolverSportsAttributesManager.h" -CFDStructDataSolverSportsAttributesItemManager::CFDStructDataSolverSportsAttributesItemManager(QObject *parent) : CFDStructDataManagerBase(parent) -{ +CFDStructDataSolverSportsAttributesItemManager::CFDStructDataSolverSportsAttributesItemManager(QObject *parent) : CFDStructDataManagerBase(parent) { m_uiConfig = nullptr; } -CFDStructDataSolverSportsAttributesItemManager::~CFDStructDataSolverSportsAttributesItemManager() -{ +CFDStructDataSolverSportsAttributesItemManager::~CFDStructDataSolverSportsAttributesItemManager() { // CFDStructDataManagerBase::~CFDStructDataManagerBase(); } -CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() -{ +CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() { if (m_MotionType == 0) return genMovingFrameModeUIConfig(); @@ -27,13 +24,16 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() return genMovingFrameModeUIConfig(); } -void CFDStructDataSolverSportsAttributesItemManager::saveDataToDom(rapidjson::Document &dom) -{ - +void CFDStructDataSolverSportsAttributesItemManager::saveDataToDom(rapidjson::Document &dom) { + jsonAdd(dom, m_id, {"region", 0, "motion", this->getId(), "id"}); + jsonAdd(dom, m_MotionName, {"region", 0, "motion", this->getId(), "meshMotion", "name"}); + jsonAdd(dom, m_MotionType, {"region", 0, "motion", this->getId(), "meshMotion", "MotionType"}); + jsonAdd(dom, m_RotationAxisOrigin, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin"}); + jsonAdd(dom, m_RotationAxisDirection, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial"}); + jsonAdd(dom, m_RotationSpeed, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "speed"}); } -CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genMovingFrameModeUIConfig() -{ +CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genMovingFrameModeUIConfig() { return new CUIConfig({ {"type", "Widget"}, }, @@ -102,8 +102,7 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genMovingFrameModeUIC return nullptr; } -CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUIConfig() -{ +CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUIConfig() { return new CUIConfig({ {"type", "Widget"}, }, @@ -159,25 +158,37 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUICon return nullptr; } -CFDStructDataSolverSportsAttributesManager::CFDStructDataSolverSportsAttributesManager(QObject *parent) -{ +void CFDStructDataSolverSportsAttributesItemManager::setId(int id) { + m_id = id; +} + +int CFDStructDataSolverSportsAttributesItemManager::getId() { + return m_id; +} + +CFDStructDataSolverSportsAttributesManager::CFDStructDataSolverSportsAttributesManager(QObject *parent) { m_itemList.push_back(new CFDStructDataSolverSportsAttributesItemManager); } -CFDStructDataSolverSportsAttributesManager::~CFDStructDataSolverSportsAttributesManager() -{ +CFDStructDataSolverSportsAttributesManager::~CFDStructDataSolverSportsAttributesManager() { } -CUIConfig *CFDStructDataSolverSportsAttributesManager::getParamUIConfig() -{ +CUIConfig *CFDStructDataSolverSportsAttributesManager::getParamUIConfig() { return m_itemList[0]->getParamUIConfig(); return NULL; } -void CFDStructDataSolverSportsAttributesManager::addNewSportAttributesItem() -{ +void CFDStructDataSolverSportsAttributesManager::saveDataToDom(rapidjson::Document &dom) { + for (auto item : m_itemList) { + item->saveDataToDom(dom); + } +} + +void CFDStructDataSolverSportsAttributesManager::addNewSportAttributesItem() { + CFDStructDataSolverSportsAttributesItemManager *item = new CFDStructDataSolverSportsAttributesItemManager; + item->setId(m_itemList.size()); + m_itemList.push_back(item); } -void CFDStructDataSolverSportsAttributesManager::deleteSportAttributesItem(int index) -{ +void CFDStructDataSolverSportsAttributesManager::deleteSportAttributesItem(int index) { } diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h index 14c1693..2668cdd 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverSportsAttributesManager.h @@ -4,28 +4,35 @@ #ifndef CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H #define CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H -#include #include "CFDStructDataManager_global.h" +#include class CUIConfig; - -class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase -{ +class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase { Q_OBJECT -public: + public: explicit CFDStructDataSolverSportsAttributesItemManager(QObject *parent = nullptr); ~CFDStructDataSolverSportsAttributesItemManager(); - CUIConfig* getParamUIConfig(); + CUIConfig *getParamUIConfig(); void saveDataToDom(rapidjson::Document &dom); -private: + + private: // 生成运动坐标系的界面配置 - CUIConfig* genMovingFrameModeUIConfig(); + CUIConfig *genMovingFrameModeUIConfig(); // 生成刚体的界面配置 - CUIConfig* genRigidBodyModeUIConfig(); -signals: + CUIConfig *genRigidBodyModeUIConfig(); + signals: + + private: + // 运动id + int m_id = 0; -private: + public: + void setId(int id); + int getId(); + + private: // 运动名称 QString m_MotionName; // Motion Name @@ -33,6 +40,7 @@ private: int m_MotionType; // Motion Type // 运动方式 + // json中没有对应位置 QString m_MotionMode; // Motion Mode // 转轴原点 @@ -45,31 +53,28 @@ private: double m_RotationSpeed; // Rotation Speed in rpm }; -class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase -{ +class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase { Q_OBJECT -public: + public: explicit CFDStructDataSolverSportsAttributesManager(QObject *parent = nullptr); ~CFDStructDataSolverSportsAttributesManager(); - CUIConfig* getParamUIConfig(); + CUIConfig *getParamUIConfig(); + void saveDataToDom(rapidjson::Document &dom); -private: -// // 生成运动坐标系的界面配置 -// CUIConfig* genMovingFrameModeUIConfig(); -// // 生成刚体的界面配置 -// CUIConfig* genRigidBodyModeUIConfig(); + private: + // // 生成运动坐标系的界面配置 + // CUIConfig* genMovingFrameModeUIConfig(); + // // 生成刚体的界面配置 + // CUIConfig* genRigidBodyModeUIConfig(); virtual void addNewSportAttributesItem(); virtual void deleteSportAttributesItem(int index); -signals: - -private: - QVector m_itemList; - - + signals: + private: + QVector m_itemList; }; #endif // CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H diff --git a/Resources/case-01.json b/Resources/case-01.json index 05bdff9..1793d7e 100644 --- a/Resources/case-01.json +++ b/Resources/case-01.json @@ -43,7 +43,21 @@ "cfl": 1.0, "EntropyFixVal": -842150451 } - } + }, + "motion": [ + { + "id": 0, + "meshMotion": { + "name": "", + "MotionType": -842150451, + "rigid": { + "origin": "", + "axial": "", + "speed": -6.2774385622041928e66 + } + } + } + ] } ], "couplingSolver": {