修复组件无法赋材料的bug

master
禅元天道 2023-12-07 17:20:26 +08:00
parent 402a1ce747
commit d59a9d1885
28 changed files with 2470 additions and 3094 deletions

View File

@ -44,16 +44,16 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# (cmakeIDEQt) # (cmakeIDEQt)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#[[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}") message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}")
if (NOT DEFINED Qt5_DIR) if (NOT DEFINED Qt5_DIR)
if(FASTCAE_LINUX) if(FASTCAE_LINUX)
set(Qt5_DIR "/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE) set(Qt5_DIR "/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
elseif(FASTCAE_WIN) 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()
endif()]]
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #

View File

@ -64,10 +64,6 @@ enum TreeItemType
ProjectSimulationSettingGrandSon, ///< 仿真参数设置孙子节点 ProjectSimulationSettingGrandSon, ///< 仿真参数设置孙子节点
ProjectGeometry, ///< 几何根节点 ProjectGeometry, ///< 几何根节点
ProjectGeometryChild, ///< 几何子节点 ProjectGeometryChild, ///< 几何子节点
ProjectEleProperty,
ProjectElePropertyChild,
ProjectComponent, ///< 工程组件节点 ProjectComponent, ///< 工程组件节点
ProjectComponentChild, ///< 工程组件子节点 ProjectComponentChild, ///< 工程组件子节点
ProjectBoundaryCondation, ///< 工程边界条件节点 ProjectBoundaryCondation, ///< 工程边界条件节点

View File

@ -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;
}
}

View File

@ -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

View File

@ -43,7 +43,6 @@
#include <assert.h> #include <assert.h>
#include "MeshData/meshSingleton.h" #include "MeshData/meshSingleton.h"
#include "Geometry/geometryData.h" #include "Geometry/geometryData.h"
#include "elementProperty.h"
namespace ModelData namespace ModelData
{ {
@ -67,9 +66,6 @@ namespace ModelData
delete bc; delete bc;
} }
_bcList.clear(); _bcList.clear();
for (auto p : _elePropList)
delete p;
_elePropList.clear();
} }
void ModelDataBase::resetMaxID() void ModelDataBase::resetMaxID()
@ -601,43 +597,6 @@ namespace ModelData
return ids; 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() void ModelDataBase::generateParaInfo()
{ {
_solverSetting->generateParaInfo(); _solverSetting->generateParaInfo();

View File

@ -120,17 +120,6 @@ namespace ModelData
//设置需要关联的几何组件ID //设置需要关联的几何组件ID
//void setGeoComponentIDList(QList<int> ids); //void setGeoComponentIDList(QList<int> ids);
void appendEleProperty(ElementProperty* p);
int getElePropCount();
ElementProperty* getElePropertyAt(int index);
ElementProperty* getElePropertyByID(int id);
void removeElePropAt(int index);
//移除第index个组件 //移除第index个组件
virtual void removeComponentAt(int index); virtual void removeComponentAt(int index);
//获取关联的Kernal ID //获取关联的Kernal ID

View File

@ -81,22 +81,22 @@ namespace ModelData
QDomElement& ModelDataBaseExtend::writeToProjectFile(QDomDocument* doc, QDomElement* e) QDomElement& ModelDataBaseExtend::writeToProjectFile(QDomDocument* doc, QDomElement* e)
{ {
QDomElement element = ModelDataBase::writeToProjectFile(doc, e); QDomElement element = ModelDataBase::writeToProjectFile(doc, e);
QDomElement propele = doc->createElement("Property"); QDomElement materialele = doc->createElement("Material");
QList<int> setidlist = _setProperty.keys(); QList<int> setidlist = _setMaterial.keys();
for (int i = 0; i < setidlist.size(); ++i) for (int i = 0; i < setidlist.size(); ++i)
{ {
int setid = setidlist.at(i); int setid = setidlist.at(i);
int propid = _setProperty.value(setid); int materialid = _setMaterial.value(setid);
QDomElement mc = doc->createElement("PropInfo"); QDomElement mc = doc->createElement("MaterialInfo");
QDomAttr setattr = doc->createAttribute("ComponentID"); QDomAttr setattr = doc->createAttribute("ComponentID");
QDomAttr propattr = doc->createAttribute("PropID"); QDomAttr materialattr = doc->createAttribute("MaterialID");
setattr.setValue(QString::number(setid)); setattr.setValue(QString::number(setid));
propattr.setValue(QString::number(propid)); materialattr.setValue(QString::number(materialid));
mc.setAttributeNode(setattr); mc.setAttributeNode(setattr);
mc.setAttributeNode(propattr); mc.setAttributeNode(materialattr);
propele.appendChild(mc); materialele.appendChild(mc);
} }
element.appendChild(propele); element.appendChild(materialele);
QDomElement configele = doc->createElement("ConfigData"); QDomElement configele = doc->createElement("ConfigData");
QList<DataProperty::DataBase*> datalist = _configData.values(); QList<DataProperty::DataBase*> datalist = _configData.values();
@ -131,15 +131,15 @@ namespace ModelData
{ {
ModelDataBase::writeToProjectFile1(doc, e); ModelDataBase::writeToProjectFile1(doc, e);
QDomElement materialele = doc->createElement("Property"); QDomElement materialele = doc->createElement("Material");
QList<int> setidlist = _setProperty.keys(); QList<int> setidlist = _setMaterial.keys();
for (int i = 0; i < setidlist.size(); ++i) for (int i = 0; i < setidlist.size(); ++i)
{ {
int setid = setidlist.at(i); int setid = setidlist.at(i);
int materialid = _setProperty.value(setid); int materialid = _setMaterial.value(setid);
QDomElement mc = doc->createElement("PropInfo"); QDomElement mc = doc->createElement("MaterialInfo");
QDomAttr setattr = doc->createAttribute("ComponentID"); QDomAttr setattr = doc->createAttribute("ComponentID");
QDomAttr materialattr = doc->createAttribute("PropID"); QDomAttr materialattr = doc->createAttribute("MaterialID");
setattr.setValue(QString::number(setid)); setattr.setValue(QString::number(setid));
materialattr.setValue(QString::number(materialid)); materialattr.setValue(QString::number(materialid));
mc.setAttributeNode(setattr); mc.setAttributeNode(setattr);
@ -176,15 +176,15 @@ namespace ModelData
void ModelDataBaseExtend::readDataFromProjectFile(QDomElement* e) void ModelDataBaseExtend::readDataFromProjectFile(QDomElement* e)
{ {
ModelDataBase::readDataFromProjectFile(e); ModelDataBase::readDataFromProjectFile(e);
QDomNodeList materialList = e->elementsByTagName("PropInfo"); QDomNodeList materialList = e->elementsByTagName("MaterialInfo");
for (int i = 0; i < materialList.size(); ++i) for (int i = 0; i < materialList.size(); ++i)
{ {
QDomElement ele = materialList.at(i).toElement(); QDomElement ele = materialList.at(i).toElement();
QString ssetid = ele.attribute("ComponentID"); QString ssetid = ele.attribute("ComponentID");
QString smaterialID = ele.attribute("PropID"); QString smaterialID = ele.attribute("MaterialID");
int setid = ssetid.toInt(); int setid = ssetid.toInt();
int maid = smaterialID.toInt(); int maid = smaterialID.toInt();
this->setProperty(setid, maid); this->setMaterial(setid, maid);
} }
QDomNodeList configdata = e->elementsByTagName("ConfigData"); QDomNodeList configdata = e->elementsByTagName("ConfigData");
@ -233,38 +233,38 @@ namespace ModelData
this->writeToProjectFile(doc, e); 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; 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; int m = -1;
if (_setProperty.contains(setid)) if (_setMaterial.contains(setid))
{ {
m = _setProperty.value(setid); m = _setMaterial.value(setid);
} }
return m; return m;
} }
bool ModelDataBaseExtend::isPropertySetted(int setid) bool ModelDataBaseExtend::isMaterialSetted(int setid)
{ {
bool s = false; bool s = false;
if (_setProperty.contains(setid)) if (_setMaterial.contains(setid))
{ {
if (_setProperty.value(setid) >= 0) if (_setMaterial.value(setid) >= 0)
s = true; s = true;
} }
return s; 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) for (int id : removeid)
{ {
if (_setProperty.contains(id)) if (_setMaterial.contains(id))
_setProperty.remove(id); _setMaterial.remove(id);
for (auto bc : _bcList) for (auto bc : _bcList)
{ {
if (bc->getComponentID() == id) if (bc->getComponentID() == id)
@ -296,9 +296,9 @@ namespace ModelData
{ {
assert(index >= 0 && index < _ComponentIDList.size()); assert(index >= 0 && index < _ComponentIDList.size());
int id = _ComponentIDList.at(index); int id = _ComponentIDList.at(index);
if (isPropertySetted(id)) if (isMaterialSetted(id))
{ {
removeProperty(id); removeMaterial(id);
} }
ModelDataBase::removeComponentAt(index); ModelDataBase::removeComponentAt(index);
} }

View File

@ -47,14 +47,14 @@ namespace ModelData
QString getReportAt(int index); QString getReportAt(int index);
//移除第index个报告 //移除第index个报告
void removeReportAt(int index); void removeReportAt(int index);
//设置属性网格组件ID与属性ID //设置材料网格组件ID与材料ID
void setProperty(int setID, int pid); void setMaterial(int setID, int materialID);
//获取组件的材料ID //获取组件的材料ID
int getPropertyID(int setid); int getMaterialID(int setid);
//组件是否被设置材料 //组件是否被设置材料
bool isPropertySetted(int setid); bool isMaterialSetted(int setid);
//解除属性与组件的绑定 //解除材料与组件的绑定
void removeProperty(int setid); void removeMaterial(int setid);
virtual void setComponentIDList(QList<int> ids); virtual void setComponentIDList(QList<int> ids);
@ -138,7 +138,7 @@ namespace ModelData
protected: protected:
QList<int> _inpMaterIds; QList<int> _inpMaterIds;
QHash<int, int> _setProperty{}; QHash<int, int> _setMaterial{};
QStringList _reportList{}; QStringList _reportList{};
QHash<int, DataProperty::DataBase*> _configData{}; QHash<int, DataProperty::DataBase*> _configData{};
QStringList _monitorFiles{}; QStringList _monitorFiles{};

View File

@ -8,6 +8,7 @@
#include <QDebug> #include <QDebug>
#include "ProjectTree/DialogAddBC.h" #include "ProjectTree/DialogAddBC.h"
namespace ModelData namespace ModelData
{ {
void ModelDataPy::importComponents(int caseId, const char* addcomponentsId) void ModelDataPy::importComponents(int caseId, const char* addcomponentsId)
@ -18,8 +19,7 @@ namespace ModelData
for (QString id : scomponentIdsList) for (QString id : scomponentIdsList)
ids.append(id.toInt()); ids.append(id.toInt());
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId); ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
if (model == nullptr) if (model == nullptr) return;
return;
model->setComponentIDList(ids); model->setComponentIDList(ids);
Py::PythonAgent::getInstance()->unLock(); Py::PythonAgent::getInstance()->unLock();
} }
@ -35,28 +35,25 @@ namespace ModelData
ids.append(scomponentIdsList[i].toInt()); ids.append(scomponentIdsList[i].toInt());
} }
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId); ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
if (model == nullptr) if (model == nullptr) return;
return;
model->setGeometryList(ids); model->setGeometryList(ids);
Py::PythonAgent::getInstance()->unLock(); Py::PythonAgent::getInstance()->unLock();
} }
void ModelDataPy::addBC(int caseId, int id, char* bctypetostring) void ModelDataPy::addBC(int caseId, int id, char* bctypetostring)
{ {
QString bctyst(bctypetostring); QString bctyst(bctypetostring);
BCBase::BCType bctype = BCBase::StringToBCType(bctyst); BCBase::BCType bctype = BCBase::StringToBCType(bctyst);
// bctyst = BCBase::BCTypeToString(bctype); // bctyst = BCBase::BCTypeToString(bctype);
if (bctype == BCBase::None) if (bctype == BCBase::None) bctype = BCBase::UserDef;
bctype = BCBase::UserDef;
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId); ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
if (model == nullptr) if (model == nullptr) return;
return;
ModelDataBaseExtend *_data = dynamic_cast<ModelDataBaseExtend*>(model); ModelDataBaseExtend *_data = dynamic_cast<ModelDataBaseExtend*>(model);
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bctype, bctyst, _data->getTreeType()); BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bctype, bctyst, _data->getTreeType());
if (bc == nullptr) if (bc == nullptr) return;
return;
// bc->setBCType(bctype); // bc->setBCType(bctype);
bc->bingdingComponentID(id); bc->bingdingComponentID(id);
_data->appeendBC(bc); _data->appeendBC(bc);
@ -70,14 +67,11 @@ namespace ModelData
QString sType(type); QString sType(type);
QString sValue(value); QString sValue(value);
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID); ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
if (model == nullptr) if (model == nullptr) return;
return;
DataProperty::ParameterBase* p = model->getParameterByName(svariable); DataProperty::ParameterBase* p = model->getParameterByName(svariable);
if (p == nullptr) if (p == nullptr) return;
return;
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType); DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
if (t != p->getParaType()) if (t != p->getParaType()) return;
return;
p->setValueFromString(sValue); p->setValueFromString(sValue);
Py::PythonAgent::getInstance()->unLock(); Py::PythonAgent::getInstance()->unLock();
} }
@ -88,29 +82,25 @@ namespace ModelData
QString sType(type); QString sType(type);
QString sValue(value); QString sValue(value);
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID); ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
if (model == nullptr) if (model == nullptr) return;
return;
BCBase::BCBase* bc = model->getBCAt(index); BCBase::BCBase* bc = model->getBCAt(index);
DataProperty::ParameterBase* p = bc->getParameterByName(svariable); DataProperty::ParameterBase* p = bc->getParameterByName(svariable);
if (p == nullptr) if (p == nullptr) return;
return;
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType); DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
if (t != p->getParaType()) if (t != p->getParaType()) return;
return;
p->setValueFromString(sValue); p->setValueFromString(sValue);
Py::PythonAgent::getInstance()->unLock(); 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::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance();
ModelData::ModelDataBaseExtend* model = dynamic_cast<ModelData::ModelDataBaseExtend*>(modelData->getModelByID(caseID)); ModelData::ModelDataBaseExtend* model = dynamic_cast<ModelData::ModelDataBaseExtend*>(modelData->getModelByID(caseID));
if (!model) if (!model) return;
return;
QString cpIDs(componentIDs); QString cpIDs(componentIDs);
QStringList cpIDList = cpIDs.split(';'); QStringList cpIDList = cpIDs.split(';');
for (QString cpID : cpIDList) for (QString cpID : cpIDList)
model->setProperty(cpID.toInt(), pid); model->setMaterial(cpID.toInt(), materialID);
Py::PythonAgent::getInstance()->unLock(); 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); 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);
} }

