Browse Source

opt:修改项目树状结构;流体红外网格分开

wzj 11 months ago
parent
commit
686659898d

+ 5 - 3
src/DataProperty/modelTreeItemType.h

@@ -25,8 +25,6 @@ enum TreeItemType
 	Undefined = -1,					  ///< 未定义的
 	GeometryRoot = 1,				  ///< 几何根节点
 	GeometryChild,					  ///< 几何子节点
-	Datum,							  ///< 基准
-	DatumPlane,						  ///< 基准平面
 	GeoComponentRoot,				  ///< 几何组件根节点
 	GeoComponentChild,				  ///< 几何组件子节点
 	MeshRoot,						  ///< 网格根节点
@@ -91,7 +89,11 @@ enum TreeItemType
 	IRcomputationparaenv,		///< IR环境参数节点
 	IRcalc,						///< IR计算节点
 
-	modelTemp,
+	IRtouyingmianji,
+
+	modelTemp,					//模型临时节点
+	CFDmeshTemp,				//流体网格临时节点
+	IRmeshTemp,					//红外网格临时节点
 
 };
 

+ 0 - 23
src/Geometry/geometrySet.cpp

@@ -50,15 +50,6 @@ namespace Geometry {
 	{
 		*s << _id << _name << _visible;
 	}
-	// 	void GeometrySet::setFilePath(const QString& filepath)
-	// 	{
-	// 		_filePath = filepath;
-	// 		appendProperty(QString("Path"), _filePath);
-	// 	}
-	// 	QString GeometrySet::getFilePath()
-	// 	{
-	// 		return _filePath;
-	// 	}
 	void GeometrySet::setVisible(bool v)
 	{
 		_visible = v;
@@ -157,15 +148,6 @@ namespace Geometry {
 		return *tempShape;
 	}
 
-	// 	void GeometrySet::setStlDataSet(vtkSmartPointer<vtkDataSet> polyData)
-	// 	{
-	// 		_polyData = polyData;
-	// 		appendProperty(QObject::tr("Triangles"), (int)polyData->GetNumberOfCells());
-	// 	}
-	// 	vtkDataSet* GeometrySet::getStlDataSet()
-	// 	{
-	// 		return _polyData;
-	// 	}
 	QDomElement& GeometrySet::writeToProjectFile(QDomDocument* doc, QDomElement* ele, bool isDiso)
 	{
 		QDomElement element = doc->createElement("GeoSet"); // 创建子节点
@@ -188,10 +170,6 @@ namespace Geometry {
 		QDomText	nameText = doc->createTextNode(_name);
 		nameele.appendChild(nameText);
 		element.appendChild(nameele);
-		// 		QDomElement pathele = doc->createElement("Path");
-		// 		QDomText pathtext = doc->createTextNode(_filePath);
-		// 		pathele.appendChild(pathtext);
-		// 		element.appendChild(pathele);
 
 		ele->appendChild(element); // 子节点挂载
 		if(_parameter != nullptr)
@@ -257,7 +235,6 @@ namespace Geometry {
 		if(paraList.size() == 1) {
 			QDomElement paraele = paraList.at(0).toElement();
 			QString		type	= paraele.attribute("Type");
-			// qDebug() << type;
 			_parameter			= GeometryModelParaBase::createParaByString(type);
 			if(_parameter != nullptr)
 				_parameter->readDataFromProjectFile(&paraele);

+ 0 - 1
src/Geometry/geometrySketch.cpp

@@ -1 +0,0 @@
-

+ 0 - 1
src/Geometry/geometrySketch.h

@@ -1 +0,0 @@
-

+ 48 - 40
src/GeometryDataExchange/STEPdataExchange.cpp

@@ -84,55 +84,60 @@ namespace Geometry
 
 		bool empty = true;
 		//获取模型对象中实体的数量
-//		Standard_Integer nb = Model->NbEntities();
+		// Standard_Integer nb = Model->NbEntities();
+		// qDebug()<<"nb:"<<nb;
+		// // 遍历模型中每个实体
+		// for (int i = 1; i <= nb; ++i)
+		// {
+		// 	//从模型对象中获取指定索引的临时对象
+		// 	Handle(Standard_Transient) enti = Model->Value(i);
+		// 	// 检查对象的动态类型,如果不是 "StepRepr_RepresentationItem" 类型,则跳过当前循环
+		// 	if (!enti->DynamicType()->SubType("StepRepr_RepresentationItem"))
+		// 		continue;
+		// 	//将对象转换为 "StepRepr_RepresentationItem" 类型
+		// 	Handle(StepRepr_RepresentationItem) SRRI = Handle(StepRepr_RepresentationItem)::DownCast(enti);
+		// 	// 获取 "StepRepr_RepresentationItem" 的名称并转换
+		// 	Handle(TCollection_HAsciiString) hName = SRRI->Name();
+		// 	const char *cname = hName->ToCString();
+		// 	QString name = QString::fromLatin1(cname);
+		// 	if (name.isEmpty())
+		// 		continue;
 
-//		for (int i = 1; i <= nb; ++i)
-//		{
-			//从模型对象中获取指定索引的临时对象
-//			Handle(Standard_Transient) enti = Model->Value(i);
-//			if (!enti->DynamicType()->SubType("StepRepr_RepresentationItem"))
-//				continue;
-//			Handle(StepRepr_RepresentationItem) SRRI = Handle(StepRepr_RepresentationItem)::DownCast(enti);
-//			Handle(TCollection_HAsciiString) hName = SRRI->Name();
+		// 	empty = false;
+		// 	Handle(Transfer_Binder) binder = TP->Find(enti);
+		// 	if (binder.IsNull() || !binder->HasResult())
+		// 		continue;
 
-//			const char *cname = hName->ToCString();
-//			QString name = QString::fromLatin1(cname);
-//			if (name.isEmpty())
-//				continue;
+		// 	TopoDS_Shape S = TransferBRep::ShapeResult(TP, binder);
 
-//			empty = false;
-//			Handle(Transfer_Binder) binder = TP->Find(enti);
-//			if (binder.IsNull() || !binder->HasResult())
-//				continue;
+		// 	if(name != " ")
+		// 	{
+		// 		auto geoSet = new GeometrySet;
+		// 		TopoDS_Shape *shape = new TopoDS_Shape;
+		// 		*shape = S;
+		// 		geoSet->setShape(shape);
+		// 		geoSet->setName(name);
+		// 		GeometryData::getInstance()->appendGeometrySet(geoSet);
+		// 		getResult().append(geoSet);
+		// 	}
 
-//			TopoDS_Shape S = TransferBRep::ShapeResult(TP, binder);
+		// }
+		// if (!empty)
+		// 	return true;
 
-//			if(name != " ")
-//			{
-//				auto geoSet = new GeometrySet;
-//				TopoDS_Shape *shape = new TopoDS_Shape;
-//				*shape = S;
-//				geoSet->setShape(shape);
-//				geoSet->setName(name);
-//				qDebug() << "name = " <<  name  << i;
-//				GeometryData::getInstance()->appendGeometrySet(geoSet);
-//				getResult().append(geoSet);
-//			}
-
-//		}
-		if (!empty)
-			return true;
-
-		// Collecting resulting entities
+		// 获取在 STEP 文件中读取到的几何模型的数量
+		// NbShapes()获取STEP文件读取到的几何模型的数量
 		Standard_Integer nbs = aReader.NbShapes();
+		qDebug() << "nbs = " << nbs;
 		if (nbs == 0)
 			return false;
 		TopoDS_Shape aShape;
+		// 遍历每个几何模型
 		for (Standard_Integer i = 1; i <= nbs; i++)
 		{
 			aShape = aReader.Shape(i);
 
-			// load each solid as an own object
+			// 将每个实体加载为一个对象(处理固体)
 			TopExp_Explorer ex;
 			for (ex.Init(aShape, TopAbs_SOLID); ex.More(); ex.Next())
 			{
@@ -149,11 +154,12 @@ namespace Geometry
 				geoset->setName(name);
 				GeometryData::getInstance()->appendGeometrySet(geoset);
 				getResult().append(geoset);
+				qDebug()<<"solid";
 			}
-			// load all non-solids now
+			// 现在加载所有非固体(处理壳体)
 			for (ex.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); ex.More(); ex.Next())
 			{
-				// get the shape
+				// 获取形状
 				const TopoDS_Shell &aShell = TopoDS::Shell(ex.Current());
 
 				const int maxid = Geometry::GeometrySet::getMaxID() + 1;
@@ -166,8 +172,9 @@ namespace Geometry
 				geoset->setName(name);
 				GeometryData::getInstance()->appendGeometrySet(geoset);
 				getResult().append(geoset);
+				qDebug()<<"shell";
 			}
-			// put all other free-flying shapes into a single compound
+			// 将所有其他自由飞行的形状放入一个单一的复合体中
 			Standard_Boolean emptyComp = Standard_True;
 			BRep_Builder builder;
 			TopoDS_Compound comp;
@@ -206,11 +213,12 @@ namespace Geometry
 				}
 			}
 
+			// 如果复合体非空,则将其作为一个新的几何模型加载
 			if (!emptyComp)
 			{
 				const int maxid = Geometry::GeometrySet::getMaxID();
 				QString name = QString("Compound_%1").arg(maxid) + 1;
-
+				// 创建一个新的几何集合,并将复合体加入其中
 				auto geoset = new GeometrySet(STEP);
 				TopoDS_Shape *sh = new TopoDS_Shape;
 				*sh = comp;

+ 11 - 0
src/IR/IRcalcDialog.cpp

@@ -15,6 +15,11 @@ namespace IR
 		ui->stopBnt->setIcon(QIcon(":/QUI/icons/pqVcrLoop.svg"));
 		ui->lineEdit->setReadOnly(true);
 		ui->stopBnt->setDisabled(true);
+		_watcher = new QFileSystemWatcher(this);
+		_watcher->addPath("D:/project2023/IR/Output");
+
+		connect(_watcher,&QFileSystemWatcher::directoryChanged,this,&IRCalcDialog::onDirectoryChanged);
+
 		//捕获进程打印信息输出到LineEdit
 		connect(_process,SIGNAL(readyReadStandardOutput()),this,SLOT(readOutPut()));
 		//终止
@@ -68,5 +73,11 @@ namespace IR
 	{
 		ui->lineEdit->append(QString::fromLocal8Bit(_process->readAllStandardOutput().data()));
 	}
+
+	void IRCalcDialog::onDirectoryChanged(const QString &path)
+	{
+		Q_UNUSED(path);
+		QStringList changeFiles = _watcher->files();
+	}
 }
 

+ 3 - 0
src/IR/IRcalcDialog.h

@@ -4,6 +4,7 @@
 #include "IRAPI.h"
 #include <QDialog>
 #include <QProcess>
+#include <QFileSystemWatcher>
 
 namespace Ui {
 	class IRCalcDialog;
@@ -23,10 +24,12 @@ namespace IR
 		void onStartBntClicked();
 		void onStopBntClicked();
 		void finishedTask();
+		void onDirectoryChanged(const QString &path);
 	private:
 		Ui::IRCalcDialog *ui;
 		QProcess* _process;
 		bool isRun{false};
+		QFileSystemWatcher* _watcher;
 	};
 }
 

+ 5 - 0
src/IR/IRdataSingleton.cpp

@@ -116,5 +116,10 @@ namespace IR
 		outputFile << std::setw(4) << jsonObj << std::endl;
 		outputFile.close();
 	}
+
+	void IRData::updateOutputFile(QStringList outputs)
+	{
+		_outputFileList = outputs;
+	}
 	
 }

+ 5 - 0
src/IR/IRdataSingleton.h

@@ -161,6 +161,8 @@ namespace IR
 		void readJson(QString path);
 		//写入json文件
 		void writeJson();
+		//更新输出文件
+		void updateOutputFile(QStringList outputs);
 
 	private:
 		IRData() = default;
@@ -187,6 +189,9 @@ namespace IR
 		//求解器安装路径
 		QString _solverPath;
 
+		//输出文件列表
+		QStringList _outputFileList;
+
 	};
 }
 

