修复组件无法赋材料的bug
parent
402a1ce747
commit
d59a9d1885
|
@ -44,16 +44,16 @@ endif()
|
|||
#-----------------------------------------------------------------------------
|
||||
# 测试环境定义(如果在支持cmake系统的IDE中编写代码,可以打开以下注释,并将路径修改为自己的Qt路径)
|
||||
#-----------------------------------------------------------------------------
|
||||
#[[set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
if (NOT DEFINED Qt5_DIR)
|
||||
if(FASTCAE_LINUX)
|
||||
set(Qt5_DIR "/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
elseif(FASTCAE_WIN)
|
||||
set(Qt5_DIR "D:/software/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
set(Qt5_DIR "D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()]]
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 编译选项设置
|
||||
|
|
|
@ -64,10 +64,6 @@ enum TreeItemType
|
|||
ProjectSimulationSettingGrandSon, ///< 仿真参数设置孙子节点
|
||||
ProjectGeometry, ///< 几何根节点
|
||||
ProjectGeometryChild, ///< 几何子节点
|
||||
|
||||
ProjectEleProperty,
|
||||
ProjectElePropertyChild,
|
||||
|
||||
ProjectComponent, ///< 工程组件节点
|
||||
ProjectComponentChild, ///< 工程组件子节点
|
||||
ProjectBoundaryCondation, ///< 工程边界条件节点
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#include "elementProperty.h"
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
int ElementProperty::MaxID = 0;
|
||||
|
||||
ElementProperty::ElementProperty()
|
||||
{
|
||||
this->setID(++MaxID);
|
||||
}
|
||||
void ElementProperty::setEleType(QString s)
|
||||
{
|
||||
_eletype = s;
|
||||
this->appendProperty("Type", s);
|
||||
}
|
||||
QString ElementProperty::getEleType()
|
||||
{
|
||||
return _eletype;
|
||||
}
|
||||
|
||||
void ElementProperty::setMaterialID(int id)
|
||||
{
|
||||
_materialID = id;
|
||||
this->appendProperty("Material", id);
|
||||
}
|
||||
|
||||
int ElementProperty::getMaterialID()
|
||||
{
|
||||
return _materialID;
|
||||
}
|
||||
|
||||
int ElementProperty::getMaxID()
|
||||
{
|
||||
return MaxID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef __ELEMENTPROPERTY_H__
|
||||
#define __ELEMENTPROPERTY_H__
|
||||
|
||||
#include "modelDataAPI.h"
|
||||
#include "DataProperty/DataBase.h"
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
class MODELDATAAPI ElementProperty : public DataProperty::DataBase
|
||||
{
|
||||
public:
|
||||
ElementProperty();
|
||||
~ElementProperty() = default;
|
||||
|
||||
void setEleType(QString s);
|
||||
QString getEleType();
|
||||
|
||||
void setMaterialID(int id);
|
||||
int getMaterialID();
|
||||
|
||||
static int getMaxID();
|
||||
|
||||
private:
|
||||
QString _eletype{};
|
||||
int _materialID{ -1 };
|
||||
|
||||
static int MaxID;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -43,7 +43,6 @@
|
|||
#include <assert.h>
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "elementProperty.h"
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
|
@ -67,9 +66,6 @@ namespace ModelData
|
|||
delete bc;
|
||||
}
|
||||
_bcList.clear();
|
||||
for (auto p : _elePropList)
|
||||
delete p;
|
||||
_elePropList.clear();
|
||||
}
|
||||
|
||||
void ModelDataBase::resetMaxID()
|
||||
|
@ -601,43 +597,6 @@ namespace ModelData
|
|||
return ids;
|
||||
}
|
||||
|
||||
void ModelDataBase::appendEleProperty(ElementProperty *p)
|
||||
{
|
||||
if (p != nullptr)
|
||||
_elePropList.append(p);
|
||||
}
|
||||
|
||||
int ModelDataBase::getElePropCount()
|
||||
{
|
||||
return _elePropList.size();
|
||||
}
|
||||
|
||||
ElementProperty *ModelDataBase::getElePropertyAt(int index)
|
||||
{
|
||||
if (index < 0 || index >= _elePropList.size())
|
||||
return nullptr;
|
||||
return _elePropList.at(index);
|
||||
}
|
||||
|
||||
ElementProperty *ModelDataBase::getElePropertyByID(int id)
|
||||
{
|
||||
for (auto p : _elePropList)
|
||||
{
|
||||
if (id == p->getID())
|
||||
return p;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ModelDataBase::removeElePropAt(int index)
|
||||
{
|
||||
if (index < 0 || index >= _elePropList.size())
|
||||
return;
|
||||
auto m = _elePropList.at(index);
|
||||
_elePropList.removeOne(m);
|
||||
delete m;
|
||||
}
|
||||
|
||||
void ModelDataBase::generateParaInfo()
|
||||
{
|
||||
_solverSetting->generateParaInfo();
|
||||
|
|
|
@ -120,17 +120,6 @@ namespace ModelData
|
|||
//设置需要关联的几何组件ID
|
||||
//void setGeoComponentIDList(QList<int> ids);
|
||||
|
||||
void appendEleProperty(ElementProperty* p);
|
||||
|
||||
int getElePropCount();
|
||||
|
||||
ElementProperty* getElePropertyAt(int index);
|
||||
|
||||
ElementProperty* getElePropertyByID(int id);
|
||||
|
||||
void removeElePropAt(int index);
|
||||
|
||||
|
||||
//移除第index个组件
|
||||
virtual void removeComponentAt(int index);
|
||||
//获取关联的Kernal ID
|
||||
|
|
|
@ -81,22 +81,22 @@ namespace ModelData
|
|||
QDomElement& ModelDataBaseExtend::writeToProjectFile(QDomDocument* doc, QDomElement* e)
|
||||
{
|
||||
QDomElement element = ModelDataBase::writeToProjectFile(doc, e);
|
||||
QDomElement propele = doc->createElement("Property");
|
||||
QList<int> setidlist = _setProperty.keys();
|
||||
QDomElement materialele = doc->createElement("Material");
|
||||
QList<int> setidlist = _setMaterial.keys();
|
||||
for (int i = 0; i < setidlist.size(); ++i)
|
||||
{
|
||||
int setid = setidlist.at(i);
|
||||
int propid = _setProperty.value(setid);
|
||||
QDomElement mc = doc->createElement("PropInfo");
|
||||
int materialid = _setMaterial.value(setid);
|
||||
QDomElement mc = doc->createElement("MaterialInfo");
|
||||
QDomAttr setattr = doc->createAttribute("ComponentID");
|
||||
QDomAttr propattr = doc->createAttribute("PropID");
|
||||
QDomAttr materialattr = doc->createAttribute("MaterialID");
|
||||
setattr.setValue(QString::number(setid));
|
||||
propattr.setValue(QString::number(propid));
|
||||
materialattr.setValue(QString::number(materialid));
|
||||
mc.setAttributeNode(setattr);
|
||||
mc.setAttributeNode(propattr);
|
||||
propele.appendChild(mc);
|
||||
mc.setAttributeNode(materialattr);
|
||||
materialele.appendChild(mc);
|
||||
}
|
||||
element.appendChild(propele);
|
||||
element.appendChild(materialele);
|
||||
|
||||
QDomElement configele = doc->createElement("ConfigData");
|
||||
QList<DataProperty::DataBase*> datalist = _configData.values();
|
||||
|
@ -131,15 +131,15 @@ namespace ModelData
|
|||
{
|
||||
ModelDataBase::writeToProjectFile1(doc, e);
|
||||
|
||||
QDomElement materialele = doc->createElement("Property");
|
||||
QList<int> setidlist = _setProperty.keys();
|
||||
QDomElement materialele = doc->createElement("Material");
|
||||
QList<int> setidlist = _setMaterial.keys();
|
||||
for (int i = 0; i < setidlist.size(); ++i)
|
||||
{
|
||||
int setid = setidlist.at(i);
|
||||
int materialid = _setProperty.value(setid);
|
||||
QDomElement mc = doc->createElement("PropInfo");
|
||||
int materialid = _setMaterial.value(setid);
|
||||
QDomElement mc = doc->createElement("MaterialInfo");
|
||||
QDomAttr setattr = doc->createAttribute("ComponentID");
|
||||
QDomAttr materialattr = doc->createAttribute("PropID");
|
||||
QDomAttr materialattr = doc->createAttribute("MaterialID");
|
||||
setattr.setValue(QString::number(setid));
|
||||
materialattr.setValue(QString::number(materialid));
|
||||
mc.setAttributeNode(setattr);
|
||||
|
@ -176,15 +176,15 @@ namespace ModelData
|
|||
void ModelDataBaseExtend::readDataFromProjectFile(QDomElement* e)
|
||||
{
|
||||
ModelDataBase::readDataFromProjectFile(e);
|
||||
QDomNodeList materialList = e->elementsByTagName("PropInfo");
|
||||
QDomNodeList materialList = e->elementsByTagName("MaterialInfo");
|
||||
for (int i = 0; i < materialList.size(); ++i)
|
||||
{
|
||||
QDomElement ele = materialList.at(i).toElement();
|
||||
QString ssetid = ele.attribute("ComponentID");
|
||||
QString smaterialID = ele.attribute("PropID");
|
||||
QString smaterialID = ele.attribute("MaterialID");
|
||||
int setid = ssetid.toInt();
|
||||
int maid = smaterialID.toInt();
|
||||
this->setProperty(setid, maid);
|
||||
this->setMaterial(setid, maid);
|
||||
}
|
||||
|
||||
QDomNodeList configdata = e->elementsByTagName("ConfigData");
|
||||
|
@ -233,38 +233,38 @@ namespace ModelData
|
|||
this->writeToProjectFile(doc, e);
|
||||
}
|
||||
|
||||
void ModelDataBaseExtend::setProperty(int setID, int materialID)
|
||||
void ModelDataBaseExtend::setMaterial(int setID, int materialID)
|
||||
{
|
||||
if (!_ComponentIDList.contains(setID) || materialID <= 0) return;
|
||||
_setProperty[setID] = materialID;
|
||||
_setMaterial[setID] = materialID;
|
||||
}
|
||||
|
||||
int ModelDataBaseExtend::getPropertyID(int setid)
|
||||
int ModelDataBaseExtend::getMaterialID(int setid)
|
||||
{
|
||||
int m = -1;
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
m = _setProperty.value(setid);
|
||||
m = _setMaterial.value(setid);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
bool ModelDataBaseExtend::isPropertySetted(int setid)
|
||||
bool ModelDataBaseExtend::isMaterialSetted(int setid)
|
||||
{
|
||||
bool s = false;
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
if (_setProperty.value(setid) >= 0)
|
||||
if (_setMaterial.value(setid) >= 0)
|
||||
s = true;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void ModelDataBaseExtend::removeProperty(int setid)
|
||||
void ModelDataBaseExtend::removeMaterial(int setid)
|
||||
{
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
_setProperty.remove(setid);
|
||||
_setMaterial.remove(setid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ namespace ModelData
|
|||
|
||||
for (int id : removeid)
|
||||
{
|
||||
if (_setProperty.contains(id))
|
||||
_setProperty.remove(id);
|
||||
if (_setMaterial.contains(id))
|
||||
_setMaterial.remove(id);
|
||||
for (auto bc : _bcList)
|
||||
{
|
||||
if (bc->getComponentID() == id)
|
||||
|
@ -296,9 +296,9 @@ namespace ModelData
|
|||
{
|
||||
assert(index >= 0 && index < _ComponentIDList.size());
|
||||
int id = _ComponentIDList.at(index);
|
||||
if (isPropertySetted(id))
|
||||
if (isMaterialSetted(id))
|
||||
{
|
||||
removeProperty(id);
|
||||
removeMaterial(id);
|
||||
}
|
||||
ModelDataBase::removeComponentAt(index);
|
||||
}
|
||||
|
|
|
@ -47,14 +47,14 @@ namespace ModelData
|
|||
QString getReportAt(int index);
|
||||
//移除第index个报告
|
||||
void removeReportAt(int index);
|
||||
//设置属性,网格组件ID与属性ID
|
||||
void setProperty(int setID, int pid);
|
||||
//设置材料,网格组件ID与材料ID
|
||||
void setMaterial(int setID, int materialID);
|
||||
//获取组件的材料ID
|
||||
int getPropertyID(int setid);
|
||||
int getMaterialID(int setid);
|
||||
//组件是否被设置材料
|
||||
bool isPropertySetted(int setid);
|
||||
//解除属性与组件的绑定
|
||||
void removeProperty(int setid);
|
||||
bool isMaterialSetted(int setid);
|
||||
//解除材料与组件的绑定
|
||||
void removeMaterial(int setid);
|
||||
|
||||
virtual void setComponentIDList(QList<int> ids);
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace ModelData
|
|||
|
||||
protected:
|
||||
QList<int> _inpMaterIds;
|
||||
QHash<int, int> _setProperty{};
|
||||
QHash<int, int> _setMaterial{};
|
||||
QStringList _reportList{};
|
||||
QHash<int, DataProperty::DataBase*> _configData{};
|
||||
QStringList _monitorFiles{};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QDebug>
|
||||
#include "ProjectTree/DialogAddBC.h"
|
||||
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
void ModelDataPy::importComponents(int caseId, const char* addcomponentsId)
|
||||
|
@ -18,8 +19,7 @@ namespace ModelData
|
|||
for (QString id : scomponentIdsList)
|
||||
ids.append(id.toInt());
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
if (model == nullptr) return;
|
||||
model->setComponentIDList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
@ -35,28 +35,25 @@ namespace ModelData
|
|||
ids.append(scomponentIdsList[i].toInt());
|
||||
}
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
if (model == nullptr) return;
|
||||
|
||||
model->setGeometryList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
|
||||
void ModelDataPy::addBC(int caseId, int id, char* bctypetostring)
|
||||
{
|
||||
|
||||
QString bctyst(bctypetostring);
|
||||
BCBase::BCType bctype = BCBase::StringToBCType(bctyst);
|
||||
// bctyst = BCBase::BCTypeToString(bctype);
|
||||
if (bctype == BCBase::None)
|
||||
bctype = BCBase::UserDef;
|
||||
if (bctype == BCBase::None) bctype = BCBase::UserDef;
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
if (model == nullptr) return;
|
||||
ModelDataBaseExtend *_data = dynamic_cast<ModelDataBaseExtend*>(model);
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bctype, bctyst, _data->getTreeType());
|
||||
if (bc == nullptr)
|
||||
return;
|
||||
if (bc == nullptr) return;
|
||||
// bc->setBCType(bctype);
|
||||
bc->bingdingComponentID(id);
|
||||
_data->appeendBC(bc);
|
||||
|
@ -70,14 +67,11 @@ namespace ModelData
|
|||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
if (model == nullptr) return;
|
||||
DataProperty::ParameterBase* p = model->getParameterByName(svariable);
|
||||
if (p == nullptr)
|
||||
return;
|
||||
if (p == nullptr) return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType())
|
||||
return;
|
||||
if (t != p->getParaType()) return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
@ -88,29 +82,25 @@ namespace ModelData
|
|||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
if (model == nullptr) return;
|
||||
BCBase::BCBase* bc = model->getBCAt(index);
|
||||
DataProperty::ParameterBase* p = bc->getParameterByName(svariable);
|
||||
if (p == nullptr)
|
||||
return;
|
||||
if (p == nullptr) return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType())
|
||||
return;
|
||||
if (t != p->getParaType()) return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::setProperty(int caseID, char *componentIDs, int pid)
|
||||
void ModelDataPy::setMaterial(int caseID, char* componentIDs, int materialID)
|
||||
{
|
||||
ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance();
|
||||
ModelData::ModelDataBaseExtend* model = dynamic_cast<ModelData::ModelDataBaseExtend*>(modelData->getModelByID(caseID));
|
||||
if (!model)
|
||||
return;
|
||||
if (!model) return;
|
||||
QString cpIDs(componentIDs);
|
||||
QStringList cpIDList = cpIDs.split(';');
|
||||
for (QString cpID : cpIDList)
|
||||
model->setProperty(cpID.toInt(), pid);
|
||||
model->setMaterial(cpID.toInt(), materialID);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +128,7 @@ void MODELDATAAPI setBCValue(int caseID, int index, char *variable, char *stype,
|
|||
ModelData::ModelDataPy::setBCValue(caseID, index, variable, stype, svalue);
|
||||
}
|
||||
|
||||
void MODELDATAAPI setProperty(int caseID, char *componentIDs, int materialID)
|
||||
void MODELDATAAPI setMaterial(int caseID, char* componentIDs, int materialID)
|
||||
{
|
||||
ModelData::ModelDataPy::setProperty(caseID, componentIDs, materialID);
|
||||
ModelData::ModelDataPy::setMaterial(caseID, componentIDs, materialID);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ModelData
|
|||
static void addBC(int caseId, int id, char* bctypetostring);
|
||||
static void setValue(int caseID, char* variable, char* stype, char* svalue);
|
||||
static void setBCValue(int caseID, int index, char* variable, char* stype, char* svalue);
|
||||
static void setProperty(int caseID, char* componentIDs, int materialID);
|
||||
static void setMaterial(int caseID, char* componentIDs, int materialID);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern "C"
|
|||
void MODELDATAAPI addBC(int caseId, int id, char* bctypetostring);
|
||||
void MODELDATAAPI setValue(int caseID, char* variable, char* stype, char* svalue);
|
||||
void MODELDATAAPI setBCValue(int caseID,int index,char* variable, char* stype, char* svalue);
|
||||
void MODELDATAAPI setProperty(int caseID, char* componentIDs, int materialID);
|
||||
void MODELDATAAPI setMaterial(int caseID, char* componentIDs, int materialID);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
// #include "BCBase/BCPressure.h"
|
||||
// #include "BCBase/BCDisplacement.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
#include "ConfigOptions/BCConfig.h"
|
||||
#include <assert.h>
|
||||
|
@ -20,19 +20,17 @@
|
|||
#include <QDebug>
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
namespace ProjectTree
|
||||
{
|
||||
namespace ProjectTree {
|
||||
|
||||
AddBCDialog::AddBCDialog(GUI::MainWindow* m, ModelData::ModelDataBaseExtend* data)
|
||||
: QFDialog(m), _data(data)
|
||||
: QFDialog(m)
|
||||
, _data(data)
|
||||
{
|
||||
_ui = new Ui::AddBCDialog();
|
||||
_ui->setupUi(this);
|
||||
init();
|
||||
}
|
||||
AddBCDialog::~AddBCDialog()
|
||||
{
|
||||
}
|
||||
AddBCDialog::~AddBCDialog() {}
|
||||
void AddBCDialog::init()
|
||||
{
|
||||
initBCType();
|
||||
|
@ -42,8 +40,7 @@ namespace ProjectTree
|
|||
{
|
||||
MeshData::MeshData* mesh = MeshData::MeshData::getInstance();
|
||||
QList<int> mshList = _data->getMeshSetList();
|
||||
for (int i = 0; i < mshList.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < mshList.size(); ++i) {
|
||||
int setID = mshList.at(i);
|
||||
MeshData::MeshSet* set = mesh->getMeshSetByID(setID);
|
||||
assert(set != nullptr);
|
||||
|
@ -54,8 +51,7 @@ namespace ProjectTree
|
|||
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcList = _data->getGeoComponentIDList();
|
||||
for (int i = 0; i < gcList.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < gcList.size(); ++i) {
|
||||
int gcID = gcList.at(i);
|
||||
auto* aGC = geoData->getGeoComponentByID(gcID);
|
||||
assert(aGC != nullptr);
|
||||
|
@ -68,18 +64,18 @@ namespace ProjectTree
|
|||
{
|
||||
int beg = BCBase::BCType::None;
|
||||
int end = BCBase::BCType::End;
|
||||
ConfigOption::BCConfig *userdefbcs = ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
for (int i = beg; i < end; ++i)
|
||||
{
|
||||
ConfigOption::BCConfig* userdefbcs =
|
||||
ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
for(int i = beg; i < end; ++i) {
|
||||
QString stype = BCBase::BCTypeToString((BCBase::BCType)i);
|
||||
if(!userdefbcs->isEnable(stype, _data->getTreeType()))
|
||||
continue;
|
||||
_ui->typeComboBox->addItem(stype, i);
|
||||
}
|
||||
// ConfigOption::BCConfig* userdefbcs = ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
// ConfigOption::BCConfig* userdefbcs =
|
||||
//ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
const int n = userdefbcs->getBCCount(_data->getTreeType());
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
BCBase::BCUserDef* bc = userdefbcs->getBCAt(i, _data->getTreeType());
|
||||
_ui->typeComboBox->addItem(bc->getName(), BCBase::UserDef);
|
||||
}
|
||||
|
@ -101,11 +97,13 @@ namespace ProjectTree
|
|||
MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
|
||||
assert(set != nullptr);
|
||||
QString bcTypeToString = BCBase::BCTypeToString(bcType);//liu
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bcType, name, _data->getTreeType());
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bcType, name,
|
||||
_data->getTreeType());
|
||||
|
||||
if (bc != nullptr)
|
||||
{
|
||||
//QString code = QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(id).arg(addIdValues.join(" "));//
|
||||
//QString code =
|
||||
QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(id).arg(addIdValues.join(" "));//
|
||||
//qDebug() << code;
|
||||
//Py::PythonAgent::getInstance()->submit(code);
|
||||
bc->setType(bcType);
|
||||
|
@ -115,17 +113,18 @@ namespace ProjectTree
|
|||
void AddBCDialog::accept()
|
||||
{
|
||||
// const int index = _ui->typeComboBox->currentIndex();
|
||||
// BCBase::BCType bcType = (BCBase::BCType)(_ui->typeComboBox->itemData(index).toInt()); //Commented-Out By Baojun
|
||||
int cpID = _ui->setComboBox->itemData(_ui->setComboBox->currentIndex(), Qt::UserRole + 1).toInt();
|
||||
// BCBase::BCType bcType =
|
||||
//(BCBase::BCType)(_ui->typeComboBox->itemData(index).toInt()); //Commented-Out By Baojun
|
||||
int cpID =
|
||||
_ui->setComboBox->itemData(_ui->setComboBox->currentIndex(), Qt::UserRole + 1).toInt();
|
||||
if(cpID < 0)
|
||||
return;
|
||||
QString typeName = _ui->typeComboBox->currentText();
|
||||
// QList<int> setidlist = _data->getMeshSetList();
|
||||
int caseid = _data->getID();
|
||||
|
||||
// MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id); //Commented-Out By Baojun
|
||||
// if (set == nullptr) return;
|
||||
// int caseid = _data->getID();
|
||||
// MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
|
||||
////Commented-Out By Baojun if (set == nullptr) return; int caseid = _data->getID();
|
||||
// assert(set != nullptr);
|
||||
// QString bctypetostring = BCBase::BCTypeToString(bcType);//liu
|
||||
|
||||
|
@ -137,4 +136,4 @@ namespace ProjectTree
|
|||
QDialog::accept();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file DialogAddBC.h
|
||||
* @brief 设置边界条件对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:03
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGADDBC_H_
|
||||
#ifndef _DIALOGADDBC_H_
|
||||
#define _DIALOGADDBC_H_
|
||||
|
||||
#include "SelfDefObject/QFDialog.h"
|
||||
|
@ -40,10 +18,7 @@ namespace ModelData
|
|||
|
||||
namespace ProjectTree
|
||||
{
|
||||
/**
|
||||
* @brief 设置边界条件对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
class AddBCDialog : public QFDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -52,28 +27,21 @@ namespace ProjectTree
|
|||
~AddBCDialog();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief 初始化对话框数据
|
||||
* @since 2.5.0
|
||||
*/
|
||||
void init();
|
||||
/**
|
||||
* @brief 初始化边界条件列表
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
virtual void initBCType();
|
||||
/**
|
||||
* @brief 初始化组件列表
|
||||
* @since 2.5.0
|
||||
*/
|
||||
virtual void initComponents();
|
||||
virtual void accept() override;
|
||||
|
||||
private:
|
||||
Ui::AddBCDialog* _ui{};
|
||||
ModelData::ModelDataBaseExtend* _data{};
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
#include "DialogAddProperty.h"
|
||||
#include <ui_DialogAddProperty.h>
|
||||
#include "Material/Material.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "ModelData/elementProperty.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
AddPropDialog::AddPropDialog(GUI::MainWindow * mw, ModelData::ModelDataBaseExtend * model)
|
||||
:_mainWindow(mw), _model(model)
|
||||
{
|
||||
_ui = new Ui::CreateEleProp;
|
||||
_ui->setupUi(this);
|
||||
init();
|
||||
}
|
||||
|
||||
AddPropDialog::~AddPropDialog()
|
||||
{
|
||||
if (_ui != nullptr) delete _ui;
|
||||
}
|
||||
|
||||
void ProjectTree::AddPropDialog::init()
|
||||
{
|
||||
int id = ModelData::ElementProperty::getMaxID();
|
||||
QString text = QString("Prop_%1").arg(id+1);
|
||||
_ui->nameLineEdit->setPlaceholderText(text);
|
||||
|
||||
auto mdata = Material::MaterialSingleton::getInstance();
|
||||
const int n = mdata->getMaterialCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
auto m = mdata->getMaterialAt(i);
|
||||
const int id = m->getID();
|
||||
_ui->materialCombox->addItem(QIcon(), m->getName(), id);
|
||||
}
|
||||
}
|
||||
|
||||
void AddPropDialog::accept()
|
||||
{
|
||||
QString name = _ui->nameLineEdit->text();
|
||||
if (name.isEmpty()) name = _ui->nameLineEdit->placeholderText();
|
||||
|
||||
int matID = _ui->materialCombox->currentData(Qt::UserRole).toInt();
|
||||
if (matID < 1) return;
|
||||
|
||||
auto prop = new ModelData::ElementProperty();
|
||||
prop->setName(name);
|
||||
prop->setEleType(_ui->eleTypeCombox->currentText());
|
||||
prop->setMaterialID(matID);
|
||||
|
||||
_model->appendEleProperty(prop);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef __DIALOGADDPROPERTY_H__
|
||||
#define __DIALOGADDPROPERTY_H__
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CreateEleProp;
|
||||
}
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
class AddPropDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
AddPropDialog(GUI::MainWindow* mw, ModelData::ModelDataBaseExtend* model);
|
||||
~AddPropDialog();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
Ui::CreateEleProp* _ui{};
|
||||
|
||||
GUI::MainWindow* _mainWindow{};
|
||||
ModelData::ModelDataBaseExtend* _model{};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // !__DIALOGADDPROPERTY_H__
|
|
@ -1,100 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateEleProp</class>
|
||||
<widget class="QDialog" name="CreateEleProp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>314</width>
|
||||
<height>119</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create Prop</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Element Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="eleTypeCombox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>elem_fem_sta_linear</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Material:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="materialCombox"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CreateEleProp</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CreateEleProp</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -0,0 +1,90 @@
|
|||
#include "DialogAssignMaterial.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "Material/Material.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include <QDebug>
|
||||
|
||||
namespace ProjectTree {
|
||||
AssignMaterialDialog::AssignMaterialDialog(GUI::MainWindow* mainwindow,
|
||||
ModelData::ModelDataBaseExtend* data)
|
||||
: ComponentSelectDialogBase(mainwindow, nullptr, nullptr)
|
||||
, _data(data)
|
||||
{
|
||||
_layout = new QHBoxLayout;
|
||||
_label = new QLabel("Material");
|
||||
_combobox = new QComboBox;
|
||||
_layout->addWidget(_label);
|
||||
_layout->addWidget(_combobox);
|
||||
this->setCustomLayout(_layout);
|
||||
init();
|
||||
}
|
||||
|
||||
AssignMaterialDialog::~AssignMaterialDialog()
|
||||
{
|
||||
if(_label != nullptr)
|
||||
delete _label;
|
||||
if(_combobox != nullptr)
|
||||
delete _combobox;
|
||||
if(_layout != nullptr)
|
||||
delete _layout;
|
||||
}
|
||||
|
||||
void AssignMaterialDialog::init()
|
||||
{
|
||||
MeshData::MeshData* meshdata = MeshData::MeshData::getInstance();
|
||||
QList<int> setlist = _data->getMeshSetList();
|
||||
for(int i = 0; i < setlist.size(); ++i) {
|
||||
int setid = setlist.at(i);
|
||||
MeshData::MeshSet* set = meshdata->getMeshSetByID(setid);
|
||||
if((set == nullptr) || (set->getSetType() != MeshData::Element))
|
||||
continue;
|
||||
QString name = set->getName();
|
||||
this->appendItemToAvailableList(name, setid, ":/QUI/icon/mesh.png");
|
||||
}
|
||||
|
||||
auto* geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcIDs = _data->getGeoComponentIDList();
|
||||
for(int gcID : gcIDs) {
|
||||
auto aGC = geoData->getGeoComponentByID(gcID);
|
||||
if(!aGC)
|
||||
continue;
|
||||
appendItemToAvailableList(aGC->getName(), gcID, ":/QUI/icon/geometry.png");
|
||||
}
|
||||
|
||||
Material::MaterialSingleton* materialData = Material::MaterialSingleton::getInstance();
|
||||
const int n = materialData->getMaterialCount();
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Material::Material* m = materialData->getMaterialAt(i);
|
||||
QString name = m->getName();
|
||||
const int id = m->getID();
|
||||
_combobox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
|
||||
void AssignMaterialDialog::accept()
|
||||
{
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QList<int> ids = idname.keys();
|
||||
const int currentindex = _combobox->currentIndex();
|
||||
const int mid = _combobox->itemData(currentindex).toInt();
|
||||
QString cpIDs;
|
||||
for(int i = 0; i < ids.size(); ++i) {
|
||||
int cpID = ids.at(i);
|
||||
cpIDs.append(QString::number(cpID)).append(';');
|
||||
}
|
||||
QString code = QString("Case.setMaterial(%1,\"%2\",%3)")
|
||||
.arg(_data->getID())
|
||||
.arg(cpIDs.left(cpIDs.size() - 1))
|
||||
.arg(mid);
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _DIALOGASSIGNMATERIAL_H_
|
||||
#define _DIALOGASSIGNMATERIAL_H_
|
||||
|
||||
#include "moduleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
class AssignMaterialDialog: public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
public:
|
||||
AssignMaterialDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data);
|
||||
~AssignMaterialDialog();
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
||||
|
||||
private:
|
||||
ModelData::ModelDataBaseExtend* _data{};
|
||||
QHBoxLayout* _layout{};
|
||||
QLabel* _label{};
|
||||
QComboBox* _combobox{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,93 +0,0 @@
|
|||
#include "DialogAssignProperty.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "Material/Material.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include "ModelData/elementProperty.h"
|
||||
#include <QDebug>
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
AssignPropertyDialog::AssignPropertyDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data)
|
||||
: ComponentSelectDialogBase(mainwindow, nullptr, nullptr), _data(data)
|
||||
{
|
||||
_layout = new QHBoxLayout;
|
||||
_label = new QLabel("Property");
|
||||
_combobox = new QComboBox;
|
||||
_layout->addWidget(_label);
|
||||
_layout->addWidget(_combobox);
|
||||
this->setCustomLayout(_layout);
|
||||
init();
|
||||
}
|
||||
|
||||
AssignPropertyDialog::~AssignPropertyDialog()
|
||||
{
|
||||
if (_label != nullptr)
|
||||
delete _label;
|
||||
if (_combobox != nullptr)
|
||||
delete _combobox;
|
||||
if (_layout != nullptr)
|
||||
delete _layout;
|
||||
}
|
||||
|
||||
void AssignPropertyDialog::init()
|
||||
{
|
||||
MeshData::MeshData *meshdata = MeshData::MeshData::getInstance();
|
||||
QList<int> setlist = _data->getMeshSetList();
|
||||
for (int i = 0; i < setlist.size(); ++i)
|
||||
{
|
||||
int setid = setlist.at(i);
|
||||
MeshData::MeshSet *set = meshdata->getMeshSetByID(setid);
|
||||
if ((set == nullptr) || (set->getSetType() != MeshData::Element))
|
||||
continue;
|
||||
QString name = set->getName();
|
||||
this->appendItemToAvailableList(name, setid, ":/QUI/icon/mesh.png");
|
||||
}
|
||||
|
||||
auto *geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcIDs = _data->getGeoComponentIDList();
|
||||
for (int gcID : gcIDs)
|
||||
{
|
||||
auto aGC = geoData->getGeoComponentByID(gcID);
|
||||
if (!aGC)
|
||||
continue;
|
||||
appendItemToAvailableList(aGC->getName(), gcID, ":/QUI/icon/geometry.png");
|
||||
}
|
||||
|
||||
// Material::MaterialSingleton* materialData = Material::MaterialSingleton::getInstance();
|
||||
// const int n = materialData->getMaterialCount();
|
||||
const int n = _data->getElePropCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
// Material::Material* m = materialData->getMaterialAt(i);
|
||||
auto m = _data->getElePropertyAt(i);
|
||||
QString name = m->getName();
|
||||
const int id = m->getID();
|
||||
_combobox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
|
||||
void AssignPropertyDialog::accept()
|
||||
{
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QList<int> ids = idname.keys();
|
||||
const int currentindex = _combobox->currentIndex();
|
||||
const int mid = _combobox->itemData(currentindex).toInt();
|
||||
QString cpIDs;
|
||||
for (int i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
int cpID = ids.at(i);
|
||||
cpIDs.append(QString::number(cpID)).append(';');
|
||||
}
|
||||
QString code = QString("Case.setProperty(%1,\"%2\",%3)").arg(_data->getID()).arg(cpIDs.left(cpIDs.size() - 1)).arg(mid);
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* @file DialogAssignMaterial.h
|
||||
* @brief 材料设置对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:08
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGASSIGNMATERIAL_H_
|
||||
#define _DIALOGASSIGNMATERIAL_H_
|
||||
|
||||
#include "ModuleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
/**
|
||||
* @brief 材料设置对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
class AssignPropertyDialog : public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
public:
|
||||
AssignPropertyDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data);
|
||||
~AssignPropertyDialog();
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
ModelData::ModelDataBaseExtend *_data{};
|
||||
QHBoxLayout *_layout{};
|
||||
QLabel *_label{};
|
||||
QComboBox *_combobox{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
#include "DialogImport.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
@ -8,14 +8,15 @@
|
|||
#include "PythonModule/PyAgent.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/geometrySet.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
ImportDialog::ImportDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data, ImportType t)
|
||||
: ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr), _type(t)
|
||||
namespace ProjectTree {
|
||||
ImportDialog::ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data,
|
||||
ImportType t)
|
||||
: ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr)
|
||||
, _type(t)
|
||||
{
|
||||
_data = data;
|
||||
init();
|
||||
|
@ -62,21 +63,18 @@ namespace ProjectTree
|
|||
for(int id : ids)
|
||||
addIdValues << QString::number(id);
|
||||
int caseID = _data->getID();
|
||||
QString code = QString("Case.importComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
QString code =
|
||||
QString("Case.importComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取可用的几何组件
|
||||
/// </summary>
|
||||
void ImportDialog::initGeo()
|
||||
{
|
||||
Geometry::GeometryData* geoData = Geometry::GeometryData::getInstance();
|
||||
const int n = geoData->getGeometrySetCount();
|
||||
QList<int> geoIDs = _data->getGeometryList();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Geometry::GeometrySet* set = geoData->getGeometrySetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
|
@ -87,16 +85,13 @@ namespace ProjectTree
|
|||
appendItemToAvailableList(name, id, icon);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取可用的网格组件
|
||||
/// </summary>
|
||||
|
||||
void ImportDialog::initMeshSet()
|
||||
{
|
||||
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
|
||||
const int n = meshData->getMeshSetCount();
|
||||
QList<int> compIDs = _data->getMeshSetList();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for(int i = 0; i < n; ++i) {
|
||||
MeshData::MeshSet* set = meshData->getMeshSetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
|
@ -114,8 +109,7 @@ namespace ProjectTree
|
|||
{
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> geoIDs = _data->getGeoComponentIDList();
|
||||
foreach (auto aGc, geoData->getGeoComponentList())
|
||||
{
|
||||
foreach(auto aGc, geoData->getGeoComponentList()) {
|
||||
QString name = aGc->getName();
|
||||
int id = aGc->getID();
|
||||
QString icon = ":/QUI/icon/geometry.png";
|
||||
|
@ -132,12 +126,12 @@ namespace ProjectTree
|
|||
QStringList values = idname.values();
|
||||
QList<int> ids = idname.keys();
|
||||
QStringList addIdValues;
|
||||
for (int i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
for(int i = 0; i < ids.size(); ++i) {
|
||||
addIdValues << QString::number(ids.at(i));
|
||||
}
|
||||
int id = _data->getID();
|
||||
QString code = QString("Case.importGeometry(%1,\"%2\")").arg(id).arg(addIdValues.join(" ")); //
|
||||
QString code =
|
||||
QString("Case.importGeometry(%1,\"%2\")").arg(id).arg(addIdValues.join(" ")); //
|
||||
qDebug() << code;
|
||||
if(ids.size() > 0)
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
|
@ -152,7 +146,8 @@ namespace ProjectTree
|
|||
// foreach(int id, ids)
|
||||
// addIdValues << QString::number(id);
|
||||
// int caseID = _data->getID();
|
||||
// QString code = QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// QString code =
|
||||
// QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// Py::PythonAgent::getInstance()->submit(code);
|
||||
// }
|
||||
|
||||
|
@ -164,7 +159,8 @@ namespace ProjectTree
|
|||
// foreach(int id, ids)
|
||||
// addIdValues << QString::number(id);
|
||||
// int caseID = _data->getID();
|
||||
// QString code = QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// QString code =
|
||||
// QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// Py::PythonAgent::getInstance()->submit(code);
|
||||
// }
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -1,29 +1,7 @@
|
|||
/**
|
||||
* @file DialogImport.h
|
||||
* @brief 导入组件对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:14
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGIMPORTMESHSET_
|
||||
#ifndef _DIALOGIMPORTMESHSET_
|
||||
#define _DIALOGIMPORTMESHSET_
|
||||
|
||||
#include "ModuleBase/componentDialogBase.h"
|
||||
#include "moduleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
@ -42,10 +20,7 @@ namespace ProjectTree
|
|||
Geometry,
|
||||
MeshSet
|
||||
};
|
||||
/**
|
||||
* @brief 导入组件对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
class ImportDialog : public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -53,6 +28,7 @@ namespace ProjectTree
|
|||
ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data, ImportType t);
|
||||
~ImportDialog() = default;
|
||||
|
||||
|
||||
protected:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
@ -72,4 +48,5 @@ namespace ProjectTree
|
|||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file DialogRemoveReport.h
|
||||
* @brief 报告移除确认对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:20
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _REMOVEREPORTDIALOG_H_
|
||||
#ifndef _REMOVEREPORTDIALOG_H_
|
||||
#define _REMOVEREPORTDIALOG_H_
|
||||
|
||||
#include "SelfDefObject/QFDialog.h"
|
||||
|
@ -47,7 +25,9 @@ namespace ProjectTree
|
|||
|
||||
private:
|
||||
Ui::RemoveReportDialog* _ui{};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
#include "ProjectTreeWithBasicNode.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "ConfigOptions/TreeItemData.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "DialogImport.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "DialogAddBC.h"
|
||||
#include "DialogAddProperty.h"
|
||||
#include "BCBase/BCBase.h"
|
||||
#include "BCBase/BCUserDef.h"
|
||||
#include "MainWindow/MainWindow.h"
|
||||
#include "mainWindow/mainWindow.h"
|
||||
#include "DialogRemoveReport.h"
|
||||
#include "ModelData/simulationSettingBase.h"
|
||||
#include "ModelData/solverSettingBase.h"
|
||||
#include "ModelData/elementProperty.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "DialogAssignProperty.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/geometrySet.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
#include "DialogAssignMaterial.h"
|
||||
#include "DataProperty/PropertyBase.h"
|
||||
#include "DataProperty/PropertyString.h"
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
|
@ -32,7 +30,6 @@
|
|||
#include "Material/MaterialSingletion.h"
|
||||
#include "Material/Material.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
@ -43,15 +40,18 @@
|
|||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
namespace ProjectTree {
|
||||
ProjectTreeWithBasicNode::ProjectTreeWithBasicNode(GUI::MainWindow* mainwindow)
|
||||
: ProjectTreeBase(mainwindow)
|
||||
{
|
||||
connect(this, SIGNAL(highLightSet(MeshData::MeshSet *)), mainwindow, SIGNAL(highLightSetSig(MeshData::MeshSet *)));
|
||||
connect(this, SIGNAL(highLightGeoComponent(Geometry::GeoComponent *)), mainwindow, SIGNAL(highLightGeoComponentSig(Geometry::GeoComponent *)));
|
||||
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *)));
|
||||
connect(this, SIGNAL(openRealTimeWin(Post::RealTimeWindowBase *, int)), mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int)));
|
||||
connect(this, SIGNAL(highLightSet(MeshData::MeshSet*)), mainwindow,
|
||||
SIGNAL(highLightSetSig(MeshData::MeshSet*)));
|
||||
connect(this, SIGNAL(highLightGeoComponent(Geometry::GeoComponent*)), mainwindow,
|
||||
SIGNAL(highLightGeoComponentSig(Geometry::GeoComponent*)));
|
||||
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase*)), this,
|
||||
SLOT(closePostWindow(Post::PostWindowBase*)));
|
||||
connect(this, SIGNAL(openRealTimeWin(Post::RealTimeWindowBase*, int)), mainwindow,
|
||||
SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase*, int)));
|
||||
connect(this, SIGNAL(clearAllHighLightSig()), mainwindow, SIGNAL(clearAllHighLight()));
|
||||
connect(this, SIGNAL(addComponentRootItemSig()), this, SLOT(addComponentRootItemSlot()));
|
||||
_nodeMenu = new QMenu;
|
||||
|
@ -73,7 +73,7 @@ namespace ProjectTree
|
|||
_root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
_root->setFlags(_root->flags() | Qt::ItemIsEditable);
|
||||
_root->setIcon(0, QIcon("://QUI/icon/physics.png"));
|
||||
// int id = _data->getID();
|
||||
int id = _data->getID();
|
||||
_root->setText(0, _data->getName()); // 根据项目名称确定
|
||||
_root->setData(0, Qt::UserRole, _data->getID());
|
||||
_root->setExpanded(true);
|
||||
|
@ -86,10 +86,6 @@ namespace ProjectTree
|
|||
// _geometryRootItem->setText(0, tr("Geometry"));
|
||||
// _geometryRootItem->setIcon(0, QIcon("://QUI/icon/geometry.png"));
|
||||
// _textItemHash["Geometry"] = _geometryRootItem;
|
||||
_propertyRootItem = new QTreeWidgetItem(_root, TreeItemType::ProjectEleProperty);
|
||||
_propertyRootItem->setText(0, tr("Element Property"));
|
||||
_propertyRootItem->setIcon(0, QIcon("://QUI/icon/solumationsetting.png"));
|
||||
_textItemHash["Element Property"] = _propertyRootItem;
|
||||
|
||||
_ComponentRootItem = new QTreeWidgetItem(_root, TreeItemType::ProjectComponent);
|
||||
_ComponentRootItem->setText(0, tr("Set"));
|
||||
|
@ -136,7 +132,8 @@ namespace ProjectTree
|
|||
_postVectorItem->setIcon(0, QIcon("://QUI/icon/vector.png"));
|
||||
_textItemHash["Vector"] = _postVectorItem;
|
||||
|
||||
_postStreamLineItem = new QTreeWidgetItem(_postRootItem, TreeItemType::ProjectPostStreamLine);
|
||||
_postStreamLineItem =
|
||||
new QTreeWidgetItem(_postRootItem, TreeItemType::ProjectPostStreamLine);
|
||||
_postStreamLineItem->setText(0, tr("Stream Line"));
|
||||
_postStreamLineItem->setIcon(0, QIcon("://QUI/icon/streamline.png"));
|
||||
_textItemHash["Stream Line"] = _postStreamLineItem;
|
||||
|
@ -177,28 +174,18 @@ namespace ProjectTree
|
|||
QAction* action = nullptr;
|
||||
TreeItemType type = (TreeItemType)_currentItem->type();
|
||||
auto glo = ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case ProjectGeometry:
|
||||
action = menu->addAction(tr("Import Geometry"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(importGeometry()));
|
||||
break;
|
||||
case ProjectEleProperty:
|
||||
action = menu->addAction(tr("Add Property"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(addEleProperty()));
|
||||
break;
|
||||
case ProjectElePropertyChild:
|
||||
action = menu->addAction(tr("Remove"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(removeItem()));
|
||||
break;
|
||||
case ProjectComponent:
|
||||
action = menu->addAction(tr("Import Set"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(importComponents()));
|
||||
|
||||
if (glo->isMaterialEnabled())
|
||||
{
|
||||
action = menu->addAction(tr("Assign Property"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(assignProperty()));
|
||||
if (glo->isMaterialEnabled()) {
|
||||
action = menu->addAction(tr("Assign Material"));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(assignMaterial()));
|
||||
}
|
||||
break;
|
||||
case ProjectComponentChild:
|
||||
|
@ -268,7 +255,6 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeWithBasicNode::updateTree()
|
||||
{
|
||||
updatePropTree();
|
||||
updateGeometrySubTree();
|
||||
updateComponentSubTree();
|
||||
updateBCSubTree();
|
||||
|
@ -290,16 +276,12 @@ namespace ProjectTree
|
|||
auto materialData = Material::MaterialSingleton::getInstance();
|
||||
QString name{};
|
||||
QString icon{};
|
||||
for (int id : IDs)
|
||||
{
|
||||
for (int id : IDs) {
|
||||
auto type = DataProperty::ComponentBase::getComponentTypeByID(id);
|
||||
if (type == 0)
|
||||
continue;
|
||||
if (type == DataProperty::ComponentType::MESH)
|
||||
{
|
||||
if (type == DataProperty::ComponentType::MESH) {
|
||||
auto set = meshData->getMeshSetByID(id);
|
||||
if (set == nullptr)
|
||||
continue;
|
||||
name = set->getName();
|
||||
MeshData::SetType type = set->getSetType();
|
||||
if (type == MeshData::Element)
|
||||
|
@ -309,24 +291,24 @@ namespace ProjectTree
|
|||
else
|
||||
icon = "://QUI/icon/nodeset.png";
|
||||
}
|
||||
else if (type == DataProperty::ComponentType::GEOMETRY)
|
||||
{
|
||||
else if (type == DataProperty::ComponentType::GEOMETRY) {
|
||||
auto gc = geoData->getGeoComponentByID(id);
|
||||
name = gc->getName();
|
||||
icon = "://QUI/icon/geometry.png";
|
||||
}
|
||||
|
||||
if (_modelDataExtend->isPropertySetted(id)) //是否指定材料
|
||||
if (_modelDataExtend->isMaterialSetted(id)) // 是否指定材料
|
||||
{
|
||||
int pid = _modelDataExtend->getPropertyID(id);
|
||||
auto m = _modelDataExtend->getElePropertyByID(pid);
|
||||
int materialid = _modelDataExtend->getMaterialID(id);
|
||||
Material::Material* m = materialData->getMaterialByID(materialid);
|
||||
if (!m)
|
||||
continue;
|
||||
QString mname = m->getName();
|
||||
name.append(QString("-[%1]").arg(mname));
|
||||
}
|
||||
|
||||
QTreeWidgetItem *temp = new QTreeWidgetItem(/*_ComponentRootItem, */ TreeItemType::ProjectComponentChild);
|
||||
QTreeWidgetItem* temp =
|
||||
new QTreeWidgetItem(/*_ComponentRootItem, */ TreeItemType::ProjectComponentChild);
|
||||
temp->setIcon(0, QIcon(icon));
|
||||
temp->setText(0, name);
|
||||
temp->setData(0, Qt::UserRole, id);
|
||||
|
@ -374,9 +356,8 @@ namespace ProjectTree
|
|||
icon = "://QUI/icon/family.png";
|
||||
}
|
||||
|
||||
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem, TreeItemType::ProjectComponentChild);
|
||||
temp->setIcon(0, QIcon(icon));
|
||||
temp->setText(0, name);
|
||||
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem,
|
||||
TreeItemType::ProjectComponentChild); temp->setIcon(0, QIcon(icon)); temp->setText(0, name);
|
||||
temp->setData(0, Qt::UserRole, id);
|
||||
}
|
||||
}
|
||||
|
@ -401,58 +382,40 @@ namespace ProjectTree
|
|||
name.append(QString("-[%1]").arg(m->getName()));
|
||||
}
|
||||
|
||||
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem, TreeItemType::ProjectComponentChild);
|
||||
temp->setIcon(0, QIcon("://QUI/icon/geometry.png"));
|
||||
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem,
|
||||
TreeItemType::ProjectComponentChild); temp->setIcon(0, QIcon("://QUI/icon/geometry.png"));
|
||||
temp->setText(0, name);
|
||||
temp->setData(0, Qt::UserRole, GCID);
|
||||
}
|
||||
}*/
|
||||
|
||||
void ProjectTreeWithBasicNode::updatePropTree()
|
||||
{
|
||||
if (_propertyRootItem == nullptr)
|
||||
return;
|
||||
_propertyRootItem->takeChildren();
|
||||
const int np = _modelDataExtend->getElePropCount();
|
||||
for (int i = 0; i < np; ++i)
|
||||
{
|
||||
auto prop = _modelDataExtend->getElePropertyAt(i);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(_propertyRootItem, TreeItemType::ProjectElePropertyChild);
|
||||
item->setText(0, prop->getName());
|
||||
item->setData(0, Qt::UserRole, prop->getID());
|
||||
}
|
||||
_propertyRootItem->setExpanded(true);
|
||||
}
|
||||
|
||||
void ProjectTreeWithBasicNode::updateBCSubTree()
|
||||
{
|
||||
if (_boundaryConditionItem == nullptr)
|
||||
return;
|
||||
_boundaryConditionItem->takeChildren();
|
||||
const int nBC = _modelDataExtend->getBCCount();
|
||||
for (int i = 0; i < nBC; ++i)
|
||||
{
|
||||
for (int i = 0; i < nBC; ++i) {
|
||||
QString icon;
|
||||
BCBase::BCBase* bc = _modelDataExtend->getBCAt(i);
|
||||
if (bc == nullptr)
|
||||
continue;
|
||||
BCBase::BCType ty = bc->getBCType();
|
||||
QString stype;
|
||||
if (ty == BCBase::UserDef)
|
||||
{
|
||||
if (ty == BCBase::UserDef) {
|
||||
stype = ((BCBase::BCUserDef*)bc)->getName();
|
||||
QString sicon = ((BCBase::BCUserDef*)bc)->getIcon();
|
||||
icon = qApp->applicationDirPath() + "/../ConfigFiles/Icon/" + sicon;
|
||||
bc->appendProperty("BCType", stype);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
stype = BCBase::BCTypeToString(ty);
|
||||
icon = BCBase::BCIconByType(ty);
|
||||
}
|
||||
QString cpName = bc->getComponentName();
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(_boundaryConditionItem, TreeItemType::ProjectBoundaryCondationChild);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(
|
||||
_boundaryConditionItem, TreeItemType::ProjectBoundaryCondationChild);
|
||||
QString text = QString("%1 @ %2").arg(stype).arg(cpName);
|
||||
item->setText(0, text);
|
||||
item->setIcon(0, QIcon(icon));
|
||||
|
@ -466,8 +429,7 @@ namespace ProjectTree
|
|||
_monitorRootItem->takeChildren();
|
||||
QList<ConfigOption::PostCurve*> curvelist = _modelDataExtend->getMonitorCurves();
|
||||
// qDebug() << curvelist.size();
|
||||
for (int i = 0; i < curvelist.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < curvelist.size(); ++i) {
|
||||
ConfigOption::PostCurve* c = curvelist.at(i);
|
||||
QString text = c->getDescribe();
|
||||
QTreeWidgetItem* tempitem = new QTreeWidgetItem(_monitorRootItem, ProjectMonitorChild);
|
||||
|
@ -482,20 +444,17 @@ namespace ProjectTree
|
|||
_postVectorItem->takeChildren();
|
||||
// QStringList d2v = _modelDataExtend->getPlot2DVariable();
|
||||
QList<ConfigOption::PostCurve*> d2v = _modelDataExtend->getPlotCurves();
|
||||
for (int i = 0; i < d2v.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < d2v.size(); ++i) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(_post2DItem, ProJectPost2DGraphChild);
|
||||
QString text = d2v.at(i)->getDescribe();
|
||||
item->setText(0, text);
|
||||
item->setIcon(0, QIcon("://QUI/icon/curve.png"));
|
||||
}
|
||||
QStringList scalarv = _modelDataExtend->getScalarVariable();
|
||||
for (int i = 0; i < scalarv.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < scalarv.size(); ++i) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(_postCounterItem, ProjectPostCounterChild);
|
||||
QString text = scalarv.at(i);
|
||||
if (text.endsWith("_cell000"))
|
||||
{
|
||||
if (text.endsWith("_cell000")) {
|
||||
text.replace("_cell000", " @ Cell");
|
||||
}
|
||||
else
|
||||
|
@ -504,12 +463,10 @@ namespace ProjectTree
|
|||
item->setText(0, text);
|
||||
}
|
||||
QStringList vectorv = _modelDataExtend->getVectorVariable();
|
||||
for (int i = 0; i < vectorv.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < vectorv.size(); ++i) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(_postVectorItem, ProjectPostVectorChild);
|
||||
QString text = vectorv.at(i);
|
||||
if (text.endsWith("_cell000"))
|
||||
{
|
||||
if (text.endsWith("_cell000")) {
|
||||
text.replace("_cell000", " @ Cell");
|
||||
}
|
||||
else
|
||||
|
@ -531,11 +488,9 @@ namespace ProjectTree
|
|||
|
||||
QTreeWidgetItem* item{};
|
||||
int childCount = _ComponentRootItem->childCount();
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
QTreeWidgetItem* tmp = _ComponentRootItem->child(i);
|
||||
if (tmp->data(0, Qt::UserRole).toInt() == cpID)
|
||||
{
|
||||
if (tmp->data(0, Qt::UserRole).toInt() == cpID) {
|
||||
item = tmp;
|
||||
break;
|
||||
}
|
||||
|
@ -546,8 +501,7 @@ namespace ProjectTree
|
|||
|
||||
QList<QTreeWidgetItem*> items;
|
||||
childCount = _boundaryConditionItem->childCount();
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
QTreeWidgetItem* item = _boundaryConditionItem->child(i);
|
||||
if (item->data(0, Qt::UserRole).toInt() == cpID)
|
||||
items << item;
|
||||
|
@ -570,16 +524,14 @@ namespace ProjectTree
|
|||
QTreeWidgetItem* item{};
|
||||
QString cpName = component->getName();
|
||||
int childCount = _ComponentRootItem->childCount();
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
item = _ComponentRootItem->child(i);
|
||||
if (item->data(0, Qt::UserRole).toInt() != cpID)
|
||||
continue;
|
||||
QString oldText = item->text(0);
|
||||
if (!oldText.contains("-["))
|
||||
item->setText(0, cpName);
|
||||
else
|
||||
{
|
||||
else {
|
||||
int index = oldText.lastIndexOf("-[");
|
||||
QString right = oldText.right(oldText.size() - index);
|
||||
QString newText = cpName + right;
|
||||
|
@ -589,8 +541,7 @@ namespace ProjectTree
|
|||
}
|
||||
|
||||
childCount = _boundaryConditionItem->childCount();
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
for (int i = 0; i < childCount; ++i) {
|
||||
item = _boundaryConditionItem->child(i);
|
||||
if (item->data(0, Qt::UserRole).toInt() != cpID)
|
||||
continue;
|
||||
|
@ -609,37 +560,29 @@ namespace ProjectTree
|
|||
|
||||
void ProjectTreeWithBasicNode::removeItem()
|
||||
{
|
||||
// TreeItemType type = (TreeItemType)_currentItem->type();
|
||||
if (_currentItem->type() == ProjectComponentChild)
|
||||
{
|
||||
TreeItemType type = (TreeItemType)_currentItem->type();
|
||||
if (_currentItem->type() == ProjectComponentChild) {
|
||||
int index = _ComponentRootItem->indexOfChild(_currentItem);
|
||||
if (_data->isComponentUsed(index))
|
||||
{
|
||||
if (QMessageBox::Yes != QMessageBox::warning(_mainWindow, tr("Warning"), tr("This Set has been used, still remove?"), QMessageBox::Yes, QMessageBox::No))
|
||||
if (_data->isComponentUsed(index)) {
|
||||
if (QMessageBox::Yes
|
||||
!= QMessageBox::warning(_mainWindow, tr("Warning"),
|
||||
tr("This Set has been used, still remove?"),
|
||||
QMessageBox::Yes, QMessageBox::No))
|
||||
return;
|
||||
}
|
||||
_modelDataExtend->removeComponentAt(index);
|
||||
updateComponentSubTree();
|
||||
updateBCSubTree();
|
||||
}
|
||||
else if (_currentItem->type() == ProjectElePropertyChild)
|
||||
{
|
||||
int index = _propertyRootItem->indexOfChild(_currentItem);
|
||||
_data->removeElePropAt(index);
|
||||
updatePropTree();
|
||||
}
|
||||
else if (_currentItem->type() == ProjectBoundaryCondationChild)
|
||||
{
|
||||
else if (_currentItem->type() == ProjectBoundaryCondationChild) {
|
||||
int index = _boundaryConditionItem->indexOfChild(_currentItem);
|
||||
_modelDataExtend->removeBCAt(index);
|
||||
updateBCSubTree();
|
||||
}
|
||||
else if (_currentItem->type() == ProjectReportChild)
|
||||
{
|
||||
else if (_currentItem->type() == ProjectReportChild) {
|
||||
int index = _reportItem->indexOfChild(_currentItem);
|
||||
RemoveReportDialog dlg(_mainWindow);
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
QString fileName = _modelDataExtend->getReportAt(index);
|
||||
QFile f(fileName);
|
||||
if (f.exists() && dlg.isRemoveCompletely())
|
||||
|
@ -648,39 +591,29 @@ namespace ProjectTree
|
|||
updateReportTree();
|
||||
}
|
||||
}
|
||||
else if (_currentItem->type() == ProJectPost2DGraphChild)
|
||||
{
|
||||
else if (_currentItem->type() == ProJectPost2DGraphChild) {
|
||||
const int index = _post2DItem->indexOfChild(_currentItem);
|
||||
QString name = _currentItem->text(0);
|
||||
qDebug() << name;
|
||||
_modelDataExtend->removePlotCurve(index);
|
||||
updatePostTree();
|
||||
auto p2d = _modelDataExtend->getPost2DWindow();
|
||||
if (p2d != nullptr)
|
||||
{
|
||||
if (p2d != nullptr) {
|
||||
p2d->removeCurve(name);
|
||||
}
|
||||
}
|
||||
else if (_currentItem->type() == ProjectPostCounterChild)
|
||||
{
|
||||
else if (_currentItem->type() == ProjectPostCounterChild) {
|
||||
const int index = _postCounterItem->indexOfChild(_currentItem);
|
||||
_modelDataExtend->removeScalarVariable(index);
|
||||
updatePostTree();
|
||||
}
|
||||
else if (_currentItem->type() == ProjectPostVectorChild)
|
||||
{
|
||||
else if (_currentItem->type() == ProjectPostVectorChild) {
|
||||
const int index = _postVectorItem->indexOfChild(_currentItem);
|
||||
_modelDataExtend->removeVectorVariable(index);
|
||||
updatePostTree();
|
||||
}
|
||||
emit disPlayProp(nullptr);
|
||||
}
|
||||
void ProjectTreeWithBasicNode::addEleProperty()
|
||||
{
|
||||
AddPropDialog dlg(_mainWindow, _modelDataExtend);
|
||||
if (QDialog::Accepted == dlg.exec())
|
||||
updatePropTree();
|
||||
}
|
||||
void ProjectTreeWithBasicNode::createReport()
|
||||
{
|
||||
// _modelDataExtend->appendReport("D:/test.docx");
|
||||
|
@ -697,21 +630,17 @@ namespace ProjectTree
|
|||
void ProjectTreeWithBasicNode::singleClicked()
|
||||
{
|
||||
TreeItemType type = (TreeItemType)_currentItem->type();
|
||||
if (type == ProjectComponentChild)
|
||||
{
|
||||
if (type == ProjectComponentChild) {
|
||||
const int index = _ComponentRootItem->indexOfChild(_currentItem);
|
||||
if (index >= 0)
|
||||
{
|
||||
if (index >= 0) {
|
||||
emit clearAllHighLightSig();
|
||||
int id = _modelDataExtend->getComponentIDList().at(index);
|
||||
auto ms = MeshData::MeshData::getInstance()->getMeshSetByID(id);
|
||||
if (ms)
|
||||
{
|
||||
if (ms) {
|
||||
emit highLightSet(ms);
|
||||
emit disPlayProp(ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
auto gc = Geometry::GeometryData::getInstance()->getGeoComponentByID(id);
|
||||
if (!gc)
|
||||
return;
|
||||
|
@ -720,17 +649,7 @@ namespace ProjectTree
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (type == ProjectElePropertyChild)
|
||||
{
|
||||
const int index = _propertyRootItem->indexOfChild(_currentItem);
|
||||
if (index >= 0)
|
||||
{
|
||||
auto prop = _modelDataExtend->getElePropertyAt(index);
|
||||
emit disPlayProp(prop);
|
||||
}
|
||||
}
|
||||
else if (type == ProjectBoundaryCondationChild)
|
||||
{
|
||||
else if (type == ProjectBoundaryCondationChild) {
|
||||
emit clearAllHighLightSig();
|
||||
const int index = _boundaryConditionItem->indexOfChild(_currentItem);
|
||||
BCBase::BCBase* bc = _modelDataExtend->getBCAt(index);
|
||||
|
@ -739,68 +658,57 @@ namespace ProjectTree
|
|||
DataProperty::ComponentBase* component = bc->getComponent();
|
||||
if (!component)
|
||||
return;
|
||||
if (component->getComponentType() == DataProperty::ComponentType::MESH)
|
||||
{
|
||||
if (component->getComponentType() == DataProperty::ComponentType::MESH) {
|
||||
auto set = dynamic_cast<MeshData::MeshSet*>(component);
|
||||
emit highLightSet(set);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
auto gc = dynamic_cast<Geometry::GeoComponent*>(component);
|
||||
emit highLightGeoComponent(gc);
|
||||
}
|
||||
}
|
||||
else if (type == ProjectSimulationSetting)
|
||||
{
|
||||
else if (type == ProjectSimulationSetting) {
|
||||
ModelData::SimlutationSettingBase* s = _data->getSimlutationSetting();
|
||||
emit disPlayProp(s);
|
||||
}
|
||||
else if (type == ProjectSolver)
|
||||
{
|
||||
else if (type == ProjectSolver) {
|
||||
ModelData::SolverSettingBase* s = _data->getSolverSetting();
|
||||
emit disPlayProp(s);
|
||||
}
|
||||
else if (type == ProjectMonitorChild)
|
||||
{
|
||||
else if (type == ProjectMonitorChild) {
|
||||
const int index = _monitorRootItem->indexOfChild(_currentItem);
|
||||
// QList<DataProperty::DataBase*> mon = _modelDataExtend->getMonitorList();
|
||||
emit disPlayProp(_modelDataExtend->getMonitorCurveAt(index));
|
||||
if (_realTimeWin != nullptr)
|
||||
{
|
||||
if (_realTimeWin != nullptr) {
|
||||
QString name = _currentItem->text(0);
|
||||
_realTimeWin->viewRealTimeWindow(name);
|
||||
}
|
||||
}
|
||||
else if (type == ProJectPost2DGraphChild)
|
||||
{
|
||||
else if (type == ProJectPost2DGraphChild) {
|
||||
const int index = _post2DItem->indexOfChild(_currentItem);
|
||||
ConfigOption::PostCurve* temp = _modelDataExtend->getPlotCurves().at(index);
|
||||
emit disPlayProp(temp);
|
||||
QString text = _currentItem->text(0);
|
||||
viewPlot2D(text);
|
||||
}
|
||||
else if (type == ProjectPostCounterChild)
|
||||
{
|
||||
else if (type == ProjectPostCounterChild) {
|
||||
QString text = _currentItem->text(0);
|
||||
text.remove(" @ Node");
|
||||
text.replace(" @ Cell", "_cell000");
|
||||
viewCounter(text);
|
||||
}
|
||||
else if (type == ProjectPostVectorChild)
|
||||
{
|
||||
else if (type == ProjectPostVectorChild) {
|
||||
QString text = _currentItem->text(0);
|
||||
text.remove(" @ Node");
|
||||
text.replace(" @ Cell", "_cell000");
|
||||
viewVector(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
emit clearAllHighLightSig();
|
||||
emit disPlayProp(nullptr);
|
||||
}
|
||||
const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1;
|
||||
if (index >= 0)
|
||||
{
|
||||
if (index >= 0) {
|
||||
ConfigOption::TreeItem* item = _itemList.at(index);
|
||||
const int id = item->getDataID();
|
||||
DataProperty::DataBase* d = _modelDataExtend->getConfigData(id);
|
||||
|
@ -811,13 +719,10 @@ namespace ProjectTree
|
|||
|
||||
void ProjectTreeWithBasicNode::doubleClicked()
|
||||
{
|
||||
if (_treeType == 1)
|
||||
{
|
||||
if (_treeType == 1) {
|
||||
TreeItemType itemType = (TreeItemType)_currentItem->type();
|
||||
switch (itemType)
|
||||
{
|
||||
case TreeItemType::ProjectSimulationSettingChild:
|
||||
{
|
||||
switch (itemType) {
|
||||
case TreeItemType::ProjectSimulationSettingChild: {
|
||||
// NodeParameterDlg dlg(_treeType, _currentItem->text(0), _mainWindow);
|
||||
break;
|
||||
}
|
||||
|
@ -831,32 +736,32 @@ namespace ProjectTree
|
|||
return;
|
||||
_reportItem->takeChildren();
|
||||
const int nReport = _modelDataExtend->getReportCount();
|
||||
for (int i = 0; i < nReport; ++i)
|
||||
{
|
||||
for (int i = 0; i < nReport; ++i) {
|
||||
QString report = _modelDataExtend->getReportAt(i);
|
||||
QFileInfo file(report);
|
||||
if (!file.exists())
|
||||
continue;
|
||||
QString text = file.fileName();
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(_reportItem, TreeItemType::ProjectReportChild);
|
||||
QTreeWidgetItem* item =
|
||||
new QTreeWidgetItem(_reportItem, TreeItemType::ProjectReportChild);
|
||||
item->setText(0, text);
|
||||
}
|
||||
_reportItem->setExpanded(true);
|
||||
}
|
||||
void ProjectTreeWithBasicNode::assignProperty()
|
||||
void ProjectTreeWithBasicNode::assignMaterial()
|
||||
{
|
||||
AssignPropertyDialog dlg(_mainWindow, _modelDataExtend);
|
||||
AssignMaterialDialog dlg(_mainWindow, _modelDataExtend);
|
||||
if (dlg.exec() == QDialog::Accepted)
|
||||
this->updateComponentSubTree();
|
||||
}
|
||||
void ProjectTreeWithBasicNode::d2PlotContextMenu(QMenu* menu)
|
||||
{
|
||||
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfig* option =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
if (info == nullptr)
|
||||
return;
|
||||
if (_postMapper != nullptr)
|
||||
{
|
||||
if (_postMapper != nullptr) {
|
||||
delete _postMapper;
|
||||
_postMapper = nullptr;
|
||||
}
|
||||
|
@ -864,8 +769,7 @@ namespace ProjectTree
|
|||
_postMapper = new QSignalMapper(this);
|
||||
// QStringList d2Variables = info->get2DVariable();
|
||||
QList<ConfigOption::PostCurve*> curlist = info->getCurveList();
|
||||
for (int i = 0; i < curlist.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < curlist.size(); ++i) {
|
||||
QString text = curlist.at(i)->getDescribe();
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
|
@ -877,12 +781,12 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeWithBasicNode::counterContextMenu(QMenu* menu)
|
||||
{
|
||||
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfig* option =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
if (info == nullptr)
|
||||
return;
|
||||
if (_postMapper != nullptr)
|
||||
{
|
||||
if (_postMapper != nullptr) {
|
||||
delete _postMapper;
|
||||
_postMapper = nullptr;
|
||||
}
|
||||
|
@ -899,8 +803,7 @@ namespace ProjectTree
|
|||
// if (scalarVariables.at(0) != "")
|
||||
// {
|
||||
|
||||
for (int i = 0; i < scalarVariables.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < scalarVariables.size(); ++i) {
|
||||
QString text = scalarVariables.at(i);
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
|
@ -914,8 +817,7 @@ namespace ProjectTree
|
|||
// if (scalarVariables.at(0) != "")
|
||||
// {
|
||||
|
||||
for (int i = 0; i < scalarVariables.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < scalarVariables.size(); ++i) {
|
||||
QString text = scalarVariables.at(i);
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
|
@ -928,12 +830,12 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeWithBasicNode::vectorContextMenu(QMenu* menu)
|
||||
{
|
||||
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfig* option =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
if (info == nullptr)
|
||||
return;
|
||||
if (_postMapper != nullptr)
|
||||
{
|
||||
if (_postMapper != nullptr) {
|
||||
delete _postMapper;
|
||||
_postMapper = nullptr;
|
||||
}
|
||||
|
@ -950,8 +852,7 @@ namespace ProjectTree
|
|||
// if (vectorVariables.at(0) != "")
|
||||
// {
|
||||
|
||||
for (int i = 0; i < vectorVariables.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < vectorVariables.size(); ++i) {
|
||||
QString text = vectorVariables.at(i);
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
|
@ -964,8 +865,7 @@ namespace ProjectTree
|
|||
// if (vectorVariables.at(0) != "")
|
||||
// {
|
||||
|
||||
for (int i = 0; i < vectorVariables.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < vectorVariables.size(); ++i) {
|
||||
QString text = vectorVariables.at(i);
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
|
@ -981,15 +881,13 @@ namespace ProjectTree
|
|||
{
|
||||
auto p2d = _modelDataExtend->getPost2DWindow();
|
||||
auto p3d = _modelDataExtend->getPost3DWindow();
|
||||
if (p2d == w)
|
||||
{
|
||||
if (p2d == w) {
|
||||
// _post2DWindow = nullptr;
|
||||
_modelDataExtend->setPost2DWindow(nullptr);
|
||||
_modelDataExtend->clearPlotCurve();
|
||||
this->updatePostTree();
|
||||
}
|
||||
if (p3d == w)
|
||||
{
|
||||
if (p3d == w) {
|
||||
// _post3DWindow = nullptr;
|
||||
_modelDataExtend->setPost3DWindow(nullptr);
|
||||
_modelDataExtend->clear3DVariable();
|
||||
|
@ -1011,35 +909,35 @@ namespace ProjectTree
|
|||
{
|
||||
auto p2d = _modelDataExtend->getPost2DWindow();
|
||||
|
||||
if (p2d == nullptr)
|
||||
{
|
||||
// ConfigOption::PostConfig* option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
if (p2d == nullptr) {
|
||||
// ConfigOption::PostConfig* option =
|
||||
// ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
// ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
p2d = new Post::Post2DWindowInterface(_mainWindow, _data->getID());
|
||||
_modelDataExtend->setPost2DWindow(p2d);
|
||||
// QStringList filenames = info->getPost2DFile();
|
||||
QStringList filenames = _modelDataExtend->getAbsolutePost2DFiles();
|
||||
//
|
||||
// for (int i = 0; i < filenames.size(); ++i)
|
||||
// {
|
||||
// QString fileName = filenames.at(i);
|
||||
// // QString file = _data->getPath() + "/Result/" + fileName;
|
||||
// // qDebug() << fileName;
|
||||
// p2d->openfile(fileName);
|
||||
// }
|
||||
|
||||
for (int i = 0; i < filenames.size(); ++i) {
|
||||
QString fileName = filenames.at(i);
|
||||
// QString file = _data->getPath() + "/Result/" + fileName;
|
||||
// qDebug() << fileName;
|
||||
p2d->openfile(fileName);
|
||||
}
|
||||
}
|
||||
emit openPostWindowSig(p2d);
|
||||
|
||||
if (_modelDataExtend->isPostCurveExist(variable))
|
||||
return;
|
||||
|
||||
ConfigOption::PostConfig *postinfo = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfig* postinfo =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = postinfo->getPostConfigInfo(_treeType);
|
||||
ConfigOption::PostCurve* curve = info->getCurveByName(variable);
|
||||
ConfigOption::PostCurve* newcurve = new ConfigOption::PostCurve;
|
||||
QString path = _modelDataExtend->getPath() + "/Result/";
|
||||
newcurve->copy(curve);
|
||||
p2d->addCurve(curve->getDescribe(), path + curve->getFile(), curve->getXVariable(), curve->getYVariable());
|
||||
p2d->addCurve(curve->getDescribe(), curve->getFile(), curve->getXVariable(),
|
||||
curve->getYVariable());
|
||||
_modelDataExtend->apppendPlotCurve(newcurve);
|
||||
this->updatePostTree();
|
||||
|
||||
|
@ -1057,9 +955,9 @@ namespace ProjectTree
|
|||
{
|
||||
auto p3d = _modelDataExtend->getPost3DWindow();
|
||||
|
||||
if (p3d == nullptr)
|
||||
{
|
||||
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
if (p3d == nullptr) {
|
||||
ConfigOption::PostConfig* option =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
QString fileName = info->getPost3DFile();
|
||||
QString file = _data->getPath() + "/Result/" + fileName;
|
||||
|
@ -1070,8 +968,7 @@ namespace ProjectTree
|
|||
}
|
||||
emit openPostWindowSig(p3d);
|
||||
QStringList variablelist = _modelDataExtend->getScalarVariable();
|
||||
if (!variablelist.contains(variable))
|
||||
{
|
||||
if (!variablelist.contains(variable)) {
|
||||
_modelDataExtend->appendScalarVariable(variable);
|
||||
this->updatePostTree();
|
||||
}
|
||||
|
@ -1095,9 +992,9 @@ namespace ProjectTree
|
|||
void ProjectTreeWithBasicNode::viewVectorPost(QString variable)
|
||||
{
|
||||
auto p3d = _modelDataExtend->getPost3DWindow();
|
||||
if (p3d == nullptr)
|
||||
{
|
||||
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
if (p3d == nullptr) {
|
||||
ConfigOption::PostConfig* option =
|
||||
ConfigOption::ConfigOption::getInstance()->getPostConfig();
|
||||
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
|
||||
QString fileName = info->getPost3DFile();
|
||||
QString file = _data->getPath() + "/Result/" + fileName;
|
||||
|
@ -1108,8 +1005,7 @@ namespace ProjectTree
|
|||
}
|
||||
emit openPostWindowSig(p3d);
|
||||
QStringList variablelist = _modelDataExtend->getVectorVariable();
|
||||
if (!variablelist.contains(variable))
|
||||
{
|
||||
if (!variablelist.contains(variable)) {
|
||||
_modelDataExtend->appendVectorVariable(variable);
|
||||
this->updatePostTree();
|
||||
}
|
||||
|
@ -1125,19 +1021,16 @@ namespace ProjectTree
|
|||
QStringList files; //= _modelDataExtend->getMonitorNameList();
|
||||
if (files.size() > 1)
|
||||
return;
|
||||
for (int i = 0; i < files.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < files.size(); ++i) {
|
||||
QString fi = files.at(i);
|
||||
QFile f(fi);
|
||||
if (!f.exists())
|
||||
{
|
||||
if (!f.exists()) {
|
||||
QMessageBox::warning(nullptr, tr("Warning"), tr("File %1 is not exist").arg(fi));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_realTimeWin == nullptr)
|
||||
{
|
||||
if (_realTimeWin == nullptr) {
|
||||
_realTimeWin = new Post::RealTimeWindowBase(_mainWindow, _data->getID());
|
||||
emit openRealTimeWin(_realTimeWin, _data->getID());
|
||||
}
|
||||
|
@ -1153,8 +1046,7 @@ namespace ProjectTree
|
|||
return _modelDataExtend->getSolverSetting();
|
||||
|
||||
const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1;
|
||||
if (index >= 0)
|
||||
{
|
||||
if (index >= 0) {
|
||||
ConfigOption::TreeItem* item = _itemList.at(index);
|
||||
const int id = item->getDataID();
|
||||
DataProperty::DataBase* d = _modelDataExtend->getConfigData(id);
|
||||
|
@ -1202,15 +1094,15 @@ namespace ProjectTree
|
|||
Geometry::GeometryData* geodata = Geometry::GeometryData::getInstance();
|
||||
|
||||
QList<int> geoIDs = _modelDataExtend->getGeometryList();
|
||||
for (int i = 0; i < geoIDs.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < geoIDs.size(); ++i) {
|
||||
int id = geoIDs.at(i);
|
||||
Geometry::GeometrySet* set = geodata->getGeometrySetByID(id);
|
||||
if (set == nullptr)
|
||||
continue;
|
||||
QString name = set->getName();
|
||||
QString icon = "://QUI/icon/geometry.png";
|
||||
QTreeWidgetItem *temp = new QTreeWidgetItem(_geometryRootItem, TreeItemType::ProjectGeometryChild);
|
||||
QTreeWidgetItem* temp =
|
||||
new QTreeWidgetItem(_geometryRootItem, TreeItemType::ProjectGeometryChild);
|
||||
temp->setIcon(0, QIcon(icon));
|
||||
temp->setText(0, name);
|
||||
temp->setData(0, Qt::UserRole, id);
|
||||
|
@ -1218,4 +1110,4 @@ namespace ProjectTree
|
|||
_geometryRootItem->setExpanded(true);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file ProjectTreeWithBasicNode.h
|
||||
* @brief 新建算例时默认树形菜单
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:36
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _PROJECTTREEWITHBASICNODE_H_
|
||||
#ifndef _PROJECTTREEWITHBASICNODE_H_
|
||||
#define _PROJECTTREEWITHBASICNODE_H_
|
||||
|
||||
#include "projectTreeBase.h"
|
||||
|
@ -72,7 +50,6 @@ namespace ProjectTree
|
|||
virtual void updateComponentSubTree();
|
||||
// virtual void updateMeshSetSubTree();
|
||||
// virtual void updateGeoComponentTree();
|
||||
virtual void updatePropTree();
|
||||
virtual void updateBCSubTree();
|
||||
virtual void updateReportTree();
|
||||
virtual void updateMonitorTree();
|
||||
|
@ -108,10 +85,9 @@ namespace ProjectTree
|
|||
virtual void importGeometry();
|
||||
virtual void importComponents();
|
||||
virtual void removeItem();
|
||||
virtual void addEleProperty();
|
||||
virtual void addBC();
|
||||
virtual void createReport();
|
||||
virtual void assignProperty();
|
||||
virtual void assignMaterial();
|
||||
virtual void viewRealTimeWindow();
|
||||
virtual void viewPlot2D(QString variable);
|
||||
virtual void viewCounter(QString variable);
|
||||
|
@ -121,7 +97,6 @@ namespace ProjectTree
|
|||
|
||||
protected:
|
||||
QTreeWidgetItem* _geometryRootItem{};
|
||||
QTreeWidgetItem *_propertyRootItem{};
|
||||
QTreeWidgetItem* _ComponentRootItem{};
|
||||
QTreeWidgetItem* _simulationSettingItem{};
|
||||
QTreeWidgetItem* _boundaryConditionItem{};
|
||||
|
@ -148,6 +123,7 @@ namespace ProjectTree
|
|||
QList<QTreeWidgetItem*> _ComponentItems;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
#include <QTreeWidget>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTime>
|
||||
#include "ConfigOptions/TreeItemData.h"
|
||||
#include "ConfigOptions/ProjectTreeInfo.h"
|
||||
#include "MainWindow/MainWindow.h"
|
||||
#include "mainWindow/mainWindow.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "Settings/BusAPI.h"
|
||||
#include "settings/busAPI.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
@ -34,8 +34,7 @@ namespace ProjectTree
|
|||
}
|
||||
ProjectTreeBase::~ProjectTreeBase()
|
||||
{
|
||||
if (_root == nullptr)
|
||||
return;
|
||||
if (_root == nullptr) return;
|
||||
_root->takeChildren();
|
||||
_itemList.clear();
|
||||
}
|
||||
|
@ -66,16 +65,14 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeBase::createTree(QTreeWidgetItem* phyroot, GUI::MainWindow* mainwindow)
|
||||
{
|
||||
if (_data == nullptr)
|
||||
return;
|
||||
if (_data == nullptr) return;
|
||||
_mainWindow = mainwindow;
|
||||
// QTreeWidgetItem* root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
|
||||
initBasicNode(phyroot);
|
||||
QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||
double time = _data->getSolveTime();
|
||||
if (time > 0)
|
||||
_solveStatus = Finished;
|
||||
if (time > 0) _solveStatus = Finished;
|
||||
_data->setOutputFileName(_outputFile);
|
||||
|
||||
int n = _itemList.size();
|
||||
|
@ -83,11 +80,9 @@ namespace ProjectTree
|
|||
{
|
||||
QTreeWidgetItem* parent = _root;
|
||||
ConfigOption::TreeItem* item = _itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
if (item == nullptr) continue;
|
||||
QString sparent = item->getParent();
|
||||
if (_textItemHash.contains(sparent))
|
||||
parent = _textItemHash.value(sparent);
|
||||
if (_textItemHash.contains(sparent)) parent = _textItemHash.value(sparent);
|
||||
QTreeWidgetItem* treeitem = new QTreeWidgetItem(parent, item->getType());
|
||||
treeitem->setData(0, Qt::UserRole + 1, i + 1); //留空0,标记为不是配置文件创建
|
||||
treeitem->setData(1, Qt::UserRole, item->getText()); //英文
|
||||
|
@ -95,8 +90,7 @@ namespace ProjectTree
|
|||
QString text = item->getText();
|
||||
if (lang == "Chinese")
|
||||
text = item->getChinese();
|
||||
if (text.isEmpty())
|
||||
text = item->getText();
|
||||
if (text.isEmpty()) text = item->getText();
|
||||
|
||||
treeitem->setText(0,text);
|
||||
QString sicon = item->getIcon();
|
||||
|
@ -109,20 +103,21 @@ namespace ProjectTree
|
|||
{
|
||||
QString s = _disableItems.at(i);
|
||||
auto item = _textItemHash.value(s);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
if (item == nullptr) continue;
|
||||
item->setHidden(true);
|
||||
}
|
||||
|
||||
}
|
||||
void ProjectTreeBase::initBasicNode(QTreeWidgetItem* phyroot)
|
||||
{
|
||||
_root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
_root->setFlags(_root->flags() | Qt::ItemIsEditable);
|
||||
_root->setIcon(0, QIcon(":/QUI/icon/physics.png"));
|
||||
// int id = _data->getID();
|
||||
int id = _data->getID();
|
||||
_root->setText(0, _data->getName()); //根据项目名称确定
|
||||
_root->setData(0, Qt::UserRole, _data->getID());
|
||||
_root->setExpanded(true);
|
||||
|
||||
}
|
||||
void ProjectTreeBase::on_MouseEvent(int eventType, QTreeWidgetItem* item)
|
||||
{
|
||||
|
@ -132,17 +127,10 @@ namespace ProjectTree
|
|||
|
||||
switch (eventType)
|
||||
{
|
||||
case 0:
|
||||
singleClicked();
|
||||
break;
|
||||
case 1:
|
||||
createContextMenu();
|
||||
break;
|
||||
case 2:
|
||||
doubleClicked();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0: singleClicked();break;
|
||||
case 1:createContextMenu();break;
|
||||
case 2:doubleClicked();break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
// void ProjectTreeBase::copy(ProjectTreeBase* tree)
|
||||
|
@ -177,6 +165,7 @@ namespace ProjectTree
|
|||
}
|
||||
_outputFile = info->getOutputFileName();
|
||||
_disableItems = info->getDisableItems();
|
||||
|
||||
}
|
||||
void ProjectTreeBase::setData(ModelData::ModelDataBase* data)
|
||||
{
|
||||
|
@ -204,6 +193,7 @@ namespace ProjectTree
|
|||
void ProjectTreeBase::singleClicked()
|
||||
{
|
||||
//qDebug() << "parent s";
|
||||
|
||||
}
|
||||
void ProjectTreeBase::doubleClicked()
|
||||
{
|
||||
|
@ -225,8 +215,7 @@ namespace ProjectTree
|
|||
{
|
||||
ConfigOption::TreeItem* treeItem = _itemList.at(itemindex - 1);
|
||||
const int n = treeItem->getContextMenuCount();
|
||||
if (n < 1)
|
||||
return;
|
||||
if (n < 1) return;
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QString menuText = treeItem->getContextMenuAt(i);
|
||||
|
@ -234,34 +223,31 @@ namespace ProjectTree
|
|||
switch (type)
|
||||
{
|
||||
case ProjectPostSetting:
|
||||
if (0 == i)
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
|
||||
if (0 == i) connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
|
||||
|
||||
break;
|
||||
case ProjectComponent:
|
||||
break;
|
||||
case ProjectSolver:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void ProjectTreeBase::updateTree()
|
||||
{
|
||||
|
||||
}
|
||||
void ProjectTreeBase::updateTreeByType(const TreeItemType type)
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
|
||||
}
|
||||
QList<QTreeWidgetItem*> ProjectTreeBase::getItemByType(const TreeItemType type,QTreeWidgetItem* root)
|
||||
{
|
||||
QList<QTreeWidgetItem*> items;
|
||||
if (root == nullptr)
|
||||
root = _root;
|
||||
if (root->type() == type)
|
||||
items.append(root);
|
||||
if (root == nullptr) root = _root;
|
||||
if (root->type() == type) items.append(root);
|
||||
const int n = root->childCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
|
@ -285,27 +271,21 @@ namespace ProjectTree
|
|||
{
|
||||
ModelData::ModelDataSingleton* s = ModelData::ModelDataSingleton::getinstance();
|
||||
int id = s->getModelIDByIndex(proIndex);
|
||||
if (id < 0)
|
||||
return;
|
||||
if (id != _data->getID())
|
||||
return;
|
||||
if (id < 0) return;
|
||||
if (id != _data->getID()) return;
|
||||
_solveStatus = Solving;
|
||||
if (_timer == nullptr)
|
||||
_timer = new QElapsedTimer;
|
||||
if (_timer == nullptr) _timer = new QTime;
|
||||
_timer->start();
|
||||
emit solveStatusChanged();
|
||||
}
|
||||
void ProjectTreeBase::solveFinished(int proid)
|
||||
{
|
||||
if (proid != _data->getID())
|
||||
return;
|
||||
if (proid != _data->getID()) return;
|
||||
_solveStatus = Finished;
|
||||
if (_timer == nullptr)
|
||||
return;
|
||||
if (_timer == nullptr) return;
|
||||
double time = _timer->elapsed();
|
||||
// qDebug() << time;
|
||||
delete _timer;
|
||||
_timer = nullptr;
|
||||
delete _timer; _timer = nullptr;
|
||||
_data->setSolveTime(time);
|
||||
emit solveStatusChanged();
|
||||
}
|
||||
|
@ -323,11 +303,9 @@ namespace ProjectTree
|
|||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem* item = itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
if (item == nullptr) continue;
|
||||
QString text = item->data(1, Qt::UserRole + 1).toString();
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
if (text.isEmpty()) continue;
|
||||
item->setText(0, text);
|
||||
}
|
||||
}
|
||||
|
@ -336,11 +314,9 @@ namespace ProjectTree
|
|||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem* item = itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
if (item == nullptr) continue;
|
||||
QString text = item->data(1, Qt::UserRole).toString();
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
if (text.isEmpty()) continue;
|
||||
item->setText(0, text);
|
||||
}
|
||||
}
|
||||
|
@ -357,6 +333,7 @@ namespace ProjectTree
|
|||
{
|
||||
if (id == _data->getID())
|
||||
_realTimeWin = w;
|
||||
|
||||
}
|
||||
void ProjectTreeBase::realTimeWindowClosed(Post::RealTimeWindowBase* w)
|
||||
{
|
||||
|
@ -374,4 +351,5 @@ namespace ProjectTree
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,25 +1,7 @@
|
|||
/**
|
||||
* @file projectTreeBase.h
|
||||
* @brief ProjectTreeBase
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:27
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
/******************
|
||||
ProjectTreeBase操作
|
||||
***************** */
|
||||
|
||||
#ifndef PROJECTTREE_H
|
||||
#define PROJECTTREE_H
|
||||
|
||||
|
@ -32,7 +14,7 @@
|
|||
#include "ProjectTreeAPI.h"
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class QElapsedTimer;
|
||||
class QTime;
|
||||
class QMenu;
|
||||
|
||||
namespace ModelData
|
||||
|
@ -62,6 +44,7 @@ namespace ConfigOption
|
|||
namespace ProjectTree
|
||||
{
|
||||
|
||||
|
||||
enum SolveStatus
|
||||
{
|
||||
UnSolved = 1,
|
||||
|
@ -77,11 +60,7 @@ namespace ProjectTree
|
|||
virtual ~ProjectTreeBase();
|
||||
//ProjectTree* copy();
|
||||
// void copy(ProjectTreeBase* tree);
|
||||
/**
|
||||
* @brief 从配置文件拷贝节点信息
|
||||
* @param info 节点
|
||||
* @since 2.5.0
|
||||
*/
|
||||
//从配置文件中拷贝信息
|
||||
void copy(ConfigOption::ProjectTreeInfo* info);
|
||||
void setOutputFileName(QString fileName);
|
||||
//设置名称
|
||||
|
@ -146,6 +125,7 @@ namespace ProjectTree
|
|||
//求解状态改变
|
||||
void solveStatusChanged();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void initBasicNode(QTreeWidgetItem* root);
|
||||
|
||||
|
@ -170,7 +150,7 @@ namespace ProjectTree
|
|||
QHash<QString, QTreeWidgetItem*> _textItemHash{};
|
||||
ModelData::ModelDataBase* _data{};
|
||||
SolveStatus _solveStatus{ UnSolved };
|
||||
QElapsedTimer *_timer{};
|
||||
QTime* _timer{};
|
||||
QString _outputFile{};
|
||||
QString _chinese{};
|
||||
QStringList _disableItems{};
|
||||
|
@ -179,4 +159,5 @@ namespace ProjectTree
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||
#-------关联C++库---------------
|
||||
import ControlPanel
|
||||
import ctypes
|
||||
import platform
|
||||
system = platform.system()
|
||||
|
@ -7,7 +6,7 @@ if system == "Windows":
|
|||
pre = "./"
|
||||
suff = ".dll"
|
||||
else:
|
||||
pre = "../lib/lib"
|
||||
pre = "./lib"
|
||||
suff = ".so"
|
||||
|
||||
libfile = ctypes.cdll.LoadLibrary
|
||||
|
@ -15,17 +14,15 @@ filename = pre+"ModelData"+suff
|
|||
|
||||
md = libfile(filename)
|
||||
|
||||
import ControlPanel
|
||||
#---------------------------------
|
||||
|
||||
#-------定义函数------------------
|
||||
|
||||
|
||||
def setProperty(modelID, strcpIDs, pid):
|
||||
def setMaterial(modelID, strcpIDs ,mid):
|
||||
strcpIDs = bytes(strcpIDs,encoding='utf-8')
|
||||
md.setProperty(modelID, strcpIDs, pid)
|
||||
md.setMaterial(modelID, strcpIDs ,mid)
|
||||
pass
|
||||
|
||||
|
||||
def importComponents(caseId,addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
|
||||
md.importComponents(caseId,addcomponentsId)
|
||||
|
@ -33,28 +30,23 @@ def importComponents(caseId, addcomponentsId):
|
|||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def importGeometry(caseId,addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
|
||||
md.importGeometry(caseId,addcomponentsId)
|
||||
ControlPanel.updateGeometrySubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def addBC(caseId,id,bctypetostring):
|
||||
bctypetostring = bytes(bctypetostring,encoding='utf-8')
|
||||
md.addBC(caseId,id,bctypetostring)
|
||||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def objValChanged(value,describe,stype):
|
||||
describe = bytes(describe,encoding='utf-8')
|
||||
stype = bytes(stype,encoding='utf-8')
|
||||
md.objValChanged(value,describe,stype)
|
||||
pass
|
||||
|
||||
|
||||
def setValue(caseId,svariable,stype,sValue):
|
||||
variable = bytes(svariable,encoding='utf-8')
|
||||
type = bytes(stype,encoding='utf-8')
|
||||
|
@ -62,10 +54,11 @@ def setValue(caseId, svariable, stype, sValue):
|
|||
md.setValue(caseId, variable, type, value)
|
||||
pass
|
||||
|
||||
|
||||
def setBCValue(caseId,index,svariable,stype,sValue):
|
||||
variable = bytes(svariable,encoding='utf-8')
|
||||
type = bytes(stype,encoding='utf-8')
|
||||
value = bytes(sValue,encoding='utf-8')
|
||||
md.setBCValue(caseId, index,variable, type, value)
|
||||
pass
|
||||
|
||||
|
|
@ -38,6 +38,10 @@ ShowPoint=true
|
|||
ShowEdge=true
|
||||
ShowSurface=true
|
||||
|
||||
[MeshDisplay]
|
||||
ShowNode=true
|
||||
ShowEdge=true
|
||||
ShowFace=true
|
||||
|
||||
[Plugins]
|
||||
Name=
|
Loading…
Reference in New Issue