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 "CUIProperty/CUIConfig.h"
#include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h"
#include "CUIProperty/CUIConfig.h"
#include "CUIProperty/CUISigsCenter.h"
#include <QVariant>
#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::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
#define CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H
#include <CFDStructDataManagerBase.h>
#include "CFDStructDataManager_global.h"
#include <CFDStructDataManagerBase.h>
class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase
{
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesItemManager : public CFDStructDataManagerBase {
Q_OBJECT
public:
explicit CFDStructDataSolverSportsAttributesItemManager(QObject *parent = nullptr);
@ -18,6 +16,7 @@ public:
CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
private:
// 生成运动坐标系的界面配置
CUIConfig *genMovingFrameModeUIConfig();
@ -25,6 +24,14 @@ private:
CUIConfig *genRigidBodyModeUIConfig();
signals:
private:
// 运动id
int m_id = 0;
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,14 +53,14 @@ private:
double m_RotationSpeed; // Rotation Speed in rpm
};
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase
{
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverSportsAttributesManager : public CFDStructDataManagerBase {
Q_OBJECT
public:
explicit CFDStructDataSolverSportsAttributesManager(QObject *parent = nullptr);
~CFDStructDataSolverSportsAttributesManager();
CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
private:
// // 生成运动坐标系的界面配置
@ -67,9 +75,6 @@ signals:
private:
QVector<CFDStructDataSolverSportsAttributesItemManager *> m_itemList;
};
#endif // CFDSTRUCTDATASOLVERSPORTSATTRIBUTESMANAGER_H

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

Loading…
Cancel
Save