+ 0 - 2
src/MainWidgets/DialogGeometryRename.cpp

@@ -38,8 +38,6 @@ namespace MainWidget
 		else
 		{
 			_data->setName(strNew);
-			if (_treeItem->type() != TreeItemType::DatumPlane)
-				strNew += QString("(%1)").arg(_data->getID());
 			_treeItem->setText(0, strNew);
 		}
 		emit disPlayProp(_data);

+ 44 - 28
src/MainWidgets/TreeWidget.cpp

@@ -113,19 +113,15 @@ namespace MainWidget
 
 		//网格生成
 		_MeshData = MeshData::MeshData::getInstance();
-		_gridRoot= new QTreeWidgetItem(this);
-		_gridRoot->setText(0,"网格生成");
-		this->addTopLevelItem(_gridRoot);
-		_gridRoot->setExpanded(true);
-			_meshRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshRoot);
-			_meshRoot->setText(0, tr("流体网格"));
-			_meshRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
+		_meshRoot = new QTreeWidgetItem(this, TreeItemType::MeshRoot);
+		_meshRoot->setText(0,"流体网格");
+		this->addTopLevelItem(_meshRoot);
+		_meshRoot->setExpanded(true);
+			_meshTempItem = new QTreeWidgetItem(_meshRoot, TreeItemType::CFDmeshTemp);
+			_meshTempItem->setText(0,"单击添加流体网格");
 			// _setRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshSetRoot);
 			// _setRoot->setText(0, tr("分组"));
 			// _setRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
