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