View File

@ -13,7 +13,7 @@ namespace ModelData
static void addBC(int caseId, int id, char* bctypetostring); static void addBC(int caseId, int id, char* bctypetostring);
static void setValue(int caseID, char* variable, char* stype, char* svalue); 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 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 addBC(int caseId, int id, char* bctypetostring);
void MODELDATAAPI setValue(int caseID, char* variable, char* stype, char* svalue); 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 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);
} }

View File

@ -9,10 +9,10 @@
// #include "BCBase/BCPressure.h" // #include "BCBase/BCPressure.h"
// #include "BCBase/BCDisplacement.h" // #include "BCBase/BCDisplacement.h"
#include "ModelData/modelDataBaseExtend.h" #include "ModelData/modelDataBaseExtend.h"
#include "MeshData/meshSingleton.h" #include "meshData/meshSingleton.h"
#include "MeshData/meshSet.h" #include "meshData/meshSet.h"
#include "Geometry/geometryData.h" #include "geometry/geometryData.h"
#include "Geometry/GeoComponent.h" #include "geometry/GeoComponent.h"
#include "ConfigOptions/ConfigOptions.h" #include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/BCConfig.h" #include "ConfigOptions/BCConfig.h"
#include <assert.h> #include <assert.h>
@ -20,19 +20,17 @@
#include <QDebug> #include <QDebug>
#include "ModelData/modelDataBase.h" #include "ModelData/modelDataBase.h"
#include "ModelData/modelDataSingleton.h" #include "ModelData/modelDataSingleton.h"
namespace ProjectTree namespace ProjectTree {
{
AddBCDialog::AddBCDialog(GUI::MainWindow* m, ModelData::ModelDataBaseExtend* data) AddBCDialog::AddBCDialog(GUI::MainWindow* m, ModelData::ModelDataBaseExtend* data)
: QFDialog(m), _data(data) : QFDialog(m)
, _data(data)
{ {
_ui = new Ui::AddBCDialog(); _ui = new Ui::AddBCDialog();
_ui->setupUi(this); _ui->setupUi(this);
init(); init();
} }
AddBCDialog::~AddBCDialog() AddBCDialog::~AddBCDialog() {}
{
}
void AddBCDialog::init() void AddBCDialog::init()
{ {
initBCType(); initBCType();
@ -42,8 +40,7 @@ namespace ProjectTree
{ {
MeshData::MeshData* mesh = MeshData::MeshData::getInstance(); MeshData::MeshData* mesh = MeshData::MeshData::getInstance();
QList<int> mshList = _data->getMeshSetList(); 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); int setID = mshList.at(i);
MeshData::MeshSet* set = mesh->getMeshSetByID(setID); MeshData::MeshSet* set = mesh->getMeshSetByID(setID);
assert(set != nullptr); assert(set != nullptr);
@ -54,8 +51,7 @@ namespace ProjectTree
auto geoData = Geometry::GeometryData::getInstance(); auto geoData = Geometry::GeometryData::getInstance();
QList<int> gcList = _data->getGeoComponentIDList(); 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); int gcID = gcList.at(i);
auto* aGC = geoData->getGeoComponentByID(gcID); auto* aGC = geoData->getGeoComponentByID(gcID);
assert(aGC != nullptr); assert(aGC != nullptr);
@ -68,18 +64,18 @@ namespace ProjectTree
{ {
int beg = BCBase::BCType::None; int beg = BCBase::BCType::None;
int end = BCBase::BCType::End; int end = BCBase::BCType::End;
ConfigOption::BCConfig *userdefbcs = ConfigOption::ConfigOption::getInstance()->getBCConfig(); ConfigOption::BCConfig* userdefbcs =
for (int i = beg; i < end; ++i) ConfigOption::ConfigOption::getInstance()->getBCConfig();
{ for(int i = beg; i < end; ++i) {
QString stype = BCBase::BCTypeToString((BCBase::BCType)i); QString stype = BCBase::BCTypeToString((BCBase::BCType)i);
if(!userdefbcs->isEnable(stype, _data->getTreeType())) if(!userdefbcs->isEnable(stype, _data->getTreeType()))
continue; continue;
_ui->typeComboBox->addItem(stype, i); _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()); 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()); BCBase::BCUserDef* bc = userdefbcs->getBCAt(i, _data->getTreeType());
_ui->typeComboBox->addItem(bc->getName(), BCBase::UserDef); _ui->typeComboBox->addItem(bc->getName(), BCBase::UserDef);
} }
@ -101,11 +97,13 @@ namespace ProjectTree
MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id); MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
assert(set != nullptr); assert(set != nullptr);
QString bcTypeToString = BCBase::BCTypeToString(bcType);//liu 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) 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; //qDebug() << code;
//Py::PythonAgent::getInstance()->submit(code); //Py::PythonAgent::getInstance()->submit(code);
bc->setType(bcType); bc->setType(bcType);
@ -115,17 +113,18 @@ namespace ProjectTree
void AddBCDialog::accept() void AddBCDialog::accept()
{ {
// const int index = _ui->typeComboBox->currentIndex(); // const int index = _ui->typeComboBox->currentIndex();
// BCBase::BCType bcType = (BCBase::BCType)(_ui->typeComboBox->itemData(index).toInt()); //Commented-Out By Baojun // BCBase::BCType bcType =
int cpID = _ui->setComboBox->itemData(_ui->setComboBox->currentIndex(), Qt::UserRole + 1).toInt(); //(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) if(cpID < 0)
return; return;
QString typeName = _ui->typeComboBox->currentText(); QString typeName = _ui->typeComboBox->currentText();
// QList<int> setidlist = _data->getMeshSetList(); // QList<int> setidlist = _data->getMeshSetList();
int caseid = _data->getID(); int caseid = _data->getID();
// MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id); //Commented-Out By Baojun // MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
// if (set == nullptr) return; ////Commented-Out By Baojun if (set == nullptr) return; int caseid = _data->getID();
// int caseid = _data->getID();
// assert(set != nullptr); // assert(set != nullptr);
// QString bctypetostring = BCBase::BCTypeToString(bcType);//liu // QString bctypetostring = BCBase::BCTypeToString(bcType);//liu
@ -137,4 +136,4 @@ namespace ProjectTree
QDialog::accept(); QDialog::accept();
} }
} } // namespace ProjectTree

View File

@ -1,26 +1,4 @@
/** #ifndef _DIALOGADDBC_H_
* @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_
#define _DIALOGADDBC_H_ #define _DIALOGADDBC_H_
#include "SelfDefObject/QFDialog.h" #include "SelfDefObject/QFDialog.h"
@ -40,10 +18,7 @@ namespace ModelData
namespace ProjectTree namespace ProjectTree
{ {
/**
* @brief
* @since 2.5.0
*/
class AddBCDialog : public QFDialog class AddBCDialog : public QFDialog
{ {
Q_OBJECT Q_OBJECT
@ -52,28 +27,21 @@ namespace ProjectTree
~AddBCDialog(); ~AddBCDialog();
private: private:
/**
* @brief
* @since 2.5.0
*/
void init(); void init();
/**
* @brief
* @since 2.5.0
*/
virtual void initBCType(); virtual void initBCType();
/**
* @brief
* @since 2.5.0
*/
virtual void initComponents(); virtual void initComponents();
virtual void accept() override; virtual void accept() override;
private: private:
Ui::AddBCDialog* _ui{}; Ui::AddBCDialog* _ui{};
ModelData::ModelDataBaseExtend* _data{}; ModelData::ModelDataBaseExtend* _data{};
}; };
} }
#endif #endif

View File

@ -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();
}
}

View File

@ -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__

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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();
}
}

View File

@ -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

View File