-			_IRmeshRoot = new QTreeWidgetItem(_gridRoot, TreeItemType::MeshRoot);
-			_IRmeshRoot->setText(0, tr("红外网格"));
-			_IRmeshRoot->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
 
 		//CFD计算
 		_cfdItem = new QTreeWidgetItem(this);
@@ -183,6 +179,14 @@ namespace MainWidget
 		_cfdResultItem->setText(0,"结果");
 		_cfdResultItem->setIcon(0,QIcon(":/QUI/icons/pqLineChart16.png"));
 
+		//红外网格
+		_irMeshRoot = new QTreeWidgetItem(this,TreeItemType::MeshRoot);
+		_irMeshRoot->setText(0,"红外网格");
+		this->addTopLevelItem(_irMeshRoot);
+		_irMeshRoot->setExpanded(true);
+			_irMeshTempItem = new QTreeWidgetItem(_irMeshRoot,TreeItemType::IRmeshTemp);
+			_irMeshTempItem->setText(0,"单击添加红外网格");
+
 		//IR计算
 		_irItem = new QTreeWidgetItem(this,TreeItemType::IRRoot);
 		_irItem->setText(0,"IR计算");
@@ -209,19 +213,23 @@ namespace MainWidget
 		_irResultItem = new QTreeWidgetItem(_irItem);
 		_irResultItem->setText(0,"结果");
 		_irResultItem->setIcon(0,QIcon(":/QUI/icons/pqLineChart16.png"));
