From 732a65106b8a39226eb2412c69e5afef71c04ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=8F=A4=E6=95=9B=E9=94=8B?= <3045316072@qq.com> Date: Tue, 2 Jul 2024 17:22:29 +0800 Subject: [PATCH] =?UTF-8?q?xyz=20=E6=96=87=E4=BB=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=8B=86=E5=88=86=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MainWindow/MainWindow.cpp | 68 +++++++++++++++++++ src/MainWindow/MainWindow.h | 18 +++++ .../dialogimportmodeldataset.h | 4 ++ .../meshDataExchangePlugin.cpp | 22 +++--- .../meshDataExchangePlugin.h | 1 + 5 files changed, 105 insertions(+), 8 deletions(-) diff --git a/src/MainWindow/MainWindow.cpp b/src/MainWindow/MainWindow.cpp index 3b8576b..c37864d 100644 --- a/src/MainWindow/MainWindow.cpp +++ b/src/MainWindow/MainWindow.cpp @@ -405,6 +405,24 @@ namespace GUI { connect(_ui->actionImageShowTool, SIGNAL(triggered()), this, SLOT(on_actionImageShowTool())); connect(_ui->actionRCShowTool, SIGNAL(triggered()), this, SLOT(on_actionRCShowTool())); + + + // 加载预制模型 + connect(_ui->actionLoadPreForestMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreForestMeshFile_triggereds())); + connect(_ui->actionLoadPreCropMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreCropMeshFile_triggereds())); + connect(_ui->actionLoadPreGrasslandMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreGrasslandMeshFile_triggereds())); + connect(_ui->actionLoadPreWaterBodyMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreWaterBodyMeshFile_triggereds())); + connect(_ui->actionLoadPreSoilMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreSoilMeshFile_triggereds())); + connect(_ui->actionLoadPreDynamicWaterBodyMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreDynamicWaterBodyMeshFile_triggereds())); + connect(_ui->actionLoadPreRoadMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreRoadMeshFile_triggereds())); + connect(_ui->actionLoadPreArtificialMeshFile,SIGNAL(triggered()),this, SLOT(on_actionLoadPreArtificialMeshFile_triggereds())); + connect(_ui->actionLoadForestPointCloudFile,SIGNAL(triggered()),this, SLOT(on_actionLoadForestPointCloudFile_triggereds())); + connect(_ui->actionLoadRhounessPointCloudFile,SIGNAL(triggered()),this, SLOT(on_actionLoadRhounessPointCloudFile_triggereds())); + connect(_ui->actionLoadGeometricCorrectionFile,SIGNAL(triggered()),this, SLOT(on_actionLoadGeometricCorrectionFile_triggereds())); + connect(_ui->actionLoadRadioModelFile,SIGNAL(triggered()),this, SLOT(on_actionLoadRadioModelFile_triggereds())); + + + } void MainWindow::registerMoudel() @@ -1651,5 +1669,55 @@ namespace GUI { DebugInfo("on_actionLoadPointCloudText\n"); // emit this->actionLoadPointCloudText(this); } + void MainWindow::on_actionLoadPreForestMeshFile_triggereds() { + DebugInfo("on_actionLoadPreForestMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Forest"); + } + void MainWindow::on_actionLoadPreCropMeshFile_triggereds() { + DebugInfo("on_actionLoadPreCropMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Crop"); + + } + void MainWindow::on_actionLoadPreGrasslandMeshFile_triggereds() { + DebugInfo("on_actionLoadPreGrasslandMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Grassland"); + } + void MainWindow::on_actionLoadPreWaterBodyMeshFile_triggereds() { + DebugInfo("on_actionLoadPreWaterBodyMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "WaterBody"); + } + void MainWindow::on_actionLoadPreSoilMeshFile_triggereds() { + DebugInfo("on_actionLoadPreSoilMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Soil"); + } + void MainWindow::on_actionLoadPreDynamicWaterBodyMeshFile_triggereds() { + DebugInfo("on_actionLoadPreDynamicWaterBodyMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "DynamicWater"); + } + void MainWindow::on_actionLoadPreRoadMeshFile_triggereds() { + DebugInfo("on_actionLoadPreRoadMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Road"); + } + void MainWindow::on_actionLoadPreArtificialMeshFile_triggereds() { + DebugInfo("on_actionLoadPreArtificialMeshFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "Artificial"); + } + void MainWindow::on_actionLoadForestPointCloudFile_triggereds() { + DebugInfo("on_actionLoadForestPointCloudFile_triggered\n"); // 加载点云 + on_importPcl(); + } + void MainWindow::on_actionLoadRhounessPointCloudFile_triggereds() { // 加载粗糙度点云 + DebugInfo("on_actionLoadRhounessPointCloudFile_triggered\n"); + on_importPcl(); + } + void MainWindow::on_actionLoadGeometricCorrectionFile_triggereds() { + DebugInfo("on_actionLoadGeometricCorrectionFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "GeometricCorrection"); + } + void MainWindow::on_actionLoadRadioModelFile_triggereds() { + DebugInfo("on_actionLoadRadioModelFile_triggered\n"); + emit this->on_loadPreMeshFile(this, "RadioModel"); + + } } // namespace GUI diff --git a/src/MainWindow/MainWindow.h b/src/MainWindow/MainWindow.h index fdfbc07..67e81d9 100644 --- a/src/MainWindow/MainWindow.h +++ b/src/MainWindow/MainWindow.h @@ -336,6 +336,9 @@ namespace GUI { void on_actionImageShowToolTriggleSIGNAL(GUI::MainWindow* m); void on_actionRCShowToolSIGNAL(GUI::MainWindow* m); + + void on_loadPreMeshFile(GUI::MainWindow* m,QString modeltype); + public slots: /*状态栏显示信息 */ void setStatusBarInfo(QString); @@ -396,6 +399,21 @@ namespace GUI { // 在状态栏中显示坐标 void showStateToolbarPosition(double x,double y,double z); + // 加载预制模型 + void on_actionLoadPreForestMeshFile_triggereds(); + void on_actionLoadPreCropMeshFile_triggereds(); + void on_actionLoadPreGrasslandMeshFile_triggereds(); + void on_actionLoadPreWaterBodyMeshFile_triggereds(); + void on_actionLoadPreSoilMeshFile_triggereds(); + void on_actionLoadPreDynamicWaterBodyMeshFile_triggereds(); + void on_actionLoadPreRoadMeshFile_triggereds(); + void on_actionLoadPreArtificialMeshFile_triggereds(); + void on_actionLoadForestPointCloudFile_triggereds(); + void on_actionLoadRhounessPointCloudFile_triggereds(); + void on_actionLoadGeometricCorrectionFile_triggereds(); + void on_actionLoadRadioModelFile_triggereds(); + + private slots: /*关闭主窗口 */ diff --git a/src/PluginMeshDataExchange/dialogimportmodeldataset.h b/src/PluginMeshDataExchange/dialogimportmodeldataset.h index 24f26c4..a8fd4fe 100644 --- a/src/PluginMeshDataExchange/dialogimportmodeldataset.h +++ b/src/PluginMeshDataExchange/dialogimportmodeldataset.h @@ -36,9 +36,13 @@ namespace WBFZ { explicit DialogImportModelDataset(GUI::MainWindow* _mainwindow,QWidget* parent = nullptr); ~DialogImportModelDataset() override; + public: + void importMeshModel(); + public: void initLibrary(); void filterModel(QString filterStr);// 根据条件筛选 + private: GUI::MainWindow* _mainwindow; Ui::DialogImportModelDataset* ui; diff --git a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp index f9916ff..c8b65aa 100644 --- a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp +++ b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp @@ -19,6 +19,7 @@ #include "Dialogmeshsurfacesampling.h" #include "dialogimportmodeldataset.h" #include "Common/DebugLogger.h" +#include "AsciiOpenDialog.h" #include GUI::MainWindow* MeshData::MeshDataExchangePlugin::_mainwindow = nullptr; @@ -29,17 +30,15 @@ namespace MeshData { _mainwindow = m; connect(_mainwindow, SIGNAL(on_actionvtkPointSamplorTriggleSIGNAL(GUI::MainWindow*)),this,SLOT(vtkPointSamplerDialog(GUI::MainWindow*))); + connect(_mainwindow, SIGNAL(on_loadPreMeshFile(GUI::MainWindow*,QString)),this,SLOT(on_LoadPreMeshFileDialog(GUI::MainWindow*,QString))); - // 添加 命令 _toolboxMenu=new QMenu("ImportTestBar"); - // 增加菜单 QAction* action_ModelFilterImport=_toolboxMenu->addAction("ModelFilterImport"); - connect(action_ModelFilterImport, SIGNAL(triggered()),this, SLOT(on_TestLoadModelImport())); - m->menuBar()->addMenu(_toolboxMenu); + } bool MeshDataExchangePlugin::install() @@ -132,6 +131,12 @@ namespace MeshData { WBFZ::DialogImportModelDataset* dialog=new WBFZ::DialogImportModelDataset(_mainwindow); dialog->exec(); } + void MeshDataExchangePlugin::on_LoadPreMeshFileDialog(GUI::MainWindow* _m, QString _fileType) { + WBFZ::DialogImportModelDataset* dialog=new WBFZ::DialogImportModelDataset(_mainwindow); + dialog->filterModel(_fileType); + dialog->exec(); + + } } @@ -380,10 +385,11 @@ bool MESHDATAEXCHANGEPLUGINAPI FOAMexportMesh(QString AbFileName, int id) bool MESHDATAEXCHANGEPLUGINAPI XYZimportPCL(QString AbFileName, int id) { - auto xyzReader = new MeshData::PointClouddataExchange( - AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt(), id); - ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(xyzReader); - emit tc->threadStart(); // emit MSHwriter->start(); + MeshData::loadXYZImportPCL(AbFileName, MeshData::MeshDataExchangePlugin::getMWpt()); +// auto xyzReader = new MeshData::PointClouddataExchange( +// AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt(), id); +// ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(xyzReader); +// emit tc->threadStart(); // emit MSHwriter->start(); return false; } diff --git a/src/PluginMeshDataExchange/meshDataExchangePlugin.h b/src/PluginMeshDataExchange/meshDataExchangePlugin.h index 758dbdc..61adaa1 100644 --- a/src/PluginMeshDataExchange/meshDataExchangePlugin.h +++ b/src/PluginMeshDataExchange/meshDataExchangePlugin.h @@ -28,6 +28,7 @@ namespace MeshData { QMenu* _toolboxMenu=nullptr; public slots: void on_TestLoadModelImport(); + void on_LoadPreMeshFileDialog(GUI::MainWindow* _m, QString _fileType); }; }