You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
223 lines
11 KiB
C++
223 lines
11 KiB
C++
#include "CFDStructDataSolverSportsAttributesManager.h"
|
|
#include "CFDStructDataSolverTimeModeManager.h"
|
|
#include "CFDStructMain/CFDStructDefine.h"
|
|
#include "CFDStructSigsCenter.h"
|
|
#include "CUIProperty/CUIConfig.h"
|
|
#include "CUIProperty/CUISigsCenter.h"
|
|
#include <QVariant>
|
|
|
|
CFDStructDataSolverSportsAttributesItemManager::CFDStructDataSolverSportsAttributesItemManager(QObject *parent) : CFDStructDataManagerBase(parent) {
|
|
m_uiConfig = nullptr;
|
|
}
|
|
|
|
CFDStructDataSolverSportsAttributesItemManager::~CFDStructDataSolverSportsAttributesItemManager() {
|
|
// CFDStructDataManagerBase::~CFDStructDataManagerBase();
|
|
}
|
|
|
|
CUIConfig *CFDStructDataSolverSportsAttributesItemManager::getParamUIConfig() {
|
|
|
|
if (m_MotionType == 0)
|
|
return genMovingFrameModeUIConfig();
|
|
if (m_MotionType == 1)
|
|
return genRigidBodyModeUIConfig();
|
|
|
|
return genMovingFrameModeUIConfig();
|
|
}
|
|
|
|
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"});
|
|
}
|
|
|
|
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"},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 运动名称
|
|
{"name", tr("Sports name")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_MotionName)},
|
|
},
|
|
{}),
|
|
new CUIConfig({
|
|
{"type", "ComboBox"}, // 运动类型
|
|
{"name", tr("Sports type")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_MotionType)},
|
|
{"semaphore", (int)SolutionAnalysisModuleProperty::Motion_Properties},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "Item"}, // 运动坐标系
|
|
{"name", tr("Moving Frame")},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "Item"}, // 刚体
|
|
{"name", tr("RigidBody")},
|
|
}),
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "GroupBox"}, // 运动特征
|
|
{"name", tr("Sports characteristics")},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 运动方式
|
|
{"name", tr("Sports Style")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_MotionMode)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 转轴原点
|
|
{"name", tr("Axis origin")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_RotationAxisOrigin)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 转轴方向
|
|
{"name", tr("Axis direction")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_RotationAxisDirection)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 转速
|
|
{"name", tr("speed")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_RotationSpeed)},
|
|
}),
|
|
}),
|
|
// TODO
|
|
new CUIConfig({
|
|
{"type", "List"}, // 域列表
|
|
{"name", tr("Domain List")},
|
|
},
|
|
{}),
|
|
});
|
|
return nullptr;
|
|
}
|
|
|
|
CUIConfig *CFDStructDataSolverSportsAttributesItemManager::genRigidBodyModeUIConfig() {
|
|
return new CUIConfig({
|
|
{"type", "Widget"},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 运动名称
|
|
{"name", tr("Sports name")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
{"value_origin", QVA_GLOBAL(&m_MotionName)},
|
|
|
|
},
|
|
{}),
|
|
new CUIConfig({
|
|
{"type", "ComboBox"}, // 运动类型
|
|
{"name", tr("Sports type")},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_MotionType)},
|
|
{"semaphore", (int)SolutionAnalysisModuleProperty::Motion_Properties},
|
|
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "Item"}, // 运动坐标系
|
|
{"name", tr("Moving Frame")},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "Item"}, // 刚体
|
|
{"name", tr("RigidBody")},
|
|
}),
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "GroupBox"}, // 用户自定义
|
|
{"name", tr("User defined")},
|
|
},
|
|
{
|
|
// TODO
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 打开文件
|
|
{"name", tr("Open file")},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"}, // 函数名称
|
|
{"name", tr("Function Name")},
|
|
}),
|
|
}),
|
|
// TODO
|
|
new CUIConfig({
|
|
{"type", "List"}, // 域列表
|
|
{"name", tr("Domain List")},
|
|
},
|
|
{}),
|
|
});
|
|
return nullptr;
|
|
}
|
|
|
|
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() {
|
|
}
|
|
|
|
CUIConfig *CFDStructDataSolverSportsAttributesManager::getParamUIConfig() {
|
|
return m_itemList[0]->getParamUIConfig();
|
|
return NULL;
|
|
}
|
|
|
|
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) {
|
|
}
|