1、完成运动属性部分的添加item函数

2、运动属性item添加id属性
3、完成运动属性和运动属性item的写入json设置
feature/struct-menu-20241023
mzh 1 week ago
parent e4de1b5d3d
commit 7c61eaef24

@ -1,23 +1,20 @@
#include "CFDStructDataSolverSportsAttributesManager.h"
#include "CFDStructDataSolverTimeModeManager.h" #include "CFDStructDataSolverTimeModeManager.h"
#include "CUIProperty/CUIConfig.h"
#include "CFDStructMain/CFDStructDefine.h" #include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h" #include "CFDStructSigsCenter.h"
#include "CUIProperty/CUIConfig.h"
#include "CUIProperty/CUISigsCenter.h" #include "CUIProperty/CUISigsCenter.h"
#include <QVariant> #include <QVariant>
#include "CFDStructDataSolverSportsAttributesManager.h"
CFDStructDataSolverSportsAttributesItemManager::CFDStructDataSolverSportsAttributesItemManager(QObject *parent) : CFDStructDataManagerBase(parent) CFDStructDataSolverSportsAttributesItemManager::CFDStructDataSolverSportsAttributesItemManager(QObject *parent) : CFDStructDataManagerBase(parent) {
{
m_uiConfig = nullptr; m_uiConfig = nullptr;
} }
CFDStructDataSolverSportsAttributesItemManager::~CFDStructDataSolverSportsAttributesItemManager() CFDStructDataSolverSportsAttributesItemManager::~CFDStructDataSolverSportsAttributesItemManager() {
{
// CFDStructDataManagerBase::~CFDStructDataManagerBase(); // CFDStructDataManagerBase::~CFDStructDataManagerBase();
} }
CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() {
{
if (m_MotionType == 0) if (m_MotionType == 0)
return genMovingFrameModeUIConfig(); return genMovingFrameModeUIConfig();
@ -27,13 +24,16 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig()
return genMovingFrameModeUIConfig(); 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({ return new CUIConfig({
{"type", "Widget"}, {"type", "Widget"},
}, },
@ -102,8 +102,7 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genMovingFrameModeUIC
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUIConfig() CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUIConfig() {
{
return new CUIConfig({ return new CUIConfig({
{"type", "Widget"}, {"type", "Widget"},
}, },
@ -159,25 +158,37 @@ CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUICon
return nullptr; 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); m_itemList.push_back(new CFDStructDataSolverSportsAttributesItemManager);
} }
CFDStructDataSolverSportsAttributesManager::~CFDStructDataSolverSportsAttributesManager() CFDStructDataSolverSportsAttributesManager::~CFDStructDataSolverSportsAttributesManager() {
{
} }
CUIConfig *CFDStructDataSolverSportsAttributesManager::getParamUIConfig() CUIConfig *CFDStructDataSolverSportsAttributesManager::getParamUIConfig() {
{
return m_itemList[0]->getParamUIConfig(); return m_itemList[0]->getParamUIConfig();
return NULL; return NULL;
} }
void CFDStructDataSolverSportsAttributesManager::addNewSportAttributesItem() void CFDStructDataSolverSportsAttributesManager::saveDataToDom(rapidjson::Document &dom) {
{ for (auto item : m_itemList) {
item->saveDataToDom(dom);
}
} }
void CFDStructDataSolverSportsAttributesManager::deleteSportAttributesItem(int index) void CFDStructDataSolverSportsAttributesManager::addNewSportAttributesItem() {
{ CFDStructDataSolverSportsAttributesItemManager *item = new CFDStructDataSolverSportsAttributesItemManager;
item->setId(m_itemList.size());
m_itemList.push_back(item);
}
void CFDStructDataSolverSportsAttributesManager::deleteSportAttributesItem(int index) {
} }

@ -4,13 +4,11 @@
#ifndef CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H #ifndef CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H
#define CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H #define CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H
#include <CFDStructDataManagerBase.h>
#include "CFDStructDataManager_global.h" #include "CFDStructDataManager_global.h"
#include <CFDStructDataManagerBase.h>
class CUIConfig; class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase {
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase
{
Q_OBJECT Q_OBJECT
public: public:
explicit CFDStructDataSolverSportsAttributesItemManager(QObject *parent = nullptr); explicit CFDStructDataSolverSportsAttributesItemManager(QObject *parent = nullptr);
@ -18,6 +16,7 @@ public:
CUIConfig *getParamUIConfig(); CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom); void saveDataToDom(rapidjson::Document &dom);
private: private:
// 生成运动坐标系的界面配置 // 生成运动坐标系的界面配置
CUIConfig *genMovingFrameModeUIConfig(); CUIConfig *genMovingFrameModeUIConfig();
@ -25,6 +24,14 @@ private:
CUIConfig *genRigidBodyModeUIConfig(); CUIConfig *genRigidBodyModeUIConfig();
signals: signals:
private:
// 运动id
int m_id = 0;
public:
void setId(int id);
int getId();
private: private:
// 运动名称 // 运动名称
QString m_MotionName; // Motion Name QString m_MotionName; // Motion Name
@ -33,6 +40,7 @@ private:
int m_MotionType; // Motion Type int m_MotionType; // Motion Type
// 运动方式 // 运动方式
// json中没有对应位置
QString m_MotionMode; // Motion Mode QString m_MotionMode; // Motion Mode
// 转轴原点 // 转轴原点
@ -45,14 +53,14 @@ private:
double m_RotationSpeed; // Rotation Speed in rpm double m_RotationSpeed; // Rotation Speed in rpm
}; };
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase {
{
Q_OBJECT Q_OBJECT
public: public:
explicit CFDStructDataSolverSportsAttributesManager(QObject *parent = nullptr); explicit CFDStructDataSolverSportsAttributesManager(QObject *parent = nullptr);
~CFDStructDataSolverSportsAttributesManager(); ~CFDStructDataSolverSportsAttributesManager();
CUIConfig *getParamUIConfig(); CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
private: private:
// // 生成运动坐标系的界面配置 // // 生成运动坐标系的界面配置
@ -67,9 +75,6 @@ signals:
private: private:
QVector<CFDStructDataSolverSportsAttributesItemManager *> m_itemList; QVector<CFDStructDataSolverSportsAttributesItemManager *> m_itemList;
}; };
#endif // CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H #endif // CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H

@ -43,7 +43,21 @@
"cfl": 1.0, "cfl": 1.0,
"EntropyFixVal": -842150451 "EntropyFixVal": -842150451
} }
},
"motion": [
{
"id": 0,
"meshMotion": {
"name": "",
"MotionType": -842150451,
"rigid": {
"origin": "",
"axial": "",
"speed": -6.2774385622041928e66
}
}
} }
]
} }
], ],
"couplingSolver": { "couplingSolver": {

Loading…
Cancel
Save