修复组件无法赋材料的bug
parent
402a1ce747
commit
d59a9d1885
|
@ -44,16 +44,16 @@ endif()
|
|||
#-----------------------------------------------------------------------------
|
||||
# 测试环境定义(如果在支持cmake系统的IDE中编写代码,可以打开以下注释,并将路径修改为自己的Qt路径)
|
||||
#-----------------------------------------------------------------------------
|
||||
#[[set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
||||
message(STATUS "${PROJECT_NAME} will be installed to ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
if (NOT DEFINED Qt5_DIR)
|
||||
if(FASTCAE_LINUX)
|
||||
set(Qt5_DIR "/opt/Qt5.14.2/5.14.2/gcc_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
elseif(FASTCAE_WIN)
|
||||
set(Qt5_DIR "D:/software/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
set(Qt5_DIR "D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake/Qt5" CACHE PATH "Qt5Config.cmake所在目录" FORCE)
|
||||
endif()
|
||||
endif()]]
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 编译选项设置
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
#include <QString>
|
||||
#include "DataPropertyAPI.h"
|
||||
|
||||
/**
|
||||
* @brief 模型树类型
|
||||
* @since 2.5.0
|
||||
*/
|
||||
/**
|
||||
* @brief 模型树类型
|
||||
* @since 2.5.0
|
||||
*/
|
||||
enum ProjectTreeType
|
||||
{
|
||||
UnDefined = -1, ///< 未定义的
|
||||
TreeType = 0, ///< 树类型
|
||||
PluginDefType = 100, ///< 插件
|
||||
TreeTypeBoundary = 100000, ///< 边界
|
||||
UnDefined = -1, ///< 未定义的
|
||||
TreeType = 0, ///< 树类型
|
||||
PluginDefType = 100, ///< 插件
|
||||
TreeTypeBoundary = 100000, ///< 边界
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -44,56 +44,52 @@ enum ProjectTreeType
|
|||
*/
|
||||
enum TreeItemType
|
||||
{
|
||||
Undefined = -1, ///< 未定义的
|
||||
GeometryRoot = 1, ///< 几何根节点
|
||||
GeometryChild, ///< 几何子节点
|
||||
Datum, ///< 基准
|
||||
DatumPlane, ///< 基准平面
|
||||
GeoComponentRoot, ///< 几何组件根节点
|
||||
GeoComponentChild, ///< 几何组件子节点
|
||||
MeshRoot, ///< 网格根节点
|
||||
MeshChild, ///< 网格子节点
|
||||
MeshSetRoot, ///< 网格组件根节点
|
||||
MeshSetChild, ///< 网格组件子节点
|
||||
MaterialRoot, ///< 材料根节点
|
||||
MaterialChild, ///< 材料子节点
|
||||
PhyaicsModelRoot, ///< 物理模型(算例)根节点
|
||||
ProjectRoot, ///< 工程根节点(Case_*)
|
||||
ProjectSimulationSetting, ///< 仿真参数设置
|
||||
ProjectSimulationSettingChild, ///< 仿真参数设置子节点
|
||||
ProjectSimulationSettingGrandSon, ///< 仿真参数设置孙子节点
|
||||
ProjectGeometry, ///< 几何根节点
|
||||
ProjectGeometryChild, ///< 几何子节点
|
||||
|
||||
ProjectEleProperty,
|
||||
ProjectElePropertyChild,
|
||||
|
||||
ProjectComponent, ///< 工程组件节点
|
||||
ProjectComponentChild, ///< 工程组件子节点
|
||||
ProjectBoundaryCondation, ///< 工程边界条件节点
|
||||
ProjectBoundaryCondationChild, ///< 工程边界条件子节点
|
||||
ProjectMonitor, ///< 监视器节点
|
||||
ProjectMonitorChild, ///< 监视器子节点
|
||||
ProjectSolver, ///< 求解设置节点
|
||||
ProjectSolverChild, ///< 求解设置子节点
|
||||
ProjectSolverGrandSon, ///< 求解设置孙子节点
|
||||
ProjectPostSetting, ///< 后处理节点
|
||||
ProjectPostSettingChild, ///< 后处理子节点
|
||||
ProjectCaseTemplate, ///<
|
||||
ProjectPost, ///<
|
||||
ProjectPost3DGraph, ///< 三维绘图(云图???)
|
||||
ProjectPost3DGraphChild, ///< 三维绘图子节点
|
||||
ProJectPost2DGraph, ///< 二维绘图
|
||||
ProJectPost2DGraphChild, ///< 二维绘图子节点
|
||||
ProjectPostCounter, ///< 云图
|
||||
ProjectPostCounterChild, ///< 云图子节点
|
||||
ProjectPostVector, ///< 矢量
|
||||
ProjectPostVectorChild, ///< 矢量子节点
|
||||
ProjectPostStreamLine, ///< 流线
|
||||
ProjectPostStreamLineChild, ///< 流线子节点
|
||||
ProjectReport, ///< 报告
|
||||
ProjectReportChild, ///< 报告子节点
|
||||
SelfDefineItem, ///< 自定义节点
|
||||
Undefined = -1, ///< 未定义的
|
||||
GeometryRoot = 1, ///< 几何根节点
|
||||
GeometryChild, ///< 几何子节点
|
||||
Datum, ///< 基准
|
||||
DatumPlane, ///< 基准平面
|
||||
GeoComponentRoot, ///< 几何组件根节点
|
||||
GeoComponentChild, ///< 几何组件子节点
|
||||
MeshRoot, ///< 网格根节点
|
||||
MeshChild, ///< 网格子节点
|
||||
MeshSetRoot, ///< 网格组件根节点
|
||||
MeshSetChild, ///< 网格组件子节点
|
||||
MaterialRoot, ///< 材料根节点
|
||||
MaterialChild, ///< 材料子节点
|
||||
PhyaicsModelRoot, ///< 物理模型(算例)根节点
|
||||
ProjectRoot, ///< 工程根节点(Case_*)
|
||||
ProjectSimulationSetting, ///< 仿真参数设置
|
||||
ProjectSimulationSettingChild, ///< 仿真参数设置子节点
|
||||
ProjectSimulationSettingGrandSon, ///< 仿真参数设置孙子节点
|
||||
ProjectGeometry, ///< 几何根节点
|
||||
ProjectGeometryChild, ///< 几何子节点
|
||||
ProjectComponent, ///< 工程组件节点
|
||||
ProjectComponentChild, ///< 工程组件子节点
|
||||
ProjectBoundaryCondation, ///< 工程边界条件节点
|
||||
ProjectBoundaryCondationChild, ///< 工程边界条件子节点
|
||||
ProjectMonitor, ///< 监视器节点
|
||||
ProjectMonitorChild, ///< 监视器子节点
|
||||
ProjectSolver, ///< 求解设置节点
|
||||
ProjectSolverChild, ///< 求解设置子节点
|
||||
ProjectSolverGrandSon, ///< 求解设置孙子节点
|
||||
ProjectPostSetting, ///< 后处理节点
|
||||
ProjectPostSettingChild, ///< 后处理子节点
|
||||
ProjectCaseTemplate, ///<
|
||||
ProjectPost, ///<
|
||||
ProjectPost3DGraph, ///< 三维绘图(云图???)
|
||||
ProjectPost3DGraphChild, ///< 三维绘图子节点
|
||||
ProJectPost2DGraph, ///< 二维绘图
|
||||
ProJectPost2DGraphChild, ///< 二维绘图子节点
|
||||
ProjectPostCounter, ///< 云图
|
||||
ProjectPostCounterChild, ///< 云图子节点
|
||||
ProjectPostVector, ///< 矢量
|
||||
ProjectPostVectorChild, ///< 矢量子节点
|
||||
ProjectPostStreamLine, ///< 流线
|
||||
ProjectPostStreamLineChild, ///< 流线子节点
|
||||
ProjectReport, ///< 报告
|
||||
ProjectReportChild, ///< 报告子节点
|
||||
SelfDefineItem, ///< 自定义节点
|
||||
};
|
||||
|
||||
extern TreeItemType DATAPROPERTYAPI getTreeItemTypeByString(const QString &type);
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#include "elementProperty.h"
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
int ElementProperty::MaxID = 0;
|
||||
|
||||
ElementProperty::ElementProperty()
|
||||
{
|
||||
this->setID(++MaxID);
|
||||
}
|
||||
void ElementProperty::setEleType(QString s)
|
||||
{
|
||||
_eletype = s;
|
||||
this->appendProperty("Type", s);
|
||||
}
|
||||
QString ElementProperty::getEleType()
|
||||
{
|
||||
return _eletype;
|
||||
}
|
||||
|
||||
void ElementProperty::setMaterialID(int id)
|
||||
{
|
||||
_materialID = id;
|
||||
this->appendProperty("Material", id);
|
||||
}
|
||||
|
||||
int ElementProperty::getMaterialID()
|
||||
{
|
||||
return _materialID;
|
||||
}
|
||||
|
||||
int ElementProperty::getMaxID()
|
||||
{
|
||||
return MaxID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef __ELEMENTPROPERTY_H__
|
||||
#define __ELEMENTPROPERTY_H__
|
||||
|
||||
#include "modelDataAPI.h"
|
||||
#include "DataProperty/DataBase.h"
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
class MODELDATAAPI ElementProperty : public DataProperty::DataBase
|
||||
{
|
||||
public:
|
||||
ElementProperty();
|
||||
~ElementProperty() = default;
|
||||
|
||||
void setEleType(QString s);
|
||||
QString getEleType();
|
||||
|
||||
void setMaterialID(int id);
|
||||
int getMaterialID();
|
||||
|
||||
static int getMaxID();
|
||||
|
||||
private:
|
||||
QString _eletype{};
|
||||
int _materialID{ -1 };
|
||||
|
||||
static int MaxID;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -5,15 +5,15 @@
|
|||
* @version 2.5.0
|
||||
* @date 2022-03-08 10:54
|
||||
* @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
|
||||
|
@ -37,145 +37,134 @@ class QDomDocument;
|
|||
|
||||
namespace BCBase
|
||||
{
|
||||
class BCBase;
|
||||
class BCBase;
|
||||
}
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
class SimlutationSettingBase;
|
||||
class SolverSettingBase;
|
||||
class ElementProperty;
|
||||
class SimlutationSettingBase;
|
||||
class SolverSettingBase;
|
||||
class ElementProperty;
|
||||
|
||||
class MODELDATAAPI ModelDataBase : public DataProperty::DataBase
|
||||
{
|
||||
public:
|
||||
//构造函数
|
||||
ModelDataBase(ProjectTreeType treeType);
|
||||
virtual ~ModelDataBase();
|
||||
//从配置文件中拷贝
|
||||
virtual void copyFormConfig();
|
||||
//将ID和类型信息传递给基类的各个参数
|
||||
virtual void generateParaInfo() override;
|
||||
//获取最大的ID
|
||||
static int getMaxID();
|
||||
void setID(int id) override;
|
||||
//获取算例路径
|
||||
QString getPath();
|
||||
static void resetMaxID();
|
||||
//设置类型
|
||||
void setTreeType(ProjectTreeType type);
|
||||
//获取类型
|
||||
ProjectTreeType getTreeType();
|
||||
//求解完成时间
|
||||
void setSolveTime(double t);
|
||||
//获取求解完成时间
|
||||
double getSolveTime();
|
||||
//设置写出给求解器的文件名称
|
||||
void setOutputFileName(QString name);
|
||||
QString& getOutputFileName();
|
||||
/*获取MD5的stream*/
|
||||
virtual void dataToStream(QDataStream* datas) override;
|
||||
//数据写出到工程文件 子类必须重写该函数
|
||||
virtual QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* ele) override;
|
||||
//数据写出到工程文件 子类必须重写该函数
|
||||
virtual void writeToProjectFile1(QDomDocument* doc, QDomElement* ele);
|
||||
///从工程文件块读入数据,子类必须重写此函数
|
||||
virtual void readDataFromProjectFile(QDomElement* e) override;
|
||||
///将数据写出文本给求解器
|
||||
virtual void writeToSolverText(QTextStream* stream);
|
||||
///将数据写出XML给求解器
|
||||
virtual void writeToSolverXML(QDomDocument* doc, QDomElement* e);
|
||||
//检查数据是否可以求解 返回True-可以求解;False-不能求解
|
||||
virtual bool checkSolveableStatus(QVector<ModuleBase::Message> & messages);
|
||||
|
||||
//获取BC数量
|
||||
int getBCCount();
|
||||
//添加BC
|
||||
void appeendBC(BCBase::BCBase* bc);
|
||||
//根据类型获取BC
|
||||
QList<BCBase::BCBase*> getBCByType(BCBase::BCType type);
|
||||
class MODELDATAAPI ModelDataBase : public DataProperty::DataBase
|
||||
{
|
||||
public:
|
||||
//构造函数
|
||||
ModelDataBase(ProjectTreeType treeType);
|
||||
virtual ~ModelDataBase();
|
||||
//从配置文件中拷贝
|
||||
virtual void copyFormConfig();
|
||||
//将ID和类型信息传递给基类的各个参数
|
||||
virtual void generateParaInfo() override;
|
||||
//获取最大的ID
|
||||
static int getMaxID();
|
||||
void setID(int id) override;
|
||||
//获取算例路径
|
||||
QString getPath();
|
||||
static void resetMaxID();
|
||||
//设置类型
|
||||
void setTreeType(ProjectTreeType type);
|
||||
//获取类型
|
||||
ProjectTreeType getTreeType();
|
||||
//求解完成时间
|
||||
void setSolveTime(double t);
|
||||
//获取求解完成时间
|
||||
double getSolveTime();
|
||||
//设置写出给求解器的文件名称
|
||||
void setOutputFileName(QString name);
|
||||
QString& getOutputFileName();
|
||||
/*获取MD5的stream*/
|
||||
virtual void dataToStream(QDataStream* datas) override;
|
||||
//数据写出到工程文件 子类必须重写该函数
|
||||
virtual QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* ele) override;
|
||||
//数据写出到工程文件 子类必须重写该函数
|
||||
virtual void writeToProjectFile1(QDomDocument* doc, QDomElement* ele);
|
||||
///从工程文件块读入数据,子类必须重写此函数
|
||||
virtual void readDataFromProjectFile(QDomElement* e) override;
|
||||
///将数据写出文本给求解器
|
||||
virtual void writeToSolverText(QTextStream* stream);
|
||||
///将数据写出XML给求解器
|
||||
virtual void writeToSolverXML(QDomDocument* doc, QDomElement* e);
|
||||
//检查数据是否可以求解 返回True-可以求解;False-不能求解
|
||||
virtual bool checkSolveableStatus(QVector<ModuleBase::Message> & messages);
|
||||
|
||||
//获取第index个BC
|
||||
BCBase::BCBase* getBCAt(const int index);
|
||||
//移除边界条件
|
||||
void removeBCAt(const int index);
|
||||
//通过组件ID删除BC,每个BC都会绑定一个组件
|
||||
void removeBCByComponentID(int);
|
||||
//设置需要关联的组件ID(包括网格组件和几何组件)
|
||||
void setComponentIDList(const QList<int>& ids);
|
||||
//添加一个组件ID
|
||||
void addComponentID(int cpId);
|
||||
//获取关联的组件ID(包括网格组件和几何组件)
|
||||
const QList<int>& getComponentIDList();
|
||||
//通过ID删除组件
|
||||
bool removeComponentByID(int);
|
||||
//获取BC数量
|
||||
int getBCCount();
|
||||
//添加BC
|
||||
void appeendBC(BCBase::BCBase* bc);
|
||||
//根据类型获取BC
|
||||
QList<BCBase::BCBase*> getBCByType(BCBase::BCType type);
|
||||
|
||||
//获取关联的网格组件ID
|
||||
QList<int> getMeshSetList();
|
||||
//获取关联的几何组件ID
|
||||
QList<int> getGeoComponentIDList();
|
||||
//获取第index个BC
|
||||
BCBase::BCBase* getBCAt(const int index);
|
||||
//移除边界条件
|
||||
void removeBCAt(const int index);
|
||||
//通过组件ID删除BC,每个BC都会绑定一个组件
|
||||
void removeBCByComponentID(int);
|
||||
//设置需要关联的组件ID(包括网格组件和几何组件)
|
||||
void setComponentIDList(const QList<int>& ids);
|
||||
//添加一个组件ID
|
||||
void addComponentID(int cpId);
|
||||
//获取关联的组件ID(包括网格组件和几何组件)
|
||||
const QList<int>& getComponentIDList();
|
||||
//通过ID删除组件
|
||||
bool removeComponentByID(int);
|
||||
|
||||
//设置需要关联的网格组件ID
|
||||
//virtual void setMeshSetList(QList<int> ids);
|
||||
//设置需要关联的几何组件ID
|
||||
//void setGeoComponentIDList(QList<int> ids);
|
||||
//获取关联的网格组件ID
|
||||
QList<int> getMeshSetList();
|
||||
//获取关联的几何组件ID
|
||||
QList<int> getGeoComponentIDList();
|
||||
|
||||
void appendEleProperty(ElementProperty* p);
|
||||
//设置需要关联的网格组件ID
|
||||
//virtual void setMeshSetList(QList<int> ids);
|
||||
//设置需要关联的几何组件ID
|
||||
//void setGeoComponentIDList(QList<int> ids);
|
||||
|
||||
int getElePropCount();
|
||||
//移除第index个组件
|
||||
virtual void removeComponentAt(int index);
|
||||
//获取关联的Kernal ID
|
||||
QList<int>& getMeshKernalList();
|
||||
//设置关联的Kernal ID
|
||||
void setMeshKernelList(const QList<int>& kids);
|
||||
//添加关联的Kernal ID
|
||||
void addMeshKernalId(const int);
|
||||
//获取关联的几何形状
|
||||
QList<int>& getGeometryList();
|
||||
//设置关联的几何形状
|
||||
void setGeometryList(QList<int> geo);
|
||||
//获取仿真参数
|
||||
SimlutationSettingBase* getSimlutationSetting();
|
||||
//获取求解器设置
|
||||
SolverSettingBase* getSolverSetting();
|
||||
//组件是否使用
|
||||
bool isComponentUsed(int index);
|
||||
|
||||
ElementProperty* getElePropertyAt(int index);
|
||||
|
||||
ElementProperty* getElePropertyByID(int id);
|
||||
|
||||
void removeElePropAt(int index);
|
||||
|
||||
|
||||
//移除第index个组件
|
||||
virtual void removeComponentAt(int index);
|
||||
//获取关联的Kernal ID
|
||||
QList<int>& getMeshKernalList();
|
||||
//设置关联的Kernal ID
|
||||
void setMeshKernelList(const QList<int>& kids);
|
||||
//添加关联的Kernal ID
|
||||
void addMeshKernalId(const int);
|
||||
//获取关联的几何形状
|
||||
QList<int>& getGeometryList();
|
||||
//设置关联的几何形状
|
||||
void setGeometryList(QList<int> geo);
|
||||
//获取仿真参数
|
||||
SimlutationSettingBase* getSimlutationSetting();
|
||||
//获取求解器设置
|
||||
SolverSettingBase* getSolverSetting();
|
||||
//组件是否使用
|
||||
bool isComponentUsed(int index);
|
||||
|
||||
virtual DataProperty::ParameterBase* getParameterByName(QString name) override;
|
||||
virtual void removeParameter(DataProperty::ParameterBase* p) override;
|
||||
virtual DataProperty::ParameterGroup* getParameterGroupByName(QString name) override;
|
||||
virtual void removeParameterGroup(DataProperty::ParameterGroup* g) override;
|
||||
virtual DataProperty::ParameterBase* getParameterByName(QString name) override;
|
||||
virtual void removeParameter(DataProperty::ParameterBase* p) override;
|
||||
virtual DataProperty::ParameterGroup* getParameterGroupByName(QString name) override;
|
||||
virtual void removeParameterGroup(DataProperty::ParameterGroup* g) override;
|
||||
|
||||
|
||||
private:
|
||||
ProjectTreeType getTreeTypeByString(const QString& type);
|
||||
QString getTreeTypeToSring(ProjectTreeType type);
|
||||
private:
|
||||
ProjectTreeType getTreeTypeByString(const QString& type);
|
||||
QString getTreeTypeToSring(ProjectTreeType type);
|
||||
|
||||
protected:
|
||||
ProjectTreeType _treeType{ UnDefined };
|
||||
static int maxID;
|
||||
double _solvetime{ -1.0 };
|
||||
QString _outputFileName{};
|
||||
protected:
|
||||
ProjectTreeType _treeType{ UnDefined };
|
||||
static int maxID;
|
||||
double _solvetime{ -1.0 };
|
||||
QString _outputFileName{};
|
||||
|
||||
QList<ElementProperty*> _elePropList{};
|
||||
QList<BCBase::BCBase*> _bcList{};
|
||||
// QMultiHash<int, QString> _ComponentIDType{};
|
||||
QList<int> _ComponentIDList{};
|
||||
QList<int> _meshKernalIDList{};
|
||||
QList<int> _geometryList{};
|
||||
QList<ElementProperty*> _elePropList{};
|
||||
QList<BCBase::BCBase*> _bcList{};
|
||||
// QMultiHash<int, QString> _ComponentIDType{};
|
||||
QList<int> _ComponentIDList{};
|
||||
QList<int> _meshKernalIDList{};
|
||||
QList<int> _geometryList{};
|
||||
|
||||
SolverSettingBase* _solverSetting{};
|
||||
SimlutationSettingBase* _simlutationSetting{};
|
||||
};
|
||||
SolverSettingBase* _solverSetting{};
|
||||
SimlutationSettingBase* _simlutationSetting{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -80,23 +80,23 @@ namespace ModelData
|
|||
|
||||
QDomElement& ModelDataBaseExtend::writeToProjectFile(QDomDocument* doc, QDomElement* e)
|
||||
{
|
||||
QDomElement element = ModelDataBase::writeToProjectFile(doc, e);
|
||||
QDomElement propele = doc->createElement("Property");
|
||||
QList<int> setidlist = _setProperty.keys();
|
||||
QDomElement element = ModelDataBase::writeToProjectFile(doc, e);
|
||||
QDomElement materialele = doc->createElement("Material");
|
||||
QList<int> setidlist = _setMaterial.keys();
|
||||
for (int i = 0; i < setidlist.size(); ++i)
|
||||
{
|
||||
int setid = setidlist.at(i);
|
||||
int propid = _setProperty.value(setid);
|
||||
QDomElement mc = doc->createElement("PropInfo");
|
||||
int materialid = _setMaterial.value(setid);
|
||||
QDomElement mc = doc->createElement("MaterialInfo");
|
||||
QDomAttr setattr = doc->createAttribute("ComponentID");
|
||||
QDomAttr propattr = doc->createAttribute("PropID");
|
||||
QDomAttr materialattr = doc->createAttribute("MaterialID");
|
||||
setattr.setValue(QString::number(setid));
|
||||
propattr.setValue(QString::number(propid));
|
||||
materialattr.setValue(QString::number(materialid));
|
||||
mc.setAttributeNode(setattr);
|
||||
mc.setAttributeNode(propattr);
|
||||
propele.appendChild(mc);
|
||||
mc.setAttributeNode(materialattr);
|
||||
materialele.appendChild(mc);
|
||||
}
|
||||
element.appendChild(propele);
|
||||
element.appendChild(materialele);
|
||||
|
||||
QDomElement configele = doc->createElement("ConfigData");
|
||||
QList<DataProperty::DataBase*> datalist = _configData.values();
|
||||
|
@ -131,15 +131,15 @@ namespace ModelData
|
|||
{
|
||||
ModelDataBase::writeToProjectFile1(doc, e);
|
||||
|
||||
QDomElement materialele = doc->createElement("Property");
|
||||
QList<int> setidlist = _setProperty.keys();
|
||||
QDomElement materialele = doc->createElement("Material");
|
||||
QList<int> setidlist = _setMaterial.keys();
|
||||
for (int i = 0; i < setidlist.size(); ++i)
|
||||
{
|
||||
int setid = setidlist.at(i);
|
||||
int materialid = _setProperty.value(setid);
|
||||
QDomElement mc = doc->createElement("PropInfo");
|
||||
int materialid = _setMaterial.value(setid);
|
||||
QDomElement mc = doc->createElement("MaterialInfo");
|
||||
QDomAttr setattr = doc->createAttribute("ComponentID");
|
||||
QDomAttr materialattr = doc->createAttribute("PropID");
|
||||
QDomAttr materialattr = doc->createAttribute("MaterialID");
|
||||
setattr.setValue(QString::number(setid));
|
||||
materialattr.setValue(QString::number(materialid));
|
||||
mc.setAttributeNode(setattr);
|
||||
|
@ -176,15 +176,15 @@ namespace ModelData
|
|||
void ModelDataBaseExtend::readDataFromProjectFile(QDomElement* e)
|
||||
{
|
||||
ModelDataBase::readDataFromProjectFile(e);
|
||||
QDomNodeList materialList = e->elementsByTagName("PropInfo");
|
||||
QDomNodeList materialList = e->elementsByTagName("MaterialInfo");
|
||||
for (int i = 0; i < materialList.size(); ++i)
|
||||
{
|
||||
QDomElement ele = materialList.at(i).toElement();
|
||||
QString ssetid = ele.attribute("ComponentID");
|
||||
QString smaterialID = ele.attribute("PropID");
|
||||
QString smaterialID = ele.attribute("MaterialID");
|
||||
int setid = ssetid.toInt();
|
||||
int maid = smaterialID.toInt();
|
||||
this->setProperty(setid, maid);
|
||||
this->setMaterial(setid, maid);
|
||||
}
|
||||
|
||||
QDomNodeList configdata = e->elementsByTagName("ConfigData");
|
||||
|
@ -233,38 +233,38 @@ namespace ModelData
|
|||
this->writeToProjectFile(doc, e);
|
||||
}
|
||||
|
||||
void ModelDataBaseExtend::setProperty(int setID, int materialID)
|
||||
void ModelDataBaseExtend::setMaterial(int setID, int materialID)
|
||||
{
|
||||
if (!_ComponentIDList.contains(setID) || materialID <= 0) return;
|
||||
_setProperty[setID] = materialID;
|
||||
_setMaterial[setID] = materialID;
|
||||
}
|
||||
|
||||
int ModelDataBaseExtend::getPropertyID(int setid)
|
||||
int ModelDataBaseExtend::getMaterialID(int setid)
|
||||
{
|
||||
int m = -1;
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
m = _setProperty.value(setid);
|
||||
m = _setMaterial.value(setid);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
bool ModelDataBaseExtend::isPropertySetted(int setid)
|
||||
bool ModelDataBaseExtend::isMaterialSetted(int setid)
|
||||
{
|
||||
bool s = false;
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
if (_setProperty.value(setid) >= 0)
|
||||
if (_setMaterial.value(setid) >= 0)
|
||||
s = true;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void ModelDataBaseExtend::removeProperty(int setid)
|
||||
void ModelDataBaseExtend::removeMaterial(int setid)
|
||||
{
|
||||
if (_setProperty.contains(setid))
|
||||
if (_setMaterial.contains(setid))
|
||||
{
|
||||
_setProperty.remove(setid);
|
||||
_setMaterial.remove(setid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ namespace ModelData
|
|||
|
||||
for (int id : removeid)
|
||||
{
|
||||
if (_setProperty.contains(id))
|
||||
_setProperty.remove(id);
|
||||
if (_setMaterial.contains(id))
|
||||
_setMaterial.remove(id);
|
||||
for (auto bc : _bcList)
|
||||
{
|
||||
if (bc->getComponentID() == id)
|
||||
|
@ -296,9 +296,9 @@ namespace ModelData
|
|||
{
|
||||
assert(index >= 0 && index < _ComponentIDList.size());
|
||||
int id = _ComponentIDList.at(index);
|
||||
if (isPropertySetted(id))
|
||||
if (isMaterialSetted(id))
|
||||
{
|
||||
removeProperty(id);
|
||||
removeMaterial(id);
|
||||
}
|
||||
ModelDataBase::removeComponentAt(index);
|
||||
}
|
||||
|
@ -688,4 +688,4 @@ namespace ModelData
|
|||
{
|
||||
return _inpMaterIds;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,14 +47,14 @@ namespace ModelData
|
|||
QString getReportAt(int index);
|
||||
//移除第index个报告
|
||||
void removeReportAt(int index);
|
||||
//设置属性,网格组件ID与属性ID
|
||||
void setProperty(int setID, int pid);
|
||||
//设置材料,网格组件ID与材料ID
|
||||
void setMaterial(int setID, int materialID);
|
||||
//获取组件的材料ID
|
||||
int getPropertyID(int setid);
|
||||
int getMaterialID(int setid);
|
||||
//组件是否被设置材料
|
||||
bool isPropertySetted(int setid);
|
||||
//解除属性与组件的绑定
|
||||
void removeProperty(int setid);
|
||||
bool isMaterialSetted(int setid);
|
||||
//解除材料与组件的绑定
|
||||
void removeMaterial(int setid);
|
||||
|
||||
virtual void setComponentIDList(QList<int> ids);
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace ModelData
|
|||
|
||||
protected:
|
||||
QList<int> _inpMaterIds;
|
||||
QHash<int, int> _setProperty{};
|
||||
QHash<int, int> _setMaterial{};
|
||||
QStringList _reportList{};
|
||||
QHash<int, DataProperty::DataBase*> _configData{};
|
||||
QStringList _monitorFiles{};
|
||||
|
|
|
@ -8,137 +8,127 @@
|
|||
#include <QDebug>
|
||||
#include "ProjectTree/DialogAddBC.h"
|
||||
|
||||
|
||||
namespace ModelData
|
||||
{
|
||||
void ModelDataPy::importComponents(int caseId, const char *addcomponentsId)
|
||||
{
|
||||
QString scomponentIds(addcomponentsId);
|
||||
QStringList scomponentIdsList = scomponentIds.simplified().split(" ");
|
||||
QList<int> ids;
|
||||
for (QString id : scomponentIdsList)
|
||||
ids.append(id.toInt());
|
||||
ModelDataBase *model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
model->setComponentIDList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
void ModelDataPy::importComponents(int caseId, const char* addcomponentsId)
|
||||
{
|
||||
QString scomponentIds(addcomponentsId);
|
||||
QStringList scomponentIdsList = scomponentIds.simplified().split(" ");
|
||||
QList<int> ids;
|
||||
for (QString id : scomponentIdsList)
|
||||
ids.append(id.toInt());
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr) return;
|
||||
model->setComponentIDList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::importGeometry(int caseId, char *addcomponentsId)
|
||||
{
|
||||
QString scomponentIds(addcomponentsId);
|
||||
QStringList scomponentIdsList = scomponentIds.simplified().split(" ");
|
||||
QList<int> ids;
|
||||
for (int i = 0; i < scomponentIdsList.size(); ++i)
|
||||
{
|
||||
// qDebug() << scomponentIdsList[i];
|
||||
ids.append(scomponentIdsList[i].toInt());
|
||||
}
|
||||
ModelDataBase *model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
void ModelDataPy::importGeometry(int caseId, char* addcomponentsId)
|
||||
{
|
||||
QString scomponentIds(addcomponentsId);
|
||||
QStringList scomponentIdsList = scomponentIds.simplified().split(" ");
|
||||
QList<int> ids;
|
||||
for (int i = 0; i < scomponentIdsList.size(); ++i)
|
||||
{
|
||||
// qDebug() << scomponentIdsList[i];
|
||||
ids.append(scomponentIdsList[i].toInt());
|
||||
}
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr) return;
|
||||
|
||||
model->setGeometryList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
model->setGeometryList(ids);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::addBC(int caseId, int id, char *bctypetostring)
|
||||
{
|
||||
|
||||
QString bctyst(bctypetostring);
|
||||
BCBase::BCType bctype = BCBase::StringToBCType(bctyst);
|
||||
// bctyst = BCBase::BCTypeToString(bctype);
|
||||
if (bctype == BCBase::None)
|
||||
bctype = BCBase::UserDef;
|
||||
ModelDataBase *model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
ModelDataBaseExtend *_data = dynamic_cast<ModelDataBaseExtend *>(model);
|
||||
BCBase::BCBase *bc = ParaClassFactory::BCFactory::createBCByType(bctype, bctyst, _data->getTreeType());
|
||||
if (bc == nullptr)
|
||||
return;
|
||||
// bc->setBCType(bctype);
|
||||
bc->bingdingComponentID(id);
|
||||
_data->appeendBC(bc);
|
||||
bc->generateParaInfo();
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
void ModelDataPy::addBC(int caseId, int id, char* bctypetostring)
|
||||
{
|
||||
|
||||
void ModelDataPy::setValue(int caseID, char *variable, char *type, char *value)
|
||||
{
|
||||
QString svariable(variable);
|
||||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase *model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
DataProperty::ParameterBase *p = model->getParameterByName(svariable);
|
||||
if (p == nullptr)
|
||||
return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType())
|
||||
return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
QString bctyst(bctypetostring);
|
||||
BCBase::BCType bctype = BCBase::StringToBCType(bctyst);
|
||||
// bctyst = BCBase::BCTypeToString(bctype);
|
||||
if (bctype == BCBase::None) bctype = BCBase::UserDef;
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseId);
|
||||
if (model == nullptr) return;
|
||||
ModelDataBaseExtend *_data = dynamic_cast<ModelDataBaseExtend*>(model);
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bctype, bctyst, _data->getTreeType());
|
||||
if (bc == nullptr) return;
|
||||
// bc->setBCType(bctype);
|
||||
bc->bingdingComponentID(id);
|
||||
_data->appeendBC(bc);
|
||||
bc->generateParaInfo();
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::setBCValue(int caseID, int index, char *variable, char *type, char *value)
|
||||
{
|
||||
QString svariable(variable);
|
||||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase *model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr)
|
||||
return;
|
||||
BCBase::BCBase *bc = model->getBCAt(index);
|
||||
DataProperty::ParameterBase *p = bc->getParameterByName(svariable);
|
||||
if (p == nullptr)
|
||||
return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType())
|
||||
return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
void ModelDataPy::setValue(int caseID, char* variable, char* type, char* value)
|
||||
{
|
||||
QString svariable(variable);
|
||||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr) return;
|
||||
DataProperty::ParameterBase* p = model->getParameterByName(svariable);
|
||||
if (p == nullptr) return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType()) return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::setProperty(int caseID, char *componentIDs, int pid)
|
||||
{
|
||||
ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance();
|
||||
ModelData::ModelDataBaseExtend *model = dynamic_cast<ModelData::ModelDataBaseExtend *>(modelData->getModelByID(caseID));
|
||||
if (!model)
|
||||
return;
|
||||
QString cpIDs(componentIDs);
|
||||
QStringList cpIDList = cpIDs.split(';');
|
||||
for (QString cpID : cpIDList)
|
||||
model->setProperty(cpID.toInt(), pid);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
void ModelDataPy::setBCValue(int caseID, int index, char* variable, char* type, char* value)
|
||||
{
|
||||
QString svariable(variable);
|
||||
QString sType(type);
|
||||
QString sValue(value);
|
||||
ModelDataBase* model = ModelDataSingleton::getinstance()->getModelByID(caseID);
|
||||
if (model == nullptr) return;
|
||||
BCBase::BCBase* bc = model->getBCAt(index);
|
||||
DataProperty::ParameterBase* p = bc->getParameterByName(svariable);
|
||||
if (p == nullptr) return;
|
||||
DataProperty::ParaType t = DataProperty::ParameterBase::StringToParaType(sType);
|
||||
if (t != p->getParaType()) return;
|
||||
p->setValueFromString(sValue);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
|
||||
void ModelDataPy::setMaterial(int caseID, char* componentIDs, int materialID)
|
||||
{
|
||||
ModelData::ModelDataSingleton *modelData = ModelData::ModelDataSingleton::getinstance();
|
||||
ModelData::ModelDataBaseExtend* model = dynamic_cast<ModelData::ModelDataBaseExtend*>(modelData->getModelByID(caseID));
|
||||
if (!model) return;
|
||||
QString cpIDs(componentIDs);
|
||||
QStringList cpIDList = cpIDs.split(';');
|
||||
for (QString cpID : cpIDList)
|
||||
model->setMaterial(cpID.toInt(), materialID);
|
||||
Py::PythonAgent::getInstance()->unLock();
|
||||
}
|
||||
}
|
||||
|
||||
void MODELDATAAPI importComponents(int caseId, const char *addcomponentsId)
|
||||
void MODELDATAAPI importComponents(int caseId, const char* addcomponentsId)
|
||||
{
|
||||
ModelData::ModelDataPy::importComponents(caseId, addcomponentsId);
|
||||
ModelData::ModelDataPy::importComponents(caseId, addcomponentsId);
|
||||
}
|
||||
|
||||
void MODELDATAAPI addBC(int caseId, int id, char *bctypetostring)
|
||||
void MODELDATAAPI addBC(int caseId, int id, char* bctypetostring)
|
||||
{
|
||||
ModelData::ModelDataPy::addBC(caseId, id, bctypetostring);
|
||||
ModelData::ModelDataPy::addBC(caseId, id, bctypetostring);
|
||||
}
|
||||
|
||||
void MODELDATAAPI importGeometry(int caseId, char *addcomponentsId)
|
||||
void MODELDATAAPI importGeometry(int caseId, char* addcomponentsId)
|
||||
{
|
||||
ModelData::ModelDataPy::importGeometry(caseId, addcomponentsId);
|
||||
ModelData::ModelDataPy::importGeometry(caseId, addcomponentsId);
|
||||
}
|
||||
void MODELDATAAPI setValue(int caseID, char *variable, char *stype, char *svalue)
|
||||
void MODELDATAAPI setValue(int caseID, char* variable, char* stype, char* svalue)
|
||||
{
|
||||
ModelData::ModelDataPy::setValue(caseID, variable, stype, svalue);
|
||||
ModelData::ModelDataPy::setValue(caseID, variable, stype, 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ModelData
|
|||
static void addBC(int caseId, int id, char* bctypetostring);
|
||||
static void setValue(int caseID, char* variable, char* stype, char* svalue);
|
||||
static void setBCValue(int caseID, int index, char* variable, char* stype, char* svalue);
|
||||
static void setProperty(int caseID, char* componentIDs, int materialID);
|
||||
static void setMaterial(int caseID, char* componentIDs, int materialID);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern "C"
|
|||
void MODELDATAAPI addBC(int caseId, int id, char* bctypetostring);
|
||||
void MODELDATAAPI setValue(int caseID, char* variable, char* stype, char* svalue);
|
||||
void MODELDATAAPI setBCValue(int caseID,int index,char* variable, char* stype, char* svalue);
|
||||
void MODELDATAAPI setProperty(int caseID, char* componentIDs, int materialID);
|
||||
void MODELDATAAPI setMaterial(int caseID, char* componentIDs, int materialID);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
// #include "BCBase/BCPressure.h"
|
||||
// #include "BCBase/BCDisplacement.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
#include "ConfigOptions/ConfigOptions.h"
|
||||
#include "ConfigOptions/BCConfig.h"
|
||||
#include <assert.h>
|
||||
|
@ -20,19 +20,17 @@
|
|||
#include <QDebug>
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
namespace ProjectTree
|
||||
{
|
||||
namespace ProjectTree {
|
||||
|
||||
AddBCDialog::AddBCDialog(GUI::MainWindow *m, ModelData::ModelDataBaseExtend *data)
|
||||
: QFDialog(m), _data(data)
|
||||
AddBCDialog::AddBCDialog(GUI::MainWindow* m, ModelData::ModelDataBaseExtend* data)
|
||||
: QFDialog(m)
|
||||
, _data(data)
|
||||
{
|
||||
_ui = new Ui::AddBCDialog();
|
||||
_ui->setupUi(this);
|
||||
init();
|
||||
}
|
||||
AddBCDialog::~AddBCDialog()
|
||||
{
|
||||
}
|
||||
AddBCDialog::~AddBCDialog() {}
|
||||
void AddBCDialog::init()
|
||||
{
|
||||
initBCType();
|
||||
|
@ -40,24 +38,22 @@ namespace ProjectTree
|
|||
}
|
||||
void AddBCDialog::initComponents()
|
||||
{
|
||||
MeshData::MeshData *mesh = MeshData::MeshData::getInstance();
|
||||
QList<int> mshList = _data->getMeshSetList();
|
||||
for (int i = 0; i < mshList.size(); ++i)
|
||||
{
|
||||
int setID = mshList.at(i);
|
||||
MeshData::MeshSet *set = mesh->getMeshSetByID(setID);
|
||||
MeshData::MeshData* mesh = MeshData::MeshData::getInstance();
|
||||
QList<int> mshList = _data->getMeshSetList();
|
||||
for(int i = 0; i < mshList.size(); ++i) {
|
||||
int setID = mshList.at(i);
|
||||
MeshData::MeshSet* set = mesh->getMeshSetByID(setID);
|
||||
assert(set != nullptr);
|
||||
QString name = set->getName();
|
||||
_ui->setComboBox->addItem(name, Qt::UserRole + 1);
|
||||
_ui->setComboBox->setItemData(_ui->setComboBox->count() - 1, setID, Qt::UserRole + 1);
|
||||
}
|
||||
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcList = _data->getGeoComponentIDList();
|
||||
for (int i = 0; i < gcList.size(); ++i)
|
||||
{
|
||||
int gcID = gcList.at(i);
|
||||
auto *aGC = geoData->getGeoComponentByID(gcID);
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcList = _data->getGeoComponentIDList();
|
||||
for(int i = 0; i < gcList.size(); ++i) {
|
||||
int gcID = gcList.at(i);
|
||||
auto* aGC = geoData->getGeoComponentByID(gcID);
|
||||
assert(aGC != nullptr);
|
||||
QString name = aGC->getName();
|
||||
_ui->setComboBox->addItem(name, Qt::UserRole + 1);
|
||||
|
@ -66,21 +62,21 @@ namespace ProjectTree
|
|||
}
|
||||
void AddBCDialog::initBCType()
|
||||
{
|
||||
int beg = BCBase::BCType::None;
|
||||
int end = BCBase::BCType::End;
|
||||
ConfigOption::BCConfig *userdefbcs = ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
for (int i = beg; i < end; ++i)
|
||||
{
|
||||
int beg = BCBase::BCType::None;
|
||||
int end = BCBase::BCType::End;
|
||||
ConfigOption::BCConfig* userdefbcs =
|
||||
ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
for(int i = beg; i < end; ++i) {
|
||||
QString stype = BCBase::BCTypeToString((BCBase::BCType)i);
|
||||
if (!userdefbcs->isEnable(stype, _data->getTreeType()))
|
||||
if(!userdefbcs->isEnable(stype, _data->getTreeType()))
|
||||
continue;
|
||||
_ui->typeComboBox->addItem(stype, i);
|
||||
}
|
||||
// ConfigOption::BCConfig* userdefbcs = ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
// ConfigOption::BCConfig* userdefbcs =
|
||||
//ConfigOption::ConfigOption::getInstance()->getBCConfig();
|
||||
const int n = userdefbcs->getBCCount(_data->getTreeType());
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
BCBase::BCUserDef *bc = userdefbcs->getBCAt(i, _data->getTreeType());
|
||||
for(int i = 0; i < n; ++i) {
|
||||
BCBase::BCUserDef* bc = userdefbcs->getBCAt(i, _data->getTreeType());
|
||||
_ui->typeComboBox->addItem(bc->getName(), BCBase::UserDef);
|
||||
}
|
||||
}
|
||||
|
@ -101,11 +97,13 @@ namespace ProjectTree
|
|||
MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
|
||||
assert(set != nullptr);
|
||||
QString bcTypeToString = BCBase::BCTypeToString(bcType);//liu
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bcType, name, _data->getTreeType());
|
||||
BCBase::BCBase* bc = ParaClassFactory::BCFactory::createBCByType(bcType, name,
|
||||
_data->getTreeType());
|
||||
|
||||
if (bc != nullptr)
|
||||
{
|
||||
//QString code = QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(id).arg(addIdValues.join(" "));//
|
||||
//QString code =
|
||||
QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(id).arg(addIdValues.join(" "));//
|
||||
//qDebug() << code;
|
||||
//Py::PythonAgent::getInstance()->submit(code);
|
||||
bc->setType(bcType);
|
||||
|
@ -115,26 +113,27 @@ namespace ProjectTree
|
|||
void AddBCDialog::accept()
|
||||
{
|
||||
// const int index = _ui->typeComboBox->currentIndex();
|
||||
// BCBase::BCType bcType = (BCBase::BCType)(_ui->typeComboBox->itemData(index).toInt()); //Commented-Out By Baojun
|
||||
int cpID = _ui->setComboBox->itemData(_ui->setComboBox->currentIndex(), Qt::UserRole + 1).toInt();
|
||||
if (cpID < 0)
|
||||
// BCBase::BCType bcType =
|
||||
//(BCBase::BCType)(_ui->typeComboBox->itemData(index).toInt()); //Commented-Out By Baojun
|
||||
int cpID =
|
||||
_ui->setComboBox->itemData(_ui->setComboBox->currentIndex(), Qt::UserRole + 1).toInt();
|
||||
if(cpID < 0)
|
||||
return;
|
||||
QString typeName = _ui->typeComboBox->currentText();
|
||||
// QList<int> setidlist = _data->getMeshSetList();
|
||||
int caseid = _data->getID();
|
||||
int caseid = _data->getID();
|
||||
|
||||
// MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id); //Commented-Out By Baojun
|
||||
// if (set == nullptr) return;
|
||||
// int caseid = _data->getID();
|
||||
// MeshData::MeshSet* set = MeshData::MeshData::getInstance()->getMeshSetByID(id);
|
||||
////Commented-Out By Baojun if (set == nullptr) return; int caseid = _data->getID();
|
||||
// assert(set != nullptr);
|
||||
// QString bctypetostring = BCBase::BCTypeToString(bcType);//liu
|
||||
|
||||
// submit py code
|
||||
QString code = QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(cpID).arg(typeName);
|
||||
QString code = QString("Case.addBC(%1,%2,\"%3\")").arg(caseid).arg(cpID).arg(typeName);
|
||||
qDebug() << code;
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file DialogAddBC.h
|
||||
* @brief 设置边界条件对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:03
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGADDBC_H_
|
||||
#ifndef _DIALOGADDBC_H_
|
||||
#define _DIALOGADDBC_H_
|
||||
|
||||
#include "SelfDefObject/QFDialog.h"
|
||||
|
@ -40,40 +18,30 @@ namespace ModelData
|
|||
|
||||
namespace ProjectTree
|
||||
{
|
||||
/**
|
||||
* @brief 设置边界条件对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
class AddBCDialog : public QFDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddBCDialog(GUI::MainWindow *m, ModelData::ModelDataBaseExtend *data);
|
||||
AddBCDialog(GUI::MainWindow* m, ModelData::ModelDataBaseExtend* data);
|
||||
~AddBCDialog();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief 初始化对话框数据
|
||||
* @since 2.5.0
|
||||
*/
|
||||
void init();
|
||||
/**
|
||||
* @brief 初始化边界条件列表
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
virtual void initBCType();
|
||||
/**
|
||||
* @brief 初始化组件列表
|
||||
* @since 2.5.0
|
||||
*/
|
||||
virtual void initComponents();
|
||||
virtual void accept() override;
|
||||
|
||||
private:
|
||||
Ui::AddBCDialog *_ui{};
|
||||
ModelData::ModelDataBaseExtend *_data{};
|
||||
Ui::AddBCDialog* _ui{};
|
||||
ModelData::ModelDataBaseExtend* _data{};
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
#include "DialogAddProperty.h"
|
||||
#include <ui_DialogAddProperty.h>
|
||||
#include "Material/Material.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "ModelData/elementProperty.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
AddPropDialog::AddPropDialog(GUI::MainWindow * mw, ModelData::ModelDataBaseExtend * model)
|
||||
:_mainWindow(mw), _model(model)
|
||||
{
|
||||
_ui = new Ui::CreateEleProp;
|
||||
_ui->setupUi(this);
|
||||
init();
|
||||
}
|
||||
|
||||
AddPropDialog::~AddPropDialog()
|
||||
{
|
||||
if (_ui != nullptr) delete _ui;
|
||||
}
|
||||
|
||||
void ProjectTree::AddPropDialog::init()
|
||||
{
|
||||
int id = ModelData::ElementProperty::getMaxID();
|
||||
QString text = QString("Prop_%1").arg(id+1);
|
||||
_ui->nameLineEdit->setPlaceholderText(text);
|
||||
|
||||
auto mdata = Material::MaterialSingleton::getInstance();
|
||||
const int n = mdata->getMaterialCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
auto m = mdata->getMaterialAt(i);
|
||||
const int id = m->getID();
|
||||
_ui->materialCombox->addItem(QIcon(), m->getName(), id);
|
||||
}
|
||||
}
|
||||
|
||||
void AddPropDialog::accept()
|
||||
{
|
||||
QString name = _ui->nameLineEdit->text();
|
||||
if (name.isEmpty()) name = _ui->nameLineEdit->placeholderText();
|
||||
|
||||
int matID = _ui->materialCombox->currentData(Qt::UserRole).toInt();
|
||||
if (matID < 1) return;
|
||||
|
||||
auto prop = new ModelData::ElementProperty();
|
||||
prop->setName(name);
|
||||
prop->setEleType(_ui->eleTypeCombox->currentText());
|
||||
prop->setMaterialID(matID);
|
||||
|
||||
_model->appendEleProperty(prop);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef __DIALOGADDPROPERTY_H__
|
||||
#define __DIALOGADDPROPERTY_H__
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CreateEleProp;
|
||||
}
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
class AddPropDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
AddPropDialog(GUI::MainWindow* mw, ModelData::ModelDataBaseExtend* model);
|
||||
~AddPropDialog();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
Ui::CreateEleProp* _ui{};
|
||||
|
||||
GUI::MainWindow* _mainWindow{};
|
||||
ModelData::ModelDataBaseExtend* _model{};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // !__DIALOGADDPROPERTY_H__
|
|
@ -1,100 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateEleProp</class>
|
||||
<widget class="QDialog" name="CreateEleProp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>314</width>
|
||||
<height>119</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create Prop</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Element Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="eleTypeCombox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>elem_fem_sta_linear</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Material:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="materialCombox"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>CreateEleProp</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>CreateEleProp</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -0,0 +1,90 @@
|
|||
#include "DialogAssignMaterial.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "Material/Material.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include <QDebug>
|
||||
|
||||
namespace ProjectTree {
|
||||
AssignMaterialDialog::AssignMaterialDialog(GUI::MainWindow* mainwindow,
|
||||
ModelData::ModelDataBaseExtend* data)
|
||||
: ComponentSelectDialogBase(mainwindow, nullptr, nullptr)
|
||||
, _data(data)
|
||||
{
|
||||
_layout = new QHBoxLayout;
|
||||
_label = new QLabel("Material");
|
||||
_combobox = new QComboBox;
|
||||
_layout->addWidget(_label);
|
||||
_layout->addWidget(_combobox);
|
||||
this->setCustomLayout(_layout);
|
||||
init();
|
||||
}
|
||||
|
||||
AssignMaterialDialog::~AssignMaterialDialog()
|
||||
{
|
||||
if(_label != nullptr)
|
||||
delete _label;
|
||||
if(_combobox != nullptr)
|
||||
delete _combobox;
|
||||
if(_layout != nullptr)
|
||||
delete _layout;
|
||||
}
|
||||
|
||||
void AssignMaterialDialog::init()
|
||||
{
|
||||
MeshData::MeshData* meshdata = MeshData::MeshData::getInstance();
|
||||
QList<int> setlist = _data->getMeshSetList();
|
||||
for(int i = 0; i < setlist.size(); ++i) {
|
||||
int setid = setlist.at(i);
|
||||
MeshData::MeshSet* set = meshdata->getMeshSetByID(setid);
|
||||
if((set == nullptr) || (set->getSetType() != MeshData::Element))
|
||||
continue;
|
||||
QString name = set->getName();
|
||||
this->appendItemToAvailableList(name, setid, ":/QUI/icon/mesh.png");
|
||||
}
|
||||
|
||||
auto* geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcIDs = _data->getGeoComponentIDList();
|
||||
for(int gcID : gcIDs) {
|
||||
auto aGC = geoData->getGeoComponentByID(gcID);
|
||||
if(!aGC)
|
||||
continue;
|
||||
appendItemToAvailableList(aGC->getName(), gcID, ":/QUI/icon/geometry.png");
|
||||
}
|
||||
|
||||
Material::MaterialSingleton* materialData = Material::MaterialSingleton::getInstance();
|
||||
const int n = materialData->getMaterialCount();
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Material::Material* m = materialData->getMaterialAt(i);
|
||||
QString name = m->getName();
|
||||
const int id = m->getID();
|
||||
_combobox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
|
||||
void AssignMaterialDialog::accept()
|
||||
{
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QList<int> ids = idname.keys();
|
||||
const int currentindex = _combobox->currentIndex();
|
||||
const int mid = _combobox->itemData(currentindex).toInt();
|
||||
QString cpIDs;
|
||||
for(int i = 0; i < ids.size(); ++i) {
|
||||
int cpID = ids.at(i);
|
||||
cpIDs.append(QString::number(cpID)).append(';');
|
||||
}
|
||||
QString code = QString("Case.setMaterial(%1,\"%2\",%3)")
|
||||
.arg(_data->getID())
|
||||
.arg(cpIDs.left(cpIDs.size() - 1))
|
||||
.arg(mid);
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _DIALOGASSIGNMATERIAL_H_
|
||||
#define _DIALOGASSIGNMATERIAL_H_
|
||||
|
||||
#include "moduleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
class AssignMaterialDialog: public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
public:
|
||||
AssignMaterialDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data);
|
||||
~AssignMaterialDialog();
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
||||
|
||||
private:
|
||||
ModelData::ModelDataBaseExtend* _data{};
|
||||
QHBoxLayout* _layout{};
|
||||
QLabel* _label{};
|
||||
QComboBox* _combobox{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,93 +0,0 @@
|
|||
#include "DialogAssignProperty.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "Material/MaterialSingletion.h"
|
||||
#include "Material/Material.h"
|
||||
#include "PythonModule/PyAgent.h"
|
||||
#include "ModelData/elementProperty.h"
|
||||
#include <QDebug>
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
AssignPropertyDialog::AssignPropertyDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data)
|
||||
: ComponentSelectDialogBase(mainwindow, nullptr, nullptr), _data(data)
|
||||
{
|
||||
_layout = new QHBoxLayout;
|
||||
_label = new QLabel("Property");
|
||||
_combobox = new QComboBox;
|
||||
_layout->addWidget(_label);
|
||||
_layout->addWidget(_combobox);
|
||||
this->setCustomLayout(_layout);
|
||||
init();
|
||||
}
|
||||
|
||||
AssignPropertyDialog::~AssignPropertyDialog()
|
||||
{
|
||||
if (_label != nullptr)
|
||||
delete _label;
|
||||
if (_combobox != nullptr)
|
||||
delete _combobox;
|
||||
if (_layout != nullptr)
|
||||
delete _layout;
|
||||
}
|
||||
|
||||
void AssignPropertyDialog::init()
|
||||
{
|
||||
MeshData::MeshData *meshdata = MeshData::MeshData::getInstance();
|
||||
QList<int> setlist = _data->getMeshSetList();
|
||||
for (int i = 0; i < setlist.size(); ++i)
|
||||
{
|
||||
int setid = setlist.at(i);
|
||||
MeshData::MeshSet *set = meshdata->getMeshSetByID(setid);
|
||||
if ((set == nullptr) || (set->getSetType() != MeshData::Element))
|
||||
continue;
|
||||
QString name = set->getName();
|
||||
this->appendItemToAvailableList(name, setid, ":/QUI/icon/mesh.png");
|
||||
}
|
||||
|
||||
auto *geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> gcIDs = _data->getGeoComponentIDList();
|
||||
for (int gcID : gcIDs)
|
||||
{
|
||||
auto aGC = geoData->getGeoComponentByID(gcID);
|
||||
if (!aGC)
|
||||
continue;
|
||||
appendItemToAvailableList(aGC->getName(), gcID, ":/QUI/icon/geometry.png");
|
||||
}
|
||||
|
||||
// Material::MaterialSingleton* materialData = Material::MaterialSingleton::getInstance();
|
||||
// const int n = materialData->getMaterialCount();
|
||||
const int n = _data->getElePropCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
// Material::Material* m = materialData->getMaterialAt(i);
|
||||
auto m = _data->getElePropertyAt(i);
|
||||
QString name = m->getName();
|
||||
const int id = m->getID();
|
||||
_combobox->addItem(name, id);
|
||||
}
|
||||
}
|
||||
|
||||
void AssignPropertyDialog::accept()
|
||||
{
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QList<int> ids = idname.keys();
|
||||
const int currentindex = _combobox->currentIndex();
|
||||
const int mid = _combobox->itemData(currentindex).toInt();
|
||||
QString cpIDs;
|
||||
for (int i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
int cpID = ids.at(i);
|
||||
cpIDs.append(QString::number(cpID)).append(';');
|
||||
}
|
||||
QString code = QString("Case.setProperty(%1,\"%2\",%3)").arg(_data->getID()).arg(cpIDs.left(cpIDs.size() - 1)).arg(mid);
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* @file DialogAssignMaterial.h
|
||||
* @brief 材料设置对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:08
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGASSIGNMATERIAL_H_
|
||||
#define _DIALOGASSIGNMATERIAL_H_
|
||||
|
||||
#include "ModuleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
namespace ModelData
|
||||
{
|
||||
class ModelDataBaseExtend;
|
||||
}
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QComboBox;
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
/**
|
||||
* @brief 材料设置对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
class AssignPropertyDialog : public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
public:
|
||||
AssignPropertyDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data);
|
||||
~AssignPropertyDialog();
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
ModelData::ModelDataBaseExtend *_data{};
|
||||
QHBoxLayout *_layout{};
|
||||
QLabel *_label{};
|
||||
QComboBox *_combobox{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
#include "DialogImport.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshSet.h"
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshSet.h"
|
||||
#include "ModelData/modelDataBaseExtend.h"
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
@ -8,14 +8,15 @@
|
|||
#include "PythonModule/PyAgent.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "Geometry/geometryData.h"
|
||||
#include "Geometry/geometrySet.h"
|
||||
#include "Geometry/GeoComponent.h"
|
||||
#include "geometry/geometryData.h"
|
||||
#include "geometry/geometrySet.h"
|
||||
#include "geometry/GeoComponent.h"
|
||||
|
||||
namespace ProjectTree
|
||||
{
|
||||
ImportDialog::ImportDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data, ImportType t)
|
||||
: ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr), _type(t)
|
||||
namespace ProjectTree {
|
||||
ImportDialog::ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data,
|
||||
ImportType t)
|
||||
: ModuleBase::ComponentSelectDialogBase(mainwindow, nullptr, nullptr)
|
||||
, _type(t)
|
||||
{
|
||||
_data = data;
|
||||
init();
|
||||
|
@ -57,53 +58,47 @@ namespace ProjectTree
|
|||
}*/
|
||||
// acceptGeo();
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QList<int> ids = idname.keys();
|
||||
QStringList addIdValues{};
|
||||
for (int id : ids)
|
||||
QList<int> ids = idname.keys();
|
||||
QStringList addIdValues{};
|
||||
for(int id : ids)
|
||||
addIdValues << QString::number(id);
|
||||
int caseID = _data->getID();
|
||||
QString code = QString("Case.importComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
int caseID = _data->getID();
|
||||
QString code =
|
||||
QString("Case.importComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取可用的几何组件
|
||||
/// </summary>
|
||||
void ImportDialog::initGeo()
|
||||
{
|
||||
Geometry::GeometryData *geoData = Geometry::GeometryData::getInstance();
|
||||
const int n = geoData->getGeometrySetCount();
|
||||
QList<int> geoIDs = _data->getGeometryList();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
Geometry::GeometrySet *set = geoData->getGeometrySetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
QString icon = ":/QUI/icon/geometry.png";
|
||||
if (geoIDs.contains(id))
|
||||
Geometry::GeometryData* geoData = Geometry::GeometryData::getInstance();
|
||||
const int n = geoData->getGeometrySetCount();
|
||||
QList<int> geoIDs = _data->getGeometryList();
|
||||
for(int i = 0; i < n; ++i) {
|
||||
Geometry::GeometrySet* set = geoData->getGeometrySetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
QString icon = ":/QUI/icon/geometry.png";
|
||||
if(geoIDs.contains(id))
|
||||
appendItemToSelectedList(name, id, icon);
|
||||
else
|
||||
appendItemToAvailableList(name, id, icon);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取可用的网格组件
|
||||
/// </summary>
|
||||
|
||||
void ImportDialog::initMeshSet()
|
||||
{
|
||||
MeshData::MeshData *meshData = MeshData::MeshData::getInstance();
|
||||
const int n = meshData->getMeshSetCount();
|
||||
QList<int> compIDs = _data->getMeshSetList();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
MeshData::MeshSet *set = meshData->getMeshSetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
QString icon = ":/QUI/icon/node.png";
|
||||
if (set->getSetType() == MeshData::Element)
|
||||
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
|
||||
const int n = meshData->getMeshSetCount();
|
||||
QList<int> compIDs = _data->getMeshSetList();
|
||||
for(int i = 0; i < n; ++i) {
|
||||
MeshData::MeshSet* set = meshData->getMeshSetAt(i);
|
||||
QString name = set->getName();
|
||||
int id = set->getID();
|
||||
QString icon = ":/QUI/icon/node.png";
|
||||
if(set->getSetType() == MeshData::Element)
|
||||
icon = ":/QUI/icon/mesh.png";
|
||||
if (compIDs.contains(id))
|
||||
if(compIDs.contains(id))
|
||||
appendItemToSelectedList(name, id, icon);
|
||||
else
|
||||
appendItemToAvailableList(name, id, icon);
|
||||
|
@ -112,14 +107,13 @@ namespace ProjectTree
|
|||
|
||||
void ImportDialog::initGeoComponent()
|
||||
{
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> geoIDs = _data->getGeoComponentIDList();
|
||||
foreach (auto aGc, geoData->getGeoComponentList())
|
||||
{
|
||||
auto geoData = Geometry::GeometryData::getInstance();
|
||||
QList<int> geoIDs = _data->getGeoComponentIDList();
|
||||
foreach(auto aGc, geoData->getGeoComponentList()) {
|
||||
QString name = aGc->getName();
|
||||
int id = aGc->getID();
|
||||
int id = aGc->getID();
|
||||
QString icon = ":/QUI/icon/geometry.png";
|
||||
if (geoIDs.contains(id))
|
||||
if(geoIDs.contains(id))
|
||||
appendItemToSelectedList(name, id, icon);
|
||||
else
|
||||
appendItemToAvailableList(name, id, icon);
|
||||
|
@ -129,17 +123,17 @@ namespace ProjectTree
|
|||
void ImportDialog::acceptGeo()
|
||||
{
|
||||
QMap<int, QString> idname = this->getSelectedItemIDNames();
|
||||
QStringList values = idname.values();
|
||||
QList<int> ids = idname.keys();
|
||||
QStringList addIdValues;
|
||||
for (int i = 0; i < ids.size(); ++i)
|
||||
{
|
||||
QStringList values = idname.values();
|
||||
QList<int> ids = idname.keys();
|
||||
QStringList addIdValues;
|
||||
for(int i = 0; i < ids.size(); ++i) {
|
||||
addIdValues << QString::number(ids.at(i));
|
||||
}
|
||||
int id = _data->getID();
|
||||
QString code = QString("Case.importGeometry(%1,\"%2\")").arg(id).arg(addIdValues.join(" ")); //
|
||||
int id = _data->getID();
|
||||
QString code =
|
||||
QString("Case.importGeometry(%1,\"%2\")").arg(id).arg(addIdValues.join(" ")); //
|
||||
qDebug() << code;
|
||||
if (ids.size() > 0)
|
||||
if(ids.size() > 0)
|
||||
Py::PythonAgent::getInstance()->submit(code);
|
||||
ComponentSelectDialogBase::accept();
|
||||
}
|
||||
|
@ -152,7 +146,8 @@ namespace ProjectTree
|
|||
// foreach(int id, ids)
|
||||
// addIdValues << QString::number(id);
|
||||
// int caseID = _data->getID();
|
||||
// QString code = QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// QString code =
|
||||
// QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// Py::PythonAgent::getInstance()->submit(code);
|
||||
// }
|
||||
|
||||
|
@ -164,7 +159,8 @@ namespace ProjectTree
|
|||
// foreach(int id, ids)
|
||||
// addIdValues << QString::number(id);
|
||||
// int caseID = _data->getID();
|
||||
// QString code = QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// QString code =
|
||||
// QString("Case.importGeoComponents(%1,\"%2\")").arg(caseID).arg(addIdValues.join(" "));
|
||||
// Py::PythonAgent::getInstance()->submit(code);
|
||||
// }
|
||||
}
|
||||
} // namespace ProjectTree
|
|
@ -1,29 +1,7 @@
|
|||
/**
|
||||
* @file DialogImport.h
|
||||
* @brief 导入组件对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:14
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _DIALOGIMPORTMESHSET_
|
||||
#ifndef _DIALOGIMPORTMESHSET_
|
||||
#define _DIALOGIMPORTMESHSET_
|
||||
|
||||
#include "ModuleBase/componentDialogBase.h"
|
||||
#include "moduleBase/componentDialogBase.h"
|
||||
|
||||
namespace GUI
|
||||
{
|
||||
|
@ -42,34 +20,33 @@ namespace ProjectTree
|
|||
Geometry,
|
||||
MeshSet
|
||||
};
|
||||
/**
|
||||
* @brief 导入组件对话框类
|
||||
* @since 2.5.0
|
||||
*/
|
||||
|
||||
class ImportDialog : public ModuleBase::ComponentSelectDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImportDialog(GUI::MainWindow *mainwindow, ModelData::ModelDataBaseExtend *data, ImportType t);
|
||||
ImportDialog(GUI::MainWindow* mainwindow, ModelData::ModelDataBaseExtend* data, ImportType t);
|
||||
~ImportDialog() = default;
|
||||
|
||||
|
||||
protected:
|
||||
void init() override;
|
||||
void accept() override;
|
||||
|
||||
|
||||
private:
|
||||
void initGeo();
|
||||
void initMeshSet();
|
||||
void initGeoComponent();
|
||||
|
||||
void acceptGeo();
|
||||
// void acceptComponents();
|
||||
// void acceptComponents();
|
||||
|
||||
private:
|
||||
ImportType _type{None};
|
||||
ModelData::ModelDataBaseExtend *_data{};
|
||||
ImportType _type{ None };
|
||||
ModelData::ModelDataBaseExtend* _data{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file DialogRemoveReport.h
|
||||
* @brief 报告移除确认对话框
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:20
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _REMOVEREPORTDIALOG_H_
|
||||
#ifndef _REMOVEREPORTDIALOG_H_
|
||||
#define _REMOVEREPORTDIALOG_H_
|
||||
|
||||
#include "SelfDefObject/QFDialog.h"
|
||||
|
@ -40,14 +18,16 @@ namespace ProjectTree
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RemoveReportDialog(GUI::MainWindow *m);
|
||||
RemoveReportDialog(GUI::MainWindow* m);
|
||||
~RemoveReportDialog();
|
||||
|
||||
bool isRemoveCompletely();
|
||||
|
||||
private:
|
||||
Ui::RemoveReportDialog *_ui{};
|
||||
Ui::RemoveReportDialog* _ui{};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,4 @@
|
|||
/**
|
||||
* @file ProjectTreeWithBasicNode.h
|
||||
* @brief 新建算例时默认树形菜单
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:36
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
#ifndef _PROJECTTREEWITHBASICNODE_H_
|
||||
#ifndef _PROJECTTREEWITHBASICNODE_H_
|
||||
#define _PROJECTTREEWITHBASICNODE_H_
|
||||
|
||||
#include "projectTreeBase.h"
|
||||
|
@ -54,12 +32,12 @@ namespace Geometry
|
|||
|
||||
namespace ProjectTree
|
||||
{
|
||||
|
||||
|
||||
class PROJECTTREEAPI ProjectTreeWithBasicNode : public ProjectTreeBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectTreeWithBasicNode(GUI::MainWindow *mainwindow);
|
||||
ProjectTreeWithBasicNode(GUI::MainWindow* mainwindow);
|
||||
~ProjectTreeWithBasicNode();
|
||||
//查看云图
|
||||
void viewCounterPost(QString variable);
|
||||
|
@ -70,84 +48,82 @@ namespace ProjectTree
|
|||
//更新子树节点
|
||||
virtual void updateGeometrySubTree();
|
||||
virtual void updateComponentSubTree();
|
||||
// virtual void updateMeshSetSubTree();
|
||||
// virtual void updateGeoComponentTree();
|
||||
virtual void updatePropTree();
|
||||
// virtual void updateMeshSetSubTree();
|
||||
// virtual void updateGeoComponentTree();
|
||||
virtual void updateBCSubTree();
|
||||
virtual void updateReportTree();
|
||||
virtual void updateMonitorTree();
|
||||
virtual void updatePostTree();
|
||||
//获取关联的组件ID(包括网格组件和几何组件)
|
||||
const QList<int> &getComponentIDList();
|
||||
const QList<int>& getComponentIDList();
|
||||
//通过组件ID删除算例中的项,并更新树
|
||||
void removeCaseComponentByID(int);
|
||||
//通过组件ID重命名算例中的项,并更新树
|
||||
void renameCaseComponentByID(int);
|
||||
|
||||
signals:
|
||||
void highLightSet(MeshData::MeshSet *set);
|
||||
void openRealTimeWin(Post::RealTimeWindowBase *w, int id);
|
||||
void highLightGeoComponent(Geometry::GeoComponent *);
|
||||
void highLightSet(MeshData::MeshSet* set);
|
||||
void openRealTimeWin(Post::RealTimeWindowBase* w, int id);
|
||||
void highLightGeoComponent(Geometry::GeoComponent*);
|
||||
void clearAllHighLightSig();
|
||||
void addComponentRootItemSig();
|
||||
|
||||
protected:
|
||||
virtual void initBasicNode(QTreeWidgetItem *root) override;
|
||||
virtual void contextMenu(QMenu *menu) override;
|
||||
virtual void initBasicNode(QTreeWidgetItem* root) override;
|
||||
virtual void contextMenu(QMenu* menu) override;
|
||||
virtual void singleClicked() override;
|
||||
virtual void doubleClicked() override;
|
||||
virtual void setData(ModelData::ModelDataBase *data);
|
||||
virtual void d2PlotContextMenu(QMenu *menu);
|
||||
virtual void counterContextMenu(QMenu *menu);
|
||||
virtual void vectorContextMenu(QMenu *menu);
|
||||
virtual DataProperty::DataBase *getCurrentItemData();
|
||||
virtual void setData(ModelData::ModelDataBase* data);
|
||||
virtual void d2PlotContextMenu(QMenu* menu);
|
||||
virtual void counterContextMenu(QMenu* menu);
|
||||
virtual void vectorContextMenu(QMenu* menu);
|
||||
virtual DataProperty::DataBase* getCurrentItemData();
|
||||
|
||||
// bool readInForm();
|
||||
//bool readInForm();
|
||||
|
||||
protected slots:
|
||||
virtual void importGeometry();
|
||||
virtual void importGeometry();
|
||||
virtual void importComponents();
|
||||
virtual void removeItem();
|
||||
virtual void addEleProperty();
|
||||
virtual void addBC();
|
||||
virtual void createReport();
|
||||
virtual void assignProperty();
|
||||
virtual void assignMaterial();
|
||||
virtual void viewRealTimeWindow();
|
||||
virtual void viewPlot2D(QString variable);
|
||||
virtual void viewCounter(QString variable);
|
||||
virtual void viewVector(QString variable);
|
||||
virtual void closePostWindow(Post::PostWindowBase *w);
|
||||
virtual void closePostWindow(Post::PostWindowBase* w);
|
||||
void addComponentRootItemSlot();
|
||||
|
||||
protected:
|
||||
QTreeWidgetItem *_geometryRootItem{};
|
||||
QTreeWidgetItem *_propertyRootItem{};
|
||||
QTreeWidgetItem *_ComponentRootItem{};
|
||||
QTreeWidgetItem *_simulationSettingItem{};
|
||||
QTreeWidgetItem *_boundaryConditionItem{};
|
||||
QTreeWidgetItem *_solverSettingItem{};
|
||||
QTreeWidgetItem *_monitorRootItem{};
|
||||
QTreeWidgetItem *_postRootItem{};
|
||||
QTreeWidgetItem *_post2DItem{};
|
||||
QTreeWidgetItem *_postCounterItem{};
|
||||
QTreeWidgetItem *_postVectorItem{};
|
||||
QTreeWidgetItem *_postStreamLineItem{};
|
||||
QTreeWidgetItem *_post3DItem{};
|
||||
QTreeWidgetItem *_reportItem{};
|
||||
QTreeWidgetItem* _geometryRootItem{};
|
||||
QTreeWidgetItem* _ComponentRootItem{};
|
||||
QTreeWidgetItem* _simulationSettingItem{};
|
||||
QTreeWidgetItem* _boundaryConditionItem{};
|
||||
QTreeWidgetItem* _solverSettingItem{};
|
||||
QTreeWidgetItem* _monitorRootItem{};
|
||||
QTreeWidgetItem* _postRootItem{};
|
||||
QTreeWidgetItem* _post2DItem{};
|
||||
QTreeWidgetItem* _postCounterItem{};
|
||||
QTreeWidgetItem* _postVectorItem{};
|
||||
QTreeWidgetItem* _postStreamLineItem{};
|
||||
QTreeWidgetItem* _post3DItem{};
|
||||
QTreeWidgetItem* _reportItem{};
|
||||
|
||||
QSignalMapper *_postMapper{};
|
||||
//
|
||||
// Post::Post2DWindowInterface* _post2DWindow{};
|
||||
// Post::Post3DWindowInterface* _post3DWindow{};
|
||||
QSignalMapper* _postMapper{};
|
||||
//
|
||||
// Post::Post2DWindowInterface* _post2DWindow{};
|
||||
// Post::Post3DWindowInterface* _post3DWindow{};
|
||||
|
||||
QMenu *_nodeMenu{};
|
||||
QMenu *_cellMeun{};
|
||||
QMenu* _nodeMenu{};
|
||||
QMenu* _cellMeun{};
|
||||
|
||||
ModelData::ModelDataBaseExtend *_modelDataExtend{};
|
||||
ModelData::ModelDataBaseExtend* _modelDataExtend{};
|
||||
|
||||
QList<QTreeWidgetItem *> _ComponentItems;
|
||||
QList<QTreeWidgetItem*> _ComponentItems;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
#include <QTreeWidget>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTime>
|
||||
#include "ConfigOptions/TreeItemData.h"
|
||||
#include "ConfigOptions/ProjectTreeInfo.h"
|
||||
#include "MainWindow/MainWindow.h"
|
||||
#include "mainWindow/mainWindow.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "Settings/BusAPI.h"
|
||||
#include "settings/busAPI.h"
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
|
@ -18,24 +18,23 @@
|
|||
namespace ProjectTree
|
||||
{
|
||||
ProjectTreeBase::ProjectTreeBase(GUI::MainWindow *mainwindow)
|
||||
: _mainWindow(mainwindow)
|
||||
:_mainWindow(mainwindow)
|
||||
{
|
||||
if (_mainWindow != nullptr)
|
||||
{
|
||||
connect(this, SIGNAL(openPostWindowSig(Post::PostWindowBase *)), _mainWindow, SIGNAL(openPostWindowSig(Post::PostWindowBase *)));
|
||||
connect(this, SIGNAL(disPlayProp(DataProperty::DataBase *)), _mainWindow, SIGNAL(updateProperty(DataProperty::DataBase *)));
|
||||
connect(this, SIGNAL(openPostWindowSig(Post::PostWindowBase*)), _mainWindow, SIGNAL(openPostWindowSig(Post::PostWindowBase*)));
|
||||
connect(this, SIGNAL(disPlayProp(DataProperty::DataBase*)), _mainWindow, SIGNAL(updateProperty(DataProperty::DataBase*)));
|
||||
connect(this, SIGNAL(showPostWindowInfo(int, int)), _mainWindow, SIGNAL(showPostWindowInfoSig(int, int)));
|
||||
connect(_mainWindow, SIGNAL(solveProjectSig(int, int)), this, SLOT(solveBegin(int)));
|
||||
connect(_mainWindow, SIGNAL(processFinished(int)), this, SLOT(solveFinished(int)));
|
||||
connect(_mainWindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase *, int)), this, SLOT(realTimeWindowOpened(Post::RealTimeWindowBase *, int)));
|
||||
connect(_mainWindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase *)), this, SLOT(realTimeWindowClosed(Post::RealTimeWindowBase *)));
|
||||
connect(this, SIGNAL(dispalyParaWidget(QWidget *)), _mainWindow, SIGNAL(updateParaWidget(QWidget *)));
|
||||
connect(_mainWindow, SIGNAL(openRealTimeWindowSig(Post::RealTimeWindowBase*, int)), this, SLOT(realTimeWindowOpened(Post::RealTimeWindowBase*, int)));
|
||||
connect(_mainWindow, SIGNAL(closeRealTimeWindowSig(Post::RealTimeWindowBase*)), this, SLOT(realTimeWindowClosed(Post::RealTimeWindowBase*)));
|
||||
connect(this, SIGNAL(dispalyParaWidget(QWidget*)), _mainWindow, SIGNAL(updateParaWidget(QWidget*)));
|
||||
}
|
||||
}
|
||||
ProjectTreeBase::~ProjectTreeBase()
|
||||
{
|
||||
if (_root == nullptr)
|
||||
return;
|
||||
if (_root == nullptr) return;
|
||||
_root->takeChildren();
|
||||
_itemList.clear();
|
||||
}
|
||||
|
@ -60,130 +59,120 @@ namespace ProjectTree
|
|||
{
|
||||
_treeType = type;
|
||||
}
|
||||
void ProjectTreeBase::appendItem(ConfigOption::TreeItem *item)
|
||||
void ProjectTreeBase::appendItem(ConfigOption::TreeItem* item)
|
||||
{
|
||||
_itemList.append(item);
|
||||
}
|
||||
void ProjectTreeBase::createTree(QTreeWidgetItem *phyroot, GUI::MainWindow *mainwindow)
|
||||
void ProjectTreeBase::createTree(QTreeWidgetItem* phyroot, GUI::MainWindow* mainwindow)
|
||||
{
|
||||
if (_data == nullptr)
|
||||
return;
|
||||
if (_data == nullptr) return;
|
||||
_mainWindow = mainwindow;
|
||||
// QTreeWidgetItem* root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
// QTreeWidgetItem* root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
|
||||
initBasicNode(phyroot);
|
||||
QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||
double time = _data->getSolveTime();
|
||||
if (time > 0)
|
||||
_solveStatus = Finished;
|
||||
if (time > 0) _solveStatus = Finished;
|
||||
_data->setOutputFileName(_outputFile);
|
||||
|
||||
int n = _itemList.size();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem *parent = _root;
|
||||
ConfigOption::TreeItem *item = _itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
QTreeWidgetItem* parent = _root;
|
||||
ConfigOption::TreeItem* item = _itemList.at(i);
|
||||
if (item == nullptr) continue;
|
||||
QString sparent = item->getParent();
|
||||
if (_textItemHash.contains(sparent))
|
||||
parent = _textItemHash.value(sparent);
|
||||
QTreeWidgetItem *treeitem = new QTreeWidgetItem(parent, item->getType());
|
||||
treeitem->setData(0, Qt::UserRole + 1, i + 1); //留空0,标记为不是配置文件创建
|
||||
treeitem->setData(1, Qt::UserRole, item->getText()); //英文
|
||||
treeitem->setData(1, Qt::UserRole + 1, item->getChinese()); //中文
|
||||
if (_textItemHash.contains(sparent)) parent = _textItemHash.value(sparent);
|
||||
QTreeWidgetItem* treeitem = new QTreeWidgetItem(parent, item->getType());
|
||||
treeitem->setData(0, Qt::UserRole + 1, i + 1); //留空0,标记为不是配置文件创建
|
||||
treeitem->setData(1, Qt::UserRole, item->getText()); //英文
|
||||
treeitem->setData(1, Qt::UserRole + 1, item->getChinese());//中文
|
||||
QString text = item->getText();
|
||||
if (lang == "Chinese")
|
||||
text = item->getChinese();
|
||||
if (text.isEmpty())
|
||||
text = item->getText();
|
||||
if (text.isEmpty()) text = item->getText();
|
||||
|
||||
treeitem->setText(0, text);
|
||||
treeitem->setText(0,text);
|
||||
QString sicon = item->getIcon();
|
||||
QString icon = qApp->applicationDirPath() + "/../ConfigFiles/Icon/" + sicon;
|
||||
treeitem->setIcon(0, QIcon(icon));
|
||||
// qDebug() << text << item->getType();
|
||||
// qDebug() << text << item->getType();
|
||||
_textItemHash[item->getText()] = treeitem;
|
||||
}
|
||||
for (int i = 0; i < _disableItems.size(); ++i)
|
||||
{
|
||||
QString s = _disableItems.at(i);
|
||||
auto item = _textItemHash.value(s);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
if (item == nullptr) continue;
|
||||
item->setHidden(true);
|
||||
}
|
||||
|
||||
}
|
||||
void ProjectTreeBase::initBasicNode(QTreeWidgetItem *phyroot)
|
||||
void ProjectTreeBase::initBasicNode(QTreeWidgetItem* phyroot)
|
||||
{
|
||||
_root = new QTreeWidgetItem(phyroot, TreeItemType::ProjectRoot);
|
||||
_root->setFlags(_root->flags() | Qt::ItemIsEditable);
|
||||
_root->setIcon(0, QIcon(":/QUI/icon/physics.png"));
|
||||
// int id = _data->getID();
|
||||
_root->setText(0, _data->getName()); //根据项目名称确定
|
||||
int id = _data->getID();
|
||||
_root->setText(0, _data->getName()); //根据项目名称确定
|
||||
_root->setData(0, Qt::UserRole, _data->getID());
|
||||
_root->setExpanded(true);
|
||||
|
||||
}
|
||||
void ProjectTreeBase::on_MouseEvent(int eventType, QTreeWidgetItem *item)
|
||||
{
|
||||
void ProjectTreeBase::on_MouseEvent(int eventType, QTreeWidgetItem* item)
|
||||
{
|
||||
_currentItem = item;
|
||||
// TreeItemType type = (TreeItemType)item->type();
|
||||
// if (type == Undefined) return;
|
||||
// TreeItemType type = (TreeItemType)item->type();
|
||||
// if (type == Undefined) return;
|
||||
|
||||
switch (eventType)
|
||||
{
|
||||
case 0:
|
||||
singleClicked();
|
||||
break;
|
||||
case 1:
|
||||
createContextMenu();
|
||||
break;
|
||||
case 2:
|
||||
doubleClicked();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 0: singleClicked();break;
|
||||
case 1:createContextMenu();break;
|
||||
case 2:doubleClicked();break;
|
||||
default:break;
|
||||
}
|
||||
}
|
||||
// void ProjectTreeBase::copy(ProjectTreeBase* tree)
|
||||
// {
|
||||
// // ProjectTree* tree = new ProjectTree;
|
||||
// tree->setType(_treeType);
|
||||
// tree->setName(_name);
|
||||
// for (int i = 0; i < _itemList.size(); ++i)
|
||||
// {
|
||||
// ConfigOption::TreeItem* item = _itemList.at(i);
|
||||
// ConfigOption::TreeItem* newitem = new ConfigOption::TreeItem;
|
||||
// newitem->copy(item);
|
||||
// tree->appendItem(newitem);
|
||||
// }
|
||||
// tree->setOutputFileName(_outputFile);
|
||||
// tree->setDisableItems(_disableItems);
|
||||
// // _disableItems = tree->getDisableItems();
|
||||
// qDebug() << _disableItems;
|
||||
// // return tree;
|
||||
// }
|
||||
void ProjectTreeBase::copy(ConfigOption::ProjectTreeInfo *info)
|
||||
// void ProjectTreeBase::copy(ProjectTreeBase* tree)
|
||||
// {
|
||||
// // ProjectTree* tree = new ProjectTree;
|
||||
// tree->setType(_treeType);
|
||||
// tree->setName(_name);
|
||||
// for (int i = 0; i < _itemList.size(); ++i)
|
||||
// {
|
||||
// ConfigOption::TreeItem* item = _itemList.at(i);
|
||||
// ConfigOption::TreeItem* newitem = new ConfigOption::TreeItem;
|
||||
// newitem->copy(item);
|
||||
// tree->appendItem(newitem);
|
||||
// }
|
||||
// tree->setOutputFileName(_outputFile);
|
||||
// tree->setDisableItems(_disableItems);
|
||||
// // _disableItems = tree->getDisableItems();
|
||||
// qDebug() << _disableItems;
|
||||
// // return tree;
|
||||
// }
|
||||
void ProjectTreeBase::copy(ConfigOption::ProjectTreeInfo* info)
|
||||
{
|
||||
_treeType = info->type();
|
||||
_name = info->getName();
|
||||
QList<ConfigOption::TreeItem *> items = info->getItemList();
|
||||
QList<ConfigOption::TreeItem*> items = info->getItemList();
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
{
|
||||
ConfigOption::TreeItem *item = items.at(i);
|
||||
ConfigOption::TreeItem *newitem = new ConfigOption::TreeItem;
|
||||
ConfigOption::TreeItem* item = items.at(i);
|
||||
ConfigOption::TreeItem* newitem = new ConfigOption::TreeItem;
|
||||
newitem->copy(item);
|
||||
this->appendItem(newitem);
|
||||
}
|
||||
_outputFile = info->getOutputFileName();
|
||||
_disableItems = info->getDisableItems();
|
||||
|
||||
}
|
||||
void ProjectTreeBase::setData(ModelData::ModelDataBase *data)
|
||||
void ProjectTreeBase::setData(ModelData::ModelDataBase* data)
|
||||
{
|
||||
_data = data;
|
||||
transferData();
|
||||
}
|
||||
ModelData::ModelDataBase *ProjectTreeBase::getData()
|
||||
ModelData::ModelDataBase* ProjectTreeBase::getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
@ -196,14 +185,15 @@ namespace ProjectTree
|
|||
return _disableItems;
|
||||
}
|
||||
|
||||
void ProjectTreeBase::setCurrentItem(QTreeWidgetItem *item)
|
||||
void ProjectTreeBase::setCurrentItem(QTreeWidgetItem* item)
|
||||
{
|
||||
_currentItem = item;
|
||||
}
|
||||
|
||||
void ProjectTreeBase::singleClicked()
|
||||
{
|
||||
// qDebug() << "parent s";
|
||||
//qDebug() << "parent s";
|
||||
|
||||
}
|
||||
void ProjectTreeBase::doubleClicked()
|
||||
{
|
||||
|
@ -211,22 +201,21 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeBase::createContextMenu()
|
||||
{
|
||||
// qDebug() << "parent c";
|
||||
// qDebug() << "parent c";
|
||||
QMenu pop_menu;
|
||||
contextMenu(&pop_menu);
|
||||
pop_menu.exec(QCursor::pos());
|
||||
}
|
||||
void ProjectTreeBase::contextMenu(QMenu *menu)
|
||||
void ProjectTreeBase::contextMenu(QMenu* menu)
|
||||
{
|
||||
QAction *action = nullptr;
|
||||
QAction* action = nullptr;
|
||||
int itemindex = _currentItem->data(0, Qt::UserRole + 1).toInt();
|
||||
TreeItemType type = (TreeItemType)_currentItem->type();
|
||||
if (itemindex > 0)
|
||||
{
|
||||
ConfigOption::TreeItem *treeItem = _itemList.at(itemindex - 1);
|
||||
ConfigOption::TreeItem* treeItem = _itemList.at(itemindex - 1);
|
||||
const int n = treeItem->getContextMenuCount();
|
||||
if (n < 1)
|
||||
return;
|
||||
if (n < 1) return;
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QString menuText = treeItem->getContextMenuAt(i);
|
||||
|
@ -234,44 +223,41 @@ namespace ProjectTree
|
|||
switch (type)
|
||||
{
|
||||
case ProjectPostSetting:
|
||||
if (0 == i)
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
|
||||
if (0 == i) connect(action, SIGNAL(triggered()), this, SLOT(openPostWindow()));
|
||||
|
||||
break;
|
||||
case ProjectComponent:
|
||||
break;
|
||||
case ProjectSolver:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void ProjectTreeBase::updateTree()
|
||||
{
|
||||
|
||||
}
|
||||
void ProjectTreeBase::updateTreeByType(const TreeItemType type)
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
|
||||
}
|
||||
QList<QTreeWidgetItem *> ProjectTreeBase::getItemByType(const TreeItemType type, QTreeWidgetItem *root)
|
||||
QList<QTreeWidgetItem*> ProjectTreeBase::getItemByType(const TreeItemType type,QTreeWidgetItem* root)
|
||||
{
|
||||
QList<QTreeWidgetItem *> items;
|
||||
if (root == nullptr)
|
||||
root = _root;
|
||||
if (root->type() == type)
|
||||
items.append(root);
|
||||
QList<QTreeWidgetItem*> items;
|
||||
if (root == nullptr) root = _root;
|
||||
if (root->type() == type) items.append(root);
|
||||
const int n = root->childCount();
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem *cc = root->child(i);
|
||||
// qDebug() << cc->text(0);
|
||||
QTreeWidgetItem* cc = root->child(i);
|
||||
// qDebug() << cc->text(0);
|
||||
if (cc->type() == type)
|
||||
items.append(cc);
|
||||
if (cc->childCount() > 0)
|
||||
{
|
||||
QList<QTreeWidgetItem *> il = getItemByType(type, cc);
|
||||
QList<QTreeWidgetItem*> il = getItemByType(type, cc);
|
||||
items.append(il);
|
||||
}
|
||||
}
|
||||
|
@ -283,29 +269,23 @@ namespace ProjectTree
|
|||
}
|
||||
void ProjectTreeBase::solveBegin(int proIndex)
|
||||
{
|
||||
ModelData::ModelDataSingleton *s = ModelData::ModelDataSingleton::getinstance();
|
||||
ModelData::ModelDataSingleton* s = ModelData::ModelDataSingleton::getinstance();
|
||||
int id = s->getModelIDByIndex(proIndex);
|
||||
if (id < 0)
|
||||
return;
|
||||
if (id != _data->getID())
|
||||
return;
|
||||
if (id < 0) return;
|
||||
if (id != _data->getID()) return;
|
||||
_solveStatus = Solving;
|
||||
if (_timer == nullptr)
|
||||
_timer = new QElapsedTimer;
|
||||
if (_timer == nullptr) _timer = new QTime;
|
||||
_timer->start();
|
||||
emit solveStatusChanged();
|
||||
}
|
||||
void ProjectTreeBase::solveFinished(int proid)
|
||||
{
|
||||
if (proid != _data->getID())
|
||||
return;
|
||||
if (proid != _data->getID()) return;
|
||||
_solveStatus = Finished;
|
||||
if (_timer == nullptr)
|
||||
return;
|
||||
if (_timer == nullptr) return;
|
||||
double time = _timer->elapsed();
|
||||
// qDebug() << time;
|
||||
delete _timer;
|
||||
_timer = nullptr;
|
||||
// qDebug() << time;
|
||||
delete _timer; _timer = nullptr;
|
||||
_data->setSolveTime(time);
|
||||
emit solveStatusChanged();
|
||||
}
|
||||
|
@ -316,18 +296,16 @@ namespace ProjectTree
|
|||
void ProjectTreeBase::reTranslate()
|
||||
{
|
||||
QString lang = Setting::BusAPI::instance()->getLanguage();
|
||||
QList<QTreeWidgetItem *> itemList = _textItemHash.values();
|
||||
QList<QTreeWidgetItem*> itemList = _textItemHash.values();
|
||||
const int n = itemList.size();
|
||||
if (lang == "Chinese")
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem *item = itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
QTreeWidgetItem* item = itemList.at(i);
|
||||
if (item == nullptr) continue;
|
||||
QString text = item->data(1, Qt::UserRole + 1).toString();
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
if (text.isEmpty()) continue;
|
||||
item->setText(0, text);
|
||||
}
|
||||
}
|
||||
|
@ -335,12 +313,10 @@ namespace ProjectTree
|
|||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
QTreeWidgetItem *item = itemList.at(i);
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
QTreeWidgetItem* item = itemList.at(i);
|
||||
if (item == nullptr) continue;
|
||||
QString text = item->data(1, Qt::UserRole).toString();
|
||||
if (text.isEmpty())
|
||||
continue;
|
||||
if (text.isEmpty()) continue;
|
||||
item->setText(0, text);
|
||||
}
|
||||
}
|
||||
|
@ -353,12 +329,13 @@ namespace ProjectTree
|
|||
{
|
||||
return _chinese;
|
||||
}
|
||||
void ProjectTreeBase::realTimeWindowOpened(Post::RealTimeWindowBase *w, int id)
|
||||
void ProjectTreeBase::realTimeWindowOpened(Post::RealTimeWindowBase* w, int id)
|
||||
{
|
||||
if (id == _data->getID())
|
||||
_realTimeWin = w;
|
||||
|
||||
}
|
||||
void ProjectTreeBase::realTimeWindowClosed(Post::RealTimeWindowBase *w)
|
||||
void ProjectTreeBase::realTimeWindowClosed(Post::RealTimeWindowBase* w)
|
||||
{
|
||||
if (_realTimeWin == w)
|
||||
_realTimeWin = nullptr;
|
||||
|
@ -374,4 +351,5 @@ namespace ProjectTree
|
|||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,25 +1,7 @@
|
|||
/**
|
||||
* @file projectTreeBase.h
|
||||
* @brief ProjectTreeBase
|
||||
* @author FastCAE研发小组(fastcae@diso.cn)
|
||||
* @version 2.5.0
|
||||
* @date 2022-07-07 10:27
|
||||
* @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
*
|
||||
* ============================================================================
|
||||
* Program: FastCAE
|
||||
*
|
||||
* Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved.
|
||||
* See License or http://www.fastcae.com/ for details.
|
||||
*
|
||||
* BSD 3-Clause License
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED.
|
||||
* ==================================================================================
|
||||
*/
|
||||
/******************
|
||||
ProjectTreeBase操作
|
||||
***************** */
|
||||
|
||||
#ifndef PROJECTTREE_H
|
||||
#define PROJECTTREE_H
|
||||
|
||||
|
@ -32,7 +14,7 @@
|
|||
#include "ProjectTreeAPI.h"
|
||||
|
||||
class QTreeWidgetItem;
|
||||
class QElapsedTimer;
|
||||
class QTime;
|
||||
class QMenu;
|
||||
|
||||
namespace ModelData
|
||||
|
@ -61,6 +43,7 @@ namespace ConfigOption
|
|||
|
||||
namespace ProjectTree
|
||||
{
|
||||
|
||||
|
||||
enum SolveStatus
|
||||
{
|
||||
|
@ -75,14 +58,10 @@ namespace ProjectTree
|
|||
public:
|
||||
ProjectTreeBase(GUI::MainWindow *mainwindow);
|
||||
virtual ~ProjectTreeBase();
|
||||
// ProjectTree* copy();
|
||||
// void copy(ProjectTreeBase* tree);
|
||||
/**
|
||||
* @brief 从配置文件拷贝节点信息
|
||||
* @param info 节点
|
||||
* @since 2.5.0
|
||||
*/
|
||||
void copy(ConfigOption::ProjectTreeInfo *info);
|
||||
//ProjectTree* copy();
|
||||
// void copy(ProjectTreeBase* tree);
|
||||
//从配置文件中拷贝信息
|
||||
void copy(ConfigOption::ProjectTreeInfo* info);
|
||||
void setOutputFileName(QString fileName);
|
||||
//设置名称
|
||||
void setName(const QString &name);
|
||||
|
@ -91,19 +70,19 @@ namespace ProjectTree
|
|||
//设置树的类型
|
||||
void setType(ProjectTreeType type);
|
||||
//获取树的类型
|
||||
ProjectTreeType type() const { return _treeType; }
|
||||
ProjectTreeType type() const{ return _treeType; }
|
||||
//根据配置项追加节点
|
||||
void appendItem(ConfigOption::TreeItem *item);
|
||||
void appendItem(ConfigOption::TreeItem* item);
|
||||
//创建树
|
||||
virtual void createTree(QTreeWidgetItem *root, GUI::MainWindow *mainwindow);
|
||||
virtual void createTree(QTreeWidgetItem* root, GUI::MainWindow* mainwindow);
|
||||
//设置模型数据
|
||||
virtual void setData(ModelData::ModelDataBase *data);
|
||||
virtual void setData(ModelData::ModelDataBase* data);
|
||||
//获取模型数据
|
||||
ModelData::ModelDataBase *getData();
|
||||
ModelData::ModelDataBase* getData();
|
||||
///清空QList<TreeItem*> _itemList{} 会产生严重后果,慎重调用
|
||||
void clearTreeItems();
|
||||
//鼠标事件
|
||||
void on_MouseEvent(int eventType, QTreeWidgetItem *item);
|
||||
void on_MouseEvent(int eventType, QTreeWidgetItem* item);
|
||||
//跟新树
|
||||
virtual void updateTree();
|
||||
//根据类型更新子树
|
||||
|
@ -121,62 +100,64 @@ namespace ProjectTree
|
|||
//获取不可见节点
|
||||
QStringList getDisableItems();
|
||||
//设置当前item
|
||||
void setCurrentItem(QTreeWidgetItem *item);
|
||||
void setCurrentItem(QTreeWidgetItem* item);
|
||||
//文件是否存在
|
||||
static bool isFileExist(QString fileName);
|
||||
//右键菜单
|
||||
virtual void contextMenu(QMenu *menu);
|
||||
virtual void contextMenu(QMenu* menu);
|
||||
|
||||
protected slots:
|
||||
// mainwindow 发送的求解模型信号
|
||||
//mainwindow 发送的求解模型信号
|
||||
void solveBegin(int proIndex);
|
||||
virtual void solveFinished(int proid);
|
||||
void realTimeWindowOpened(Post::RealTimeWindowBase *w, int id);
|
||||
void realTimeWindowClosed(Post::RealTimeWindowBase *w);
|
||||
void realTimeWindowOpened(Post::RealTimeWindowBase* w, int id);
|
||||
void realTimeWindowClosed(Post::RealTimeWindowBase* w);
|
||||
|
||||
signals:
|
||||
/*显示属性 */
|
||||
void disPlayProp(DataProperty::DataBase *pops);
|
||||
void disPlayProp(DataProperty::DataBase* pops);
|
||||
//显示参数widget
|
||||
void dispalyParaWidget(QWidget *w);
|
||||
void dispalyParaWidget(QWidget* w);
|
||||
///打开后处理窗口
|
||||
void openPostWindowSig(Post::PostWindowBase *w);
|
||||
void openPostWindowSig(Post::PostWindowBase* w);
|
||||
///展示PostWindow,根据ID和类型过滤
|
||||
void showPostWindowInfo(int id, int type);
|
||||
//求解状态改变
|
||||
void solveStatusChanged();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void initBasicNode(QTreeWidgetItem *root);
|
||||
virtual void initBasicNode(QTreeWidgetItem* root);
|
||||
|
||||
virtual void singleClicked(/*QTreeWidgetItem* item, TreeItemType type */);
|
||||
virtual void doubleClicked(/*QTreeWidgetItem* item, TreeItemType type */);
|
||||
virtual void doubleClicked(/*QTreeWidgetItem* item, TreeItemType type */);
|
||||
virtual void createContextMenu(/*QTreeWidgetItem* item, TreeItemType type */);
|
||||
|
||||
|
||||
///根据类型获取树节点,根节点为nullptr时遍历全树
|
||||
QList<QTreeWidgetItem *> getItemByType(const TreeItemType type, QTreeWidgetItem *root = nullptr);
|
||||
QList<QTreeWidgetItem*> getItemByType(const TreeItemType type,QTreeWidgetItem *root = nullptr);
|
||||
|
||||
private:
|
||||
virtual void transferData() {}
|
||||
virtual void transferData(){}
|
||||
|
||||
protected:
|
||||
QString _name{};
|
||||
ProjectTreeType _treeType{ProjectTreeType::UnDefined};
|
||||
QList<ConfigOption::TreeItem *> _itemList{};
|
||||
|
||||
ProjectTreeType _treeType{ ProjectTreeType::UnDefined };
|
||||
QList<ConfigOption::TreeItem*> _itemList{};
|
||||
|
||||
QTreeWidgetItem *_root{};
|
||||
QTreeWidgetItem *_currentItem{};
|
||||
GUI::MainWindow *_mainWindow{};
|
||||
QHash<QString, QTreeWidgetItem *> _textItemHash{};
|
||||
ModelData::ModelDataBase *_data{};
|
||||
SolveStatus _solveStatus{UnSolved};
|
||||
QElapsedTimer *_timer{};
|
||||
QTreeWidgetItem* _currentItem{};
|
||||
GUI::MainWindow* _mainWindow{};
|
||||
QHash<QString, QTreeWidgetItem*> _textItemHash{};
|
||||
ModelData::ModelDataBase* _data{};
|
||||
SolveStatus _solveStatus{ UnSolved };
|
||||
QTime* _timer{};
|
||||
QString _outputFile{};
|
||||
QString _chinese{};
|
||||
QStringList _disableItems{};
|
||||
|
||||
Post::RealTimeWindowBase *_realTimeWin{};
|
||||
|
||||
Post::RealTimeWindowBase* _realTimeWin{};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,71 +1,64 @@
|
|||
# -------关联C++库---------------
|
||||
import ControlPanel
|
||||
import ctypes
|
||||
#-------关联C++库---------------
|
||||
import ctypes
|
||||
import platform
|
||||
system = platform.system()
|
||||
if system == "Windows":
|
||||
pre = "./"
|
||||
suff = ".dll"
|
||||
pre = "./"
|
||||
suff = ".dll"
|
||||
else:
|
||||
pre = "../lib/lib"
|
||||
suff = ".so"
|
||||
pre = "./lib"
|
||||
suff = ".so"
|
||||
|
||||
libfile = ctypes.cdll.LoadLibrary
|
||||
filename = pre+"ModelData"+suff
|
||||
|
||||
md = libfile(filename)
|
||||
|
||||
# ---------------------------------
|
||||
import ControlPanel
|
||||
#---------------------------------
|
||||
|
||||
# -------定义函数------------------
|
||||
#-------定义函数------------------
|
||||
def setMaterial(modelID, strcpIDs ,mid):
|
||||
strcpIDs = bytes(strcpIDs,encoding='utf-8')
|
||||
md.setMaterial(modelID, strcpIDs ,mid)
|
||||
pass
|
||||
|
||||
|
||||
def setProperty(modelID, strcpIDs, pid):
|
||||
strcpIDs = bytes(strcpIDs, encoding='utf-8')
|
||||
md.setProperty(modelID, strcpIDs, pid)
|
||||
pass
|
||||
|
||||
|
||||
def importComponents(caseId, addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId, encoding='utf-8')
|
||||
md.importComponents(caseId, addcomponentsId)
|
||||
ControlPanel.updateComponentSubTree(caseId)
|
||||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def importGeometry(caseId, addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId, encoding='utf-8')
|
||||
md.importGeometry(caseId, addcomponentsId)
|
||||
ControlPanel.updateGeometrySubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def addBC(caseId, id, bctypetostring):
|
||||
bctypetostring = bytes(bctypetostring, encoding='utf-8')
|
||||
md.addBC(caseId, id, bctypetostring)
|
||||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
|
||||
|
||||
def objValChanged(value, describe, stype):
|
||||
describe = bytes(describe, encoding='utf-8')
|
||||
stype = bytes(stype, encoding='utf-8')
|
||||
md.objValChanged(value, describe, stype)
|
||||
pass
|
||||
|
||||
|
||||
def setValue(caseId, svariable, stype, sValue):
|
||||
variable = bytes(svariable, encoding='utf-8')
|
||||
type = bytes(stype, encoding='utf-8')
|
||||
value = bytes(sValue, encoding='utf-8')
|
||||
md.setValue(caseId, variable, type, value)
|
||||
pass
|
||||
|
||||
|
||||
def setBCValue(caseId, index, svariable, stype, sValue):
|
||||
variable = bytes(svariable, encoding='utf-8')
|
||||
type = bytes(stype, encoding='utf-8')
|
||||
value = bytes(sValue, encoding='utf-8')
|
||||
md.setBCValue(caseId, index, variable, type, value)
|
||||
pass
|
||||
def importComponents(caseId,addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
|
||||
md.importComponents(caseId,addcomponentsId)
|
||||
ControlPanel.updateComponentSubTree(caseId)
|
||||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
|
||||
def importGeometry(caseId,addcomponentsId):
|
||||
addcomponentsId = bytes(addcomponentsId,encoding='utf-8')
|
||||
md.importGeometry(caseId,addcomponentsId)
|
||||
ControlPanel.updateGeometrySubTree(caseId)
|
||||
pass
|
||||
|
||||
def addBC(caseId,id,bctypetostring):
|
||||
bctypetostring = bytes(bctypetostring,encoding='utf-8')
|
||||
md.addBC(caseId,id,bctypetostring)
|
||||
ControlPanel.updateBCSubTree(caseId)
|
||||
pass
|
||||
def objValChanged(value,describe,stype):
|
||||
describe = bytes(describe,encoding='utf-8')
|
||||
stype = bytes(stype,encoding='utf-8')
|
||||
md.objValChanged(value,describe,stype)
|
||||
pass
|
||||
|
||||
def setValue(caseId,svariable,stype,sValue):
|
||||
variable = bytes(svariable,encoding='utf-8')
|
||||
type = bytes(stype,encoding='utf-8')
|
||||
value = bytes(sValue,encoding='utf-8')
|
||||
md.setValue(caseId, variable, type, value)
|
||||
pass
|
||||
|
||||
def setBCValue(caseId,index,svariable,stype,sValue):
|
||||
variable = bytes(svariable,encoding='utf-8')
|
||||
type = bytes(stype,encoding='utf-8')
|
||||
value = bytes(sValue,encoding='utf-8')
|
||||
md.setBCValue(caseId, index,variable, type, value)
|
||||
pass
|
||||
|
||||
|
|
@ -38,6 +38,10 @@ ShowPoint=true
|
|||
ShowEdge=true
|
||||
ShowSurface=true
|
||||
|
||||
[MeshDisplay]
|
||||
ShowNode=true
|
||||
ShowEdge=true
|
||||
ShowFace=true
|
||||
|
||||
[Plugins]
|
||||
Name=
|
Loading…
Reference in New Issue