-			// _irFusheqiangdu = new QTreeWidgetItem(_irResultItem);
-			// _irFusheqiangdu->setText(0,"角度分布辐射强度");
-			// _irMianji = new QTreeWidgetItem(_irResultItem);
-			// _irMianji->setText(0,"面积");
-			// _irFusheLiangdu = new QTreeWidgetItem(_irResultItem);
-			// _irFusheLiangdu->setText(0,"辐射亮度效果图");
-			// _irSanweiFushe = new QTreeWidgetItem(_irResultItem);
-			// _irSanweiFushe->setText(0,"三维分布辐射效果");
-			// _irGuangpuQiangdu = new QTreeWidgetItem(_irResultItem);
-			// _irGuangpuQiangdu->setText(0,"光谱强度效果图");
-			// _irFusheWendu = new QTreeWidgetItem(_irResultItem);
-			// _irFusheWendu->setText(0,"辐射温度图");
-			//红外热成像\直角坐标图\极坐标图\
+			_irTouyingMianJi = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irTouyingMianJi->setText(0,"投影面积");
+			
+			_irKuanpuDaiGuangPu = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irKuanpuDaiGuangPu->setText(0,"宽谱带光谱");
+			
+			_irKuanpuDaiJiFen = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irKuanpuDaiJiFen->setText(0,"宽谱带积分");
+
+			_irWenduChengXiang = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irWenduChengXiang->setText(0,"温度成像图");
+
+			_irLiangduChengXiang = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irLiangduChengXiang->setText(0,"亮度成像图");
+
+			_irBujianGongXian = new QTreeWidgetItem(_irResultItem,TreeItemType::IRtouyingmianji);
+			_irBujianGongXian->setText(0,"部件贡献");
 
 		setStyleSheet("QTreeWidget::item{height:20px;}");
 	}
