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.
298 lines
17 KiB
C++
298 lines
17 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_MotionMode, {"region", 0, "motion", this->getId(), "meshMotion", "attrtype"});
|
|
// jsonAdd(dom, m_RotationAxisOrigin, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin"});
|
|
jsonAdd(dom, m_originX, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin", 0});
|
|
jsonAdd(dom, m_originY, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin", 1});
|
|
jsonAdd(dom, m_originZ, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin", 2});
|
|
|
|
jsonAdd(dom, m_axisX, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 0});
|
|
jsonAdd(dom, m_axisY, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 1});
|
|
jsonAdd(dom, m_axisZ, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 2});
|
|
|
|
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", 0});
|
|
if (temp != QVariant()) {
|
|
m_originX = temp.toDouble();
|
|
}
|
|
jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin", 1});
|
|
if (temp != QVariant()) {
|
|
m_originY = temp.toDouble();
|
|
}
|
|
jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "origin", 2});
|
|
if (temp != QVariant()) {
|
|
m_originZ = temp.toDouble();
|
|
}
|
|
jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 0});
|
|
if (temp != QVariant()) {
|
|
m_axisX = temp.toDouble();
|
|
}
|
|
jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 1});
|
|
if (temp != QVariant()) {
|
|
m_axisY = temp.toDouble();
|
|
}
|
|
jsonRead(dom, temp, {"region", 0, "motion", this->getId(), "meshMotion", "rigid", "axial", 2});
|
|
if (temp != QVariant()) {
|
|
m_axisZ = temp.toDouble();
|
|
}
|
|
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", "GroupBox"}, // 转轴原点
|
|
{"name", "Axis origin"},
|
|
{"layout", "QHBoxLayout"},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "X:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_originX},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "Y:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_originY},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "Z:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_originZ},
|
|
}),
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "GroupBox"}, // 转轴方向
|
|
{"name", tr("Axis direction")},
|
|
{"layout", "QHBoxLayout"},
|
|
// {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
|
|
// {"value_origin", QVA_GLOBAL(&m_RotationAxisDirection)},
|
|
},
|
|
{
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "X:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_axisX},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "Y:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_axisY},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "Z:"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", m_axisZ},
|
|
}),
|
|
|
|
}),
|
|
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::readDataFromDom(rapidjson::Document &dom) {
|
|
// TODO
|
|
}
|
|
|
|
void CFDStructDataSolverSportsAttributesManager::addNewSportAttributesItem() {
|
|
CFDStructDataSolverSportsAttributesItemManager *item = new CFDStructDataSolverSportsAttributesItemManager;
|
|
item->setId(m_itemList.size());
|
|
m_itemList.push_back(item);
|
|
}
|
|
|
|
void CFDStructDataSolverSportsAttributesManager::deleteSportAttributesItem(int index) {
|
|
}
|