@ -1,6 +1,6 @@
#include "DialogImport.h" #include "DialogImport.h"
#include "MeshData/meshSingleton.h" #include "meshData/meshSingleton.h"
#include "MeshData/meshSet.h" #include "meshData/meshSet.h"
#include "ModelData/modelDataBaseExtend.h" #include "ModelData/modelDataBaseExtend.h"
#include <QMap> #include <QMap>
#include <QDebug> #include <QDebug>
@ -8,14 +8,15 @@
#include "PythonModule/PyAgent.h" #include "PythonModule/PyAgent.h"
#include "ModelData/modelDataSingleton.h" #include "ModelData/modelDataSingleton.h"
#include "ModelData/modelDataBase.h" #include "ModelData/modelDataBase.h"
#include "Geometry/geometryData.h" #include "geometry/geometryData.h"
#include "Geometry/geometrySet.h" #include "geometry/geometrySet.h"
#include "Geometry/GeoComponent.h" #include "geometry/GeoComponent.h"
namespace ProjectTree namespace ProjectTree {
{ ImportDialog::ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data,
ImportDialog::ImportDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data, ImportType t) ImportType t)
: ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr), _type(t) : ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr)
, _type(t)
{ {
_data = data; _data = data;
init(); init();
@ -62,21 +63,18 @@ namespace ProjectTree
for(int id : ids) for(int id : ids)
addIdValues << QString::number(id); addIdValues << QString::number(id);
int caseID = _data->getID(); 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); Py::PythonAgent::getInstance()->submit(code);
ComponentSelectDialogBase::accept(); ComponentSelectDialogBase::accept();
} }
/// <summary>
/// 读取可用的几何组件
/// </summary>
void ImportDialog::initGeo() void ImportDialog::initGeo()
{ {
Geometry::GeometryData* geoData = Geometry::GeometryData::getInstance(); Geometry::GeometryData* geoData = Geometry::GeometryData::getInstance();
const int n = geoData->getGeometrySetCount(); const int n = geoData->getGeometrySetCount();
QList<int> geoIDs = _data->getGeometryList(); 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); Geometry::GeometrySet* set = geoData->getGeometrySetAt(i);
QString name = set->getName(); QString name = set->getName();
int id = set->getID(); int id = set->getID();
@ -87,16 +85,13 @@ namespace ProjectTree
appendItemToAvailableList(name, id, icon); appendItemToAvailableList(name, id, icon);
} }
} }
/// <summary>
/// 读取可用的网格组件
/// </summary>
void ImportDialog::initMeshSet() void ImportDialog::initMeshSet()
{ {
MeshData::MeshData* meshData = MeshData::MeshData::getInstance(); MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
const int n = meshData->getMeshSetCount(); const int n = meshData->getMeshSetCount();
QList<int> compIDs = _data->getMeshSetList(); 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); MeshData::MeshSet* set = meshData->getMeshSetAt(i);
QString name = set->getName(); QString name = set->getName();
int id = set->getID(); int id = set->getID();
@ -114,8 +109,7 @@ namespace ProjectTree
{ {
auto geoData = Geometry::GeometryData::getInstance(); auto geoData = Geometry::GeometryData::getInstance();
QList<int> geoIDs = _data->getGeoComponentIDList(); QList<int> geoIDs = _data->getGeoComponentIDList();
foreach (auto aGc, geoData->getGeoComponentList()) foreach(auto aGc, geoData->getGeoComponentList()) {
{
QString name = aGc->getName(); QString name = aGc->getName();
int id = aGc->getID(); int id = aGc->getID();
QString icon = ":/QUI/icon/geometry.png"; QString icon = ":/QUI/icon/geometry.png";
@ -132,12 +126,12 @@ namespace ProjectTree
QStringList values = idname.values(); QStringList values = idname.values();
QList<int> ids = idname.keys(); QList<int> ids = idname.keys();
QStringList addIdValues; QStringList addIdValues;
for (int i = 0; i < ids.size(); ++i) for(int i = 0; i < ids.size(); ++i) {
{
addIdValues << QString::number(ids.at(i)); addIdValues << QString::number(ids.at(i));
} }
int id = _data->getID(); 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; qDebug() << code;
if(ids.size() > 0) if(ids.size() > 0)
Py::PythonAgent::getInstance()->submit(code); Py::PythonAgent::getInstance()->submit(code);
@ -152,7 +146,8 @@ namespace ProjectTree
// foreach(int id, ids) // foreach(int id, ids)
// addIdValues << QString::number(id); // addIdValues << QString::number(id);
// int caseID = _data->getID(); // 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); // Py::PythonAgent::getInstance()->submit(code);
// } // }
@ -164,7 +159,8 @@ namespace ProjectTree
// foreach(int id, ids) // foreach(int id, ids)
// addIdValues << QString::number(id); // addIdValues << QString::number(id);
// int caseID = _data->getID(); // 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); // Py::PythonAgent::getInstance()->submit(code);
// } // }
} } // namespace ProjectTree

View File

@ -1,29 +1,7 @@
/** #ifndef _DIALOGIMPORTMESHSET_
* @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_
#define _DIALOGIMPORTMESHSET_ #define _DIALOGIMPORTMESHSET_
#include "ModuleBase/componentDialogBase.h" #include "moduleBase/componentDialogBase.h"
namespace GUI namespace GUI
{ {
@ -42,10 +20,7 @@ namespace ProjectTree
Geometry, Geometry,
MeshSet MeshSet
}; };
/**
* @brief
* @since 2.5.0
*/
class ImportDialog : public ModuleBase::ComponentSelectDialogBase class ImportDialog : public ModuleBase::ComponentSelectDialogBase
{ {
Q_OBJECT Q_OBJECT
@ -53,6 +28,7 @@ namespace ProjectTree
ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data, ImportType t); ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data, ImportType t);
~ImportDialog() = default; ~ImportDialog() = default;
protected: protected:
void init() override; void init() override;
void accept() override; void accept() override;
@ -72,4 +48,5 @@ namespace ProjectTree
} }
#endif #endif

View File

@ -1,26 +1,4 @@
/** #ifndef _REMOVEREPORTDIALOG_H_
* @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_
#define _REMOVEREPORTDIALOG_H_ #define _REMOVEREPORTDIALOG_H_
#include "SelfDefObject/QFDialog.h" #include "SelfDefObject/QFDialog.h"
@ -47,7 +25,9 @@ namespace ProjectTree
private: private:
Ui::RemoveReportDialog* _ui{}; Ui::RemoveReportDialog* _ui{};
}; };
} }
#endif #endif

View File

@ -1,22 +1,20 @@
#include "ProjectTreeWithBasicNode.h" #include "ProjectTreeWithBasicNode.h"
#include "ModelData/modelDataBaseExtend.h" #include "ModelData/modelDataBaseExtend.h"
#include "ConfigOptions/TreeItemData.h" #include "ConfigOptions/TreeItemData.h"
#include "MeshData/meshSet.h" #include "meshData/meshSet.h"
#include "DialogImport.h" #include "DialogImport.h"
#include "MeshData/meshSingleton.h" #include "meshData/meshSingleton.h"
#include "DialogAddBC.h" #include "DialogAddBC.h"
#include "DialogAddProperty.h"
#include "BCBase/BCBase.h" #include "BCBase/BCBase.h"
#include "BCBase/BCUserDef.h" #include "BCBase/BCUserDef.h"
#include "MainWindow/MainWindow.h" #include "mainWindow/mainWindow.h"
#include "DialogRemoveReport.h" #include "DialogRemoveReport.h"
#include "ModelData/simulationSettingBase.h" #include "ModelData/simulationSettingBase.h"
#include "ModelData/solverSettingBase.h" #include "ModelData/solverSettingBase.h"
#include "ModelData/elementProperty.h" #include "geometry/geometryData.h"
#include "Geometry/geometryData.h" #include "geometry/geometrySet.h"
#include "Geometry/geometrySet.h" #include "geometry/GeoComponent.h"
#include "Geometry/GeoComponent.h" #include "DialogAssignMaterial.h"
#include "DialogAssignProperty.h"
#include "DataProperty/PropertyBase.h" #include "DataProperty/PropertyBase.h"
#include "DataProperty/PropertyString.h" #include "DataProperty/PropertyString.h"
#include "ConfigOptions/ConfigOptions.h" #include "ConfigOptions/ConfigOptions.h"
@ -32,7 +30,6 @@
#include "Material/MaterialSingletion.h" #include "Material/MaterialSingletion.h"
#include "Material/Material.h" #include "Material/Material.h"
#include "PythonModule/PyAgent.h" #include "PythonModule/PyAgent.h"
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
@ -43,15 +40,18 @@
#include <QDebug> #include <QDebug>
#include <QApplication> #include <QApplication>
namespace ProjectTree namespace ProjectTree {
{
ProjectTreeWithBasicNode::ProjectTreeWithBasicNode(GUI::MainWindow* mainwindow) ProjectTreeWithBasicNode::ProjectTreeWithBasicNode(GUI::MainWindow* mainwindow)
: ProjectTreeBase(mainwindow) : ProjectTreeBase(mainwindow)
{ {
connect(this, SIGNAL(highLightSet(MeshData::MeshSet *)), mainwindow, SIGNAL(highLightSetSig(MeshData::MeshSet *))); connect(this, SIGNAL(highLightSet(MeshData::MeshSet*)), mainwindow,
connect(this, SIGNAL(highLightGeoComponent(Geometry::GeoComponent *)), mainwindow, SIGNAL(highLightGeoComponentSig(Geometry::GeoComponent *))); SIGNAL(highLightSetSig(MeshData::MeshSet*)));
connect(mainwindow, SIGNAL(closePostWindowSig(Post::PostWindowBase *)), this, SLOT(closePostWindow(Post::PostWindowBase *))); connect(this, SIGNAL(highLightGeoComponent(Geometry::GeoComponent*)), mainwindow,
connect(this, SIGNAL(openRealTimeWin(Post::RealTimeWindowBase *, int)), mainwindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int))); 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(clearAllHighLightSig()), mainwindow, SIGNAL(clearAllHighLight()));
connect(this, SIGNAL(addComponentRootItemSig()), this, SLOT(addComponentRootItemSlot())); connect(this, SIGNAL(addComponentRootItemSig()), this, SLOT(addComponentRootItemSlot()));
_nodeMenu = new QMenu; _nodeMenu = new QMenu;
@ -73,7 +73,7 @@ namespace ProjectTree
_root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot); _root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
_root->setFlags(_root->flags() | Qt::ItemIsEditable); _root->setFlags(_root->flags() | Qt::ItemIsEditable);
_root->setIcon(0, QIcon("://QUI/icon/physics.png")); _root->setIcon(0, QIcon("://QUI/icon/physics.png"));
// int id = _data->getID(); int id = _data->getID();
_root->setText(0, _data->getName()); // 根据项目名称确定 _root->setText(0, _data->getName()); // 根据项目名称确定
_root->setData(0, Qt::UserRole, _data->getID()); _root->setData(0, Qt::UserRole, _data->getID());
_root->setExpanded(true); _root->setExpanded(true);
@ -86,10 +86,6 @@ namespace ProjectTree
// _geometryRootItem->setText(0, tr("Geometry")); // _geometryRootItem->setText(0, tr("Geometry"));
// _geometryRootItem->setIcon(0, QIcon("://QUI/icon/geometry.png")); // _geometryRootItem->setIcon(0, QIcon("://QUI/icon/geometry.png"));
// _textItemHash["Geometry"] = _geometryRootItem; // _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 = new QTreeWidgetItem(_root, TreeItemType::ProjectComponent);
_ComponentRootItem->setText(0, tr("Set")); _ComponentRootItem->setText(0, tr("Set"));
@ -136,7 +132,8 @@ namespace ProjectTree
_postVectorItem->setIcon(0, QIcon("://QUI/icon/vector.png")); _postVectorItem->setIcon(0, QIcon("://QUI/icon/vector.png"));
_textItemHash["Vector"] = _postVectorItem; _textItemHash["Vector"] = _postVectorItem;
_postStreamLineItem = new QTreeWidgetItem(_postRootItem, TreeItemType::ProjectPostStreamLine); _postStreamLineItem =
new QTreeWidgetItem(_postRootItem, TreeItemType::ProjectPostStreamLine);
_postStreamLineItem->setText(0, tr("Stream Line")); _postStreamLineItem->setText(0, tr("Stream Line"));
_postStreamLineItem->setIcon(0, QIcon("://QUI/icon/streamline.png")); _postStreamLineItem->setIcon(0, QIcon("://QUI/icon/streamline.png"));
_textItemHash["Stream Line"] = _postStreamLineItem; _textItemHash["Stream Line"] = _postStreamLineItem;
@ -177,28 +174,18 @@ namespace ProjectTree
QAction* action = nullptr; QAction* action = nullptr;
TreeItemType type = (TreeItemType)_currentItem->type(); TreeItemType type = (TreeItemType)_currentItem->type();
auto glo = ConfigOption::ConfigOption::getInstance()->getGlobalConfig(); auto glo = ConfigOption::ConfigOption::getInstance()->getGlobalConfig();
switch (type) switch (type) {
{
case ProjectGeometry: case ProjectGeometry:
action = menu->addAction(tr("Import Geometry")); action = menu->addAction(tr("Import Geometry"));
connect(action, SIGNAL(triggered()), this, SLOT(importGeometry())); connect(action, SIGNAL(triggered()), this, SLOT(importGeometry()));
break; 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: case ProjectComponent:
action = menu->addAction(tr("Import Set")); action = menu->addAction(tr("Import Set"));
connect(action, SIGNAL(triggered()), this, SLOT(importComponents())); connect(action, SIGNAL(triggered()), this, SLOT(importComponents()));
if (glo->isMaterialEnabled()) if (glo->isMaterialEnabled()) {
{ action = menu->addAction(tr("Assign Material"));
action = menu->addAction(tr("Assign Property")); connect(action, SIGNAL(triggered()), this, SLOT(assignMaterial()));
connect(action, SIGNAL(triggered()), this, SLOT(assignProperty()));
} }
break; break;
case ProjectComponentChild: case ProjectComponentChild:
@ -268,7 +255,6 @@ namespace ProjectTree
} }
void ProjectTreeWithBasicNode::updateTree() void ProjectTreeWithBasicNode::updateTree()
{ {
updatePropTree();
updateGeometrySubTree(); updateGeometrySubTree();
updateComponentSubTree(); updateComponentSubTree();
updateBCSubTree(); updateBCSubTree();
@ -290,16 +276,12 @@ namespace ProjectTree
auto materialData = Material::MaterialSingleton::getInstance(); auto materialData = Material::MaterialSingleton::getInstance();
QString name{}; QString name{};
QString icon{}; QString icon{};
for (int id : IDs) for (int id : IDs) {
{
auto type = DataProperty::ComponentBase::getComponentTypeByID(id); auto type = DataProperty::ComponentBase::getComponentTypeByID(id);
if (type == 0) if (type == 0)
continue; continue;
if (type == DataProperty::ComponentType::MESH) if (type == DataProperty::ComponentType::MESH) {
{
auto set = meshData->getMeshSetByID(id); auto set = meshData->getMeshSetByID(id);
if (set == nullptr)
continue;
name = set->getName(); name = set->getName();
MeshData::SetType type = set->getSetType(); MeshData::SetType type = set->getSetType();
if (type == MeshData::Element) if (type == MeshData::Element)
@ -309,24 +291,24 @@ namespace ProjectTree
else else
icon = "://QUI/icon/nodeset.png"; icon = "://QUI/icon/nodeset.png";
} }
else if (type == DataProperty::ComponentType::GEOMETRY) else if (type == DataProperty::ComponentType::GEOMETRY) {
{
auto gc = geoData->getGeoComponentByID(id); auto gc = geoData->getGeoComponentByID(id);
name = gc->getName(); name = gc->getName();
icon = "://QUI/icon/geometry.png"; icon = "://QUI/icon/geometry.png";
} }
if (_modelDataExtend->isPropertySetted(id)) //是否指定材料 if (_modelDataExtend->isMaterialSetted(id)) // 是否指定材料
{ {
int pid = _modelDataExtend->getPropertyID(id); int materialid = _modelDataExtend->getMaterialID(id);
auto m = _modelDataExtend->getElePropertyByID(pid); Material::Material* m = materialData->getMaterialByID(materialid);
if (!m) if (!m)
continue; continue;
QString mname = m->getName(); QString mname = m->getName();
name.append(QString("-[%1]").arg(mname)); 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->setIcon(0, QIcon(icon));
temp->setText(0, name); temp->setText(0, name);
temp->setData(0, Qt::UserRole, id); temp->setData(0, Qt::UserRole, id);
@ -374,9 +356,8 @@ namespace ProjectTree
icon = "://QUI/icon/family.png"; icon = "://QUI/icon/family.png";
} }
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem, TreeItemType::ProjectComponentChild); QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem,
temp->setIcon(0, QIcon(icon)); TreeItemType::ProjectComponentChild); temp->setIcon(0, QIcon(icon)); temp->setText(0, name);
temp->setText(0, name);
temp->setData(0, Qt::UserRole, id); temp->setData(0, Qt::UserRole, id);
} }
} }
@ -401,58 +382,40 @@ namespace ProjectTree
name.append(QString("-[%1]").arg(m->getName())); name.append(QString("-[%1]").arg(m->getName()));
} }
QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem, TreeItemType::ProjectComponentChild); QTreeWidgetItem* temp = new QTreeWidgetItem(_ComponentRootItem,
temp->setIcon(0, QIcon("://QUI/icon/geometry.png")); TreeItemType::ProjectComponentChild); temp->setIcon(0, QIcon("://QUI/icon/geometry.png"));
temp->setText(0, name); temp->setText(0, name);
temp->setData(0, Qt::UserRole, GCID); 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() void ProjectTreeWithBasicNode::updateBCSubTree()
{ {
if (_boundaryConditionItem == nullptr) if (_boundaryConditionItem == nullptr)
return; return;
_boundaryConditionItem->takeChildren(); _boundaryConditionItem->takeChildren();
const int nBC = _modelDataExtend->getBCCount(); const int nBC = _modelDataExtend->getBCCount();
for (int i = 0; i < nBC; ++i) for (int i = 0; i < nBC; ++i) {
{
QString icon; QString icon;
BCBase::BCBase* bc = _modelDataExtend->getBCAt(i); BCBase::BCBase* bc = _modelDataExtend->getBCAt(i);
if (bc == nullptr) if (bc == nullptr)
continue; continue;
BCBase::BCType ty = bc->getBCType(); BCBase::BCType ty = bc->getBCType();
QString stype; QString stype;
if (ty == BCBase::UserDef) if (ty == BCBase::UserDef) {
{
stype = ((BCBase::BCUserDef*)bc)->getName(); stype = ((BCBase::BCUserDef*)bc)->getName();
QString sicon = ((BCBase::BCUserDef*)bc)->getIcon(); QString sicon = ((BCBase::BCUserDef*)bc)->getIcon();
icon = qApp->applicationDirPath() + "/../ConfigFiles/Icon/" + sicon; icon = qApp->applicationDirPath() + "/../ConfigFiles/Icon/" + sicon;
bc->appendProperty("BCType", stype); bc->appendProperty("BCType", stype);
} }
else else {
{
stype = BCBase::BCTypeToString(ty); stype = BCBase::BCTypeToString(ty);
icon = BCBase::BCIconByType(ty); icon = BCBase::BCIconByType(ty);
} }
QString cpName = bc->getComponentName(); 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); QString text = QString("%1 @ %2").arg(stype).arg(cpName);
item->setText(0, text); item->setText(0, text);
item->setIcon(0, QIcon(icon)); item->setIcon(0, QIcon(icon));
@ -466,8 +429,7 @@ namespace ProjectTree
_monitorRootItem->takeChildren(); _monitorRootItem->takeChildren();
QList<ConfigOption::PostCurve*> curvelist = _modelDataExtend->getMonitorCurves(); QList<ConfigOption::PostCurve*> curvelist = _modelDataExtend->getMonitorCurves();
// qDebug() << curvelist.size(); // 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); ConfigOption::PostCurve* c = curvelist.at(i);
QString text = c->getDescribe(); QString text = c->getDescribe();
QTreeWidgetItem* tempitem = new QTreeWidgetItem(_monitorRootItem, ProjectMonitorChild); QTreeWidgetItem* tempitem = new QTreeWidgetItem(_monitorRootItem, ProjectMonitorChild);
@ -482,20 +444,17 @@ namespace ProjectTree
_postVectorItem->takeChildren(); _postVectorItem->takeChildren();
// QStringList d2v = _modelDataExtend->getPlot2DVariable(); // QStringList d2v = _modelDataExtend->getPlot2DVariable();
QList<ConfigOption::PostCurve*> d2v = _modelDataExtend->getPlotCurves(); 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); QTreeWidgetItem* item = new QTreeWidgetItem(_post2DItem, ProJectPost2DGraphChild);
QString text = d2v.at(i)->getDescribe(); QString text = d2v.at(i)->getDescribe();
item->setText(0, text); item->setText(0, text);
item->setIcon(0, QIcon("://QUI/icon/curve.png")); item->setIcon(0, QIcon("://QUI/icon/curve.png"));
} }
QStringList scalarv = _modelDataExtend->getScalarVariable(); 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); QTreeWidgetItem* item = new QTreeWidgetItem(_postCounterItem, ProjectPostCounterChild);
QString text = scalarv.at(i); QString text = scalarv.at(i);
if (text.endsWith("_cell000")) if (text.endsWith("_cell000")) {
{
text.replace("_cell000", " @ Cell"); text.replace("_cell000", " @ Cell");
} }
else else
@ -504,12 +463,10 @@ namespace ProjectTree
item->setText(0, text); item->setText(0, text);
} }
QStringList vectorv = _modelDataExtend->getVectorVariable(); 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); QTreeWidgetItem* item = new QTreeWidgetItem(_postVectorItem, ProjectPostVectorChild);
QString text = vectorv.at(i); QString text = vectorv.at(i);
if (text.endsWith("_cell000")) if (text.endsWith("_cell000")) {
{
text.replace("_cell000", " @ Cell"); text.replace("_cell000", " @ Cell");
} }
else else
@ -531,11 +488,9 @@ namespace ProjectTree
QTreeWidgetItem* item{}; QTreeWidgetItem* item{};
int childCount = _ComponentRootItem->childCount(); int childCount = _ComponentRootItem->childCount();
for (int i = 0; i < childCount; ++i) for (int i = 0; i < childCount; ++i) {
{
QTreeWidgetItem* tmp = _ComponentRootItem->child(i); QTreeWidgetItem* tmp = _ComponentRootItem->child(i);
if (tmp->data(0, Qt::UserRole).toInt() == cpID) if (tmp->data(0, Qt::UserRole).toInt() == cpID) {
{
item = tmp; item = tmp;
break; break;
} }
@ -546,8 +501,7 @@ namespace ProjectTree
QList<QTreeWidgetItem*> items; QList<QTreeWidgetItem*> items;
childCount = _boundaryConditionItem->childCount(); childCount = _boundaryConditionItem->childCount();
for (int i = 0; i < childCount; ++i) for (int i = 0; i < childCount; ++i) {
{
QTreeWidgetItem* item = _boundaryConditionItem->child(i); QTreeWidgetItem* item = _boundaryConditionItem->child(i);
if (item->data(0, Qt::UserRole).toInt() == cpID) if (item->data(0, Qt::UserRole).toInt() == cpID)
items << item; items << item;
@ -570,16 +524,14 @@ namespace ProjectTree
QTreeWidgetItem* item{}; QTreeWidgetItem* item{};
QString cpName = component->getName(); QString cpName = component->getName();
int childCount = _ComponentRootItem->childCount(); int childCount = _ComponentRootItem->childCount();
for (int i = 0; i < childCount; ++i) for (int i = 0; i < childCount; ++i) {
{
item = _ComponentRootItem->child(i); item = _ComponentRootItem->child(i);
if (item->data(0, Qt::UserRole).toInt() != cpID) if (item->data(0, Qt::UserRole).toInt() != cpID)
continue; continue;
QString oldText = item->text(0); QString oldText = item->text(0);
if (!oldText.contains("-[")) if (!oldText.contains("-["))
item->setText(0, cpName); item->setText(0, cpName);
else else {
{
int index = oldText.lastIndexOf("-["); int index = oldText.lastIndexOf("-[");
QString right = oldText.right(oldText.size() - index); QString right = oldText.right(oldText.size() - index);
QString newText = cpName + right; QString newText = cpName + right;
@ -589,8 +541,7 @@ namespace ProjectTree
} }
childCount = _boundaryConditionItem->childCount(); childCount = _boundaryConditionItem->childCount();
for (int i = 0; i < childCount; ++i) for (int i = 0; i < childCount; ++i) {
{
item = _boundaryConditionItem->child(i); item = _boundaryConditionItem->child(i);
if (item->data(0, Qt::UserRole).toInt() != cpID) if (item->data(0, Qt::UserRole).toInt() != cpID)
continue; continue;
@ -609,37 +560,29 @@ namespace ProjectTree
void ProjectTreeWithBasicNode::removeItem() void ProjectTreeWithBasicNode::removeItem()
{ {
// TreeItemType type = (TreeItemType)_currentItem->type(); TreeItemType type = (TreeItemType)_currentItem->type();
if (_currentItem->type() == ProjectComponentChild) if (_currentItem->type() == ProjectComponentChild) {
{
int index = _ComponentRootItem->indexOfChild(_currentItem); int index = _ComponentRootItem->indexOfChild(_currentItem);
if (_data->isComponentUsed(index)) if (_data->isComponentUsed(index)) {
{ if (QMessageBox::Yes
if (QMessageBox::Yes != QMessageBox::warning(_mainWindow, tr("Warning"), tr("This Set has been used, still remove?"), QMessageBox::Yes, QMessageBox::No)) != QMessageBox::warning(_mainWindow, tr("Warning"),
tr("This Set has been used, still remove?"),
QMessageBox::Yes, QMessageBox::No))
return; return;
} }
_modelDataExtend->removeComponentAt(index); _modelDataExtend->removeComponentAt(index);
updateComponentSubTree(); updateComponentSubTree();
updateBCSubTree(); updateBCSubTree();
} }
else if (_currentItem->type() == ProjectElePropertyChild) else if (_currentItem->type() == ProjectBoundaryCondationChild) {
{
int index = _propertyRootItem->indexOfChild(_currentItem);
_data->removeElePropAt(index);
updatePropTree();
}
else if (_currentItem->type() == ProjectBoundaryCondationChild)
{
int index = _boundaryConditionItem->indexOfChild(_currentItem); int index = _boundaryConditionItem->indexOfChild(_currentItem);
_modelDataExtend->removeBCAt(index); _modelDataExtend->removeBCAt(index);
updateBCSubTree(); updateBCSubTree();
} }
else if (_currentItem->type() == ProjectReportChild) else if (_currentItem->type() == ProjectReportChild) {
{
int index = _reportItem->indexOfChild(_currentItem); int index = _reportItem->indexOfChild(_currentItem);
RemoveReportDialog dlg(_mainWindow); RemoveReportDialog dlg(_mainWindow);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted) {
{
QString fileName = _modelDataExtend->getReportAt(index); QString fileName = _modelDataExtend->getReportAt(index);
QFile f(fileName); QFile f(fileName);
if (f.exists() && dlg.isRemoveCompletely()) if (f.exists() && dlg.isRemoveCompletely())
@ -648,39 +591,29 @@ namespace ProjectTree
updateReportTree(); updateReportTree();
} }
} }
else if (_currentItem->type() == ProJectPost2DGraphChild) else if (_currentItem->type() == ProJectPost2DGraphChild) {
{
const int index = _post2DItem->indexOfChild(_currentItem); const int index = _post2DItem->indexOfChild(_currentItem);
QString name = _currentItem->text(0); QString name = _currentItem->text(0);
qDebug() << name; qDebug() << name;
_modelDataExtend->removePlotCurve(index); _modelDataExtend->removePlotCurve(index);
updatePostTree(); updatePostTree();
auto p2d = _modelDataExtend->getPost2DWindow(); auto p2d = _modelDataExtend->getPost2DWindow();
if (p2d != nullptr) if (p2d != nullptr) {
{
p2d->removeCurve(name); p2d->removeCurve(name);
} }
} }
else if (_currentItem->type() == ProjectPostCounterChild) else if (_currentItem->type() == ProjectPostCounterChild) {
{
const int index = _postCounterItem->indexOfChild(_currentItem); const int index = _postCounterItem->indexOfChild(_currentItem);
_modelDataExtend->removeScalarVariable(index); _modelDataExtend->removeScalarVariable(index);
updatePostTree(); updatePostTree();
} }
else if (_currentItem->type() == ProjectPostVectorChild) else if (_currentItem->type() == ProjectPostVectorChild) {
{
const int index = _postVectorItem->indexOfChild(_currentItem); const int index = _postVectorItem->indexOfChild(_currentItem);
_modelDataExtend->removeVectorVariable(index); _modelDataExtend->removeVectorVariable(index);
updatePostTree(); updatePostTree();
} }
emit disPlayProp(nullptr); emit disPlayProp(nullptr);
} }
void ProjectTreeWithBasicNode::addEleProperty()
{
AddPropDialog dlg(_mainWindow, _modelDataExtend);
if (QDialog::Accepted == dlg.exec())
updatePropTree();
}
void ProjectTreeWithBasicNode::createReport() void ProjectTreeWithBasicNode::createReport()
{ {
// _modelDataExtend->appendReport("D:/test.docx"); // _modelDataExtend->appendReport("D:/test.docx");
@ -697,21 +630,17 @@ namespace ProjectTree
void ProjectTreeWithBasicNode::singleClicked() void ProjectTreeWithBasicNode::singleClicked()
{ {
TreeItemType type = (TreeItemType)_currentItem->type(); TreeItemType type = (TreeItemType)_currentItem->type();
if (type == ProjectComponentChild) if (type == ProjectComponentChild) {
{
const int index = _ComponentRootItem->indexOfChild(_currentItem); const int index = _ComponentRootItem->indexOfChild(_currentItem);
if (index >= 0) if (index >= 0) {
{
emit clearAllHighLightSig(); emit clearAllHighLightSig();
int id = _modelDataExtend->getComponentIDList().at(index); int id = _modelDataExtend->getComponentIDList().at(index);
auto ms = MeshData::MeshData::getInstance()->getMeshSetByID(id); auto ms = MeshData::MeshData::getInstance()->getMeshSetByID(id);
if (ms) if (ms) {
{
emit highLightSet(ms); emit highLightSet(ms);
emit disPlayProp(ms); emit disPlayProp(ms);
} }
else else {
{
auto gc = Geometry::GeometryData::getInstance()->getGeoComponentByID(id); auto gc = Geometry::GeometryData::getInstance()->getGeoComponentByID(id);
if (!gc) if (!gc)
return; return;
@ -720,17 +649,7 @@ namespace ProjectTree
} }
} }
} }
else if (type == ProjectElePropertyChild) else if (type == ProjectBoundaryCondationChild) {
{
const int index = _propertyRootItem->indexOfChild(_currentItem);
if (index >= 0)
{
auto prop = _modelDataExtend->getElePropertyAt(index);
emit disPlayProp(prop);
}
}
else if (type == ProjectBoundaryCondationChild)
{
emit clearAllHighLightSig(); emit clearAllHighLightSig();
const int index = _boundaryConditionItem->indexOfChild(_currentItem); const int index = _boundaryConditionItem->indexOfChild(_currentItem);
BCBase::BCBase* bc = _modelDataExtend->getBCAt(index); BCBase::BCBase* bc = _modelDataExtend->getBCAt(index);
@ -739,68 +658,57 @@ namespace ProjectTree
DataProperty::ComponentBase* component = bc->getComponent(); DataProperty::ComponentBase* component = bc->getComponent();
if (!component) if (!component)
return; return;
if (component->getComponentType() == DataProperty::ComponentType::MESH) if (component->getComponentType() == DataProperty::ComponentType::MESH) {
{
auto set = dynamic_cast<MeshData::MeshSet*>(component); auto set = dynamic_cast<MeshData::MeshSet*>(component);
emit highLightSet(set); emit highLightSet(set);
} }
else else {
{
auto gc = dynamic_cast<Geometry::GeoComponent*>(component); auto gc = dynamic_cast<Geometry::GeoComponent*>(component);
emit highLightGeoComponent(gc); emit highLightGeoComponent(gc);
} }
} }
else if (type == ProjectSimulationSetting) else if (type == ProjectSimulationSetting) {
{
ModelData::SimlutationSettingBase* s = _data->getSimlutationSetting(); ModelData::SimlutationSettingBase* s = _data->getSimlutationSetting();
emit disPlayProp(s); emit disPlayProp(s);
} }
else if (type == ProjectSolver) else if (type == ProjectSolver) {
{
ModelData::SolverSettingBase* s = _data->getSolverSetting(); ModelData::SolverSettingBase* s = _data->getSolverSetting();
emit disPlayProp(s); emit disPlayProp(s);
} }
else if (type == ProjectMonitorChild) else if (type == ProjectMonitorChild) {
{
const int index = _monitorRootItem->indexOfChild(_currentItem); const int index = _monitorRootItem->indexOfChild(_currentItem);
// QList<DataProperty::DataBase*> mon = _modelDataExtend->getMonitorList(); // QList<DataProperty::DataBase*> mon = _modelDataExtend->getMonitorList();
emit disPlayProp(_modelDataExtend->getMonitorCurveAt(index)); emit disPlayProp(_modelDataExtend->getMonitorCurveAt(index));
if (_realTimeWin != nullptr) if (_realTimeWin != nullptr) {
{
QString name = _currentItem->text(0); QString name = _currentItem->text(0);
_realTimeWin->viewRealTimeWindow(name); _realTimeWin->viewRealTimeWindow(name);
} }
} }
else if (type == ProJectPost2DGraphChild) else if (type == ProJectPost2DGraphChild) {
{
const int index = _post2DItem->indexOfChild(_currentItem); const int index = _post2DItem->indexOfChild(_currentItem);
ConfigOption::PostCurve* temp = _modelDataExtend->getPlotCurves().at(index); ConfigOption::PostCurve* temp = _modelDataExtend->getPlotCurves().at(index);
emit disPlayProp(temp); emit disPlayProp(temp);
QString text = _currentItem->text(0); QString text = _currentItem->text(0);
viewPlot2D(text); viewPlot2D(text);
} }
else if (type == ProjectPostCounterChild) else if (type == ProjectPostCounterChild) {
{
QString text = _currentItem->text(0); QString text = _currentItem->text(0);
text.remove(" @ Node"); text.remove(" @ Node");
text.replace(" @ Cell", "_cell000"); text.replace(" @ Cell", "_cell000");
viewCounter(text); viewCounter(text);
} }
else if (type == ProjectPostVectorChild) else if (type == ProjectPostVectorChild) {
{
QString text = _currentItem->text(0); QString text = _currentItem->text(0);
text.remove(" @ Node"); text.remove(" @ Node");
text.replace(" @ Cell", "_cell000"); text.replace(" @ Cell", "_cell000");
viewVector(text); viewVector(text);
} }
else else {
{
emit clearAllHighLightSig(); emit clearAllHighLightSig();
emit disPlayProp(nullptr); emit disPlayProp(nullptr);
} }
const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1; const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1;
if (index >= 0) if (index >= 0) {
{
ConfigOption::TreeItem* item = _itemList.at(index); ConfigOption::TreeItem* item = _itemList.at(index);
const int id = item->getDataID(); const int id = item->getDataID();
DataProperty::DataBase* d = _modelDataExtend->getConfigData(id); DataProperty::DataBase* d = _modelDataExtend->getConfigData(id);
@ -811,13 +719,10 @@ namespace ProjectTree
void ProjectTreeWithBasicNode::doubleClicked() void ProjectTreeWithBasicNode::doubleClicked()
{ {
if (_treeType == 1) if (_treeType == 1) {
{
TreeItemType itemType = (TreeItemType)_currentItem->type(); TreeItemType itemType = (TreeItemType)_currentItem->type();
switch (itemType) switch (itemType) {
{ case TreeItemType::ProjectSimulationSettingChild: {
case TreeItemType::ProjectSimulationSettingChild:
{
// NodeParameterDlg dlg(_treeType, _currentItem->text(0), _mainWindow); // NodeParameterDlg dlg(_treeType, _currentItem->text(0), _mainWindow);
break; break;
} }
@ -831,32 +736,32 @@ namespace ProjectTree
return; return;
_reportItem->takeChildren(); _reportItem->takeChildren();
const int nReport = _modelDataExtend->getReportCount(); const int nReport = _modelDataExtend->getReportCount();
for (int i = 0; i < nReport; ++i) for (int i = 0; i < nReport; ++i) {
{
QString report = _modelDataExtend->getReportAt(i); QString report = _modelDataExtend->getReportAt(i);
QFileInfo file(report); QFileInfo file(report);
if (!file.exists()) if (!file.exists())
continue; continue;
QString text = file.fileName(); QString text = file.fileName();
QTreeWidgetItem *item = new QTreeWidgetItem(_reportItem, TreeItemType::ProjectReportChild); QTreeWidgetItem* item =
new QTreeWidgetItem(_reportItem, TreeItemType::ProjectReportChild);
item->setText(0, text); item->setText(0, text);
} }
_reportItem->setExpanded(true); _reportItem->setExpanded(true);
} }
void ProjectTreeWithBasicNode::assignProperty() void ProjectTreeWithBasicNode::assignMaterial()
{ {
AssignPropertyDialog dlg(_mainWindow, _modelDataExtend); AssignMaterialDialog dlg(_mainWindow, _modelDataExtend);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
this->updateComponentSubTree(); this->updateComponentSubTree();
} }
void ProjectTreeWithBasicNode::d2PlotContextMenu(QMenu* menu) 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); ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
if (info == nullptr) if (info == nullptr)
return; return;
if (_postMapper != nullptr) if (_postMapper != nullptr) {
{
delete _postMapper; delete _postMapper;
_postMapper = nullptr; _postMapper = nullptr;
} }
@ -864,8 +769,7 @@ namespace ProjectTree
_postMapper = new QSignalMapper(this); _postMapper = new QSignalMapper(this);
// QStringList d2Variables = info->get2DVariable(); // QStringList d2Variables = info->get2DVariable();
QList<ConfigOption::PostCurve*> curlist = info->getCurveList(); 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(); QString text = curlist.at(i)->getDescribe();
if (text.isEmpty()) if (text.isEmpty())
continue; continue;
@ -877,12 +781,12 @@ namespace ProjectTree
} }
void ProjectTreeWithBasicNode::counterContextMenu(QMenu* menu) 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); ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
if (info == nullptr) if (info == nullptr)
return; return;
if (_postMapper != nullptr) if (_postMapper != nullptr) {
{
delete _postMapper; delete _postMapper;
_postMapper = nullptr; _postMapper = nullptr;
} }
@ -899,8 +803,7 @@ namespace ProjectTree
// if (scalarVariables.at(0) != "") // 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); QString text = scalarVariables.at(i);
if (text.isEmpty()) if (text.isEmpty())
continue; continue;
@ -914,8 +817,7 @@ namespace ProjectTree
// if (scalarVariables.at(0) != "") // 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); QString text = scalarVariables.at(i);
if (text.isEmpty()) if (text.isEmpty())
continue; continue;
@ -928,12 +830,12 @@ namespace ProjectTree
} }
void ProjectTreeWithBasicNode::vectorContextMenu(QMenu* menu) 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); ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
if (info == nullptr) if (info == nullptr)
return; return;
if (_postMapper != nullptr) if (_postMapper != nullptr) {
{
delete _postMapper; delete _postMapper;
_postMapper = nullptr; _postMapper = nullptr;
} }
@ -950,8 +852,7 @@ namespace ProjectTree
// if (vectorVariables.at(0) != "") // 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); QString text = vectorVariables.at(i);
if (text.isEmpty()) if (text.isEmpty())
continue; continue;
@ -964,8 +865,7 @@ namespace ProjectTree
// if (vectorVariables.at(0) != "") // 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); QString text = vectorVariables.at(i);
if (text.isEmpty()) if (text.isEmpty())
continue; continue;
@ -981,15 +881,13 @@ namespace ProjectTree
{ {
auto p2d = _modelDataExtend->getPost2DWindow(); auto p2d = _modelDataExtend->getPost2DWindow();
auto p3d = _modelDataExtend->getPost3DWindow(); auto p3d = _modelDataExtend->getPost3DWindow();
if (p2d == w) if (p2d == w) {
{
// _post2DWindow = nullptr; // _post2DWindow = nullptr;
_modelDataExtend->setPost2DWindow(nullptr); _modelDataExtend->setPost2DWindow(nullptr);
_modelDataExtend->clearPlotCurve(); _modelDataExtend->clearPlotCurve();
this->updatePostTree(); this->updatePostTree();
} }
if (p3d == w) if (p3d == w) {
{
// _post3DWindow = nullptr; // _post3DWindow = nullptr;
_modelDataExtend->setPost3DWindow(nullptr); _modelDataExtend->setPost3DWindow(nullptr);
_modelDataExtend->clear3DVariable(); _modelDataExtend->clear3DVariable();
@ -1011,35 +909,35 @@ namespace ProjectTree
{ {
auto p2d = _modelDataExtend->getPost2DWindow(); auto p2d = _modelDataExtend->getPost2DWindow();
if (p2d == nullptr) if (p2d == nullptr) {
{ // ConfigOption::PostConfig* option =
// ConfigOption::PostConfig* option = ConfigOption::ConfigOption::getInstance()->getPostConfig(); // ConfigOption::ConfigOption::getInstance()->getPostConfig();
// ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType); // ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
p2d = new Post::Post2DWindowInterface(_mainWindow, _data->getID()); p2d = new Post::Post2DWindowInterface(_mainWindow, _data->getID());
_modelDataExtend->setPost2DWindow(p2d); _modelDataExtend->setPost2DWindow(p2d);
// QStringList filenames = info->getPost2DFile(); // QStringList filenames = info->getPost2DFile();
QStringList filenames = _modelDataExtend->getAbsolutePost2DFiles(); QStringList filenames = _modelDataExtend->getAbsolutePost2DFiles();
//
// for (int i = 0; i < filenames.size(); ++i) for (int i = 0; i < filenames.size(); ++i) {
// { QString fileName = filenames.at(i);
// QString fileName = filenames.at(i); // QString file = _data->getPath() + "/Result/" + fileName;
// // QString file = _data->getPath() + "/Result/" + fileName; // qDebug() << fileName;
// // qDebug() << fileName; p2d->openfile(fileName);
// p2d->openfile(fileName); }
// }
} }
emit openPostWindowSig(p2d); emit openPostWindowSig(p2d);
if (_modelDataExtend->isPostCurveExist(variable)) if (_modelDataExtend->isPostCurveExist(variable))
return; return;
ConfigOption::PostConfig *postinfo = ConfigOption::ConfigOption::getInstance()->getPostConfig(); ConfigOption::PostConfig* postinfo =
ConfigOption::ConfigOption::getInstance()->getPostConfig();
ConfigOption::PostConfigInfo* info = postinfo->getPostConfigInfo(_treeType); ConfigOption::PostConfigInfo* info = postinfo->getPostConfigInfo(_treeType);
ConfigOption::PostCurve* curve = info->getCurveByName(variable); ConfigOption::PostCurve* curve = info->getCurveByName(variable);
ConfigOption::PostCurve* newcurve = new ConfigOption::PostCurve; ConfigOption::PostCurve* newcurve = new ConfigOption::PostCurve;
QString path = _modelDataExtend->getPath() + "/Result/";
newcurve->copy(curve); 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); _modelDataExtend->apppendPlotCurve(newcurve);
this->updatePostTree(); this->updatePostTree();
@ -1057,9 +955,9 @@ namespace ProjectTree
{ {
auto p3d = _modelDataExtend->getPost3DWindow(); auto p3d = _modelDataExtend->getPost3DWindow();
if (p3d == nullptr) if (p3d == nullptr) {
{ ConfigOption::PostConfig* option =
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig(); ConfigOption::ConfigOption::getInstance()->getPostConfig();
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType); ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
QString fileName = info->getPost3DFile(); QString fileName = info->getPost3DFile();
QString file = _data->getPath() + "/Result/" + fileName; QString file = _data->getPath() + "/Result/" + fileName;
@ -1070,8 +968,7 @@ namespace ProjectTree
} }
emit openPostWindowSig(p3d); emit openPostWindowSig(p3d);
QStringList variablelist = _modelDataExtend->getScalarVariable(); QStringList variablelist = _modelDataExtend->getScalarVariable();
if (!variablelist.contains(variable)) if (!variablelist.contains(variable)) {
{
_modelDataExtend->appendScalarVariable(variable); _modelDataExtend->appendScalarVariable(variable);
this->updatePostTree(); this->updatePostTree();
} }
@ -1095,9 +992,9 @@ namespace ProjectTree
void ProjectTreeWithBasicNode::viewVectorPost(QString variable) void ProjectTreeWithBasicNode::viewVectorPost(QString variable)
{ {
auto p3d = _modelDataExtend->getPost3DWindow(); auto p3d = _modelDataExtend->getPost3DWindow();
if (p3d == nullptr) if (p3d == nullptr) {
{ ConfigOption::PostConfig* option =
ConfigOption::PostConfig *option = ConfigOption::ConfigOption::getInstance()->getPostConfig(); ConfigOption::ConfigOption::getInstance()->getPostConfig();
ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType); ConfigOption::PostConfigInfo* info = option->getPostConfigInfo(_treeType);
QString fileName = info->getPost3DFile(); QString fileName = info->getPost3DFile();
QString file = _data->getPath() + "/Result/" + fileName; QString file = _data->getPath() + "/Result/" + fileName;
@ -1108,8 +1005,7 @@ namespace ProjectTree
} }
emit openPostWindowSig(p3d); emit openPostWindowSig(p3d);
QStringList variablelist = _modelDataExtend->getVectorVariable(); QStringList variablelist = _modelDataExtend->getVectorVariable();
if (!variablelist.contains(variable)) if (!variablelist.contains(variable)) {
{
_modelDataExtend->appendVectorVariable(variable); _modelDataExtend->appendVectorVariable(variable);
this->updatePostTree(); this->updatePostTree();
} }
@ -1125,19 +1021,16 @@ namespace ProjectTree
QStringList files; //= _modelDataExtend->getMonitorNameList(); QStringList files; //= _modelDataExtend->getMonitorNameList();
if (files.size() > 1) if (files.size() > 1)
return; return;
for (int i = 0; i < files.size(); ++i) for (int i = 0; i < files.size(); ++i) {
{
QString fi = files.at(i); QString fi = files.at(i);
QFile f(fi); QFile f(fi);
if (!f.exists()) if (!f.exists()) {
{
QMessageBox::warning(nullptr, tr("Warning"), tr("File %1 is not exist").arg(fi)); QMessageBox::warning(nullptr, tr("Warning"), tr("File %1 is not exist").arg(fi));
return; return;
} }
} }
if (_realTimeWin == nullptr) if (_realTimeWin == nullptr) {
{
_realTimeWin = new Post::RealTimeWindowBase(_mainWindow, _data->getID()); _realTimeWin = new Post::RealTimeWindowBase(_mainWindow, _data->getID());
emit openRealTimeWin(_realTimeWin, _data->getID()); emit openRealTimeWin(_realTimeWin, _data->getID());
} }
@ -1153,8 +1046,7 @@ namespace ProjectTree
return _modelDataExtend->getSolverSetting(); return _modelDataExtend->getSolverSetting();
const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1; const int index = _currentItem->data(0, Qt::UserRole + 1).toInt() - 1;
if (index >= 0) if (index >= 0) {
{
ConfigOption::TreeItem* item = _itemList.at(index); ConfigOption::TreeItem* item = _itemList.at(index);
const int id = item->getDataID(); const int id = item->getDataID();
DataProperty::DataBase* d = _modelDataExtend->getConfigData(id); DataProperty::DataBase* d = _modelDataExtend->getConfigData(id);
@ -1202,15 +1094,15 @@ namespace ProjectTree
Geometry::GeometryData* geodata = Geometry::GeometryData::getInstance(); Geometry::GeometryData* geodata = Geometry::GeometryData::getInstance();
QList<int> geoIDs = _modelDataExtend->getGeometryList(); 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); int id = geoIDs.at(i);
Geometry::GeometrySet* set = geodata->getGeometrySetByID(id); Geometry::GeometrySet* set = geodata->getGeometrySetByID(id);
if (set == nullptr) if (set == nullptr)
continue; continue;
QString name = set->getName(); QString name = set->getName();
QString icon = "://QUI/icon/geometry.png"; 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->setIcon(0, QIcon(icon));
temp->setText(0, name); temp->setText(0, name);
temp->setData(0, Qt::UserRole, id); temp->setData(0, Qt::UserRole, id);
@ -1218,4 +1110,4 @@ namespace ProjectTree
_geometryRootItem->setExpanded(true); _geometryRootItem->setExpanded(true);
} }
} } // namespace ProjectTree

View File

@ -1,26 +1,4 @@
/** #ifndef _PROJECTTREEWITHBASICNODE_H_
* @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_
#define _PROJECTTREEWITHBASICNODE_H_ #define _PROJECTTREEWITHBASICNODE_H_
#include "projectTreeBase.h" #include "projectTreeBase.h"
@ -72,7 +50,6 @@ namespace ProjectTree
virtual void updateComponentSubTree(); virtual void updateComponentSubTree();
// virtual void updateMeshSetSubTree(); // virtual void updateMeshSetSubTree();
// virtual void updateGeoComponentTree(); // virtual void updateGeoComponentTree();
virtual void updatePropTree();
virtual void updateBCSubTree(); virtual void updateBCSubTree();
virtual void updateReportTree(); virtual void updateReportTree();
virtual void updateMonitorTree(); virtual void updateMonitorTree();
@ -108,10 +85,9 @@ namespace ProjectTree
virtual void importGeometry(); virtual void importGeometry();
virtual void importComponents(); virtual void importComponents();
virtual void removeItem(); virtual void removeItem();
virtual void addEleProperty();
virtual void addBC(); virtual void addBC();
virtual void createReport(); virtual void createReport();
virtual void assignProperty(); virtual void assignMaterial();
virtual void viewRealTimeWindow(); virtual void viewRealTimeWindow();
virtual void viewPlot2D(QString variable); virtual void viewPlot2D(QString variable);
virtual void viewCounter(QString variable); virtual void viewCounter(QString variable);
@ -121,7 +97,6 @@ namespace ProjectTree
protected: protected:
QTreeWidgetItem* _geometryRootItem{}; QTreeWidgetItem* _geometryRootItem{};
QTreeWidgetItem *_propertyRootItem{};
QTreeWidgetItem* _ComponentRootItem{}; QTreeWidgetItem* _ComponentRootItem{};
QTreeWidgetItem* _simulationSettingItem{}; QTreeWidgetItem* _simulationSettingItem{};
QTreeWidgetItem* _boundaryConditionItem{}; QTreeWidgetItem* _boundaryConditionItem{};
@ -148,6 +123,7 @@ namespace ProjectTree
QList<QTreeWidgetItem*> _ComponentItems; QList<QTreeWidgetItem*> _ComponentItems;
}; };
} }
#endif #endif

View File

@ -3,13 +3,13 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QMenu> #include <QMenu>
#include <QAction> #include <QAction>
#include <QElapsedTimer> #include <QTime>
#include "ConfigOptions/TreeItemData.h" #include "ConfigOptions/TreeItemData.h"
#include "ConfigOptions/ProjectTreeInfo.h" #include "ConfigOptions/ProjectTreeInfo.h"
#include "MainWindow/MainWindow.h" #include "mainWindow/mainWindow.h"
#include "ModelData/modelDataBase.h" #include "ModelData/modelDataBase.h"
#include "ModelData/modelDataSingleton.h" #include "ModelData/modelDataSingleton.h"
#include "Settings/BusAPI.h" #include "settings/busAPI.h"
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
@ -34,8 +34,7 @@ namespace ProjectTree
} }
ProjectTreeBase::~ProjectTreeBase() ProjectTreeBase::~ProjectTreeBase()
{ {
if (_root == nullptr) if (_root == nullptr) return;
return;
_root->takeChildren(); _root->takeChildren();
_itemList.clear(); _itemList.clear();
} }
@ -66,16 +65,14 @@ namespace ProjectTree
} }
void ProjectTreeBase::createTree(QTreeWidgetItem* phyroot, GUI::MainWindow* mainwindow) void ProjectTreeBase::createTree(QTreeWidgetItem* phyroot, GUI::MainWindow* mainwindow)
{ {
if (_data == nullptr) if (_data == nullptr) return;
return;
_mainWindow = mainwindow; _mainWindow = mainwindow;
// QTreeWidgetItem* root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot); // QTreeWidgetItem* root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
initBasicNode(phyroot); initBasicNode(phyroot);
QString lang = Setting::BusAPI::instance()->getLanguage(); QString lang = Setting::BusAPI::instance()->getLanguage();
double time = _data->getSolveTime(); double time = _data->getSolveTime();
if (time > 0) if (time > 0) _solveStatus = Finished;
_solveStatus = Finished;
_data->setOutputFileName(_outputFile); _data->setOutputFileName(_outputFile);
int n = _itemList.size(); int n = _itemList.size();
@ -83,11 +80,9 @@ namespace ProjectTree
{ {
QTreeWidgetItem* parent = _root; QTreeWidgetItem* parent = _root;
ConfigOption::TreeItem* item = _itemList.at(i); ConfigOption::TreeItem* item = _itemList.at(i);
if (item == nullptr) if (item == nullptr) continue;
continue;
QString sparent = item->getParent(); QString sparent = item->getParent();
if (_textItemHash.contains(sparent)) if (_textItemHash.contains(sparent)) parent = _textItemHash.value(sparent);
parent = _textItemHash.value(sparent);
QTreeWidgetItem* treeitem = new QTreeWidgetItem(parent, item->getType()); QTreeWidgetItem* treeitem = new QTreeWidgetItem(parent, item->getType());
treeitem->setData(0, Qt::UserRole + 1, i + 1); //留空0标记为不是配置文件创建 treeitem->setData(0, Qt::UserRole + 1, i + 1); //留空0标记为不是配置文件创建
treeitem->setData(1, Qt::UserRole, item->getText()); //英文 treeitem->setData(1, Qt::UserRole, item->getText()); //英文
@ -95,8 +90,7 @@ namespace ProjectTree
QString text = item->getText(); QString text = item->getText();
if (lang == "Chinese") if (lang == "Chinese")
text = item->getChinese(); text = item->getChinese();
if (text.isEmpty()) if (text.isEmpty()) text = item->getText();
text = item->getText();
treeitem->setText(0,text); treeitem->setText(0,text);
QString sicon = item->getIcon(); QString sicon = item->getIcon();
@ -109,20 +103,21 @@ namespace ProjectTree
{ {
QString s = _disableItems.at(i); QString s = _disableItems.at(i);
auto item = _textItemHash.value(s); auto item = _textItemHash.value(s);
if (item == nullptr) if (item == nullptr) continue;
continue;
item->setHidden(true); item->setHidden(true);
} }
} }
void ProjectTreeBase::initBasicNode(QTreeWidgetItem* phyroot) void ProjectTreeBase::initBasicNode(QTreeWidgetItem* phyroot)
{ {
_root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot); _root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
_root->setFlags(_root->flags() | Qt::ItemIsEditable); _root->setFlags(_root->flags() | Qt::ItemIsEditable);
_root->setIcon(0, QIcon(":/QUI/icon/physics.png")); _root->setIcon(0, QIcon(":/QUI/icon/physics.png"));
// int id = _data->getID(); int id = _data->getID();
_root->setText(0, _data->getName()); //根据项目名称确定 _root->setText(0, _data->getName()); //根据项目名称确定
_root->setData(0, Qt::UserRole, _data->getID()); _root->setData(0, Qt::UserRole, _data->getID());
_root->setExpanded(true); _root->setExpanded(true);
} }
void ProjectTreeBase::on_MouseEvent(int eventType, QTreeWidgetItem* item) void ProjectTreeBase::on_MouseEvent(int eventType, QTreeWidgetItem* item)
{ {
@ -132,17 +127,10 @@ namespace ProjectTree
switch (eventType) switch (eventType)
{ {
case 0: case 0: singleClicked();break;
singleClicked(); case 1:createContextMenu();break;
break; case 2:doubleClicked();break;
case 1: default:break;
createContextMenu();
break;
case 2:
doubleClicked();
break;
default:
break;
} }
} }
// void ProjectTreeBase::copy(ProjectTreeBase* tree) // void ProjectTreeBase::copy(ProjectTreeBase* tree)
@ -177,6 +165,7 @@ namespace ProjectTree
} }
_outputFile = info->getOutputFileName(); _outputFile = info->getOutputFileName();
_disableItems = info->getDisableItems(); _disableItems = info->getDisableItems();
} }
void ProjectTreeBase::setData(ModelData::ModelDataBase* data) void ProjectTreeBase::setData(ModelData::ModelDataBase* data)
{ {
@ -204,6 +193,7 @@ namespace ProjectTree
void ProjectTreeBase::singleClicked() void ProjectTreeBase::singleClicked()
{ {
//qDebug() << "parent s"; //qDebug() << "parent s";
} }
void ProjectTreeBase::doubleClicked() void ProjectTreeBase::doubleClicked()
{ {
@ -225,8 +215,7 @@ namespace ProjectTree
{ {
ConfigOption::TreeItem* treeItem = _itemList.at(itemindex - 1); ConfigOption::TreeItem* treeItem = _itemList.at(itemindex - 1);
const int n = treeItem->getContextMenuCount(); const int n = treeItem->getContextMenuCount();
if (n < 1) if (n < 1) return;
return;
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
QString menuText = treeItem->getContextMenuAt(i); QString menuText = treeItem->getContextMenuAt(i);
@ -234,34 +223,31 @@ namespace ProjectTree
switch (type) switch (type)
{ {
case ProjectPostSetting: case ProjectPostSetting:
if (0 == i) if (0 == i) connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
break; break;
case ProjectComponent: case ProjectComponent:
break; break;
case ProjectSolver: case ProjectSolver:
break; break;
default: default: break;
break;
} }
} }
} }
} }
void ProjectTreeBase::updateTree() void ProjectTreeBase::updateTree()
{ {
} }
void ProjectTreeBase::updateTreeByType(const TreeItemType type) void ProjectTreeBase::updateTreeByType(const TreeItemType type)
{ {
Q_UNUSED(type)
} }
QList<QTreeWidgetItem*> ProjectTreeBase::getItemByType(const TreeItemType type,QTreeWidgetItem* root) QList<QTreeWidgetItem*> ProjectTreeBase::getItemByType(const TreeItemType type,QTreeWidgetItem* root)
{ {
QList<QTreeWidgetItem*> items; QList<QTreeWidgetItem*> items;
if (root == nullptr) if (root == nullptr) root = _root;
root = _root; if (root->type() == type) items.append(root);
if (root->type() == type)
items.append(root);
const int n = root->childCount(); const int n = root->childCount();
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
@ -285,27 +271,21 @@ namespace ProjectTree
{ {
ModelData::ModelDataSingleton* s = ModelData::ModelDataSingleton::getinstance(); ModelData::ModelDataSingleton* s = ModelData::ModelDataSingleton::getinstance();
int id = s->getModelIDByIndex(proIndex); int id = s->getModelIDByIndex(proIndex);
if (id < 0) if (id < 0) return;
return; if (id != _data->getID()) return;
if (id != _data->getID())
return;
_solveStatus = Solving; _solveStatus = Solving;
if (_timer == nullptr) if (_timer == nullptr) _timer = new QTime;
_timer = new QElapsedTimer;
_timer->start(); _timer->start();
emit solveStatusChanged(); emit solveStatusChanged();
} }
void ProjectTreeBase::solveFinished(int proid) void ProjectTreeBase::solveFinished(int proid)
{ {
if (proid != _data->getID()) if (proid != _data->getID()) return;
return;
_solveStatus = Finished; _solveStatus = Finished;
if (_timer == nullptr) if (_timer == nullptr) return;
return;
double time = _timer->elapsed(); double time = _timer->elapsed();
// qDebug() << time; // qDebug() << time;
delete _timer; delete _timer; _timer = nullptr;
_timer = nullptr;
_data->setSolveTime(time); _data->setSolveTime(time);
emit solveStatusChanged(); emit solveStatusChanged();
} }
@ -323,11 +303,9 @@ namespace ProjectTree
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
QTreeWidgetItem* item = itemList.at(i); QTreeWidgetItem* item = itemList.at(i);
if (item == nullptr) if (item == nullptr) continue;
continue;
QString text = item->data(1, Qt::UserRole + 1).toString(); QString text = item->data(1, Qt::UserRole + 1).toString();
if (text.isEmpty()) if (text.isEmpty()) continue;
continue;
item->setText(0, text); item->setText(0, text);
} }
} }
@ -336,11 +314,9 @@ namespace ProjectTree
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
QTreeWidgetItem* item = itemList.at(i); QTreeWidgetItem* item = itemList.at(i);
if (item == nullptr) if (item == nullptr) continue;
continue;
QString text = item->data(1, Qt::UserRole).toString(); QString text = item->data(1, Qt::UserRole).toString();
if (text.isEmpty()) if (text.isEmpty()) continue;
continue;
item->setText(0, text); item->setText(0, text);
} }
} }
@ -357,6 +333,7 @@ namespace ProjectTree
{ {
if (id == _data->getID()) if (id == _data->getID())
_realTimeWin = w; _realTimeWin = w;
} }
void ProjectTreeBase::realTimeWindowClosed(Post::RealTimeWindowBase* w) void ProjectTreeBase::realTimeWindowClosed(Post::RealTimeWindowBase* w)
{ {
@ -374,4 +351,5 @@ namespace ProjectTree
return true; return true;
} }
} }

View File

@ -1,25 +1,7 @@
/** /******************
* @file projectTreeBase.h ProjectTreeBase
* @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.
* ==================================================================================
*/
#ifndef PROJECTTREE_H #ifndef PROJECTTREE_H
#define PROJECTTREE_H #define PROJECTTREE_H
@ -32,7 +14,7 @@
#include "ProjectTreeAPI.h" #include "ProjectTreeAPI.h"
class QTreeWidgetItem; class QTreeWidgetItem;
class QElapsedTimer; class QTime;
class QMenu; class QMenu;
namespace ModelData namespace ModelData
@ -62,6 +44,7 @@ namespace ConfigOption
namespace ProjectTree namespace ProjectTree
{ {
enum SolveStatus enum SolveStatus
{ {
UnSolved = 1, UnSolved = 1,
@ -77,11 +60,7 @@ namespace ProjectTree
virtual ~ProjectTreeBase(); virtual ~ProjectTreeBase();
//ProjectTree* copy(); //ProjectTree* copy();
// void copy(ProjectTreeBase* tree); // void copy(ProjectTreeBase* tree);
/** //从配置文件中拷贝信息
* @brief
* @param info
* @since 2.5.0
*/
void copy(ConfigOption::ProjectTreeInfo* info); void copy(ConfigOption::ProjectTreeInfo* info);
void setOutputFileName(QString fileName); void setOutputFileName(QString fileName);
//设置名称 //设置名称
@ -146,6 +125,7 @@ namespace ProjectTree
//求解状态改变 //求解状态改变
void solveStatusChanged(); void solveStatusChanged();
protected: protected:
virtual void initBasicNode(QTreeWidgetItem* root); virtual void initBasicNode(QTreeWidgetItem* root);
@ -170,7 +150,7 @@ namespace ProjectTree
QHash<QString, QTreeWidgetItem*> _textItemHash{}; QHash<QString, QTreeWidgetItem*> _textItemHash{};
ModelData::ModelDataBase* _data{}; ModelData::ModelDataBase* _data{};
SolveStatus _solveStatus{ UnSolved }; SolveStatus _solveStatus{ UnSolved };
QElapsedTimer *_timer{}; QTime* _timer{};
QString _outputFile{}; QString _outputFile{};
QString _chinese{}; QString _chinese{};
QStringList _disableItems{}; QStringList _disableItems{};
@ -179,4 +159,5 @@ namespace ProjectTree
}; };
} }
#endif #endif

View File

@ -1,5 +1,4 @@
#-------关联C++库--------------- #-------关联C++库---------------
import ControlPanel
import ctypes import ctypes
import platform import platform
system = platform.system() system = platform.system()
@ -7,7 +6,7 @@ if system == "Windows":
pre = "./" pre = "./"
suff = ".dll" suff = ".dll"
else: else:
pre = "../lib/lib" pre = "./lib"
suff = ".so" suff = ".so"
libfile = ctypes.cdll.LoadLibrary libfile = ctypes.cdll.LoadLibrary
@ -15,17 +14,15 @@ filename = pre+"ModelData"+suff
md = libfile(filename) md = libfile(filename)
import ControlPanel
#--------------------------------- #---------------------------------
#-------定义函数------------------ #-------定义函数------------------
def setMaterial(modelID, strcpIDs ,mid):
def setProperty(modelID, strcpIDs, pid):
strcpIDs = bytes(strcpIDs,encoding='utf-8') strcpIDs = bytes(strcpIDs,encoding='utf-8')
md.setProperty(modelID, strcpIDs, pid) md.setMaterial(modelID, strcpIDs ,mid)
pass pass
def importComponents(caseId,addcomponentsId): def importComponents(caseId,addcomponentsId):
addcomponentsId = bytes(addcomponentsId,encoding='utf-8') addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
md.importComponents(caseId,addcomponentsId) md.importComponents(caseId,addcomponentsId)
@ -33,28 +30,23 @@ def importComponents(caseId, addcomponentsId):
ControlPanel.updateBCSubTree(caseId) ControlPanel.updateBCSubTree(caseId)
pass pass
def importGeometry(caseId,addcomponentsId): def importGeometry(caseId,addcomponentsId):
addcomponentsId = bytes(addcomponentsId,encoding='utf-8') addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
md.importGeometry(caseId,addcomponentsId) md.importGeometry(caseId,addcomponentsId)
ControlPanel.updateGeometrySubTree(caseId) ControlPanel.updateGeometrySubTree(caseId)
pass pass
def addBC(caseId,id,bctypetostring): def addBC(caseId,id,bctypetostring):
bctypetostring = bytes(bctypetostring,encoding='utf-8') bctypetostring = bytes(bctypetostring,encoding='utf-8')
md.addBC(caseId,id,bctypetostring) md.addBC(caseId,id,bctypetostring)
ControlPanel.updateBCSubTree(caseId) ControlPanel.updateBCSubTree(caseId)
pass pass
def objValChanged(value,describe,stype): def objValChanged(value,describe,stype):
describe = bytes(describe,encoding='utf-8') describe = bytes(describe,encoding='utf-8')
stype = bytes(stype,encoding='utf-8') stype = bytes(stype,encoding='utf-8')
md.objValChanged(value,describe,stype) md.objValChanged(value,describe,stype)
pass pass
def setValue(caseId,svariable,stype,sValue): def setValue(caseId,svariable,stype,sValue):
variable = bytes(svariable,encoding='utf-8') variable = bytes(svariable,encoding='utf-8')
type = bytes(stype,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) md.setValue(caseId, variable, type, value)
pass pass
def setBCValue(caseId,index,svariable,stype,sValue): def setBCValue(caseId,index,svariable,stype,sValue):
variable = bytes(svariable,encoding='utf-8') variable = bytes(svariable,encoding='utf-8')
type = bytes(stype,encoding='utf-8') type = bytes(stype,encoding='utf-8')
value = bytes(sValue,encoding='utf-8') value = bytes(sValue,encoding='utf-8')
md.setBCValue(caseId, index,variable, type, value) md.setBCValue(caseId, index,variable, type, value)
pass pass

View File

@ -38,6 +38,10 @@ ShowPoint=true
ShowEdge=true ShowEdge=true
ShowSurface=true ShowSurface=true
[MeshDisplay]
ShowNode=true
ShowEdge=true
ShowFace=true
[Plugins] [Plugins]
Name= Name=