@@ -319,6 +327,11 @@ namespace MainWidget
 			item->setCheckState(0, state);
 			item->setIcon(0, QIcon(":/QUI/icon/mesh.png"));
 		}
+		if(_meshRoot->childCount() == 0)
+		{
+			_meshTempItem = new QTreeWidgetItem(_meshRoot, TreeItemType::CFDmeshTemp);
+			_meshTempItem->setText(0,"单击添加流体网格");
+		}
 		blockSignals(false);
 	}
 
@@ -399,9 +412,6 @@ namespace MainWidget
 			case GeometryRoot:
 				emit disPlayProp(nullptr);
 				break;
-			case Datum:
-				emit disPlayProp(nullptr);
-				break;
 			case MeshChild:
 			{
 				const int index = _meshRoot->indexOfChild(item);
@@ -446,6 +456,14 @@ namespace MainWidget
 			case modelTemp:
 			{
 				emit importModel();
+			}
+			case CFDmeshTemp:
+			{
+				
+			}
+			case IRmeshTemp:
+			{
+
 			}
 			default:
 				break;
@@ -829,8 +847,6 @@ namespace MainWidget
 				index = _gcroot->indexOfChild(_currentItem);
 				data = _geoData->getGeoComponentByIndex(index);
 				break;
-			case DatumPlane:
-				break;
 		}
 		if (!data)
 			return;

+ 13 - 10
src/MainWidgets/TreeWidget.h

@@ -165,19 +165,21 @@ namespace MainWidget
 	private:
 		GUI::MainWindow* _mainWindow{};
 		//几何
-		QTreeWidgetItem* _geoRoot{};//几何根节点
 		QTreeWidgetItem* _modelRoot{};//模型节点
 		QTreeWidgetItem* _modelTempItem{};
 		QTreeWidgetItem* _gcroot{};
 		Geometry::GeometryData* _geoData{};
 
-		//网格
+		//流体网格
 		MeshData::MeshData* _MeshData{};
-		QTreeWidgetItem* _gridRoot{};//网格根节点
 		QTreeWidgetItem* _meshRoot{};
-		QTreeWidgetItem* _IRmeshRoot{};
+		QTreeWidgetItem* _meshTempItem{};
 		QTreeWidgetItem* _setRoot{};
 		QTreeWidgetItem* _currentItem{};
+		
+		//红外网格
+		QTreeWidgetItem* _irMeshRoot{};
+		QTreeWidgetItem* _irMeshTempItem{};
 
 		//CFD
 		QTreeWidgetItem* _cfdItem{};
@@ -211,12 +213,13 @@ namespace MainWidget
 		QTreeWidgetItem* _irSetEnvPara{};
 		QTreeWidgetItem* _irCalcItem{};
 		QTreeWidgetItem* _irResultItem{};
-		QTreeWidgetItem* _irFusheqiangdu{};
-		QTreeWidgetItem* _irMianji{};
-		QTreeWidgetItem* _irFusheLiangdu{};
-		QTreeWidgetItem* _irSanweiFushe{};
-		QTreeWidgetItem* _irGuangpuQiangdu{};
-		QTreeWidgetItem* _irFusheWendu{};
+
+		QTreeWidgetItem* _irTouyingMianJi{};
+		QTreeWidgetItem* _irKuanpuDaiGuangPu{};
+		QTreeWidgetItem* _irKuanpuDaiJiFen{};
+		QTreeWidgetItem* _irWenduChengXiang{};
+		QTreeWidgetItem* _irLiangduChengXiang{};
+		QTreeWidgetItem* _irBujianGongXian{};
 
 		QStringList* modelList;
 		PreWindow* _preWindow{};

+ 1 - 0
src/MeshData/meshSingleton.h

@@ -82,6 +82,7 @@ namespace MeshData
 	private:
 		static MeshData* _instance;
 		QList<MeshKernal*> _meshList{};
+		QList<MeshKernal*> _IRmeshList{};
 		QList<MeshSet*> _setList{};
 	};