From 18e7c264bfc59a5ad0cafe0b5ecea3602f77b1fc 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: Wed, 3 Apr 2024 02:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9E=E5=AE=9A=E4=BA=86=E7=82=B9=E4=BA=91?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=88pcd)=E7=9A=84=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E4=B8=8E=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- .idea/FastCAE.iml | 8 +- .idea/misc.xml | 3 + .idea/vcs.xml | 2 + CMakeLists.txt | 27 + cmake/FindOpenCASCADE.cmake | 4 +- devopler.md | 29 ++ src/CMakeLists.txt | 11 +- src/Common/DebugLogger.h | 2 +- src/ConfigOptions/MeshConfig.cpp | 123 ++++- src/ConfigOptions/MeshConfig.h | 35 +- src/DataProperty/DataBase.h | 4 +- src/IO/IOConfig.cpp | 80 ++- src/IO/IOConfig.h | 31 +- src/LAMPCAE/main.cpp | 6 +- src/LAMPTool/CMakeLists.txt | 4 +- src/MainWidgets/ControlPanel.cpp | 8 +- src/MainWidgets/preWindow.h | 14 +- src/MainWindow/CustomizerHelper.cpp | 5 + src/MainWindow/MainWindow.cpp | 110 ++++- src/MainWindow/MainWindow.h | 7 + src/MainWindow/MainWindowPy.cpp | 26 +- src/MainWindow/MainWindowPy.h | 12 +- src/MainWindow/SignalHandler.cpp | 37 ++ src/MainWindow/SignalHandler.h | 16 +- src/MainWindow/SubWindowManager.cpp | 3 +- src/MeshData/CMakeLists.txt | 64 ++- src/MeshData/meshSingleton.h | 2 +- src/ModuleBase/CMakeLists.txt | 61 ++- src/ModuleBase/graph3DWindow.cpp | 11 + src/ModuleBase/graph3DWindow.h | 111 +++++ src/PluginCustomizer/DataManager.cpp | 32 +- src/PluginCustomizer/DataManager.h | 15 + src/PluginMeshDataExchange/CMakeLists.txt | 73 ++- src/PluginMeshDataExchange/MeshThreadBase.cpp | 1 + src/PluginMeshDataExchange/PDBdataExchange.h | 33 +- .../PointClouddataExchange.cpp | 313 ++++++++++++ .../PointClouddataExchange.h | 151 ++++++ .../VTKdataExchange.cpp | 103 +++- src/PluginMeshDataExchange/VTKdataExchange.h | 4 + .../meshDataExchangePlugin.cpp | 63 ++- .../meshDataExchangePlugin.h | 11 + src/PluginMotorBike/CMakeLists.txt | 76 +++ src/PluginMotorBike/OpenFoamPluginAPI.h | 13 + src/PluginMotorBike/PluginOpenFoamExtend.cpp | 463 ++++++++++++++++++ src/PluginMotorBike/PluginOpenFoamExtend.h | 86 ++++ src/PluginMotorBike/_Create_Project.bat | 7 + src/PluginMotorBike/_Create_project.sh | 3 + src/PointCloudData/CMakeLists.txt | 161 ++++++ src/PointCloudData/PointCloudChecker.cpp | 321 ++++++++++++ src/PointCloudData/PointCloudChecker.h | 114 +++++ src/PointCloudData/PointCloudCommon.cpp | 76 +++ src/PointCloudData/PointCloudCommon.h | 14 + src/PointCloudData/PointCloudDataAPI.h | 13 + src/PointCloudData/PointCloudFactory.cpp | 44 ++ src/PointCloudData/PointCloudFactory.h | 27 + src/PointCloudData/PointCloudKernal.cpp | 263 ++++++++++ src/PointCloudData/PointCloudKernal.h | 203 ++++++++ src/PointCloudData/PointCloudPy.cpp | 102 ++++ src/PointCloudData/PointCloudPy.h | 25 + src/PointCloudData/PointCloudSet.cpp | 360 ++++++++++++++ src/PointCloudData/PointCloudSet.h | 229 +++++++++ src/PointCloudData/PointCloudSingleton.cpp | 341 +++++++++++++ src/PointCloudData/PointCloudSingleton.h | 196 ++++++++ src/PythonModule/CMakeLists.txt | 2 +- src/PythonModule/py/MainWindow.py | 11 + src/Settings/BusAPI.cpp | 1 + src/Settings/DialogWorkingDir.cpp | 3 + src/WBCLFZSystemModule/AllHead.h | 292 ++++++++--- src/WBCLFZSystemModule/CMakeLists.txt | 14 +- src/WBCLFZSystemModule/OCCTModelOperator.cpp | 6 +- .../OCCTopoShapeTreeViewer.cpp | 4 +- .../OCCViewer/DocumentCommon.cpp | 2 +- .../OCCViewer/GeomWidget.cpp | 8 +- src/WBCLFZSystemModule/OCCViewer/GeomWidget.h | 14 +- .../OCCViewer/OCCT_Test/BaseSample.cpp | 14 +- .../OCCViewer/OCCT_Test/BaseSample.h | 6 +- .../OCCViewer/OCCT_Test/MakeBottle.cpp | 78 +-- .../OCCViewer/OCCT_Test/MakeBottle.h | 4 +- .../OCCViewer/OCCT_Test/Viewer3dSamples.cpp | 14 +- .../OCCViewer/OCCT_Test/Viewer3dSamples.h | 4 +- .../OCCViewer/OcctHighlighter.cpp | 4 +- .../OCCViewer/OcctHighlighter.h | 6 +- .../OCCViewer/TranslateDialog.cpp | 4 +- .../OCCViewer/TranslateDialog.h | 4 +- .../OCCViewer/Transparency.cpp | 4 +- .../OCCViewer/Transparency.h | 6 +- src/WBCLFZSystemModule/OCCViewer/View.cpp | 16 +- src/WBCLFZSystemModule/OCCViewer/View.h | 10 +- .../PointCloudProcess/BasePCL.h | 2 +- .../PointCloudProcess/pclvisualizer.cpp | 3 +- .../QtSARAntModelSetting.cpp | 6 +- .../SharedModuleLib/BaseUiTool.h | 2 +- src/WBCLFZSystemModule/WBCLFZ.cpp | 15 + src/WBCLFZSystemModule/WBCLFZ.h | 33 ++ .../WBCLFZSystemModuleAPI.h | 13 + .../modelProcess/ModelProcess.cpp | 4 +- 97 files changed, 5096 insertions(+), 310 deletions(-) create mode 100644 devopler.md create mode 100644 src/PluginMeshDataExchange/PointClouddataExchange.cpp create mode 100644 src/PluginMeshDataExchange/PointClouddataExchange.h create mode 100644 src/PluginMotorBike/CMakeLists.txt create mode 100644 src/PluginMotorBike/OpenFoamPluginAPI.h create mode 100644 src/PluginMotorBike/PluginOpenFoamExtend.cpp create mode 100644 src/PluginMotorBike/PluginOpenFoamExtend.h create mode 100644 src/PluginMotorBike/_Create_Project.bat create mode 100644 src/PluginMotorBike/_Create_project.sh create mode 100644 src/PointCloudData/CMakeLists.txt create mode 100644 src/PointCloudData/PointCloudChecker.cpp create mode 100644 src/PointCloudData/PointCloudChecker.h create mode 100644 src/PointCloudData/PointCloudCommon.cpp create mode 100644 src/PointCloudData/PointCloudCommon.h create mode 100644 src/PointCloudData/PointCloudDataAPI.h create mode 100644 src/PointCloudData/PointCloudFactory.cpp create mode 100644 src/PointCloudData/PointCloudFactory.h create mode 100644 src/PointCloudData/PointCloudKernal.cpp create mode 100644 src/PointCloudData/PointCloudKernal.h create mode 100644 src/PointCloudData/PointCloudPy.cpp create mode 100644 src/PointCloudData/PointCloudPy.h create mode 100644 src/PointCloudData/PointCloudSet.cpp create mode 100644 src/PointCloudData/PointCloudSet.h create mode 100644 src/PointCloudData/PointCloudSingleton.cpp create mode 100644 src/PointCloudData/PointCloudSingleton.h create mode 100644 src/WBCLFZSystemModule/WBCLFZ.cpp create mode 100644 src/WBCLFZSystemModule/WBCLFZ.h create mode 100644 src/WBCLFZSystemModule/WBCLFZSystemModuleAPI.h diff --git a/.gitignore b/.gitignore index 85b618d..5556dac 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ /install /cmake-build-debug /cmake-build-release -/extlib/OpenCASCADE \ No newline at end of file +/extlib/OpenCASCADE +/extlib/OTB +/extlib/lampcae +/extlib/Python \ No newline at end of file diff --git a/.idea/FastCAE.iml b/.idea/FastCAE.iml index f08604b..73ef295 100644 --- a/.idea/FastCAE.iml +++ b/.idea/FastCAE.iml @@ -1,2 +1,8 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 79b3c94..cdda803 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index c132c9d..d3987a2 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -3,5 +3,7 @@ + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1402d21..78bbac2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,10 @@ project(LAMPCAE HOMEPAGE_URL "http://www.LAMPCAE.com/" ) +set(PROJECT_VERSION 2.5.0) +set(PROJECT_VERSION_MAJOR 2) +set(PROJECT_VERSION_MINOR 5) +set(PROJECT_VERSION_PATCH 0) #----------------------------------------------------------------------------- # 编译系统设置 #----------------------------------------------------------------------------- @@ -134,6 +138,7 @@ list(APPEND QtNeededModules OpenGL # Qwt PrintSupport # QwtPolar DBus + Qml DataVisualization Charts ) if(LAMPCAE_LINUX) list(APPEND QtNeededModules XcbQpa) @@ -206,6 +211,28 @@ find_package(Gmsh REQUIRED) # Python find_package(Python REQUIRED) +message("CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}") + + +#----------------------------------------------------------------------------- +# 初始化其他导入文件 +#----------------------------------------------------------------------------- +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(SYSTEM C:/PCL/3rdParty/FLANN/include) +include_directories(SYSTEM C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(SYSTEM C:/PCL/include/pcl-1.14) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) +find_package(PCL) +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + + #----------------------------------------------------------------------------- # 检索系统python(需要修改cmake搜索路径) #----------------------------------------------------------------------------- diff --git a/cmake/FindOpenCASCADE.cmake b/cmake/FindOpenCASCADE.cmake index 177ccaf..89fb157 100644 --- a/cmake/FindOpenCASCADE.cmake +++ b/cmake/FindOpenCASCADE.cmake @@ -103,8 +103,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") set_target_properties(OpenCASCADE::Freetype PROPERTIES IMPORTED_IMPLIB_RELEASE "D:/vcpkg/installed/x64-windows/lib/freetype.lib" IMPORTED_LOCATION_RELEASE "D:/vcpkg/installed/x64-windows/bin/freetype.dll" - IMPORTED_IMPLIB_DEBUG "D:/vcpkg/installed/x64-windows/debug/lib/freetype.lib" - IMPORTED_LOCATION_DEBUG "D:/vcpkg/installed/x64-windows/debug/bin/freetype.dll" + IMPORTED_IMPLIB_DEBUG "D:/vcpkg/installed/x64-windows/debug/lib/freetyped.lib" + IMPORTED_LOCATION_DEBUG "D:/vcpkg/installed/x64-windows/debug/bin/freetyped.dll" ) set_target_properties(OpenCASCADE::Tcl86 PROPERTIES IMPORTED_IMPLIB_RELEASE "${OpenCASCADE_LIBRARY_DIRS}/tcl86.lib" diff --git a/devopler.md b/devopler.md new file mode 100644 index 0000000..343e45d --- /dev/null +++ b/devopler.md @@ -0,0 +1,29 @@ +# 版本声明 +LAMPCAE软件是基于FastCAE 软件上开发得到,增加了点云、feko仿真、成像三个部分功能。注意FastCAE 遵循 BSD-3-Clause 协议。为了避免被其他的依赖库协议污染,这里将程序库进行了拆分。 + +## 点云功能部分依赖库 +点云部分依赖pcl,其中模型渲染部分重新用fastCAE软件的渲染重新适配。 +其中点云属性与点云实体分开存储,后期在考虑完全统一 + +## mesh网格处理 +依赖meshlab中库代码处理 + +## 模型处理 + +## 仿真成像 +1. 近场 +其中所有近场都是基于部分BP算法重新编写 +2. 远程 +专门为圆迹和ISAR构建,基于BP算法进行的适配 + + +## 后处理阶段 + +## 回波展示分析阶段 + +## 影像处理部分依赖库 + + +# V1.0 +1. 原来点云处理模块全部内置到FastCAE中 + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 351b7f5..ecce144 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,19 +1,18 @@ -set(SOVERSION ${PROJECT_VERSION} ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINOR} ${PROJECT_VERSION_PATCH}) + +set(SOVERSION ${PROJECT_VERSION} ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINOR} ${PROJECT_VERSION_PATCH}) #----------------------------------------------------------------------------- # 所有项目 #----------------------------------------------------------------------------- -list(APPEND _libraries Common PythonModule SARibbonBar Settings DataProperty MeshData SelfDefObject Material Geometry BCBase ConfigOptions ParaClassFactory ModelData ModuleBase PostAlgorithm PostRenderData PostInterface PostCurveDataManager PostPlotWidget PostWidgets GeometryDataExchange ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets PluginManager GmshModule IO SolverControl MainWidgets UserGuidence) -list(APPEND _libraries json qcustomplot qhexedit qscintilla2 LAMPTool WBCLFZSystemModule) - +list(APPEND _libraries Common PythonModule SARibbonBar Settings DataProperty MeshData SelfDefObject Material Geometry BCBase ConfigOptions ParaClassFactory ModelData ModuleBase PostAlgorithm PostRenderData PostInterface PostCurveDataManager PostPlotWidget PostWidgets GeometryDataExchange ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets PluginManager GmshModule IO SolverControl MainWidgets UserGuidence) +list(APPEND _libraries json qcustomplot qhexedit qscintilla2 LAMPTool WBCLFZSystemModule ) +list(APPEND _libraries PluginMotorBike) #[[if(_WIN_) list(APPEND _libraries XGenerateReport License) endif()]] list(APPEND _libraries MainWindow ${PROJECT_NAME}) - - #----------------------------------------------------------------------------- # 处理LAMPCAE程序的RPATH #----------------------------------------------------------------------------- diff --git a/src/Common/DebugLogger.h b/src/Common/DebugLogger.h index 533d5f2..1b79a82 100644 --- a/src/Common/DebugLogger.h +++ b/src/Common/DebugLogger.h @@ -1,7 +1,7 @@ /** * @file DebugLogger.h * @brief 用于输出调试信息的类 - * @author LAMPCAE研发小组(LAMPCAE@diso.cn) + * @author FastCAE研发小组(FastCAE@diso.cn) * @version 2.5.0 * @date 2023-05-11 16:12 * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. diff --git a/src/ConfigOptions/MeshConfig.cpp b/src/ConfigOptions/MeshConfig.cpp index 88799ed..2d954d6 100644 --- a/src/ConfigOptions/MeshConfig.cpp +++ b/src/ConfigOptions/MeshConfig.cpp @@ -4,7 +4,9 @@ #define MESHON true; #define MESHOFF false; #define MESHIMPORT "cgns;msh;neu;stl;dat;vtk;inp" -#define MESHEXPORT "vtk;neu" +#define POINTCLOUDIMPORT "xyz;pcd;ply" +#define MESHEXPORT "vtk;neu;stl" +#define POINTCLOUDEXPORT "pcd;ply" namespace ConfigOption @@ -12,10 +14,9 @@ namespace ConfigOption MeshConfig::MeshConfig() { this->clearData(); - } - bool MeshConfig::isMeshEnabled() + bool MeshConfig::isMeshEnabled(MeshDataType type/*=MeshDataType::vtkMesh*/) { bool in = this->isImportMeshEnabled(); bool ex = this->isExportMeshEnabled(); @@ -25,34 +26,117 @@ namespace ConfigOption return in || ex || gen ; } - bool MeshConfig::isImportMeshEnabled() + bool MeshConfig::isImportMeshEnabled(MeshDataType type/*=MeshDataType::vtkMesh*/) { - return !_importSuffix.isEmpty(); + switch(type) { + case MeshDataType::None :{ + return false; + } + case MeshDataType::vtkMesh:{ + return !_importMeshSuffix.isEmpty(); + } + case MeshDataType::PointCloud:{ + return !_importPclSuffix.isEmpty(); + } + default:{ + return false; + } + } } - bool MeshConfig::isExportMeshEnabled() + bool MeshConfig::isExportMeshEnabled(MeshDataType type/*=MeshDataType::vtkMesh*/) { - return !_exportSuffix.isEmpty(); + switch(type) { + case MeshDataType::None :{ + return false; + } + case MeshDataType::vtkMesh:{ + return !_exportMeshSuffix.isEmpty(); + } + case MeshDataType::PointCloud:{ + return !_exportPclSuffix.isEmpty(); + } + default:{ + return false; + } + } } - void MeshConfig::setImportSuffix(QString s) + void MeshConfig::setImportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/) { - _importSuffix = s; + switch(type) { + case MeshDataType::None :{ + break; + } + case MeshDataType::vtkMesh:{ + _importMeshSuffix=s; + break; + } + case MeshDataType::PointCloud:{ + _importPclSuffix=s; + break; + } + default:{ + break; + } + } } - QString MeshConfig::getImportSuffix() - { - return _importSuffix; + QString MeshConfig::getImportSuffix(MeshDataType type/*=MeshDataType::vtkMesh*/) + { + switch(type) { + case MeshDataType::None :{ + return ""; + } + case MeshDataType::vtkMesh:{ + return _importMeshSuffix; + } + case MeshDataType::PointCloud:{ + return _importPclSuffix; + } + default:{ + return ""; + } + } } - void MeshConfig::setExportSuffix(QString s) + void MeshConfig::setExportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/) { - _exportSuffix = s; + switch(type) { + case MeshDataType::None :{ + break ; + } + case MeshDataType::vtkMesh:{ + _exportMeshSuffix=s; + break; + } + case MeshDataType::PointCloud:{ + _exportPclSuffix=s; + break; + } + default:{ + break; + } + } } - QString MeshConfig::getExportSuffix() + QString MeshConfig::getExportSuffix(MeshDataType type/*=MeshDataType::vtkMesh*/) { - return _exportSuffix; + switch(type) { + case MeshDataType::None :{ + return ""; + break ; + } + case MeshDataType::vtkMesh:{ + return _exportMeshSuffix; + } + case MeshDataType::PointCloud:{ + return _exportPclSuffix; + } + default:{ + return ""; + } + } } bool MeshConfig::isMeshGenerationEnabled() @@ -86,9 +170,10 @@ namespace ConfigOption void MeshConfig::clearData() { - - _exportSuffix = MESHEXPORT; - _importSuffix = MESHIMPORT; + _importMeshSuffix=MESHIMPORT; + _importPclSuffix=POINTCLOUDIMPORT; + _exportMeshSuffix=MESHEXPORT; + _exportPclSuffix=POINTCLOUDEXPORT; _enableSurfaceMesh = MESHON; _enableSolidMesh = MESHON; diff --git a/src/ConfigOptions/MeshConfig.h b/src/ConfigOptions/MeshConfig.h index f3fb6be..0dcc7f1 100644 --- a/src/ConfigOptions/MeshConfig.h +++ b/src/ConfigOptions/MeshConfig.h @@ -7,7 +7,7 @@ * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. * * ============================================================================ - * Program: LAMPCAE + * Program: FastCAE * * Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. * See License or http://www.LAMPCAE.com/ for details. @@ -18,6 +18,11 @@ * 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 _MESHCONFIG_H_ @@ -28,6 +33,13 @@ namespace ConfigOption { + + enum MeshDataType{ // 网格相关数据类型 + None, + vtkMesh, // 直接网格数据 + PointCloud // 点云数据 + }; + /** * @brief 网格配置信息类 * @since 2.5.0 @@ -39,15 +51,15 @@ namespace ConfigOption ~MeshConfig() = default; void clearData(); - bool isMeshEnabled(); + bool isMeshEnabled(MeshDataType type=MeshDataType::vtkMesh); - bool isImportMeshEnabled(); - void setImportSuffix(QString s); - QString getImportSuffix(); + bool isImportMeshEnabled(MeshDataType type=MeshDataType::vtkMesh); + void setImportSuffix(QString s,MeshDataType type=MeshDataType::vtkMesh); + QString getImportSuffix(MeshDataType type=MeshDataType::vtkMesh); - bool isExportMeshEnabled(); - void setExportSuffix(QString s); - QString getExportSuffix(); + bool isExportMeshEnabled(MeshDataType type=MeshDataType::vtkMesh); + void setExportSuffix(QString s,MeshDataType type=MeshDataType::vtkMesh); + QString getExportSuffix(MeshDataType type=MeshDataType::vtkMesh); bool isMeshGenerationEnabled(); void enableSurfaceMesh(bool on); @@ -73,9 +85,12 @@ namespace ConfigOption private: // bool _enableMesh{ false }; // bool _importMesh{ false }; - QString _importSuffix{}; + QString _importMeshSuffix{}; // 网格格式 // bool _exportMesh{ false }; - QString _exportSuffix{}; + QString _exportMeshSuffix{}; + + QString _importPclSuffix{}; //点云格式 + QString _exportPclSuffix{}; // bool _enableMeshGeneration{ false }; // bool _isGmsher{ false }; diff --git a/src/DataProperty/DataBase.h b/src/DataProperty/DataBase.h index a452e7a..ff066d9 100644 --- a/src/DataProperty/DataBase.h +++ b/src/DataProperty/DataBase.h @@ -1,13 +1,13 @@ /** * @file DataBase.h * @brief 数据基类头文件 - * @author LAMPCAE研发小组(LAMPCAE@diso.cn) + * @author FastCAE研发小组(LAMPCAE@diso.cn) * @version 2.5.0 * @date 2022-03-15 13:36 * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. * * ============================================================================ - * Program: LAMPCAE + * Program: FastPCAE * * Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. * See License or http://www.LAMPCAE.com/ for details. diff --git a/src/IO/IOConfig.cpp b/src/IO/IOConfig.cpp index 19399c7..067d81f 100644 --- a/src/IO/IOConfig.cpp +++ b/src/IO/IOConfig.cpp @@ -1,12 +1,15 @@ #include -namespace IO -{ - QHash IOConfigure::_inpWriteFun = QHash(); - QHash IOConfigure::_outFileTransfer = QHash(); - QHash IOConfigure::_inputmeshFuns = QHash(); +namespace IO { + QHash IOConfigure::_inpWriteFun = QHash(); + QHash IOConfigure::_outFileTransfer = QHash(); + QHash IOConfigure::_inputmeshFuns = QHash(); // 网格 QHash IOConfigure::_exportMeshFuns = QHash(); - QHash IOConfigure::_replaceFuns = QHash(); + + QHash IOConfigure::_inputPclFuns = QHash(); // 点云 + QHash IOConfigure::_exportPclFuns = QHash(); + + QHash IOConfigure::_replaceFuns =QHash(); QStringList IOConfigure::getInputFileFormat() { @@ -42,14 +45,14 @@ namespace IO WRITEINPFILE IOConfigure::getInputFileWriter(QString format) { - if (_inpWriteFun.contains(format)) + if(_inpWriteFun.contains(format)) return _inpWriteFun.value(format); - return nullptr; + return nullptr; } TRANSFEROUTFILE IOConfigure::getOutputTransfer(QString tras) { - if (_outFileTransfer.contains(tras)) + if(_outFileTransfer.contains(tras)) return _outFileTransfer.value(tras); return nullptr; } @@ -61,7 +64,7 @@ namespace IO void IOConfigure::RemoveMeshImporter(QString suffix) { - if (_inputmeshFuns.contains(suffix)) + if(_inputmeshFuns.contains(suffix)) _inputmeshFuns.remove(suffix); } @@ -73,11 +76,23 @@ namespace IO IMPORTMESHFUN IOConfigure::getMeshImporter(QString name) { - if (_inputmeshFuns.contains(name)) + if(_inputmeshFuns.contains(name)) return _inputmeshFuns.value(name); return nullptr; } + + void IOConfigure::RegisterPclImporter(QString suffix, IMPORTMESHFUN fun) + { + _inputPclFuns.insert(suffix, fun); + } + + void IOConfigure::RegisterPclExporter(QString suffix, EXPORTMESHFUN fun) + { + _exportPclFuns.insert(suffix, fun); + } + + void IOConfigure::RegisterMeshExporter(QString suffix, EXPORTMESHFUN fun) { _exportMeshFuns.insert(suffix, fun); @@ -85,7 +100,7 @@ namespace IO void IOConfigure::RemoveMeshExporter(QString suffix) { - if (_exportMeshFuns.contains(suffix)) + if(_exportMeshFuns.contains(suffix)) _exportMeshFuns.remove(suffix); } @@ -97,7 +112,7 @@ namespace IO EXPORTMESHFUN IOConfigure::getMeshExporter(QString suffix) { - if (_exportMeshFuns.contains(suffix)) + if(_exportMeshFuns.contains(suffix)) return _exportMeshFuns.value(suffix); return nullptr; } @@ -107,11 +122,10 @@ namespace IO _replaceFuns.insert(kw, fun); } - - REPLACEKEYWORDFUN IOConfigure::getKeyWordsReplacer(QString kw) { - if (_replaceFuns.contains(kw)) return _replaceFuns.value(kw); + if(_replaceFuns.contains(kw)) + return _replaceFuns.value(kw); return nullptr; } @@ -120,7 +134,39 @@ namespace IO _replaceFuns.remove(kw); } -} + IMPORTMESHFUN IOConfigure::getPclImporter(QString name) + { + if(_inputPclFuns.contains(name)) + return _inputPclFuns.value(name); + return nullptr; + } + EXPORTMESHFUN IOConfigure::getPclExporter(QString name) + { + if(_exportPclFuns.contains(name)) + return _exportPclFuns.value(name); + return nullptr; + } + void IOConfigure::RemovePclImporter(QString suffix) { + if(_inputPclFuns.contains(suffix)) + _inputPclFuns.remove(suffix); + + } + void IOConfigure::RemovePclExporter(QString suffix) { + if(_exportPclFuns.contains(suffix)) + _exportPclFuns.remove(suffix); + } + QStringList IOConfigure::getPclImporters() + { + QList ts = _inputPclFuns.keys(); + return QStringList(ts); + } + QStringList IOConfigure::getPclExporters() + { + QList ts = _exportPclFuns.keys(); + return QStringList(ts); + } + +} // namespace IO diff --git a/src/IO/IOConfig.h b/src/IO/IOConfig.h index 387a08a..8dde777 100644 --- a/src/IO/IOConfig.h +++ b/src/IO/IOConfig.h @@ -15,9 +15,9 @@ namespace ModelData typedef bool(*WRITEINPFILE)(QString, ModelData::ModelDataBase*); //转换原文件路径 typedef bool(*TRANSFEROUTFILE)(QString); -//导入网格 文件名称 +//导入网格 点云 文件名称 typedef bool(*IMPORTMESHFUN)(QString, int); -//导出网格 文件名称 id +//导出网格 点云 文件名称 id typedef bool(*EXPORTMESHFUN)(QString, int); //模板关键字替换方法 关键字, 模型 返回替换之后的结果 typedef QString(*REPLACEKEYWORDFUN)(QString, ModelData::ModelDataBase*); @@ -39,6 +39,11 @@ namespace IO static void RegisterMeshImporter(QString suffix, IMPORTMESHFUN fun); //注册网格导出的方法 static void RegisterMeshExporter(QString suffix, EXPORTMESHFUN fun); + //注册点云文件导入的方法 + static void RegisterPclImporter(QString suffix, IMPORTMESHFUN fun); + //注册点云导出的方法 + static void RegisterPclExporter(QString suffix, EXPORTMESHFUN fun); + //移除写出文件的后缀注册 static void RemoveInputFile(QString s); @@ -48,6 +53,11 @@ namespace IO static void RemoveMeshImporter(QString suffix); //移除导出网格的方法 static void RemoveMeshExporter(QString suffix); + //移除导入点云的方法 + static void RemovePclImporter(QString suffix); + //移除导出点云的方法 + static void RemovePclExporter(QString suffix); + //获取所有输入文件格式 static QStringList getInputFileFormat(); @@ -57,6 +67,10 @@ namespace IO static QStringList getMeshImporters(); //获取所有注册的网格读入方法 static QStringList getMeshExporters(); + //获取所有注册的点云读入方法 + static QStringList getPclImporters(); + //获取所有注册的点云读入方法 + static QStringList getPclExporters(); //获取文件写出方法 static WRITEINPFILE getInputFileWriter(QString format); @@ -66,6 +80,12 @@ namespace IO static IMPORTMESHFUN getMeshImporter(QString suffix); //获取网格导出的方法 static EXPORTMESHFUN getMeshExporter(QString suffix); + //获取点云读入的方法 + static IMPORTMESHFUN getPclImporter(QString suffix); + //获取点云导出的方法 + static EXPORTMESHFUN getPclExporter(QString suffix); + + //注册替换方法 static void RegisterKeyWordReplacer(QString kw, REPLACEKEYWORDFUN fun); @@ -78,8 +98,13 @@ namespace IO //后缀 - 方法 static QHash _inpWriteFun; static QHash _outFileTransfer; - static QHash _inputmeshFuns; + + static QHash _inputPclFuns; // 点云 + static QHash _exportPclFuns; + + static QHash _inputmeshFuns; // 网格 static QHash _exportMeshFuns; + //关键字-替换方法 static QHash _replaceFuns; }; diff --git a/src/LAMPCAE/main.cpp b/src/LAMPCAE/main.cpp index 4620e92..e790218 100644 --- a/src/LAMPCAE/main.cpp +++ b/src/LAMPCAE/main.cpp @@ -98,14 +98,14 @@ int main(int argc, char* argv[]) // QString qUseRibbon = ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->getUseRibbon(); // bool bUseRibbon = qUseRibbon == "yes" ? true : false; - bool isRibbon = Setting::BusAPI::instance()->isUseRibbon(); + bool isRibbon = Setting::BusAPI::instance()->isUseRibbon(); GUI::MainWindow mainwindow(isRibbon); /******************************************************************************/ XBeautyUI::instance()->setQssFilePath(":/Beauty/QUI/beauty/qianfan.qss"); XBeautyUI::instance()->autoSetStyle(); - QString qssFileName = XBeautyUI::instance()->qssFilePath(); + QString qssFileName = XBeautyUI::instance()->qssFilePath(); // 样式文件 //**************加载qss****************** QFile qssFile(qssFileName); @@ -117,7 +117,7 @@ int main(int argc, char* argv[]) } //***************************************** - //***************正版验证****************** + //***************正版验证 后期交付时再开启****************** #ifdef Q_OS_WIN // Confirmation confirm; // confirm.setParent(&mainwindow); diff --git a/src/LAMPTool/CMakeLists.txt b/src/LAMPTool/CMakeLists.txt index fb1ba8a..5a86f6a 100644 --- a/src/LAMPTool/CMakeLists.txt +++ b/src/LAMPTool/CMakeLists.txt @@ -24,9 +24,9 @@ file(GLOB_RECURSE _source "*.cpp") qt5_wrap_ui(_interface ${_ui}) #----------------------------------------------------------------------------- -# 添加动态库目标 +# 添加动态库目标 -- 这是输出lib库, #----------------------------------------------------------------------------- -add_library(LAMPTool +add_library(LAMPTool STATIC ${_resource} ${_interface} ${_header} diff --git a/src/MainWidgets/ControlPanel.cpp b/src/MainWidgets/ControlPanel.cpp index b3c192b..d244496 100644 --- a/src/MainWidgets/ControlPanel.cpp +++ b/src/MainWidgets/ControlPanel.cpp @@ -39,13 +39,13 @@ namespace MainWidget _propTable = new PropertyTable(mainwindow, this); // 属性名表 - _postTreeWidget = new Post::PostTreeWidget(mainwindow); - _postInfoWidget = new Post::PostInfoWidget(mainwindow); - _plotTreewidget = new PostPlot::PlotTreeWidget(mainwindow); + _postTreeWidget = new Post::PostTreeWidget(mainwindow); // 后处理tree页面 + _postInfoWidget = new Post::PostInfoWidget(mainwindow); // 后处理信息页面 + _plotTreewidget = new PostPlot::PlotTreeWidget(mainwindow); // 绘图界面 Init(); repaintTitleBar(); - _ui->propTabWidget->tabBar()->hide(); + _ui->propTabWidget->tabBar()->hide(); // 属性接口 MainWidgetPy::init(mainwindow, this, _geometryWidget, _meshWidget, _physicsWidget); } diff --git a/src/MainWidgets/preWindow.h b/src/MainWidgets/preWindow.h index 4434bae..a008857 100644 --- a/src/MainWidgets/preWindow.h +++ b/src/MainWidgets/preWindow.h @@ -1,4 +1,11 @@ -#ifndef PREWINDOW_H +/* + * 前处理窗口 + * 1. OCCT + * 2. mesh + * 3. pcl + * */ + +#ifndef PREWINDOW_H #define PREWINDOW_H #include "mainWidgetsAPI.h" @@ -125,8 +132,9 @@ namespace MainWidget ModelData::ModelDataSingleton *_modelData{}; int _selectedGeoIndex{-1}; - GeometryViewProvider *_geoProvider{}; - MeshViewProvider *_meshProvider{}; + GeometryViewProvider *_geoProvider{}; // occt model + MeshViewProvider *_meshProvider{}; // mesh + SketchViewProvider *_sketchProvider{}; }; } diff --git a/src/MainWindow/CustomizerHelper.cpp b/src/MainWindow/CustomizerHelper.cpp index 9f9e189..cc49707 100644 --- a/src/MainWindow/CustomizerHelper.cpp +++ b/src/MainWindow/CustomizerHelper.cpp @@ -169,6 +169,7 @@ namespace GUI { ok = geometryOption->isGeometryCreateSetEnabled(); _ui->actionCreateGeoComponent->setVisible(ok); + // 网格、点云 ok = meshOption->isImportMeshEnabled(); const QStringList plgsin = IO::IOConfigure::getMeshImporters(); this->enableMeshImport(ok || (!plgsin.isEmpty())); @@ -183,6 +184,10 @@ namespace GUI { this->enableMeshComponent(ok); ok = meshOption->getCheckMeshEnabled(); this->enableMeshCheck(ok); + + + + _ui->SetToolBar->setVisible(ok || meshOption->isComponentEnabled()); ok = meshOption->isFilterMeshEnabled(); _ui->actionFilterMesh->setVisible(ok); diff --git a/src/MainWindow/MainWindow.cpp b/src/MainWindow/MainWindow.cpp index cdc1bdc..50614cb 100644 --- a/src/MainWindow/MainWindow.cpp +++ b/src/MainWindow/MainWindow.cpp @@ -145,7 +145,7 @@ namespace GUI { _customizerHelper = new CustomizerHelper(this, _ui); _customizerHelper->registerInterface(); - _subWindowManager->openPreWindow(); // 前处理窗口展示 + _subWindowManager->openPreWindow(); // 前处理窗口展示 -- occt mesh pcl isLoadRecordScripFile(); // ribbon customize // MainWindow的构造函数最后 @@ -217,6 +217,9 @@ namespace GUI { connect(_ui->actionWorkingDir, SIGNAL(triggered()), this, SLOT(setWorkingDir())); connect(_ui->actionImportMesh, SIGNAL(triggered()), this, SLOT(on_importMesh())); connect(_ui->actionExportMesh, SIGNAL(triggered()), this, SLOT(on_exportMesh())); + connect(_ui->actionLoadPointCloud, SIGNAL(triggered()), this, SLOT(on_importPcl())); // 点云 + connect(_ui->actionSavePointCloud, SIGNAL(triggered()), this, SLOT(on_exportPcl())); + connect(_ui->actionImportGeometry, SIGNAL(triggered()), this, SLOT(on_importGeometry())); connect(_ui->actionExportGeometry, SIGNAL(triggered()), this, SLOT(on_exportGeometry())); connect(_ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow())); @@ -331,7 +334,7 @@ namespace GUI { void MainWindow::registerMoudel() { - /// 添加ProjectWindow 为controlpanel 提供窗口绑定 + /// 添加ProjectWindow 为controlpanel 提供窗口绑定 _controlPanel = new MainWidget::ControlPanel(this); _controlPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); addDockWidget(Qt::LeftDockWidgetArea, _controlPanel); @@ -620,6 +623,59 @@ namespace GUI { Py::PythonAgent::getInstance()->submit(pyCode); } + void MainWindow::on_importPcl() + { + QStringList suffixlist = IO::IOConfigure::getPclImporters(); + DebugInfo("import point cloud data file format : %s \n ",suffixlist.join(";").toUtf8().constData()); + // QStringList list = IO::IOConfigure::getMeshImporters(); + if(suffixlist.isEmpty()) { + QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !")); + return; + } + + QStringList pclsuffix = + ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix(ConfigOption::MeshDataType::PointCloud).split( + ";"); + QStringList list; + + for(QString s : pclsuffix) { + for(int i = 0; i < suffixlist.size(); i++) { + QString suffix = suffixlist.at(i); + if(suffix.contains(s)) + list.append(suffix); + } + } + + std::sort(list.begin(), list.end()); + QString suffixes = list.join(";;"); + QString senderName = sender()->objectName(); + int modelID = -1; + if(senderName.contains("Only INP_")) { + suffixes = list.at(0); + modelID = senderName.right(1).toInt(); + } + + QString workDir = Setting::BusAPI::instance()->getWorkingDir(); + QFileDialog dlg(this, tr("Import Point Cloud"), workDir, suffixes); + dlg.setAcceptMode(QFileDialog::AcceptOpen); + dlg.setFileMode(QFileDialog::ExistingFile); + if(dlg.exec() != QFileDialog::Accepted) + return; + + QString aSuffix = dlg.selectedNameFilter(); + QString fileName = dlg.selectedFiles().join(","); + if(fileName.isEmpty()) + return; + QString pyCode = QString("MainWindow.importPcl(\"%1\",\"%2\",%3)") + .arg(fileName) + .arg(aSuffix) + .arg(modelID); + Py::PythonAgent::getInstance()->submit(pyCode); + + } + + + void MainWindow::on_exportGeometry() { QString dir = Setting::BusAPI::instance()->getWorkingDir(); @@ -698,6 +754,56 @@ namespace GUI { Py::PythonAgent::getInstance()->submit(pyCode); } + void MainWindow::on_exportPcl(){ + QStringList suffixlist = IO::IOConfigure::getPclExporters(); + if(suffixlist.isEmpty()) { + QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !")); + return; + } + + if(MeshData::MeshData::getInstance()->getKernalCount() == 0) { + QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!")); + return; + } + + QStringList meshsuffix = + ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix(ConfigOption::MeshDataType::PointCloud).split( + ";"); + QStringList list; + + for(QString s : meshsuffix) { + for(int i = 0; i < suffixlist.size(); i++) { + QString suffix = suffixlist.at(i); + if(suffix.contains(s)) + list.append(suffix); + } + } + + std::sort(list.begin(), list.end()); + QString suffixes = list.join(";;"); + QString senderName = sender()->objectName(); + int modelID = -1; + if(senderName.contains("Only INP_")) { + suffixes = list.at(0); + modelID = senderName.right(1).toInt(); + } + QString workDir = Setting::BusAPI::instance()->getWorkingDir(); + QFileDialog dlg(this, tr("Export Pcl"), workDir, suffixes); + dlg.setAcceptMode(QFileDialog::AcceptSave); + if(dlg.exec() != QFileDialog::FileName) + return; + + QString aSuffix = dlg.selectedNameFilter(); + QString aFileName = dlg.selectedFiles().join(","); + if(aFileName.isEmpty()) + return; + QString pyCode = QString("MainWindow.exportPcl(\"%1\",\"%2\",%3)") + .arg(aFileName) + .arg(aSuffix) + .arg(modelID); + Py::PythonAgent::getInstance()->submit(pyCode); + } + // void MainWindow::importMesh(QString fileName ,QString suffix, int modelId) // { // _signalHandler->importMesh(fileName, suffix, modelId); diff --git a/src/MainWindow/MainWindow.h b/src/MainWindow/MainWindow.h index 459ebec..529f789 100644 --- a/src/MainWindow/MainWindow.h +++ b/src/MainWindow/MainWindow.h @@ -350,11 +350,18 @@ namespace GUI { void on_actionSaveAs(); /// 导入网格 void on_importMesh(); + /// 导入点云 + void on_importPcl(); + + // 导入网格 void importMeshDataset(vtkDataSet* dataset); // 导出网格 void on_exportMesh(); + // 导出点云 + void on_exportPcl(); + /// 设置工作目录 void setWorkingDir(); /// 启动求解器 diff --git a/src/MainWindow/MainWindowPy.cpp b/src/MainWindow/MainWindowPy.cpp index 4a65296..f7ab211 100644 --- a/src/MainWindow/MainWindowPy.cpp +++ b/src/MainWindow/MainWindowPy.cpp @@ -76,6 +76,18 @@ namespace GUI { emit _signalHander->exportMeshPySig(file, s, modelId); } + void MainWindowPy::importPcl(char* f, char* s, int modelId) { + QString file(f); + QString suffix(s); + emit _signalHander->importPclPySig(file, suffix, modelId); + } + + void MainWindowPy::exportPcl(char* f, char* s, int modelId) { + QString file(f); + QString suffix(s); + emit _signalHander->exportPclPySig(file, s, modelId); + } + void MainWindowPy::importGeometry(char* f) { QString file(f); @@ -1637,8 +1649,6 @@ namespace GUI { void MainWindowPy::createVTKTransform(const char* componentIds, const char* rotate, const char* moveLocation, const char* scale) { - - QStringList qCompontIds = QString(componentIds).split(','); QStringList qRotate = QString(rotate).split(','); QStringList qMoveLocation = QString(moveLocation).split(','); @@ -1674,8 +1684,8 @@ namespace GUI { QString(meshSet->getName() + "_transform%1").arg(meshSet->getMaxID() + 1); setType = MeshData::MeshSet::setTypeToString(meshSet->getSetType()); ids.append(QString::number(meshKernal->getID()) + ":"); - emit _pyAgent->printInfo(Common::Message::Normal, "check setType = "+setType); - int nCount = 0; + emit _pyAgent->printInfo(Common::Message::Normal, "check setType = " + setType); + int nCount = 0; if(setType == "Node") nCount = transformed->GetNumberOfPoints(); else if(setType == "Element") @@ -2351,3 +2361,11 @@ void MAINWINDOWAPI deleteGeometry(int id) { GUI::MainWindowPy::deleteGeometry(id); } +void MAINWINDOWAPI importPcl(char* f, char* s, int modelId) +{ + GUI::MainWindowPy::importPcl(f, s, modelId); +} +void MAINWINDOWAPI exportPcl(char* f, char* s, int modelId) +{ + GUI::MainWindowPy::exportPcl(f, s, modelId); +} \ No newline at end of file diff --git a/src/MainWindow/MainWindowPy.h b/src/MainWindow/MainWindowPy.h index 644bb76..a1ad144 100644 --- a/src/MainWindow/MainWindowPy.h +++ b/src/MainWindow/MainWindowPy.h @@ -23,8 +23,12 @@ namespace GUI { static void redo(); static void init(GUI::MainWindow* m, GUI::SignalHandler* sg); static void clearData(); - static void importMesh(char* f, char* s, int modelId); + static void importMesh(char* f, char* s, int modelId); // 网格 static void exportMesh(char* f, char* s, int modelId); + + static void importPcl(char* f,char* s,int modelId); // 点云 + static void exportPcl(char* f,char* s,int modelId); + static void importGeometry(char* f); static void exportGeometry(char* f); static void openProjectFile(char* f); @@ -218,8 +222,12 @@ extern "C" { void MAINWINDOWAPI undo(); void MAINWINDOWAPI redo(); void MAINWINDOWAPI clearData(); -void MAINWINDOWAPI importMesh(char* f, char* s, int modelId); +void MAINWINDOWAPI importMesh(char* f, char* s, int modelId); // 网格 void MAINWINDOWAPI exportMesh(char* f, char* s, int modelId); + +void MAINWINDOWAPI importPcl(char* f,char* s,int modelId); // 点云 +void MAINWINDOWAPI exportPcl(char* f,char* s,int modelId); + void MAINWINDOWAPI importGeometry(char* f); void MAINWINDOWAPI exportGeometry(char* f); void MAINWINDOWAPI openProjectFile(char* f); diff --git a/src/MainWindow/SignalHandler.cpp b/src/MainWindow/SignalHandler.cpp index e9ac631..9d7774f 100644 --- a/src/MainWindow/SignalHandler.cpp +++ b/src/MainWindow/SignalHandler.cpp @@ -134,6 +134,12 @@ namespace GUI { connect(this, SIGNAL(exportMeshPySig(QString, QString, int)), this, SLOT(exportMeshSlot(QString, QString, int))); + connect(this, SIGNAL(importPclPySig(QString, QString, int)), this, // 点云 + SLOT(importPclSlot(QString, QString, int))); + connect(this, SIGNAL(exportPclPySig(QString, QString, int)), this, + SLOT(exportPclSlot(QString, QString, int))); + + connect(this, SIGNAL(open3DGraphWindowPySig()), this, SLOT(open3DGraphWindowPy())); connect(this, SIGNAL(open2DPlotWindowPySig()), this, SLOT(open2DPlotWindowPy())); connect(this, SIGNAL(openProjectFileSig(QString)), this, SLOT(openProjectFile(QString))); @@ -404,6 +410,36 @@ namespace GUI { return true; } + bool SignalHandler::importPclSlot(const QString& fileName, const QString& suffix, int modelId) + { + IMPORTMESHFUN fp = IO::IOConfigure::getPclImporter(suffix); + if(!fp) { + ModuleBase::Message m; + m.type = Common::Message::Error; + m.message = QString("\"%1\" interface has not been registered !").arg(suffix); + emit _mainWindow->printMessageToMessageWindow(m); + return false; + } + fp(fileName, modelId); + return true; + } + + + bool SignalHandler::exportPclSlot(const QString& fileName, const QString& suffix, int modelId) + { + EXPORTMESHFUN fp = IO::IOConfigure::getPclExporter(suffix); + if(!fp) { + ModuleBase::Message m; + m.type = Common::Message::Error; + m.message = QString("\"%1\" interface has not been registered !").arg(suffix); + emit _mainWindow->printMessageToMessageWindow(m); + return false; + } + fp(fileName, modelId); + // MeshData::MeshData::getInstance()->generateDisplayDataSet(); + return true; + } + bool SignalHandler::importGeometry(const QStringList& filenames) { Command::GeoCommandImport* c = new Command::GeoCommandImport( @@ -1556,4 +1592,5 @@ namespace GUI { QString pycode = QString("MainWindow.openPreWindow()"); Py::PythonAgent::getInstance()->submit(pycode); } + } // namespace GUI diff --git a/src/MainWindow/SignalHandler.h b/src/MainWindow/SignalHandler.h index dd9e5ff..c8e0098 100644 --- a/src/MainWindow/SignalHandler.h +++ b/src/MainWindow/SignalHandler.h @@ -25,10 +25,15 @@ namespace GUI { ~SignalHandler(); signals: - void importMeshPySig(QString, QString, int); + void importMeshPySig(QString, QString, int); // 网格 void exportMeshPySig(QString, QString, int); + + void importPclPySig(QString, QString, int); // 点云 + void exportPclPySig(QString, QString, int); + void open3DGraphWindowPySig(); void open2DPlotWindowPySig(); + bool openProjectFileSig(QString fileName); void saveToProjectFileSig(QString fileName); void solveProjectSig(int projectIndex, int solverIndex); @@ -49,6 +54,13 @@ namespace GUI { bool importMeshSlot(const QString& fileName, const QString& suffix, int modelId); // 导出网格 bool exportMeshSlot(const QString& fileName, const QString& suffix, int modelId); + + // 导入点云 + bool importPclSlot(const QString& fileName, const QString& suffix, int modelId); + // 导出点云 + bool exportPclSlot(const QString& fileName, const QString& suffix, int modelId); + + /// 清除数据 void clearData(bool unlock = true); /*求解 */ @@ -91,7 +103,7 @@ namespace GUI { void saveImange(); bool openProjectFile(QString fileName); void projectFileProcessed(QString filename, bool success, bool read); - void saveToProjectFile(QString fileName); + void saveToProjectFile(QString fileName); // 保存工程文档 // 检查网格质量 void meshChecking(); // 显示用户引导 diff --git a/src/MainWindow/SubWindowManager.cpp b/src/MainWindow/SubWindowManager.cpp index 3b6c65f..4dcc8b2 100644 --- a/src/MainWindow/SubWindowManager.cpp +++ b/src/MainWindow/SubWindowManager.cpp @@ -49,6 +49,7 @@ namespace GUI { connect(this, SIGNAL(openPreWindowSig()), this, SLOT(openPreWindow())); } SubWindowManager::~SubWindowManager() {} + void SubWindowManager::openPreWindow() { if (isPreWindowOpened()) { @@ -56,7 +57,7 @@ namespace GUI { return; } if (_preWindow.first == nullptr || _preWindow.second == nullptr) { - _preWindow.second = new MainWidget::PreWindow(_mainWindow); + _preWindow.second = new MainWidget::PreWindow(_mainWindow); // 前处理窗口 _preWindow.first = _mdiArea->addSubWindow(_preWindow.second); _signalHander->updateActionsStates(); Command::GeometryCommandPy::init(_mainWindow, _preWindow.second); diff --git a/src/MeshData/CMakeLists.txt b/src/MeshData/CMakeLists.txt index 6e1b32e..73df5bd 100644 --- a/src/MeshData/CMakeLists.txt +++ b/src/MeshData/CMakeLists.txt @@ -1,8 +1,37 @@ +#----------------------------------------------------------------------------- +# 将点云与 mesh 表达合并,不再单独处理点云 +# 加载: 点云-> mesh +# 处理: mesh->点云-> 处理模块 -> mesh +# +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # 头文件搜索路径 #----------------------------------------------------------------------------- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + +# qt5 +include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml) + + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +# #----------------------------------------------------------------------------- # 自动添加include目录 #----------------------------------------------------------------------------- @@ -21,6 +50,37 @@ add_library(MeshData ${_header} ${_source} ) +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) +find_package(PCL ) + +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + + +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + + +#----------------------------------------------------------------------------- +# 自动添加include目录 +#----------------------------------------------------------------------------- +set(CMAKE_INCLUDE_CURRENT_DIR ON) + #----------------------------------------------------------------------------- # 添加接口声明宏 @@ -28,7 +88,7 @@ add_library(MeshData target_compile_definitions(MeshData PRIVATE "MESHDATA_API") list(APPEND _runtimes_libraries - Qt5::Widgets Qt5::Xml VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersStatistics VTK::FiltersVerdict VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ParallelCore VTK::ParallelDIY VTK::doubleconversion VTK::expat VTK::lz4 VTK::lzma VTK::sys VTK::verdict VTK::zlib + Qt5::Widgets Qt5::Xml VTK::FiltersProgrammable VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersStatistics VTK::FiltersVerdict VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ParallelCore VTK::ParallelDIY VTK::doubleconversion VTK::expat VTK::lz4 VTK::lzma VTK::sys VTK::verdict VTK::zlib ) #----------------------------------------------------------------------------- @@ -36,6 +96,8 @@ list(APPEND _runtimes_libraries #----------------------------------------------------------------------------- target_link_libraries(MeshData PRIVATE ${_runtimes_libraries} + ${_depend_library} + ${PCL_LIBRARIES} DataProperty ) diff --git a/src/MeshData/meshSingleton.h b/src/MeshData/meshSingleton.h index 32f24fa..1182053 100644 --- a/src/MeshData/meshSingleton.h +++ b/src/MeshData/meshSingleton.h @@ -70,7 +70,7 @@ namespace MeshData void writeBinaryFile(QDataStream* dataStream); ///从工程文件读入数据 void readFromProjectFile(QDomNodeList* nodelist); - //读入二进制文件 + ///读入二进制文件 void readBinaryFile(QDataStream* dataFile); ///产生全部组件的显示模型 void generateDisplayDataSet(); diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index e0e3743..7ce1cf5 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -3,10 +3,61 @@ #----------------------------------------------------------------------------- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) +# qt5 +include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml) + +## json +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json) + +## qscintilla2 +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src) +# +## lamptool +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool) +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include) +# +## qcustomplot +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot) +# +## qhexedit +#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit) + +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(SYSTEM C:/PCL/3rdParty/FLANN/include) +include_directories(SYSTEM C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(SYSTEM C:/PCL/include/pcl-1.14) + + + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +# #----------------------------------------------------------------------------- # 自动添加include目录 #----------------------------------------------------------------------------- set(CMAKE_INCLUDE_CURRENT_DIR ON) +find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) +find_package(PCL ) +find_package(Boost ) +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + #----------------------------------------------------------------------------- # 添加资源文件 @@ -31,7 +82,7 @@ add_library(ModuleBase ${_interface} ${_header} ${_source} -) +) #----------------------------------------------------------------------------- # 添加接口声明宏 @@ -43,12 +94,20 @@ list(APPEND _runtimes_libraries Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::DICOMParser VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersHybrid VTK::FiltersModeling VTK::FiltersSources VTK::FiltersStatistics VTK::GUISupportQt VTK::IOCore VTK::IOImage VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingColor VTK::ImagingCore VTK::ImagingFourier VTK::ImagingGeneral VTK::ImagingHybrid VTK::ImagingMath VTK::ImagingSources VTK::InteractionStyle VTK::InteractionWidgets VTK::ParallelCore VTK::ParallelDIY VTK::RenderingAnnotation VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::jpeg VTK::lz4 VTK::lzma VTK::metaio VTK::png VTK::pugixml VTK::sys VTK::tiff VTK::zlib ) + +#----------------------------------------------------------------------------- +# 安装Qt的依赖文件 +#----------------------------------------------------------------------------- +get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) +get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) + #----------------------------------------------------------------------------- # 链接依赖库 #----------------------------------------------------------------------------- target_link_libraries(ModuleBase PRIVATE ${_runtimes_libraries} ${_depend_library} + ${PCL_LIBRARIES} ) #----------------------------------------------------------------------------- diff --git a/src/ModuleBase/graph3DWindow.cpp b/src/ModuleBase/graph3DWindow.cpp index 62ac3bf..0e64bdc 100644 --- a/src/ModuleBase/graph3DWindow.cpp +++ b/src/ModuleBase/graph3DWindow.cpp @@ -92,6 +92,12 @@ namespace ModuleBase // _render->SetBackground(1.0, 1.0, 1.0); _interactor = _renderWindow->GetInteractor(); _renderWindow->AddRenderer(_render); + + // 原始代码因为 pcl 1.13.1 涉及的 vtk 版本废弃,参考:https://blog.csdn.net/dyk4ever/article/details/126715543 + _viewer.reset(new pcl::visualization::PCLVisualizer(_render, _renderWindow, "pclviewer", false)); + _viewer->setupInteractor(_interactor, _renderWindow); + _viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 3); // 初始化为点云颜色 + if (_graphWindowType == PreWindows) { PropPickerInteractionStyle *style = PropPickerInteractionStyle::New(); @@ -118,6 +124,10 @@ namespace ModuleBase connect(style, SIGNAL(grabKeyBoard(bool)), this, SLOT(enableKeyBoard(bool))); connect(style, SIGNAL(mouseWhellMove()), this, SLOT(mouseWheelMove())); connect(style, SIGNAL(rightDownMenu()), this, SIGNAL(rightDownMenuSig())); + + // pointcloud + + } initAxes(); updateGraphOption(); @@ -216,6 +226,7 @@ namespace ModuleBase _renderWindow->Render(); } } + void Graph3DWindow::RemoveActor(vtkProp *actor) { if (nullptr != _render && nullptr != actor) diff --git a/src/ModuleBase/graph3DWindow.h b/src/ModuleBase/graph3DWindow.h index cca1cd7..20b9634 100644 --- a/src/ModuleBase/graph3DWindow.h +++ b/src/ModuleBase/graph3DWindow.h @@ -10,6 +10,112 @@ #include #include + +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + + + + + VTK_MODULE_INIT(vtkRenderingOpenGL2); VTK_MODULE_INIT(vtkInteractionStyle); VTK_MODULE_INIT(vtkRenderingFreeType); @@ -157,6 +263,11 @@ namespace ModuleBase PropPickerInteractionStyle* _interactionStyle{}; SelectModel _selectModel{ None }; + /*** 点云处理***/ + pcl::visualization::PCLVisualizer::Ptr _viewer; // 点云显示共享指针 + + + }; } diff --git a/src/PluginCustomizer/DataManager.cpp b/src/PluginCustomizer/DataManager.cpp index 1e07a32..2c94a5b 100644 --- a/src/PluginCustomizer/DataManager.cpp +++ b/src/PluginCustomizer/DataManager.cpp @@ -411,7 +411,7 @@ namespace LAMPCAEDesigner return true; } - //读取mesh相馆信息 + //读取mesh信息 bool DataManager::ReadMeshConfig() { ConfigOption::MeshConfig* meshConfig = ConfigOption::ConfigOption::getInstance()->getMeshConfig(); @@ -428,6 +428,11 @@ namespace LAMPCAEDesigner //_meshConfig->enableExportMesh(meshConfig->isExportMeshEnabled()); _exportMeshSuffix = meshConfig->getExportSuffix(); _meshConfig->setExportSuffix(meshConfig->getExportSuffix()); + _importPclSuffix=meshConfig->getImportSuffix(ConfigOption::MeshDataType::PointCloud); + _meshConfig->setImportSuffix(_importPclSuffix); + _exportPclSuffix=meshConfig->getExportSuffix(ConfigOption::MeshDataType::PointCloud); + _meshConfig->setExportSuffix(_exportPclSuffix); + // _meshConfig->enableMeshGeneration(meshConfig->isMeshGenerationEnabled()); _isSurfaceMesh = meshConfig->isSurfaceMeshEnabled(); _meshConfig->enableSurfaceMesh(meshConfig->isSurfaceMeshEnabled()); @@ -448,6 +453,8 @@ namespace LAMPCAEDesigner _isMeshModeling = meshConfig->isMeshModelingEnabled(); _meshConfig->enableMeshModeling(meshConfig->isMeshModelingEnabled()); + + return true; } @@ -849,4 +856,27 @@ namespace LAMPCAEDesigner { return _treeList; } + + QString DataManager::GetImportPclSuffix() + { + return _importPclSuffix; + } + void DataManager::SetImportPclSuffix(QString suffix) + { + if (nullptr == _meshConfig) + return; + _meshConfig->setImportSuffix(suffix,ConfigOption::MeshDataType::PointCloud); + _importPclSuffix = suffix; + } + QString DataManager::GetExportPclSuffix() + { + return _exportPclSuffix; + } + void DataManager::SetExportPclSuffix(QString suffix) + { + if (nullptr == _meshConfig) + return; + _meshConfig->setExportSuffix(suffix,ConfigOption::MeshDataType::PointCloud); + _exportPclSuffix = suffix; + } } diff --git a/src/PluginCustomizer/DataManager.h b/src/PluginCustomizer/DataManager.h index 088bdb1..c6bc98b 100644 --- a/src/PluginCustomizer/DataManager.h +++ b/src/PluginCustomizer/DataManager.h @@ -87,6 +87,9 @@ namespace LAMPCAEDesigner void setMeasureDistance(bool on); void SetImportGeometry(QString suffix); void SetExportGeometry(QString suffix); + void SetImportPclSuffix(QString suffix); + void SetExportPclSuffix(QString suffix); + void SetSurfaceMesh(bool on); void SetSolidMesh(bool on); @@ -119,6 +122,9 @@ namespace LAMPCAEDesigner QString GetExportGeometrySuffix(); QString GetImportMeshSuffix(); QString GetExportMeshSuffix(); + QString GetImportPclSuffix(); + QString GetExportPclSuffix(); + QMap DictTreeItemToModel; @@ -203,6 +209,15 @@ namespace LAMPCAEDesigner QString _exportGeoSuffix; //export geometry suffix QString _importMeshSuffix; //import mesh suffix QString _exportMeshSuffix; //export mesh suffix + QString _importPclSuffix; + + + + private: + //import point cloud suffix + QString _exportPclSuffix; //export point cloud suffix + + bool _isSurfaceMesh{ false }; //surface mesh bool _isSolidMesh{ false }; //solid mesh diff --git a/src/PluginMeshDataExchange/CMakeLists.txt b/src/PluginMeshDataExchange/CMakeLists.txt index a08f946..4bfb247 100644 --- a/src/PluginMeshDataExchange/CMakeLists.txt +++ b/src/PluginMeshDataExchange/CMakeLists.txt @@ -1,13 +1,44 @@ +#----------------------------------------------------------------------------- +# 将点云与 mesh 表达合并,不再单独处理点云 +# 加载: 点云-> mesh +# 处理: mesh->点云-> 处理模块 -> mesh +# +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # 头文件搜索路径 #----------------------------------------------------------------------------- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + +# qt5 +include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml) + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + + #----------------------------------------------------------------------------- # 自动添加include目录 #----------------------------------------------------------------------------- set(CMAKE_INCLUDE_CURRENT_DIR ON) + + + #----------------------------------------------------------------------------- # 添加资源文件 #----------------------------------------------------------------------------- @@ -33,17 +64,56 @@ add_library(PluginMeshDataExchange ${_source} ) + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) +find_package(PCL ) + +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + + +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + + + #----------------------------------------------------------------------------- # 添加接口声明宏 #----------------------------------------------------------------------------- +target_compile_definitions(PluginMeshDataExchange PRIVATE "NOMINMAX") # 禁用vc++ 中的min max 定义,避免与 pcl 的中 std::min,pcl::max 函数冲突 target_compile_definitions(PluginMeshDataExchange PRIVATE "MESHDATAEXCHANGEPLUGIN_API") -list(APPEND _depend_library PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow) +list(APPEND _depend_library + Common PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow) + + + list(APPEND _runtimes_libraries LAMPCAE::CGNS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml ) +# 添加 点云 pcl +list(APPEND _runtimes_libraries + +) + + # 添加 VTK list(APPEND _runtimes_libraries VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::DICOMParser VTK::FiltersCore VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersHybrid VTK::FiltersModeling VTK::FiltersSources VTK::IOCore VTK::IOChemistry VTK::IOGeometry VTK::IOImage VTK::IOLegacy VTK::ImagingCore VTK::ImagingSources VTK::RenderingCore VTK::RenderingLOD VTK::doubleconversion VTK::jpeg VTK::jsoncpp VTK::lz4 VTK::lzma VTK::metaio VTK::png VTK::pugixml VTK::sys VTK::tiff VTK::zlib @@ -55,6 +125,7 @@ list(APPEND _runtimes_libraries target_link_libraries(PluginMeshDataExchange PRIVATE ${_runtimes_libraries} ${_depend_library} + ${PCL_LIBRARIES} ) #----------------------------------------------------------------------------- diff --git a/src/PluginMeshDataExchange/MeshThreadBase.cpp b/src/PluginMeshDataExchange/MeshThreadBase.cpp index 081c229..5271514 100644 --- a/src/PluginMeshDataExchange/MeshThreadBase.cpp +++ b/src/PluginMeshDataExchange/MeshThreadBase.cpp @@ -5,6 +5,7 @@ #include "MeshData/meshSingleton.h" #include "MeshData/meshKernal.h" #include "Common/Types.h" +#include "Common/DebugLogger.h" namespace MeshData { diff --git a/src/PluginMeshDataExchange/PDBdataExchange.h b/src/PluginMeshDataExchange/PDBdataExchange.h index eca1526..50b0655 100644 --- a/src/PluginMeshDataExchange/PDBdataExchange.h +++ b/src/PluginMeshDataExchange/PDBdataExchange.h @@ -7,38 +7,35 @@ class vtkUnstructuredGrid; -namespace MeshData{ +namespace MeshData { class MeshData; - class MESHDATAEXCHANGEPLUGINAPI PDBdataExchange :public MeshThreadBase - { + class MESHDATAEXCHANGEPLUGINAPI PDBdataExchange : public MeshThreadBase { public: - PDBdataExchange(const QString &fileName, MeshOperation operation, GUI::MainWindow *mw, int modelId = -1); + PDBdataExchange(const QString& fileName, MeshOperation operation, GUI::MainWindow* mw, + int modelId = -1); ~PDBdataExchange(); void run() override; - private: + private: bool read(); bool write(); private: - QString _fileName{}; -// QTextStream* _stream{}; + QString _fileName{}; + // QTextStream* _stream{}; -// int _nodeNum{ 0 }; -// int _cellNum{ 0 }; -// - // QHash _nodeIdIndex{}; + // int _nodeNum{ 0 }; + // int _cellNum{ 0 }; + // + // QHash _nodeIdIndex{}; - MeshData* _meshData{}; - //vtkUnstructuredGrid* _gird{}; - int _modelId; + MeshData* _meshData{}; + // vtkUnstructuredGrid* _gird{}; + int _modelId; MeshOperation _operation; - }; -} +} // namespace MeshData #endif - - diff --git a/src/PluginMeshDataExchange/PointClouddataExchange.cpp b/src/PluginMeshDataExchange/PointClouddataExchange.cpp new file mode 100644 index 0000000..623b279 --- /dev/null +++ b/src/PluginMeshDataExchange/PointClouddataExchange.cpp @@ -0,0 +1,313 @@ +// +// Created by 30453 on 2024/4/1. +// + +#include "PointClouddataExchange.h" +#include "MeshData/meshSingleton.h" +#include "MeshData/meshKernal.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// debug +#include "Common/DebugLogger.h" + + +namespace MeshData { + PointClouddataExchange::PointClouddataExchange(const QString& fileName, MeshOperation operation, + GUI::MainWindow* mw, int modelId) + : MeshThreadBase(fileName, operation, mw) + , _fileName(fileName) + , _operation(operation) + , _modelId(modelId) + , _meshData(MeshData::getInstance()) + { + } + +// PCDdataExchange::~PCDdataExchange() {} + + void PointClouddataExchange::run() + { + ModuleBase::ThreadTask::run(); + bool result = false; + switch (_operation) + { + case MESH_READ: + emit showInformation(tr("Import PCD Point Cloud File From \"%1\"").arg(_fileName)); + result = read(); + setReadResult(result); + break; + case MESH_WRITE: + emit showInformation(tr("Export PCD Point Cloud File To \"%1\"").arg(_fileName)); + result = write(); + setWriteResult(result); + break; + } + defaultMeshFinished(); + } + bool PointClouddataExchange::read() + { + QFileInfo info(_fileName); + if (!info.exists()) + return false; + QString name = info.fileName(); + QString path = info.filePath(); + QString suffix = info.suffix().toLower(); + vtkDataSet *dataset = nullptr; + + if (suffix == "pcd") + { + dataset = readPCD(); + } + else if (suffix == "ply") + { + dataset = readPLY(); + } + else if (suffix == "xyz") + { + dataset = readXYZ(); + } + if (dataset != nullptr) + { + MeshKernal *k = new MeshKernal; + k->setName(name); + k->setPath(path); + + int nKernal = _meshData->getKernalCount(); + for (int iKernal = 0; iKernal < nKernal; ++iKernal) + { + if (!_threadRuning) + return false; + MeshKernal *temp = _meshData->getKernalAt(iKernal); + if (temp->getPath() == path) + { ///< MG same file update + _meshData->removeKernalAt(iKernal); + break; + } + } + + k->setMeshData(dataset); + _meshData->appendMeshKernal(k); + return true; + } + return false; + } + bool PointClouddataExchange::write() + { + QFileInfo info(_fileName); + if (!info.exists()) + return false; + QString name = info.fileName(); + QString path = info.filePath(); + QString suffix = info.suffix().toLower(); + DebugInfo("PointClouddataExchange::writePCD FileName :%s \n",_fileName.toUtf8().constData()); + if (suffix == "pcd") + { + return writePCD(); + } + else if (suffix == "ply") + { + return writePLY(); + } + else if (suffix == "xyz") + { + return writeXYZ(); + } + return false; + } + vtkDataSet* PointClouddataExchange::readPCD() + { + if (!_threadRuning) + return nullptr; + // 打开点云数据 + + pcl::PointCloud::Ptr cloud_with_rgba(new pcl::PointCloud); + int readstate =pcl::io::loadPCDFile(_fileName.toUtf8().constData(), *cloud_with_rgba); // 读取数据 + vtkPolyData* polydata=nullptr; + polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放 + pcl::io::pointCloudTovtkPolyData(*cloud_with_rgba,polydata); + vtkDataSet* tempvtkdataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset + + return tempvtkdataset; // 默认完成 vtkpolydata --> vtkdataset + } + vtkDataSet* PointClouddataExchange::readPLY() + { + + if (!_threadRuning) + return nullptr; + // 打开点云数据 + + pcl::PointCloud::Ptr cloud_with_rgba(new pcl::PointCloud); + int readstate =pcl::io::loadPLYFile(_fileName.toUtf8().constData(), *cloud_with_rgba); // 读取数据 + vtkPolyData* polydata=nullptr; + polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放 + pcl::io::pointCloudTovtkPolyData(*cloud_with_rgba,polydata); + vtkDataSet* tempvtkdataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset + + return tempvtkdataset; // 默认完成 vtkpolydata --> vtkdataset + + } + vtkDataSet* PointClouddataExchange::readXYZ() + { + if (!_threadRuning) + return nullptr; + // 1. 打开文件 + QString filePathWithName = _fileName; + QFile file(filePathWithName); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + return nullptr; + } + + // 2. 读取文件内容 + QTextStream in(&file); + int pointcount = 0; + QStringList templist; + pcl::PointCloud::Ptr cloud_with_rgba(new pcl::PointCloud); + // 3. 处理每一行数据 + while (!in.atEnd()) { + QString line = in.readLine(); + templist = line.split(' '); + + // 4. 处理分割得到的数据 + if (templist.size() >= 3) { + // 开始相关的点云存储设置 + double x = templist[0].toDouble() / 100.0; + double y = templist[1].toDouble() / 100.0; + double z = templist[2].toDouble() / 100.0; + + pcl::PointXYZRGBA p; + p.x = templist[0].toDouble() / 100.0; + p.y = templist[1].toDouble() / 100.0; + p.z = templist[2].toDouble() / 100.0;//坐标 + cloud_with_rgba->points.push_back(p); + + } + } + + // 5. 关闭文件 + file.close(); + cloud_with_rgba->is_dense = false; + vtkPolyData* polydata=nullptr; + polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放 + pcl::io::pointCloudTovtkPolyData(*cloud_with_rgba,polydata); + vtkDataSet* tempvtkdataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset + size_t test = tempvtkdataset->GetNumberOfPoints(); + return tempvtkdataset; // 默认完成 vtkpolydata --> vtkdataset + + } + bool PointClouddataExchange::writePCD() + { + QTextCodec *codec = QTextCodec::codecForName("GB18030"); + QByteArray ba = codec->fromUnicode(_fileName); + vtkUnstructuredGrid *ungird = vtkUnstructuredGrid::New(); + vtkSmartPointer filter = vtkSmartPointer::New(); + // 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData + vtkSmartPointer geometryFilter = vtkSmartPointer::New(); + + DebugInfo("PointClouddataExchange::writePCD Filter prepare :ok \n"); + + if (_modelId > 0) + { + MeshKernal *kernal = _meshData->getKernalByID(_modelId); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + geometryFilter->AddInputData(dataset); + } + } + else + { + const int n = _meshData->getKernalCount(); + for (int i = 0; i < n; ++i) + { + if (!_threadRuning) + return false; + MeshKernal *kernal = _meshData->getKernalAt(i); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + geometryFilter->AddInputData(dataset); + } + } + } + filter->Update(); + vtkSmartPointer polyData = geometryFilter->GetOutput(); + pcl::PointCloud::Ptr cloud_with_rgba(new pcl::PointCloud); + pcl::io::vtkPolyDataToPointCloud(polyData,*cloud_with_rgba); + DebugInfo("PointClouddataExchange::writePCD writer prepare :ok \n"); + std::string outFileName=ba.data(); + pcl::io::savePCDFileBinary(outFileName,*cloud_with_rgba); + DebugInfo("PointClouddataExchange::writePCD writer over :ok \n"); + return true; + } + bool PointClouddataExchange::writePLY() + { + QTextCodec *codec = QTextCodec::codecForName("GB18030"); + QByteArray ba = codec->fromUnicode(_fileName); + vtkUnstructuredGrid *ungird = vtkUnstructuredGrid::New(); + vtkSmartPointer filter = vtkSmartPointer::New(); + // 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData + vtkSmartPointer geometryFilter = vtkSmartPointer::New(); + + + if (_modelId > 0) + { + MeshKernal *kernal = _meshData->getKernalByID(_modelId); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + geometryFilter->AddInputData(dataset); + } + } + else + { + const int n = _meshData->getKernalCount(); + for (int i = 0; i < n; ++i) + { + if (!_threadRuning) + return false; + MeshKernal *kernal = _meshData->getKernalAt(i); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + geometryFilter->AddInputData(dataset); + } + } + } + filter->Update(); + vtkSmartPointer polyData = geometryFilter->GetOutput(); + pcl::PointCloud::Ptr cloud_with_rgba(new pcl::PointCloud); + pcl::io::vtkPolyDataToPointCloud(polyData,*cloud_with_rgba); + std::string outFileName=ba.data(); + pcl::io::savePLYFileBinary(outFileName,*cloud_with_rgba); + return true; + } + bool PointClouddataExchange::writeXYZ() + { + return false; + } +} // namespace MeshData \ No newline at end of file diff --git a/src/PluginMeshDataExchange/PointClouddataExchange.h b/src/PluginMeshDataExchange/PointClouddataExchange.h new file mode 100644 index 0000000..711ead3 --- /dev/null +++ b/src/PluginMeshDataExchange/PointClouddataExchange.h @@ -0,0 +1,151 @@ +// +// Created by 30453 on 2024/4/1. +// + +#ifndef LAMPCAE_POINTCLOUDDATAEXCHANGE_H +#define LAMPCAE_POINTCLOUDDATAEXCHANGE_H + +#include "MeshThreadBase.h" +#include +#include + +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + +// Visualization Toolkit (VTK) +#include + + + + +namespace MeshData { + class MeshData; + + class MESHDATAEXCHANGEPLUGINAPI PointClouddataExchange : public MeshThreadBase + { + public: + PointClouddataExchange(const QString &fileName, MeshOperation operation, GUI::MainWindow *mw, int modelId = -1); + ~PointClouddataExchange()=default; + + void run() ; + bool read(); + bool write(); + private: + vtkDataSet* readPCD(); + vtkDataSet* readPLY(); + vtkDataSet* readXYZ(); + + bool writePCD(); + bool writePLY(); + bool writeXYZ(); + private: + QString _fileName; + MeshData* _meshData{}; + MeshOperation _operation; + int _modelId; + + }; + +} // namespace MeshData + +#endif // LAMPCAE_POINTCLOUDDATAEXCHANGE_H diff --git a/src/PluginMeshDataExchange/VTKdataExchange.cpp b/src/PluginMeshDataExchange/VTKdataExchange.cpp index e7efa5d..f8018fe 100644 --- a/src/PluginMeshDataExchange/VTKdataExchange.cpp +++ b/src/PluginMeshDataExchange/VTKdataExchange.cpp @@ -13,6 +13,8 @@ #include #include #include +#include + namespace MeshData { @@ -129,6 +131,49 @@ namespace MeshData } bool VTKdataExchange::write() + { + QFileInfo info(_fileName); + if (!info.exists()) + return false; + QString name = info.fileName(); + QString path = info.filePath(); + QString suffix = info.suffix().toLower(); + + if (suffix == "vtk") + { + return writeVTK(); + } + else if (suffix == "stl") + { + return writeSTL(); + } + else if (suffix == "dat") + { + return false; + } + return false; + } + + void VTKdataExchange::run() + { + ModuleBase::ThreadTask::run(); + bool result = false; + switch (_operation) + { + case MESH_READ: + emit showInformation(tr("Import VTK Mesh File From \"%1\"").arg(_fileName)); + result = read(); + setReadResult(result); + break; + case MESH_WRITE: + emit showInformation(tr("Export VTK Mesh File To \"%1\"").arg(_fileName)); + result = write(); + setWriteResult(result); + break; + } + defaultMeshFinished(); + } + bool VTKdataExchange::writeVTK() { QTextCodec *codec = QTextCodec::codecForName("GB18030"); QByteArray ba = codec->fromUnicode(_fileName); @@ -169,24 +214,50 @@ namespace MeshData writer->Write(); return true; } - - void VTKdataExchange::run() + bool VTKdataExchange::writeSTL() { - ModuleBase::ThreadTask::run(); - bool result = false; - switch (_operation) + QTextCodec *codec = QTextCodec::codecForName("GB18030"); + QByteArray ba = codec->fromUnicode(_fileName); + vtkUnstructuredGrid *ungird = vtkUnstructuredGrid::New(); + vtkSmartPointer filter = vtkSmartPointer::New(); + if (_modelId > 0) { - case MESH_READ: - emit showInformation(tr("Import VTK Mesh File From \"%1\"").arg(_fileName)); - result = read(); - setReadResult(result); - break; - case MESH_WRITE: - emit showInformation(tr("Export VTK Mesh File To \"%1\"").arg(_fileName)); - result = write(); - setWriteResult(result); - break; + MeshKernal *kernal = _meshData->getKernalByID(_modelId); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + filter->AddInputData(dataset); + } } - defaultMeshFinished(); + else + { + const int n = _meshData->getKernalCount(); + for (int i = 0; i < n; ++i) + { + if (!_threadRuning) + return false; + MeshKernal *kernal = _meshData->getKernalAt(i); + if (kernal != nullptr) + { + vtkDataSet *dataset = kernal->getMeshData(); + if (dataset != nullptr) + filter->AddInputData(dataset); + } + } + } + filter->Update(); + ungird->CopyStructure(filter->GetOutput()); + vtkSmartPointer writer = vtkSmartPointer::New(); + writer->SetInputData(ungird); + writer->SetFileTypeToBinary(); + writer->SetFileName(ba); + writer->Write(); + return true; + } + bool VTKdataExchange::writeTecplot() + { + + return false; } } diff --git a/src/PluginMeshDataExchange/VTKdataExchange.h b/src/PluginMeshDataExchange/VTKdataExchange.h index ed54a12..2a73c3d 100644 --- a/src/PluginMeshDataExchange/VTKdataExchange.h +++ b/src/PluginMeshDataExchange/VTKdataExchange.h @@ -29,6 +29,10 @@ namespace MeshData vtkDataSet* readSTL(); vtkDataSet* readTecplot(); + bool writeVTK(); + bool writeSTL(); + bool writeTecplot(); + private: QString _fileName; MeshData* _meshData{}; diff --git a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp index 4e176b1..9a6d86a 100644 --- a/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp +++ b/src/PluginMeshDataExchange/meshDataExchangePlugin.cpp @@ -15,6 +15,7 @@ #include "SU2dataExchange.h" #include "VTKdataExchange.h" #include "FoamDataExchange.h" +#include "PointClouddataExchange.h" #include @@ -41,6 +42,9 @@ namespace MeshData { IO::IOConfigure::RegisterMeshImporter("LS-DYNA(*.k)", KEYimportMesh); IO::IOConfigure::RegisterMeshImporter("PDB(*.pdb)", PDBimportMesh); IO::IOConfigure::RegisterMeshImporter("Patran(*.bdf)", BDFimportMesh); + IO::IOConfigure::RegisterPclImporter("VegetationPointCloud(*.xyz)", XYZimportPCL); // 点云 + IO::IOConfigure::RegisterPclImporter("Point Cloud Data(*.pcd)",PCDimportPCL); + IO::IOConfigure::RegisterPclImporter("Polygon File Format(*.ply)",PLYimportPCL); IO::IOConfigure::RegisterMeshExporter("CGNS(*.cgns)", CGNSexportMesh); IO::IOConfigure::RegisterMeshExporter("Fluent(*.msh)", MSHexportMesh); @@ -54,6 +58,10 @@ namespace MeshData { IO::IOConfigure::RegisterMeshExporter("SU2(*.su2)", SU2exportMesh); IO::IOConfigure::RegisterMeshExporter("LS-DYNA(*.key)", KEYexportMesh); IO::IOConfigure::RegisterMeshExporter("PDB(*.pdb)", PDBexportMesh); + IO::IOConfigure::RegisterPclExporter("Point Cloud Data(*.pcd)",PCDexportPCL); + IO::IOConfigure::RegisterPclExporter("vtk polygon Data(*.ply)",PLYexportPCL); + + return true; } @@ -71,6 +79,9 @@ namespace MeshData { IO::IOConfigure::RemoveMeshImporter("LS-DYNA(*.key)"); IO::IOConfigure::RemoveMeshImporter("PDB(*.pdb)"); IO::IOConfigure::RemoveMeshImporter("Patran(*.bdf)"); + IO::IOConfigure::RemovePclImporter("VegetationPointCloud(*.xyz)"); // 点云 + IO::IOConfigure::RemovePclImporter("Point Cloud Data(*.pcd)"); + IO::IOConfigure::RemovePclImporter("Polygon File Format(*.ply)"); IO::IOConfigure::RemoveMeshExporter("CGNS(*.cgns)"); IO::IOConfigure::RemoveMeshExporter("Fluent(*.msh)"); @@ -82,7 +93,10 @@ namespace MeshData { IO::IOConfigure::RemoveMeshExporter("CNTM(*.cntm)"); IO::IOConfigure::RemoveMeshExporter("SU2(*.su2)"); IO::IOConfigure::RemoveMeshExporter("LS-DYNA(*.key)"); - IO::IOConfigure::RemoveMeshExporter("PDB(*.pdb)"); + IO::IOConfigure::RemovePclExporter("PDB(*.pdb)"); + IO::IOConfigure::RemovePclExporter("vtk polygon Data(*.ply)"); + + return true; } @@ -323,3 +337,50 @@ bool MESHDATAEXCHANGEPLUGINAPI FOAMexportMesh(QString AbFileName, int id) emit tc->threadStart(); // emit MSHwriter->start(); return false; } + +bool MESHDATAEXCHANGEPLUGINAPI XYZimportPCL(QString AbFileName, int modelId) +{ + + + return false; +} + +bool MESHDATAEXCHANGEPLUGINAPI PCDimportPCL(QString AbFileName, int id) +{ + auto pcdReader = new MeshData::PointClouddataExchange( + AbFileName, MeshData::MESH_READ, MeshData::MeshDataExchangePlugin::getMWpt(), id); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pcdReader); + emit tc->threadStart(); // emit MSHwriter->start(); + return false; +} + +bool MESHDATAEXCHANGEPLUGINAPI PLYimportPCL(QString AbFileName, int modelId) +{ + + return false; +} + + +//bool MESHDATAEXCHANGEPLUGINAPI XYZexportPCL(QString AbFileName, int modelId) +//{ +// +// return false; +//} + +bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName, int modelId) +{ + auto pcdWriter = new MeshData::PointClouddataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pcdWriter); + emit tc->threadStart(); // emit MSHwriter->start(); + return false; +} + +bool MESHDATAEXCHANGEPLUGINAPI PLYexportPCL(QString AbFileName, int modelId) +{ + auto pcdWriter = new MeshData::PointClouddataExchange( + AbFileName, MeshData::MESH_WRITE, MeshData::MeshDataExchangePlugin::getMWpt(), modelId); + ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pcdWriter); + emit tc->threadStart(); // emit MSHwriter->start(); + return false; +} diff --git a/src/PluginMeshDataExchange/meshDataExchangePlugin.h b/src/PluginMeshDataExchange/meshDataExchangePlugin.h index f9cf089..d91dd74 100644 --- a/src/PluginMeshDataExchange/meshDataExchangePlugin.h +++ b/src/PluginMeshDataExchange/meshDataExchangePlugin.h @@ -57,6 +57,17 @@ extern "C" bool MESHDATAEXCHANGEPLUGINAPI AnotherSU2exportMesh(QString AbFileName, int id); bool MESHDATAEXCHANGEPLUGINAPI KEYexportMesh(QString AbFileName, int id); bool MESHDATAEXCHANGEPLUGINAPI PDBexportMesh(QString AbFileName, int id); + + // 点云模块 + bool MESHDATAEXCHANGEPLUGINAPI XYZimportPCL(QString AbFileName,int modelId); // 导入模块 + bool MESHDATAEXCHANGEPLUGINAPI PCDimportPCL(QString AbFileName,int modelId); + bool MESHDATAEXCHANGEPLUGINAPI PLYimportPCL(QString AbFileName,int modelId); + +// bool MESHDATAEXCHANGEPLUGINAPI XYZexportPCL(QString AbFileName,int modelId); // 导出模块 + bool MESHDATAEXCHANGEPLUGINAPI PCDexportPCL(QString AbFileName,int modelId); + bool MESHDATAEXCHANGEPLUGINAPI PLYexportPCL(QString AbFileName,int modelId); + + } #endif \ No newline at end of file diff --git a/src/PluginMotorBike/CMakeLists.txt b/src/PluginMotorBike/CMakeLists.txt new file mode 100644 index 0000000..5a7e8da --- /dev/null +++ b/src/PluginMotorBike/CMakeLists.txt @@ -0,0 +1,76 @@ +#----------------------------------------------------------------------------- +# 头文件搜索路径 +#----------------------------------------------------------------------------- +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +#----------------------------------------------------------------------------- +# 自动添加include目录 +#----------------------------------------------------------------------------- +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +#----------------------------------------------------------------------------- +# 源码扫描 +#----------------------------------------------------------------------------- +file(GLOB _header "*.h") +file(GLOB _source "*.cpp") +file(GLOB _ui "*.ui") +qt5_wrap_ui(_interface ${_ui}) + +#----------------------------------------------------------------------------- +# 添加动态库目标 +#----------------------------------------------------------------------------- +add_library(PluginMotorBike + ${_interface} + ${_header} + ${_source} +) + +#----------------------------------------------------------------------------- +# 添加接口声明宏 PluginMotorBike PLUGINMOTORBIKE +#----------------------------------------------------------------------------- +target_compile_definitions(PluginMotorBike PRIVATE "PLUGINMOTORBIKE_API") + +list(APPEND _depend_library + PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow) + + +list(APPEND _runtimes_libraries + Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml +) + +# 添加 VTK +list(APPEND _runtimes_libraries + VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::DICOMParser VTK::FiltersCore VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersHybrid VTK::FiltersModeling VTK::FiltersSources VTK::IOCore VTK::IOChemistry VTK::IOGeometry VTK::IOImage VTK::IOLegacy VTK::ImagingCore VTK::ImagingSources VTK::RenderingCore VTK::RenderingLOD VTK::doubleconversion VTK::jpeg VTK::jsoncpp VTK::lz4 VTK::lzma VTK::metaio VTK::png VTK::pugixml VTK::sys VTK::tiff VTK::zlib +) + +#----------------------------------------------------------------------------- +# 链接依赖库 +#----------------------------------------------------------------------------- +target_link_libraries(PluginMotorBike PRIVATE + ${_runtimes_libraries} + ${_depend_library} +) + +#----------------------------------------------------------------------------- +# 添加依赖关系 +#----------------------------------------------------------------------------- +add_dependencies(PluginMotorBike ${_depend_library}) + +#----------------------------------------------------------------------------- +# 添加运行时依赖关系 +#----------------------------------------------------------------------------- +set(LAMPCAE_PluginMotorBike_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) + + +#----------------------------------------------------------------------------- +# 设置插件的输出目录 +#----------------------------------------------------------------------------- +set_target_properties(PluginMotorBike + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY_RELEASE $/plugins + LIBRARY_OUTPUT_DIRECTORY_RELEASE $/plugins + RUNTIME_OUTPUT_DIRECTORY_RELEASE $/plugins + ARCHIVE_OUTPUT_DIRECTORY_DEBUG $/plugins + LIBRARY_OUTPUT_DIRECTORY_DEBUG $/plugins + RUNTIME_OUTPUT_DIRECTORY_DEBUG $/plugins +) \ No newline at end of file diff --git a/src/PluginMotorBike/OpenFoamPluginAPI.h b/src/PluginMotorBike/OpenFoamPluginAPI.h new file mode 100644 index 0000000..5252f47 --- /dev/null +++ b/src/PluginMotorBike/OpenFoamPluginAPI.h @@ -0,0 +1,13 @@ +#ifndef _OPENFOAMPLUGINAPI_H__ +#define _OPENFOAMPLUGINAPI_H__ + +#include + + +#if defined(PLUGINMOTORBIKE_API) +#define OPENFOAMPLUGINAPI Q_DECL_EXPORT +#else +#define OPENFOAMPLUGINAPI Q_DECL_IMPORT +#endif + +#endif diff --git a/src/PluginMotorBike/PluginOpenFoamExtend.cpp b/src/PluginMotorBike/PluginOpenFoamExtend.cpp new file mode 100644 index 0000000..7e2e505 --- /dev/null +++ b/src/PluginMotorBike/PluginOpenFoamExtend.cpp @@ -0,0 +1,463 @@ +#include "PluginOpenFoamExtend.h" +class IOConfigure; +#include +#include "mainWindow/mainWindow.h" +#include "ModelData/modelDataFactory.h" +#include "ModelData/modelDataSingleton.h" +#include "ModelData/modelDataBase.h" +#include "IO/IOConfig.h" +#include +#include +#include +#include +#include +#include +#include "meshData/meshSingleton.h" +#include "meshData/meshKernal.h" +#include +#include +#include +#include "IO/SolverIO.h" +#include +#include +namespace GUI +{ + class MainWindow; +} +namespace Plugins +{ + + PluginOpenFoamExtend::PluginOpenFoamExtend(GUI::MainWindow* m) + { + mMainWindow = m; + _describe = "OpenFoam plugin"; + } + + bool PluginOpenFoamExtend::install() + { + IO::IOConfigure::RegisterInputFile("OpenFoamRollDamp", WriteOut); + IO::IOConfigure::RegisterOutputTransfer("OpenFoamFileTrans", transfer); + + return true; + } + + bool PluginOpenFoamExtend::uninstall() + { + IO::IOConfigure::RemoveInputFile("OpenFoamRollDamp"); + IO::IOConfigure::RemoveInputFile("OpenFoamFileTrans"); + return true; + } + + GUI::MainWindow* PluginOpenFoamExtend::getMainWindow() + { + return mMainWindow; + } +} + +void Register(GUI::MainWindow* m, QList* ps) +{ + //Plugins::PluginOpenFoamExtend::invalue = 1; + Plugins::PluginBase* p = new Plugins::PluginOpenFoamExtend(m); + ps->append(p); +} +bool WriteOut(QString path, ModelData::ModelDataBase* d) +{ + transfer(path); + QString filename; + QString casepath; + casepath = d->getPath() + "/"; + qDebug() << d->getName(); + qDebug() << "writeTest"; + QString binpath =QCoreApplication::applicationDirPath(); + QDir dir; + QString resultpath; + resultpath = casepath + "Result/"; + if (!dir.exists(resultpath)) + { + bool res = dir.mkpath(resultpath); + } + if (!copyDirectoryFiles(binpath + "/../solver/dictionary", casepath, true)) + { + sendMessageToConsole(QObject::tr("Copy dictionary fail,please check!")); + return false; + } + if (!writeinputText((casepath + "initparameter"),d)) + { + return false; + } + return true; +} +bool transfer(QString path) +{ + QStringList rowList; + QString sourcePath = path + "/postProcessing/cuttingPlane"; + QString destPath = path + "/Result/CuttingPlane/"; + if (!transfileToDest(sourcePath, destPath, 0)) + { + sendMessageToConsole(QStringLiteral("从PostProcessing/cuttingPlane目录复制文件到Result/cuttingPlane出错")); + return false; + } + sourcePath = path + "/postProcessing/sets/streamLines/"; + destPath = path + "/Result/StreamLines/"; + if (!transfileToDest(sourcePath, destPath,1)) + { + sendMessageToConsole(QStringLiteral("从PostProcessing/sets/streamLines目录复制文件到Result/cuttingPlane出错")); + return false; + } + QString fileName = path + "/postProcessing/forceCoeffs1/0/coefficient.dat"; + QFile file_y(fileName); + if (!file_y.exists()) + { + sendMessageToConsole(QStringLiteral("postProcessing/forceCoeffs1/0/目录下,不存在coefficient.dat文件转换出错")); + return false; + } + + if (!file_y.open(QIODevice::ReadOnly)) + return false; + rowList.clear(); + QString lineStr; + while (!file_y.atEnd()) + { + lineStr = file_y.readLine().trimmed(); + if (lineStr != "") + { + if (!lineStr.contains("# Time")) + { + continue; + } + lineStr = "Time Cm Cd Cl Cl(f) Cl(r)"; + rowList.append(lineStr); + break; + } + } + while (!file_y.atEnd()) + { + lineStr = file_y.readLine(); + lineStr = lineStr.replace(" ", " "); + rowList.append(lineStr); + } + QString curFileName; + curFileName = path + "/Result/coefficient.dat"; + QFile file(curFileName); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text))return false; + QTextStream stream(&file); + for (int i = 0; i < rowList.count(); i++) + { + stream << rowList.at(i) << endl; + } + return true; +} + +bool OPENFOAMPLUGINAPI copyDirectoryFiles(const QString &fromDir, const QString &toDir, bool coverFileIfExist) +{ + QDir sourceDir(fromDir); + QDir targetDir(toDir); + if (!targetDir.exists()){ /**< 如果目标目录不存在,则进行创建 */ + if (!targetDir.mkdir(targetDir.absolutePath())) + return false; + } + QFileInfoList fileInfoList = sourceDir.entryInfoList(); + foreach(QFileInfo fileInfo, fileInfoList){ + if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") + continue; + if (fileInfo.isDir()) + { /**< 当为目录时,递归的进行copy */ + if (!copyDirectoryFiles(fileInfo.filePath(), + targetDir.filePath(fileInfo.fileName()), coverFileIfExist)) + return false; + } + else{ /**< 当允许覆盖操作时,将旧文件进行删除操作 */ + + if (coverFileIfExist && targetDir.exists(fileInfo.fileName())){ + targetDir.remove(fileInfo.fileName()); + } + /// 进行文件copy + if (!QFile::copy(fileInfo.filePath(), + targetDir.filePath(fileInfo.fileName()))){ + return false; + } + } + + } + return true; +} + + +void OPENFOAMPLUGINAPI sendMessageToConsole(QString hintInfo) +{ + GUI::MainWindow* mainwindow=nullptr; + mainwindow = Plugins::PluginOpenFoamExtend::getMainWindow(); + if (mainwindow == nullptr) return; + ModuleBase::Message message; + message.type = Common::Message::Warning; + message.message = hintInfo; + emit mainwindow->printMessageToMessageWindow(message); +} + +bool OPENFOAMPLUGINAPI writeinputText(QString filename, ModelData::ModelDataBase*d) +{ + + QString splitchar = " "; + QString paravalue; + QStringList list; + QString startTime; + QString endTime; + + paravalue = getParameterValue(QStringLiteral("开始步"), d); + + list.append(QStringLiteral("starttime%1%2").arg(splitchar).arg(paravalue)); + paravalue = getParameterValue(QStringLiteral("结束步"), d); + list.append(QStringLiteral("endtime%1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("求解器名称"), d); + list.append(QStringLiteral("application%1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("文件生成间隔"), d); + list.append(QStringLiteral("writeInterval%1%2").arg(splitchar).arg(paravalue)); + + //blockmesh + + DataProperty::ParameterTable* pNx = getParameterTable(QStringLiteral("各方向网格数量"), d); + if (pNx != nullptr) + { + if (pNx->getRowCount() > 0 && pNx->getColumnCount() > 2) + { + list.append(QStringLiteral("xgridnumber%1%2").arg(splitchar).arg(pNx->getValue(0, 0))); + list.append(QStringLiteral("ygridnumber%1%2").arg(splitchar).arg(pNx->getValue(0, 1))); + list.append(QStringLiteral("zgridnumber%1%2").arg(splitchar).arg(pNx->getValue(0, 2))); + } + + } + int rowcount; + DataProperty::ParameterTable* pNy = getParameterTable(QStringLiteral("顶点坐标"), d); + if (pNy != nullptr) + { + rowcount = pNy->getRowCount(); + for (int i = 0; i < rowcount; i++) + { + double x, y, z; + x = pNy->getValue(i, 0); + y = pNy->getValue(i, 1); + z = pNy->getValue(i, 2); + list.append(QStringLiteral("x%1%2%3").arg(i + 1).arg(splitchar).arg(x)); + list.append(QStringLiteral("y%1%2%3").arg(i + 1).arg(splitchar).arg(y)); + list.append(QStringLiteral("z%1%2%3").arg(i + 1).arg(splitchar).arg(z)); + } + } + + + //decomposepardict + + DataProperty::ParameterTable* px = getParameterTable(QStringLiteral("各方向分解数量"), d); + if (px != nullptr) + { + if (px->getColumnCount()> 2&&px->getRowCount()>0) + { + list.append(QStringLiteral("nx%1%2").arg(splitchar).arg(px->getValue(0, 0))); + list.append(QStringLiteral("ny%1%2").arg(splitchar).arg(px->getValue(0, 1))); + list.append(QStringLiteral("nz%1%2").arg(splitchar).arg(px->getValue(0, 2))); + } + + } + paravalue = getParameterValue(QStringLiteral("分解域的总数"), d); + list.append(QStringLiteral("core%1%2").arg(splitchar).arg(paravalue)); + + DataProperty::ParameterSelectable *pMethod = getParameterSelectable(QStringLiteral("分解方法"), d); + if (pMethod != nullptr) + { + int index = pMethod->getCurrentIndex(); + QString methodstr; + if (index == 0) + { + methodstr = "hierarchical"; + } + else + { + methodstr = "ptscotch"; + } + list.append(QStringLiteral("decomposemethod%1%2").arg(splitchar).arg(methodstr)); + } + + //snappyHexMeshDict: + paravalue = getParameterValue(QStringLiteral("是否切割网格"), d); + + list.append(QStringLiteral("castellatedMesh%1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("是否进行网格贴合"), d); + + list.append(QStringLiteral("snap%1%2").arg(splitchar).arg(paravalue)); + + + paravalue = getParameterValue(QStringLiteral("添加网格边界层"), d); + + list.append(QStringLiteral("addLayers %1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("最小表面细化等级"), d); + + list.append(QStringLiteral("minlevel%1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("最大表面细化等级"), d); + + list.append(QStringLiteral("maxlevel%1%2").arg(splitchar).arg(paravalue)); + + paravalue = getParameterValue(QStringLiteral("边界层添加迭代数"), d); + + list.append(QStringLiteral("nLayerIter%1%2").arg(splitchar).arg(paravalue)); + + //controldict + + + QFile file(filename); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text))return false; + QTextStream stream(&file); + for (int i = 0; i < list.count(); i++) + { + stream << list.at(i)+";" << endl; + } + return true; +} + +QString getParameterValue(QString paraname, ModelData::ModelDataBase*d) +{ + QString t; + DataProperty::ParameterBase* p = d->getParameterByName(paraname); + if (p != nullptr) + { + if (p->getParaType() == DataProperty::Para_String) + { + t= p->valueToString(); + } + else if (p->getParaType() == DataProperty::Para_Int) + { + DataProperty::ParameterInt* pInt=(DataProperty::ParameterInt*)(p); + t = QString("%1").arg(pInt->getValue()); + } + else if (p->getParaType() == DataProperty::Para_Double) + { + DataProperty::ParameterDouble* pDouble = (DataProperty::ParameterDouble*)(p); + t = QString("%1").arg(pDouble->getValue()); + } + else if (p->getParaType() == DataProperty::Para_Bool) + { + DataProperty::ParameterBool* pBool = (DataProperty::ParameterBool*)(p); + return pBool->valueToString(); + if (pBool->getValue()) + { + t = QString("%1").arg("true"); + } + else + { + t = QString("%1").arg("false"); + } + + } + return t; + } + else + { + return "0.0000"; + } +} + +DataProperty::ParameterTable* getParameterTable(QString paraname, ModelData::ModelDataBase*d) +{ + DataProperty::ParameterTable* result = nullptr; + DataProperty::ParameterBase* p = d->getParameterByName(paraname); + if (p != nullptr) + { + if (p->getParaType() == DataProperty::Para_Table) + { + result = (DataProperty::ParameterTable*)(p); + } + } + return result; +} + +DataProperty::ParameterSelectable* getParameterSelectable(QString paraname, ModelData::ModelDataBase* d) +{ + DataProperty::ParameterSelectable* result = nullptr; + DataProperty::ParameterBase* p = d->getParameterByName(paraname); + if (p != nullptr) + { + if (p->getParaType() == DataProperty::Para_Selectable) + { + result = (DataProperty::ParameterSelectable*)(p); + } + } + return result; +} + +void showmsg(QString inputtext) +{ + QMessageBox msgBox; + msgBox.setText(inputtext); + msgBox.exec(); +} + +bool OPENFOAMPLUGINAPI transfileToDest(const QString &fromDir, const QString &toDir, int type) +{ + int i = 0; + QStringList dirlist; + QDir sourceDir(fromDir); + sourceDir.setFilter(QDir::Dirs); + sourceDir.setSorting(QDir::Name); + QDir targetDir(toDir); + if (!targetDir.exists()){ /**< 如果目标目录不存在,则进行创建 */ + if (!targetDir.mkdir(targetDir.absolutePath())) + return false; + } + + QString destFileName; + QFileInfoList fileInfoList = sourceDir.entryInfoList(); + int fileno = 0; + foreach(QFileInfo fileInfo, fileInfoList) + { + if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") + continue; + QString dirname = fileInfo.filePath(); + if (fileInfo.isDir()) + { + QDir fileDir(fileInfo.filePath()); + + fileDir.setFilter(QDir::Files); + + QFileInfoList fileList = fileDir.entryInfoList(); + + destFileName = ""; + + for (int j = 0; j < fileList.count(); j++) + { + if (fileList.at(j).fileName() == "." || fileList.at(j).fileName() == "..") continue; + if (type == 0) + { + if (fileList.at(j).fileName().contains("p_y")) + { + destFileName = QString("%1%2%3%4").arg(toDir).arg("p").arg(fileno).arg(".vtk"); + fileno++; + } + } + else + { + if (fileList.at(j).fileName().contains("track0_p")) + { + destFileName = QString("%1%2%3%4").arg(toDir).arg("streamline").arg(fileno).arg(".vtk"); + fileno++; + } + + } + if (targetDir.exists(fileList.at(j).fileName())) + { + targetDir.remove(fileList.at(j).fileName()); + } + QString filename; + filename = fileList.at(j).filePath(); + if (!QFile::copy(fileList.at(j).filePath(), destFileName)); + { + //return false; + } + } + } + } + return true; +} + diff --git a/src/PluginMotorBike/PluginOpenFoamExtend.h b/src/PluginMotorBike/PluginOpenFoamExtend.h new file mode 100644 index 0000000..b7b18d0 --- /dev/null +++ b/src/PluginMotorBike/PluginOpenFoamExtend.h @@ -0,0 +1,86 @@ +#ifndef PLUGINOPENFOAMEXTEND_H +#define PLUGINOPENFOAMEXTEND_H + +#include "OpenFoamPluginAPI.h" +#include "PluginManager/pluginBase.h" +#include "DataProperty/modelTreeItemType.h" +#include "mainWindow/mainWindow.h" +#include "DataProperty/ParameterTable.h" +#include "DataProperty/ParameterSelectable.h" +#include "DataProperty/ParameterInt.h" +#include "DataProperty/ParameterBool.h" +#include "DataProperty/ParameterDouble.h" + +namespace IO +{ + class SolverIO; +} +class IOConfigure; +namespace ModelData +{ + class ModelDataBase; +} +namespace GUI +{ + class MainWindow; +} +namespace Plugins +{ + static GUI::MainWindow* mMainWindow; + class OPENFOAMPLUGINAPI PluginOpenFoamExtend:public PluginBase + { + Q_OBJECT + public: + PluginOpenFoamExtend(GUI::MainWindow* m); + PluginOpenFoamExtend(); + //加载插件 + bool install() override; + //卸载插件 + bool uninstall() override; + public: + static int invalue; + static GUI::MainWindow* getMainWindow(); + private: + //发送控制台消息 + void sendMessageToConsole(QString hint); + signals: + void treePrintMessageToMessageWindowSignal(ModuleBase::Message message); + }; + + + +} + + + +extern "C" +{ + void OPENFOAMPLUGINAPI Register(GUI::MainWindow*m, QList*plugs); + void showmsg(QString inputtext); + //求解器文件写出,给求解器使用 + bool OPENFOAMPLUGINAPI WriteOut(QString path, ModelData::ModelDataBase*d); + //求解完成后的文件转换 + bool OPENFOAMPLUGINAPI transfer(QString); + //复制字典文件到case目录下 + bool OPENFOAMPLUGINAPI copyDirectoryFiles(const QString &fromDir, const QString &toDir, bool coverFileIfExist); + //求解计算完成后复制后处理文件到case下目录 + bool OPENFOAMPLUGINAPI transfileToDest(const QString &fromDir, const QString &toDir, int type); + //生成脚本文件 + bool OPENFOAMPLUGINAPI writeScriptFile(QString filename, ModelData::ModelDataBase*d); + //发送消息到控制台 + void OPENFOAMPLUGINAPI sendMessageToConsole(QString hintInfo); + //生成openfoam字典里读取的文本文件 + bool OPENFOAMPLUGINAPI writeinputText(QString filename, ModelData::ModelDataBase*d); + + + QString getParameterValue(QString paraname, ModelData::ModelDataBase* d); + DataProperty::ParameterTable* getParameterTable(QString paraname, ModelData::ModelDataBase*d); + DataProperty::ParameterSelectable* getParameterSelectable(QString paraname, ModelData::ModelDataBase* d); + + + +} + + + +#endif // PLUGINOPENFOAMEXTEND_H diff --git a/src/PluginMotorBike/_Create_Project.bat b/src/PluginMotorBike/_Create_Project.bat new file mode 100644 index 0000000..afb3dfe --- /dev/null +++ b/src/PluginMotorBike/_Create_Project.bat @@ -0,0 +1,7 @@ +call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat" + +SET "PATH=C:\Qt\Qt5.4.2\5.4\msvc2013_64_opengl\bin;%PATH%" + +qmake CONFIG+=X64 -tp vc PluginMotorBike.pro + +pause diff --git a/src/PluginMotorBike/_Create_project.sh b/src/PluginMotorBike/_Create_project.sh new file mode 100644 index 0000000..02961f3 --- /dev/null +++ b/src/PluginMotorBike/_Create_project.sh @@ -0,0 +1,3 @@ +export PATH=/opt/Qt5.4.2/5.4/gcc_64/bin/:$PATH + +qmake -o Makefile PluginMotorBike.pro diff --git a/src/PointCloudData/CMakeLists.txt b/src/PointCloudData/CMakeLists.txt new file mode 100644 index 0000000..da85e15 --- /dev/null +++ b/src/PointCloudData/CMakeLists.txt @@ -0,0 +1,161 @@ +#----------------------------------------------------------------------------- +# 将点云与 mesh 表达合并,不再单独处理点云 +# 加载: 点云-> mesh +# 处理: mesh->点云-> 处理模块 -> mesh +# +#----------------------------------------------------------------------------- + + +#----------------------------------------------------------------------------- +# 头文件搜索路径 +#----------------------------------------------------------------------------- +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + +# qt5 +include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml) + +# json +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json) + +# qscintilla2 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src) + +# lamptool +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include) + +# qcustomplot +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot) + +# qhexedit +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit) + +# 内部结构 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/SqliteDBProcess/src) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/modelProcess) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/EchoShowProcess) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/OCCViewer) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/PointCloudProcess) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/SharedModuleLib) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/TableProcess) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../WBCLFZSystemModule/TaskXml) + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +# + +#----------------------------------------------------------------------------- +# 自动添加include目录 +#----------------------------------------------------------------------------- +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +#----------------------------------------------------------------------------- +# 源码扫描 +#----------------------------------------------------------------------------- +file(GLOB _header "*.h") +file(GLOB _source "*.cpp") + +#----------------------------------------------------------------------------- +# 添加动态库目标 +#----------------------------------------------------------------------------- +add_library(PointCloudData + ${_header} + ${_source} +) + + +#----------------------------------------------------------------------------- +# 链接库 +#----------------------------------------------------------------------------- + +# pcl +link_directories("C:/PCL/3rdParty/FLANN/lib") +link_directories("C:/VTK/lib") +link_directories("C:/PCL/lib") + +find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) +find_package(PCL ) + +# boost +include_directories(D:/vcpkg/installed/x64-windows/include) + +# pcl +include_directories(C:/PCL/3rdParty/FLANN/include) +include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) +include_directories(C:/PCL/include/pcl-1.14) + + +include_directories(${PCL_INCLUDE_DIRS}) +link_directories(${PCL_LIBRARY_DIRS}) +add_definitions(${PCL_DEFINITIONS}) + + +#----------------------------------------------------------------------------- +# 自动添加include目录 +#----------------------------------------------------------------------------- +set(CMAKE_INCLUDE_CURRENT_DIR ON) + + + +#----------------------------------------------------------------------------- +# 添加接口声明宏 +#----------------------------------------------------------------------------- +target_compile_definitions(PointCloudData PRIVATE "POINTCLOUDDATA_API") + +#list(APPEND _depend_library qcustomplot LAMPTool qscintilla2 qhexedit) + + + + +list(APPEND _runtimes_libraries + Qt5::Widgets Qt5::Xml VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersStatistics VTK::FiltersVerdict VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ParallelCore VTK::ParallelDIY VTK::doubleconversion VTK::expat VTK::lz4 VTK::lzma VTK::sys VTK::verdict VTK::zlib +) + + + + +#----------------------------------------------------------------------------- +# 链接依赖库 +#----------------------------------------------------------------------------- +target_link_libraries(PointCloudData PRIVATE + ${_runtimes_libraries} + ${_depend_library} + ${PCL_LIBRARIES} + DataProperty +) + +#----------------------------------------------------------------------------- +# 添加依赖关系 +#----------------------------------------------------------------------------- +add_dependencies(PointCloudData ${_depend_library} DataProperty) + +#----------------------------------------------------------------------------- +# 添加运行时依赖关系 +#----------------------------------------------------------------------------- +set(LAMPCAE_PointCloudData_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) + + + + + + diff --git a/src/PointCloudData/PointCloudChecker.cpp b/src/PointCloudData/PointCloudChecker.cpp new file mode 100644 index 0000000..708ca4b --- /dev/null +++ b/src/PointCloudData/PointCloudChecker.cpp @@ -0,0 +1,321 @@ +#include "PointCloudChecker.h" +#include "PointCloudKernal.h" +#include "PointCloudSingleton.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PointCloudData +{ +PointCloudChecker::PointCloudChecker() +{ + _PointCloudData = PointCloudData::getInstance(); + _cellQuality = vtkSmartPointer::New(); + _qualityArray = vtkSmartPointer::New(); + _cellQuality->SetUndefinedQuality(-1e66); + _cellQuality->SetUnsupportedGeometry(-1e66); +} +PointCloudChecker::~PointCloudChecker() +{ + // const int n = _resultList.size(); + // for (int i = 0; i < n; ++i) + // { + // vtkDataSet* d = _resultList.at(i); + // d->Delete(); + // } + // _resultList.clear(); +} + +void PointCloudChecker::run() +{ + _qualityArray->SetNumberOfValues(0); + _inputCount.clear(); + _checkedCount.clear(); + // const int nc = _resultList.size(); + // for (int i = 0; i < nc; ++i) + // { + // vtkDataSet* d = _resultList.at(i); + // d->Delete(); + // } + _resultList.clear(); + + if (_measure == NONE) return; + const int n = _PointCloudData->getKernalCount(); + for (int i = 0; i < n; ++i) + { + PointCloudKernal* k = _PointCloudData->getKernalAt(i); + this->checkKernal(k); + } + _qualityArray->Modified(); + countResult(); +} + +void PointCloudChecker::setQualityMeasure(QualityMeasure m) +{ + _measure = m; + _cellQuality->SetQualityMeasure(m); +} + +void PointCloudChecker::checkKernal(PointCloudKernal* k) +{ + vtkDataSet* checkingDataset = k->getPointCloudData(); + _cellQuality->SetInputData(checkingDataset); + _cellQuality->Update(); + vtkDataSet* res = _cellQuality->GetOutput(); + + // vtkUnstructuredGrid* g = vtkUnstructuredGrid::New(); + // g->DeepCopy(res); + _resultList.append(res); + + this->collectInfo(res); + +} + +void PointCloudChecker::collectInfo(vtkDataSet* res) +{ + vtkDataArray* qua = res->GetCellData()->GetScalars("CellQuality"); + + const int n = res->GetNumberOfCells(); + + for (int i = 0; i < n; ++i) + { + vtkCell* cell = res->GetCell(i); + VTKCellType type = (VTKCellType)cell->GetCellType(); + ++_inputCount[type]; + + double q = qua->GetComponent(i, 0); + if (q > -1e65) + { + _qualityArray->InsertNextValue(q); + _checkedCount[type].append(q); + } + } +} + +QString PointCloudChecker::VTKCellTypeToString(VTKCellType type) +{ + QString stype("Undefined"); + + switch (type) + { + case VTK_VERTEX: + stype = "Vertex"; break; + case VTK_POLY_VERTEX: + stype = "PolyVertex"; break; + case VTK_LINE: + stype = "Line"; break; + case VTK_POLY_LINE: + stype = "PolyLine"; break; + case VTK_TRIANGLE: + stype = "Tri3"; break; + case VTK_TRIANGLE_STRIP: + stype = "Tri3Strip"; break; + case VTK_POLYGON: + stype = "Polygon"; break; + case VTK_PIXEL: + stype = "Pixel"; break; + case VTK_QUAD: + stype = "Quad4"; break; + case VTK_TETRA: + stype = "Tet4"; break; + case VTK_VOXEL: + stype = "Voxel"; break; + case VTK_HEXAHEDRON: + stype = "Hex8"; break; + case VTK_WEDGE: + stype = "Wedge"; break; + case VTK_PYRAMID: + stype = "Pyramid"; break; + case VTK_PENTAGONAL_PRISM: + stype = "PentaPrism"; break; + case VTK_HEXAGONAL_PRISM: + stype = "HexaPrism"; break; + + + case VTK_QUADRATIC_EDGE: + stype = "QuaEdge"; break; + case VTK_QUADRATIC_TRIANGLE: + stype = "QuaTriangle"; break; + case VTK_QUADRATIC_LINEAR_QUAD: + stype = "QuaLinearQuad"; break; + case VTK_QUADRATIC_QUAD: + stype = "QuaQuad"; break; + case VTK_BIQUADRATIC_QUAD: + stype = "BiquaQuad"; break; + case VTK_QUADRATIC_TETRA: + stype = "QuaTetra"; break; + case VTK_QUADRATIC_PYRAMID: + stype = "QuaPyramid"; break; + case VTK_QUADRATIC_HEXAHEDRON: + stype = "QuaHexa"; break; + case VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON: + stype = "BiquaQuaHexa"; break; + case VTK_TRIQUADRATIC_HEXAHEDRON: + stype = "TriquaHexa"; break; + case VTK_QUADRATIC_LINEAR_WEDGE: + stype = "QuaLinearWedge"; break; + case VTK_QUADRATIC_WEDGE: + stype = "QuaWedge"; break; + case VTK_BIQUADRATIC_QUADRATIC_WEDGE: + stype = "BiquaQuaWedge"; break; + default: + break; + } + + return stype; +} + +QList PointCloudChecker::getInputCellType() +{ + return _inputCount.keys(); +} + +int PointCloudChecker::getInputCellCount(VTKCellType type) +{ + int count = 0; + if (_inputCount.contains(type)) + count = _inputCount.value(type); + return count; +} + +int PointCloudChecker::getInputCellCount() +{ + int count = 0; + QList typelist = this->getInputCellType(); + const int n = typelist.size(); + for (int i = 0; i < n; ++i) + { + VTKCellType t = typelist.at(i); + count += this->getInputCellCount(t); + } + return count; +} + +QList PointCloudChecker::getQualityCellType() +{ + return _checkedCount.keys(); +} + +int PointCloudChecker::gettQualityCellCount(VTKCellType type) +{ + int count = 0; + if (_checkedCount.contains(type)) + count = _checkedCount.value(type).size(); + return count; +} + +int PointCloudChecker::gettQualityCellCount() +{ + int count = 0; + QList typelist = this->getQualityCellType(); + const int n = typelist.size(); + for (int i = 0; i < n; ++i) + { + VTKCellType t = typelist.at(i); + count += this->gettQualityCellCount(t); + } + return count; +} + +void PointCloudChecker::getQualityRange(double* range) +{ + _qualityArray->GetRange(range); + // range[0] = r[0]; + // range[1] = r[1]; +} + +double PointCloudChecker::getAverageQuality() +{ + const int n = _qualityArray->GetNumberOfValues(); + if (n == 0) return -1e66; + double sum = 0; + for (int i = 0; i < n; ++i) + { + sum += _qualityArray->GetValue(i); + } + return sum / n; +} + +void PointCloudChecker::countResult() +{ + _ticks.clear(); + _cellCount.clear(); + const int count = gettQualityCellCount(); + if (count == 0) return; + + double range[2]; + this->getQualityRange(range); + + if (range[1] - range[0] < 1e-8) + { + _ticks.append((range[0] + range[1]) / 2); + QList types = this->getQualityCellType(); + for (int i = 0; i < types.size(); ++i) + { + VTKCellType t = types.at(i); + int n = this->gettQualityCellCount(t); + _cellCount[t].append(n); + } + return; + } + + QList types = this->getQualityCellType(); + for (int i = 0; i < types.size(); ++i) + { + VTKCellType t = types.at(i); + //int n = this->gettQualityCellCount(t); + _cellCount[t].resize(10); + } + double ran = range[1] - range[0]; + double step = ran / 10.0; + for (int i = 0; i < 10; ++i) + _ticks.append(range[0] + step / 2 + step*i); + + for (int i = 0; i < types.size(); ++i) + { + VTKCellType t = types.at(i); + QList qual = _checkedCount[t]; + int cellcount = qual.size(); + for (int c = 0; c < cellcount; ++c) + { + double v = qual.at(c); + for (int j = 0; j < 10; ++j) + { + double ti = _ticks.at(j); + if (v >= ti - step / 2 && v < ti + step / 2) + { + ++_cellCount[t][j]; + continue; + } + } + } + + } +} + +QVector PointCloudChecker::getTicks() +{ + return _ticks; +} + +QVector PointCloudChecker::getCountList(VTKCellType t) +{ + QVector d; + if (_cellCount.contains(t)) + d = _cellCount.value(t); + return d; +} + +QList PointCloudChecker::getResultList() +{ + return _resultList; +} + + + +} diff --git a/src/PointCloudData/PointCloudChecker.h b/src/PointCloudData/PointCloudChecker.h new file mode 100644 index 0000000..def90c1 --- /dev/null +++ b/src/PointCloudData/PointCloudChecker.h @@ -0,0 +1,114 @@ +#ifndef PointCloudCHECKER_H +#define PointCloudCHECKER_H + +#include +#include "PointCloudDataAPI.h" +#include +#include +#include +#include +#include +#include + +#define BARCOUNT 10; + +class vtkDataSet; +class vtkCell; +class vtkCellQuality; +class vtkDoubleArray; + +namespace PointCloudData +{ + class PointCloudData; + class PointCloudKernal; + + enum QualityMeasure + { + NONE = 0, + AREA, + ASPECT_BETA, + ASPECT_FROBENIUS, + ASPECT_GAMMA, + ASPECT_RATIO, + COLLAPSE_RATIO, + CONDITION, + DIAGONAL, + DIMENSION, + DISTORTION, + EDGE_RATIO, + JACOBIAN, + MAX_ANGLE, + MAX_ASPECT_FROBENIUS, + MAX_EDGE_RATIO, + MED_ASPECT_FROBENIUS, + MIN_ANGLE, + NORMAL, + ODDY, + RADIUS_RATIO, + RELATIVE_SIZE_SQUARED, + SCALED_JACOBIAN, + SHAPE, + SHAPE_AND_SIZE, + SHEAR, + SHEAR_AND_SIZE, + SKEW, + STRETCH, + TAPER, + VOLUME, + WARPAGE + }; + + class POINTCLOUDDATAAPI PointCloudChecker :public QThread + { + public: + PointCloudChecker(); + ~PointCloudChecker(); + static QString VTKCellTypeToString(VTKCellType type); + + virtual void run(); + void setQualityMeasure(QualityMeasure m); + + QList getInputCellType(); + int getInputCellCount(VTKCellType type); + int getInputCellCount(); + + QList getQualityCellType(); + int gettQualityCellCount(VTKCellType type); + int gettQualityCellCount(); + + void getQualityRange(double* r); + double getAverageQuality(); + + QVector getTicks(); + QVector getCountList(VTKCellType t); + + QList getResultList(); + + private: + void checkKernal(PointCloudKernal* k); + void collectInfo(vtkDataSet* outInfo); + void countResult(); + + + private: + vtkSmartPointer _cellQuality{}; + PointCloudData* _PointCloudData{}; + QualityMeasure _measure{ NONE }; + + vtkSmartPointer _qualityArray{}; + QHash _inputCount{}; + QHash> _checkedCount{}; + QList _resultList{}; + + QVector _ticks{}; + QHash> _cellCount{}; + + + }; + + +} + + + +#endif \ No newline at end of file diff --git a/src/PointCloudData/PointCloudCommon.cpp b/src/PointCloudData/PointCloudCommon.cpp new file mode 100644 index 0000000..f6168b3 --- /dev/null +++ b/src/PointCloudData/PointCloudCommon.cpp @@ -0,0 +1,76 @@ +#include "PointCloudCommon.h" +#include + + +int VTKCellTypeToDim(int type) +{ + int dim = -1; + switch (VTKCellType(type)) + { + case VTK_EMPTY_CELL: break; + case VTK_VERTEX: + case VTK_POLY_VERTEX: dim = 0; break; + case VTK_LINE: + case VTK_POLY_LINE: dim = 1; break; + case VTK_TRIANGLE: + case VTK_TRIANGLE_STRIP: + case VTK_POLYGON: + case VTK_PIXEL: + case VTK_QUAD: dim = 2; break; + case VTK_TETRA: + case VTK_VOXEL: + case VTK_HEXAHEDRON: + case VTK_WEDGE: + case VTK_PYRAMID: + case VTK_PENTAGONAL_PRISM: + case VTK_HEXAGONAL_PRISM: dim = 3; break; + + // Quadratic, isoparametric cells + case VTK_QUADRATIC_EDGE: dim = 1; break; + case VTK_QUADRATIC_TRIANGLE: + case VTK_QUADRATIC_QUAD: + case VTK_QUADRATIC_POLYGON: dim = 2; break; + case VTK_QUADRATIC_TETRA: + case VTK_QUADRATIC_HEXAHEDRON: + case VTK_QUADRATIC_WEDGE: + case VTK_QUADRATIC_PYRAMID: dim = 3; break; + case VTK_BIQUADRATIC_QUAD: dim = 2; break; + case VTK_TRIQUADRATIC_HEXAHEDRON: dim = 3; break; + case VTK_QUADRATIC_LINEAR_QUAD: dim = 2; break; + case VTK_QUADRATIC_LINEAR_WEDGE: + case VTK_BIQUADRATIC_QUADRATIC_WEDGE: + case VTK_BIQUADRATIC_QUADRATIC_HEXAHEDRON: dim = 3; break; + case VTK_BIQUADRATIC_TRIANGLE: dim = 2; break; + + // Cubic, isoparametric cell + case VTK_CUBIC_LINE: dim = 1; break; + + // Special class of cells formed by convex group of points + case VTK_CONVEX_POINT_SET: dim = 0; break; + + // Polyhedron cell (consisting of polygonal faces) + case VTK_POLYHEDRON: dim = 2; break; + + // Higher order cells in parametric form + case VTK_PARAMETRIC_CURVE: dim = 1; break; + case VTK_PARAMETRIC_SURFACE: + case VTK_PARAMETRIC_TRI_SURFACE: + case VTK_PARAMETRIC_QUAD_SURFACE: dim = 2; break; + case VTK_PARAMETRIC_TETRA_REGION: + case VTK_PARAMETRIC_HEX_REGION: dim = 3; break; + + // Higher order cells + case VTK_HIGHER_ORDER_EDGE: dim = 1; break; + case VTK_HIGHER_ORDER_TRIANGLE: + case VTK_HIGHER_ORDER_QUAD: + case VTK_HIGHER_ORDER_POLYGON: dim = 2; break; + case VTK_HIGHER_ORDER_TETRAHEDRON: + case VTK_HIGHER_ORDER_WEDGE: + case VTK_HIGHER_ORDER_PYRAMID: + case VTK_HIGHER_ORDER_HEXAHEDRON: dim = 3; break; + + case VTK_NUMBER_OF_CELL_TYPES: dim = -1; break; + default: break; + } + return dim; +} \ No newline at end of file diff --git a/src/PointCloudData/PointCloudCommon.h b/src/PointCloudData/PointCloudCommon.h new file mode 100644 index 0000000..3402c6d --- /dev/null +++ b/src/PointCloudData/PointCloudCommon.h @@ -0,0 +1,14 @@ +#ifndef _MESHCOMMON_H_ +#define _MESHCOMMON_H_ + +#include "PointCloudDataAPI.h" +#include + +extern "C" +{ + int MESHDATAAPI VTKCellTypeToDim(int ctype); + +} + + +#endif \ No newline at end of file diff --git a/src/PointCloudData/PointCloudDataAPI.h b/src/PointCloudData/PointCloudDataAPI.h new file mode 100644 index 0000000..90e1aef --- /dev/null +++ b/src/PointCloudData/PointCloudDataAPI.h @@ -0,0 +1,13 @@ +#ifndef _POINTCLOUDDATAAPI_H_ +#define _POINTCLOUDDATAAPI_H_ + +#include + + +#if defined(POINTCLOUDDATA_API) +#define POINTCLOUDDATAAPI Q_DECL_EXPORT +#else +#define POINTCLOUDDATAAPI Q_DECL_IMPORT +#endif + +#endif diff --git a/src/PointCloudData/PointCloudFactory.cpp b/src/PointCloudData/PointCloudFactory.cpp new file mode 100644 index 0000000..f4cdc38 --- /dev/null +++ b/src/PointCloudData/PointCloudFactory.cpp @@ -0,0 +1,44 @@ +#include "PointCloudFactory.h" +#include "PointCloudSet.h" +#include "CgnsBCZone.h" +#include "CgnsFamily.h" + +namespace PointCloudData +{ + QHash PointCloudFactory::_createSetFun = QHash(); + + PointCloudData::PointCloudSet* PointCloudFactory::CreatePointCloudSet(int type) + { + SetType stype = (SetType)type; + PointCloudSet* set = nullptr; + switch (stype) + { + case PointCloudData::Node: + set = new PointCloudSet("", Node); break; + case PointCloudData::Element: + set = new PointCloudSet("", Element); break; + case PointCloudData::Family: + set = new CgnsFamily; break; + case PointCloudData::BCZone: + set = new CgnsBCZone; break; + default: + CREATEPointCloudSET fun = _createSetFun.value(type); + if (fun!= nullptr) + set = fun(type); + break; + } + return set; + + } + + void PointCloudFactory::registerFunction(int type, CREATEPointCloudSET fun) + { + _createSetFun.insert(type, fun); + } + + void PointCloudFactory::remove(int type) + { + _createSetFun.remove(type); + } + +} \ No newline at end of file diff --git a/src/PointCloudData/PointCloudFactory.h b/src/PointCloudData/PointCloudFactory.h new file mode 100644 index 0000000..d46a68b --- /dev/null +++ b/src/PointCloudData/PointCloudFactory.h @@ -0,0 +1,27 @@ +#ifndef _PointCloudFACTORY_H__ +#define _PointCloudFACTORY_H__ + +#include "PointCloudSet.h" +#include + +typedef PointCloudData::PointCloudSet* (*CREATEPointCloudSET)(int); + +namespace PointCloudData +{ + class POINTCLOUDDATAAPI PointCloudFactory + { + public: + static PointCloudSet* CreatePointCloudSet(int type); + static void registerFunction(int type, CREATEPointCloudSET fun); + static void remove(int type); + + + private: + static QHash _createSetFun; + }; + +} + + + +#endif \ No newline at end of file diff --git a/src/PointCloudData/PointCloudKernal.cpp b/src/PointCloudData/PointCloudKernal.cpp new file mode 100644 index 0000000..5352d78 --- /dev/null +++ b/src/PointCloudData/PointCloudKernal.cpp @@ -0,0 +1,263 @@ +#include "PointCloudKernal.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PointCloudData +{ + int PointCloudKernal::idOffset = 0; + int PointCloudKernal::pointIDOffset = 1; + + PointCloudKernal::PointCloudKernal() + { + idOffset++; + setID(idOffset); + _pointIDOffset = pointIDOffset; +// _PointCloud = vtkSmartPointer::New(); + _specificColor.first = false; + appendProperty(QObject::tr("Visible"), _visible); + } + + void PointCloudKernal::setPointCloudData(pcl::PointCloud::Ptr dataset) + { + _PointCloud = dataset; + _pointIDOffset = pointIDOffset; + + pointIDOffset += dataset->size(); + + appendProperty(QObject::tr("Points"), (int)dataset->size()); + } + + pcl::PointCloud::Ptr PointCloudKernal::getPointCloudData() + { + return _PointCloud; + } + + pcl::PointXYZRGBA PointCloudKernal::getPointAt(const int index) + { + return _PointCloud->at(index); + } + + bool PointCloudKernal::isVisible() + { + return _visible; + } + + void PointCloudKernal::setVisible(bool v) + { + _visible = v; + appendProperty(QObject::tr("Visible"), _visible); + } + + void PointCloudKernal::dataToStream(QDataStream* s) + { + *s << _id << _name << _PointCloud->size() ; + } + + void PointCloudKernal::setID(int id) + { + DataBase::setID(id); + if (id > idOffset) + idOffset = id; + } + + void PointCloudKernal::setPath(const QString& path) + { + _path = path; + } + + QString PointCloudKernal::getPath() + { + return _path; + } + + void PointCloudKernal::setPointIDOFfset(int offset) + { + _pointIDOffset = offset; + if (pointIDOffset < offset) + pointIDOffset = offset; + } + + + QDomElement& PointCloudKernal::writeToProjectFile(QDomDocument* doc, QDomElement* parent) + { + QDomElement kernelele = doc->createElement("PointCloudKernel"); + QDomAttr idAttr = doc->createAttribute("ID"); + idAttr.setValue(QString::number(_id)); + kernelele.setAttributeNode(idAttr); + QDomAttr visible = doc->createAttribute("Visible"); + visible.setValue("True"); + if (!_visible) visible.setValue("False"); + kernelele.setAttributeNode(visible); + QDomElement nameele = doc->createElement("Name"); + QDomText nameText = doc->createTextNode(_name); + nameele.appendChild(nameText); + kernelele.appendChild(nameele); + + if (!_path.isEmpty()) + { + QDomElement pathele = doc->createElement("Path"); + QDomText pathtext = doc->createTextNode(_path); + pathele.appendChild(pathtext); + kernelele.appendChild(pathele); + this->writePCDFile(_path); + } + + return kernelele; + } + + void PointCloudKernal::readDataFromProjectFile(QDomElement* kernelele) + { + QString sid = kernelele->attribute("ID"); + this->setID(sid.toInt()); + QString svis = kernelele->attribute("Visible"); + bool visible = true; + if (svis.toLower() == "false") visible = false; + this->setVisible(visible); + + QDomNodeList nameNodeList = kernelele->elementsByTagName("Name"); + if (nameNodeList.size() != 1) return; + QString name = nameNodeList.at(0).toElement().text(); + this->setName(name); + QDomNodeList pathList = kernelele->elementsByTagName("Path"); + if (pathList.size() > 0) + { + QString path = pathList.at(0).toElement().text(); + this->setPath(path); + this->readBinaryFile(path); + } + } + + int PointCloudKernal::getPointCount() + { + if (_PointCloud != nullptr) + + return _PointCloud->size(); + return -1; + } + + + void PointCloudKernal::resetOffset() + { + idOffset = 0; + pointIDOffset = 1; + } + + void PointCloudKernal::setDimension(int d) + { + _dimension = d; + } + + int PointCloudKernal::getDimension() + { + return _dimension; + } + + //写出二进制文件 + void PointCloudKernal::writeBinaryFile(QDataStream* dataStream){ + *dataStream << _id << _visible << _name << _path; // 保存存储文件的相对文件名 + } + + //读入二进制文件 + void PointCloudKernal::readBinaryFile(QDataStream* dataStream){ + int KernalID = 0; //KernalID + bool visible = false; + QString PointCloudName, PointCloudPath; + *dataStream >> KernalID >> visible >> PointCloudName >> PointCloudPath; + + this->setID(KernalID); + this->setVisible(visible); + this->setName(PointCloudName); + this->setPath(PointCloudPath); + this->readPCDFile(PointCloudPath); + } + + + + + void PointCloudKernal::writePCDFile(const QString& datafilepath) + { + pcl::io::savePCDFileBinary(datafilepath.toUtf8().constData(),*(this->getPointCloudData())); + } + + void PointCloudKernal::readPCDFile(const QString& dataStream) + { + // 定义点云 + pcl::PointCloud::Ptr cloud(new pcl::PointCloud); + pcl::PCLPointCloud2::Ptr cloud2(new pcl::PCLPointCloud2); + // 读取点云,失败返回-1 + if (pcl::io::loadPCDFile(dataStream.toUtf8().constData(), *cloud2) == -1) + { + PCL_ERROR("couldn't read file\n"); + }else{ + pcl::fromPCLPointCloud2(*cloud2,*cloud); + this->setPointCloudData(cloud); + this->setPath(dataStream); + } + } + + void PointCloudKernal::setPointCloudSetting(DataProperty::DataBase* data) + { + _PointCloudSetting = data; + } + + DataProperty::DataBase* PointCloudKernal::getPointCloudSetting() + { + return _PointCloudSetting; + } + + void PointCloudKernal::setSpecificColor(bool enable, QColor c) + { + _specificColor.first = enable; + _specificColor.second = c; + this->UpdatePointCloudCloudColor(); + } + + void PointCloudKernal::setSpecificColor(bool enable,std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t alpha) + { + _specificColor.first = enable; + _specificColor.second.setRedF(r); + _specificColor.second.setGreenF(g); + _specificColor.second.setBlueF(b); + _specificColor.second.setAlpha(alpha); + + this->UpdatePointCloudCloudColor(); + } + + QColor PointCloudKernal::getSpecificColor(bool &isEnable) + { + isEnable = _specificColor.first; + return _specificColor.second; + this->UpdatePointCloudCloudColor(); + } + void PointCloudKernal::UpdatePointCloudCloudColor() { + std::uint8_t r= _specificColor.second.redF(); + std::uint8_t g= _specificColor.second.greenF(); + std::uint8_t b= _specificColor.second.blueF(); + std::uint8_t a= _specificColor.second.alphaF(); + + for(std::size_t i=0;i<_PointCloud->size();i++){ + (*_PointCloud)[i].r=r; + } + for(std::size_t i=0;i<_PointCloud->size();i++){ + (*_PointCloud)[i].g=g; + } + for(std::size_t i=0;i<_PointCloud->size();i++){ + (*_PointCloud)[i].b=b; + } + for(std::size_t i=0;i<_PointCloud->size();i++){ + (*_PointCloud)[i].a=a; + } + } + +} + diff --git a/src/PointCloudData/PointCloudKernal.h b/src/PointCloudData/PointCloudKernal.h new file mode 100644 index 0000000..12ba13a --- /dev/null +++ b/src/PointCloudData/PointCloudKernal.h @@ -0,0 +1,203 @@ +/************************* +点云模块 +最终需要重新保存点云数据 + 1. 读取并解析点云文件,只限于二进制文件 + 2. 所有点云文件部件全部都是单独的文件 +*************************/ +#ifndef POINTCLOUDKERNAL_H +#define POINTCLOUDKERNAL_H + +#include "PointCloudDataAPI.h" +#include "DataProperty/DataBase.h" +#include +#include +#include +#include + +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + +// Visualization Toolkit (VTK) +#include + + +class QDataStream; + +namespace PointCloudData +{ + class POINTCLOUDDATAAPI PointCloudKernal : public DataProperty::DataBase + { + public: + PointCloudKernal(); + ~PointCloudKernal() = default; + //重置节点和单元的偏移量 + static void resetOffset(); + + void setID(int id) override; +// int getID(); +// QString getName(); +// void setName(const QString &name); + //设置点云数据 + void setPointCloudData(pcl::PointCloud::Ptr dataset); + //获取网格数据,vtk表示 + pcl::PointCloud::Ptr getPointCloudData(); + //获取节点坐标 + pcl::PointXYZRGBA getPointAt(const int index); + //是否可见 + bool isVisible(); + //设置可见状态 + void setVisible(bool v); + //获取点云数目 + int getPointCount(); + void setPath(const QString& path); + QString getPath(); + //标注维度 + void setDimension(int d); + //获取维度 + int getDimension(); + + void dataToStream(QDataStream* s) override; + //写xml + QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* ele) override; + //读xml + void readDataFromProjectFile(QDomElement* e) override; + //写出pcd 文件 + void writePCDFile(const QString& datafilepath); + //读取pcd 文件 + void readPCDFile(const QString& datafilepath); + + //写出二进制文件 + void writeBinaryFile(QDataStream* dataStream); + //读入二进制文件 + void readBinaryFile(QDataStream* dataStream); + + //设置点云属性 + void setPointCloudSetting(DataProperty::DataBase* data); + //获取点云属性 + DataProperty::DataBase* getPointCloudSetting(); + //设置特有颜色 + void setSpecificColor(bool enable ,QColor color); + void setSpecificColor(bool enable, std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t alpha= 255); + + //获取特有颜色 + QColor getSpecificColor(bool& enable); + + private: + ///设置节点ID偏移量,为读入工程文件调用, + void setPointIDOFfset(int offset); // + void UpdatePointCloudCloudColor(); + private: + bool _visible{ true }; + QString _path{}; + int _pointIDOffset{ -1 }; //起始ID,终止ID=起始ID+PointCloud.pointnum-1 + pcl::PointCloud::Ptr _PointCloud{}; // 点云实体 + int _dimension{ 3 }; + QPair _specificColor; + DataProperty::DataBase* _PointCloudSetting{};// 点云的属性 + + private: + static int idOffset; + static int pointIDOffset; // 点云id + + }; +} + +#endif \ No newline at end of file diff --git a/src/PointCloudData/PointCloudPy.cpp b/src/PointCloudData/PointCloudPy.cpp new file mode 100644 index 0000000..c69c069 --- /dev/null +++ b/src/PointCloudData/PointCloudPy.cpp @@ -0,0 +1,102 @@ +#include "PointCloudPy.h" +#include "PointCloudKernal.h" +#include "PointCloudSingleton.h" +#include "PointCloudSet.h" +#include "DataProperty/DataBase.h" + +PointCloudData::PointCloudData *md = PointCloudData::PointCloudData::getInstance(); + +POINTCLOUDDATAAPI int getPointCloudKernalCountPy() +{ + return md->getKernalCount(); +} + +POINTCLOUDDATAAPI const char* getPointCloudKernalNameByIndexPy(const int index) +{ + PointCloudData::PointCloudKernal *mk = md->getKernalAt(index); + if (!mk) return ""; + std::string cppStr = mk->getName().toStdString(); + const char* cStr = cppStr.c_str(); + char name[128] = { 0 }; + strcpy(name, cStr); + return name; +} + +POINTCLOUDDATAAPI const char* getPointCloudKernalNameByKidPy(const int kid) +{ + PointCloudData::PointCloudKernal *mk = md->getKernalByID(kid); + if (!mk) return ""; + std::string cppStr = mk->getName().toStdString(); + const char* cStr = cppStr.c_str(); + char name[128] = { 0 }; + strcpy(name, cStr); + return name; +} + +POINTCLOUDDATAAPI void removePointCloudKernalByIndexPy(const int index) +{ + md->removeKernalAt(index); +} + +POINTCLOUDDATAAPI void removePointCloudKernalByKidPy(const int kid) +{ + md->removeKernalByID(kid); +} + +POINTCLOUDDATAAPI int getPointCloudSetCountPy() +{ + return md->getPointCloudSetCount(); +} + +POINTCLOUDDATAAPI const char* getPointCloudSetNameByIndexPy(const int index) +{ + PointCloudData::PointCloudSet *ms = md->getPointCloudSetAt(index); + if (!ms) return ""; + std::string cppStr = ms->getName().toStdString(); + const char* cStr = cppStr.c_str(); + char name[128] = { 0 }; + strcpy(name, cStr); + return name; +} + +POINTCLOUDDATAAPI const char* getPointCloudSetNameBySidPy(const int sid) +{ + PointCloudData::PointCloudSet *ms = md->getPointCloudSetByID(sid); + if (!ms) return ""; + std::string cppStr = ms->getName().toStdString(); + const char* cStr = cppStr.c_str(); + char name[128] = { 0 }; + strcpy(name, cStr); + return name; +} + +POINTCLOUDDATAAPI void removePointCloudSetByIndexPy(const int index) +{ + md->removePointCloudSetAt(index); +} + +POINTCLOUDDATAAPI void clearPointCloudPy() +{ + md->clear(); +} + +POINTCLOUDDATAAPI void generatePointCloudDisplayDataSetPy() +{ + md->generateDisplayDataSet(); +} + +POINTCLOUDDATAAPI void setColor(char*lab, int id, char* color) +{ + QString slab(lab); + if (slab == "PointCloudSet") + { + PointCloudData::PointCloudSet* s = md->getPointCloudSetByID(id); + if (s == nullptr) return; + auto colorPar = s->getParameterByName("Color"); + if (colorPar == nullptr) return; + colorPar->setValueFromString(QString(color)); + } + else + { + } +} diff --git a/src/PointCloudData/PointCloudPy.h b/src/PointCloudData/PointCloudPy.h new file mode 100644 index 0000000..03a8645 --- /dev/null +++ b/src/PointCloudData/PointCloudPy.h @@ -0,0 +1,25 @@ +#ifndef _POINTCLOUDPY_H_ +#define _POINTCLOUDPY_H_ + +#include "PointCloudDataAPI.h" + +extern "C" +{ + //POINTCLOUDKernal + POINTCLOUDDATAAPI int getPointCloudKernalCountPy(); + POINTCLOUDDATAAPI const char* getPointCloudKernalNameByIndexPy(const int index); + POINTCLOUDDATAAPI const char* getPointCloudKernalNameByKidPy(const int kid); + POINTCLOUDDATAAPI void removePointCloudKernalByIndexPy(const int index); + POINTCLOUDDATAAPI void removePointCloudKernalByKidPy(const int kid); + POINTCLOUDDATAAPI void setColor(char*lab, int id, char* color); + //POINTCLOUDSet + POINTCLOUDDATAAPI int getPointCloudSetCountPy(); + POINTCLOUDDATAAPI const char* getPointCloudSetNameByIndexPy(const int index); + POINTCLOUDDATAAPI const char* getPointCloudSetNameBySidPy(const int sid); + POINTCLOUDDATAAPI void removePointCloudSetByIndexPy(const int index); + + POINTCLOUDDATAAPI void clearPointCloudPy(); + POINTCLOUDDATAAPI void generatePointCloudDisplayDataSetPy(); +} + +#endif \ No newline at end of file diff --git a/src/PointCloudData/PointCloudSet.cpp b/src/PointCloudData/PointCloudSet.cpp new file mode 100644 index 0000000..25a5e4c --- /dev/null +++ b/src/PointCloudData/PointCloudSet.cpp @@ -0,0 +1,360 @@ +#include "PointCloudSet.h" +#include "PointCloudSingleton.h" +#include "PointCloudKernal.h" +#include "DataProperty/ParameterColor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PointCloudData +{ +//int PointCloudSet::maxID = 0; + +PointCloudSet::PointCloudSet(QString name, SetType t) : ComponentBase(DataProperty::ComponentType::MESH) +{ + // maxID++; + // setID(maxID); + setName(name); + setType(t); + // _member = new SetMember; + DataProperty::ParameterColor* c = new DataProperty::ParameterColor(); + c->setDescribe("Color"); + this->setModuleType(DataProperty::Module_PointCloudSet); + this->appendParameter(c); +} + +PointCloudSet::PointCloudSet() : ComponentBase(DataProperty::ComponentType::MESH) +{ + // maxID++; + // setID(maxID); + // setName(name); + // _member = new SetMember; +} + +PointCloudSet::~PointCloudSet() +{ + // if (_member != nullptr) delete _member; + if (_displayDataSet != nullptr) _displayDataSet->Delete(); +} + +// void PointCloudSet::setID(int id) +// { +// DataBase::setID(id); +// if (maxID < id) +// maxID = id; +// } + +void PointCloudSet::setType(PointCloudSetType t) +{ + _type = t; + QString stype = "Node"; + switch (t) + { + case PointXYZRGBA: stype = "PointXYZRGBA"; break; + default: break; + } + this->appendProperty("Type", stype); +} + +PointCloudSetType PointCloudSet::getSetType() +{ + return _type; +} + +QColor PointCloudSet::getColor() +{ + DataProperty::ParameterColor* c = dynamic_cast(getParameterByName("Color")); + if (c == nullptr) return QColor(); + return c->getColor(); +} + +void PointCloudSet::appendMember(int ker, int id) +{ + // if (_members.contains(ker, id)) return; + _members.insert(ker, id); +} + +QList PointCloudSet::getKernals() +{ + return _members.uniqueKeys(); +} + +QList PointCloudSet::getKernalMembers(int k) +{ + if (_members.contains(k)) + return _members.values(k); + return QList(); +} + +int PointCloudSet::getAllCount() +{ + return _members.size(); +} + +QDomElement& PointCloudSet::writeToProjectFile(QDomDocument* doc, QDomElement* parent) +{ + QDomElement setEle = doc->createElement("PointCloudSet"); + + QDomAttr idAttr = doc->createAttribute("ID"); + idAttr.setValue(QString::number(_id)); + setEle.setAttributeNode(idAttr); + QDomAttr name = doc->createAttribute("Name"); + name.setValue(_name); + setEle.setAttributeNode(name); + QString stype = "Node"; + if (_type == Element) stype = "Element"; + QDomAttr typeAttr = doc->createAttribute("Type"); + typeAttr.setValue(stype); + setEle.setAttributeNode(typeAttr); + + QList kernalids = _members.uniqueKeys(); + for (int kid : kernalids) + { + QDomElement kele = doc->createElement("Kernal"); + kele.setAttribute("ID", kid); + QDomElement memle = doc->createElement("Member"); + QList memids = _members.values(kid); + QStringList text; + for (int id : memids) + text.append(QString::number(id)); + QDomText memText = doc->createTextNode(text.join(",")); + memle.appendChild(memText); + + kele.appendChild(memle); + setEle.appendChild(kele); + } + + parent->appendChild(setEle); + return setEle; +} + +void PointCloudSet::readDataFromProjectFile(QDomElement* setEle) +{ + QString name = setEle->attribute("Name"); + QString stype = setEle->attribute("Type"); + QString sID = setEle->attribute("ID"); + PointCloudSetType type = None; + if (stype.toLower() == "node") PointCloudSetType = Node; + else if (stype.toLower() == "element") type = Element; + this->setID(sID.toInt()); + this->setName(name); + this->setType(type); + + QDomNodeList kerList = setEle->elementsByTagName("Kernal"); + for (int i = 0; i < kerList.size(); ++i) + { + QDomElement kerele = kerList.at(i).toElement(); + QString skid = kerele.attribute("ID"); + bool ok = false; + const int kid = skid.toInt(&ok); + if (!ok) continue; + QDomNodeList memList = kerele.elementsByTagName("Member"); + for (int j = 0; j < memList.size(); ++j) + { + QDomElement memele = memList.at(j).toElement(); + QString text = memele.text(); + QStringList sids = text.split(","); + for (QString s : sids) + { + int mid = s.toInt(&ok); + if (!ok) continue; + this->appendMember(kid, mid); + } + } + } +} + +void PointCloudSet::generateDisplayDataSet() +{ + if (_displayDataSet != nullptr) return; + if (_members.isEmpty()) return; + appendProperty("Count", _members.values().size()); + + PointCloudData* meshdata = PointCloudData::getInstance(); + QList kids = _members.uniqueKeys(); + + + vtkSmartPointer appendFliter = vtkSmartPointer::New(); + for (int kid : kids) + { + QList member = _members.values(kid); + auto k = meshdata->getKernalByID(kid); + if (member.isEmpty() || k ==nullptr) continue; + vtkDataSet* dataset = k->getPointCloudData(); + if (dataset == nullptr) continue; + + vtkSmartPointer idArray = vtkSmartPointer::New(); + for (int id : member) idArray->InsertNextValue(id); + + vtkSmartPointer selectionNode = vtkSmartPointer::New(); + if (_type == Element) + { + selectionNode->SetFieldType(vtkSelectionNode::CELL); + } + else if (_type == Node) + { + selectionNode->SetFieldType(vtkSelectionNode::POINT); + } + selectionNode->SetContentType(vtkSelectionNode::INDICES); + selectionNode->SetSelectionList(idArray); + + vtkSmartPointer selection = vtkSmartPointer::New(); + selection->AddNode(selectionNode); + + vtkSmartPointer extractionSelection = vtkSmartPointer::New(); + extractionSelection->SetInputData(0, dataset); + extractionSelection->SetInputData(1, selection); + extractionSelection->Update(); + appendFliter->AddInputData(extractionSelection->GetOutput()); + } + appendFliter->Update(); + + _displayDataSet = vtkUnstructuredGrid::New(); + _displayDataSet->DeepCopy(appendFliter->GetOutput()); +} + +vtkDataSet* PointCloudSet::getDisplayDataSet() +{ + return _displayDataSet; +} + +PointCloudSetType PointCloudSet::stringToSettype(QString s) +{ + PointCloudSetType t = None; + if (s == "PointXYZRGBA") t = PointXYZRGBA; + else t=None; + return t; +} +//写set部分的二进制 +void PointCloudSet::writeBinaryFile(QDataStream* dataStream) +{ + QList kids = _members.uniqueKeys(); + const int nk = kids.size(); + *dataStream << (int)_type << _id << _name << nk; //setID,setType,setName,KernalIDs + + for (int kid : kids) + { + QList memids = _members.values(kid); + const int n = memids.size(); + *dataStream << kid << n; + for (int mem : memids) + *dataStream << mem; + } + +} +//读取set部分的二进制 +void PointCloudSet::readBinaryFile(QDataStream* dataStream) +{ + int SetID{ 0 }, nKernal{ 0 }; //, nMember{0}; //setID,KernalID,MemberNumber + QString setName; + + *dataStream >> SetID >> setName >> nKernal; + this->setID(SetID); + this->setName(setName); + + for (int nk = 0; nk < nKernal; ++nk) + { + int kid = 0, ncount = 0 , mid = 0; + *dataStream >> kid >>ncount; + for (int i = 0; i < ncount; ++i) + { + *dataStream >> mid; + appendMember(kid, mid); + } + } + +} + +void PointCloudSet::appendTempMem(int m) +{ + _tempMemberID.append(m); +} + +void PointCloudSet::setKeneralID(int id) +{ + for (int m : _tempMemberID) + this->appendMember(id, m); + _tempMemberID.clear(); +} + +bool PointCloudSet::isContainsKernal(int id) +{ + return _members.contains(id); +} + +void PointCloudSet::dataToStream(QDataStream* s) +{ + *s << _id << _name << _members.size(); +} + +void PointCloudSet::isVisible(bool v) +{ + _visible = v; +} + +bool PointCloudSet::isVisible() +{ + return _visible; +} + +void PointCloudSet::merge(PointCloudSet* set) +{ + if (set->getSetType() != _type) return; + QList ks = set->getKernals(); + for (int k : ks) + { + QList mem = set->getKernalMembers(k); + for (int m : mem) + this->appendMember(k, m); + } +} + +void PointCloudSet::cut(PointCloudSet* set) +{ + if (set->getSetType() != _type) return; + QList ks = set->getKernals(); + for (int k : ks) + { + if (!_members.contains(k)) continue; + QList mem = set->getKernalMembers(k); + for (int m : mem) + _members.remove(k, m); + } +} + +QString PointCloudSet::setTypeToString(PointCloudSetType type) +{ + QString qtype{}; + switch (type) + { + case PointXYZRGBA : qtype = "PointXYZRGBA"; break; + default : break; + } + return qtype; +} + +BoundPointCloudSet::BoundPointCloudSet(): PointCloudSet() +{ + +} + +void BoundPointCloudSet::setCellFaces(const QMap> cellFaces) +{ + m_CellFaces = cellFaces; +} + +QMap> BoundPointCloudSet::getCellFaces() +{ + return m_CellFaces; +} + +} diff --git a/src/PointCloudData/PointCloudSet.h b/src/PointCloudData/PointCloudSet.h new file mode 100644 index 0000000..90a7e61 --- /dev/null +++ b/src/PointCloudData/PointCloudSet.h @@ -0,0 +1,229 @@ +/* + * 这是点云集合,默认由 PointCloudKernal组成,其中内存的由文件组决定 + * + * */ + +#ifndef POINTCLOUDSET_H_ +#define POINTCLOUDSET_H_ + +#include "PointCloudDataAPI.h" +#include "DataProperty/ComponentBase.h" +#include +#include +#include +#include + + +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + +// Visualization Toolkit (VTK) +#include + + +namespace PointCloudData +{ + enum PointCloudSetType + { + None = 0, + PointXYZRGBA, // 表示点云类别 + UserDef = 101, + EndType = 100000, + }; + + class SetMember; + + class POINTCLOUDDATAAPI PointCloudSet : public DataProperty::ComponentBase + { + public : + //构造函数 + PointCloudSet(QString name, PointCloudSetType type); + PointCloudSet(); + ~PointCloudSet(); + //获取最大ID + //int static getMaxID(); + //重置最大ID + //void static resetMaxID(); + ///设置ID,谨慎调用 + //void setID(int id) override; + ///设置类型 + void setType(PointCloudSetType t); + ///获取类型 + PointCloudSetType getSetType(); + ///获取颜色 + QColor getColor(); + //添加成员 + void appendMember(int ker, int id); + //获取Kernal ID列表 + QList getKernals(); + //根据kernal ID获取成员 + QList getKernalMembers(int k); + //获取数量 + int getAllCount(); + //临时保存MemberID,当void setKeneralID(int id)时清空,指定为Keneral为id的的子集 + void appendTempMem(int m); + //设置Kenenal, 与 void appendTempMem(int m)配合使用 + void setKeneralID(int id); + //是否包含kernal + bool isContainsKernal(int id); + //设置可见性 + void isVisible(bool v); + //获取可见性 + bool isVisible(); + //合并组件 + void merge(PointCloudSet* set); + //减去组件 + void cut(PointCloudSet* set); + //md5 + void dataToStream(QDataStream* s) override; + //写出到XML文件 + virtual QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override; + //从XML文件读取数据 + virtual void readDataFromProjectFile(QDomElement* e) override; + //写出二进制文件 + virtual void writeBinaryFile(QDataStream* dataStream); + //读入二进制文件 + virtual void readBinaryFile(QDataStream* dataStream); + //生成可以显示的模型, 每个实例只能调用一次 + virtual void generateDisplayDataSet(); + //获取显示模型 + virtual vtkDataSet* getDisplayDataSet(); + //字符串转化为枚举 + static PointCloudSetType stringToSettype(QString s); + //枚举转字符串 + static QString setTypeToString(PointCloudSetType); + + + + protected: + PointCloudSetType _type{ None }; + bool _visible{ true }; + + QMultiHash _members{}; //keneralID - node/elementID + + QList _tempMemberID{}; + + vtkDataSet* _displayDataSet{}; + + private: + // static int maxID; + }; + + + //用于流体网格边界信息存储。边界由多个单元的一个或多个面组成。 + class POINTCLOUDDATAAPI BoundPointCloudSet : public PointCloudSet + { + public: + BoundPointCloudSet(); + ~BoundPointCloudSet() = default; + void setCellFaces(const QMap> cellFaces); + QMap> getCellFaces(); + protected: + //key为单元索引,value为该单元的面索引 + QMap> m_CellFaces{}; + + }; + + +} + + +#endif diff --git a/src/PointCloudData/PointCloudSingleton.cpp b/src/PointCloudData/PointCloudSingleton.cpp new file mode 100644 index 0000000..fedb5f1 --- /dev/null +++ b/src/PointCloudData/PointCloudSingleton.cpp @@ -0,0 +1,341 @@ +#include "PointCloudSingleton.h" +#include "PointCloudKernal.h" +#include "PointCloudSet.h" +#include "PointCloudFactory.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace PointCloudData +{ + PointCloudData* PointCloudData::_instance = nullptr; + + PointCloudData* PointCloudData::getInstance() + { + if (_instance == nullptr) + { + _instance = new PointCloudData; + } + return _instance; + } + + PointCloudData::~PointCloudData() + { + for (int i = 0; i < _pointcloudList.size(); ++i) + { + PointCloudKernal* k = _pointcloudList.at(i); + delete k; + } + _pointcloudList.clear(); + } + void PointCloudData::appendPointCloudKernal(PointCloudKernal* keneral) + { + _pointcloudList.append(keneral); + } + int PointCloudData::getKernalCount() + { + return _pointcloudList.size(); + } + PointCloudKernal* PointCloudData::getKernalAt(const int index) + { + if(index >= 0 && index < _pointcloudList.size()) + return _pointcloudList.at(index); + return nullptr; + } + PointCloudKernal* PointCloudData::getKernalByID(const int id) + { + const int n = _pointcloudList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudKernal* k = _pointcloudList.at(i); + if (k->getID() == id) + return k; + } + return nullptr; + } + void PointCloudData::removeKernalAt(const int index) + { + PointCloudKernal* k = getKernalAt(index); + + QList setlist{}; + for (int i = 0; i < _setList.size(); ++i) + { + PointCloudSet* s = _setList.at(i); +// if (s->getDataSetID() == k->getID()) + int kid = k->getID(); + if (s->isContainsKernal(kid)) + setlist.append(s); + } + for (int i = 0; i < setlist.size(); ++i) + { + PointCloudSet* s = setlist.at(i); + _setList.removeOne(s); + delete s; + } + + delete k; + _pointcloudList.removeAt(index); + } + + void PointCloudData::removeKernalByID(const int id) + { + auto k = this->getKernalByID(id); + int index = _pointcloudList.indexOf(k); + if (index < 0) return; + this->removeKernalAt(index); + } + + void PointCloudData::clear() + { + int n = this->getKernalCount(); + for (int i = 0; i < n; ++i) + { + PointCloudKernal* k = this->getKernalAt(i); + delete k; + } + _pointcloudList.clear(); + + n = _setList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudSet *s = _setList.at(i); + delete s; + } + _setList.clear(); + + PointCloudKernal::resetOffset(); + DataProperty::ComponentBase::resetMaxID(); + } + QString PointCloudData::getMD5() + { + const int n = _pointcloudList.size(); + if (n < 1) return""; + + QDataStream stream; + for (int i = 0; i < n; ++i) + { + _pointcloudList[i]->dataToStream(&stream); + } + for (auto set : _setList) + { + set->dataToStream(&stream); + } + + char* s; + stream >> s; + QString md5 = QCryptographicHash::hash(s, QCryptographicHash::Md5); + return md5; + } + QDomElement& PointCloudData::writeToProjectFile(QDomDocument* doc, QDomElement* parent) + { + QDomElement meshNode = doc->createElement("PointCloud"); + const int n = _pointcloudList.size(); + QDomElement meshKernalList = doc->createElement("Kernel"); + for (int i = 0; i < n; ++i) + { + PointCloudKernal* k = _pointcloudList.at(i); + k->writeToProjectFile(doc, &meshKernalList); + } + meshNode.appendChild(meshKernalList); + + const int nset = _setList.size(); + QDomElement setList = doc->createElement("Set"); + for (int i = 0; i < nset; ++i) + { + PointCloudSet* s = _setList.at(i); + s->writeToProjectFile(doc, &setList); + } + meshNode.appendChild(setList); + + parent->appendChild(meshNode); + return meshNode; + } + void PointCloudData::readFromProjectFile(QDomNodeList* nodelist) + { + QDomElement meshRoot = nodelist->at(0).toElement(); + QDomNodeList meshList = meshRoot.elementsByTagName("PointCloudKernel"); + const int nPointCloud = meshList.size(); + for (int i = 0; i < nPointCloud; ++i) + { + QDomElement meshKernelEle = meshList.at(i).toElement(); + { //废弃代码 + // QDomNodeList pathlist = meshKernelEle.elementsByTagName("Path"); + // if (pathlist.size() != 1) continue; + // QDomElement pathele = pathlist.at(0).toElement(); + // QString fpath = pathele.text(); + // QFileInfo finfo(fpath); + // if (!finfo.exists()) return; + // QString suffix = finfo.suffix().toLower(); + // if (suffix == "vtk" || suffix == "stl") + // { + // VTKdataExchange reader(fpath); + // if (!reader.read()) continue; + // } + // else if (suffix == "neu") + // { + // NEUdataExchange reader(fpath); + // if (!reader.read()) continue; + // } + } + PointCloudKernal* k = new PointCloudKernal; + _pointcloudList.append(k); + k->readDataFromProjectFile(&meshKernelEle); + } + QDomNodeList setList = meshRoot.elementsByTagName("PointCloudSet"); + const int nSet = setList.size(); + for (int i = 0; i < nSet; ++i) + { + PointCloudSet* s = nullptr; + QDomElement setEle = setList.at(i).toElement(); + s = new PointCloudSet; + + _setList.append(s); + s->readDataFromProjectFile(&setEle); //保存属性 +// s->generateDisplayDataSet(); + } + } + int PointCloudData::getIDByDataSet(vtkDataSet* datset) + { + const int n = _pointcloudList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudKernal* k = _pointcloudList.at(i); + vtkDataSet* s = k->getPointCloudData(); + if (s == datset) + return k->getID(); + } + return -1; + } + void PointCloudData::appendPointCloudSet(PointCloudSet* s) + { + _setList.append(s); + } + int PointCloudData::getPointCloudSetCount() + { + return _setList.size(); + } + PointCloudSet* PointCloudData::getPointCloudSetAt(const int index) + { + assert(index >= 0 && index < _setList.size()); + return _setList.at(index); + } + PointCloudSet* PointCloudData::getPointCloudSetByID(const int id) + { + const int n = _setList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudSet* set = _setList.at(i); + int sid = set->getID(); + if (sid == id) return set; + } + return nullptr; + } + PointCloudSet* PointCloudData::getPointCloudSetByName(const QString name) + { + const int n = _setList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudSet* set = _setList.at(i); + QString n = set->getName(); + if (name == n) return set; + } + return nullptr; + + } + void PointCloudData::removePointCloudSetAt(const int index) + { + assert(index >= 0 && index < _setList.size()); + PointCloudSet* s = _setList.at(index); + delete s; + _setList.removeAt(index); + } + QList PointCloudData::getSetIDFromKernal(int kid) + { + QList ids; + int n = _setList.size(); + for (int i = 0; i < n; ++i) + { + PointCloudSet* set = _setList.at(i); + //int id = set->getDataSetID(); + //if (id == kid) + if (set->isContainsKernal(kid)) + ids.append(set->getID()); + } + return ids; + } + + bool PointCloudData::isContainsKernal(PointCloudKernal* ker) + { + return _pointcloudList.contains(ker); + } + + void PointCloudData::generateDisplayDataSet() + { + const int n = this->getPointCloudSetCount(); + for (int i = 0; i < n; ++i) + { + PointCloudSet* s = this->getPointCloudSetAt(i); + s->generateDisplayDataSet(); + } + } + + void PointCloudData::writeBinaryFile(QDataStream* dataStream) + { + //写出二进制文件 + const int nk = _pointcloudList.size(); + *dataStream << nk; + for (int i = 0; i < nk; ++i) + { + PointCloudKernal* k = _pointcloudList.at(i); + k->writePCDFile(dataStream); + } + + const int ns = _setList.size(); + *dataStream << ns; + for (int i = 0; i < ns; ++i) + { + PointCloudSet* s = _setList.at(i); + s->writeBinaryFile(dataStream); + } + } + + void PointCloudData::readBinaryFile(QDataStream* dataStream) + { + //读入二进制文件 + int nk = 0; + int ns = 0; + *dataStream >> nk; + for (int i = 0; i < nk; ++i) + { + PointCloudKernal* k = new PointCloudKernal; + _pointcloudList.append(k); + k->readBinaryFile(dataStream); + } + + *dataStream >> ns; + for (int i = 0; i < ns; ++i) + { + int type = 0; + *dataStream >> type; + PointCloudSet* s = PointCloudFactory::CreatePointCloudSet(type); +// switch (type) +// { +// case 1: +// case 2: s = new PointCloudSet(QString(), SetType(type)); break; +// case 3: s = new CgnsFamily; break; +// case 4: s = new CgnsBCZone; break; +// default:break; +// } + if (s == nullptr) continue; + _setList.append(s); + s->readBinaryFile(dataStream); + } + } + + +} diff --git a/src/PointCloudData/PointCloudSingleton.h b/src/PointCloudData/PointCloudSingleton.h new file mode 100644 index 0000000..d9b3963 --- /dev/null +++ b/src/PointCloudData/PointCloudSingleton.h @@ -0,0 +1,196 @@ +/*************************** +前处理点云数据 +1. 管理点云数据 +**************************/ +#ifndef POINTCLOUDDATA_H +#define POINTCLOUDDATA_H + +#include "PointCloudDataAPI.h" +#include +#include "DataProperty/DataBase.h" +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + +// Visualization Toolkit (VTK) +#include + + + + +class QDomDocument; +class QDomElement; +class QDomNodeList; +class QDataStream; + +namespace PointCloudData +{ + class PointCloudKernal; + class PointCloudSet; + + class POINTCLOUDDATAAPI PointCloudData : public DataProperty::DataBase + { + public: + //获取单例指针 + static PointCloudData* getInstance(); + //添加Kernal + void appendPointCloudKernal(PointCloudKernal* keneral); + //获取Kernal数量 + int getKernalCount(); + //获取第index个Kernal + PointCloudKernal* getKernalAt(const int index); + //通过ID获取Kernal + PointCloudKernal* getKernalByID(const int id); + //通过网格的数据表示获取Kernal ID + int getIDByDataSet(vtkDataSet* datset); + //移除第index个Kernal + void removeKernalAt(const int index); + //移除ID为i的Kernal + void removeKernalByID(const int id); + //添加组件 + void appendPointCloudSet(PointCloudSet* s); + //获取组件数目 + int getPointCloudSetCount(); + //获取第index个组件 + PointCloudSet* getPointCloudSetAt(const int index); + //通过ID获取网格组件 + PointCloudSet* getPointCloudSetByID(const int id); + //通过名字获取组件,大小写敏感 + PointCloudSet* getPointCloudSetByName(const QString name); + //移除第index个组件 + void removePointCloudSetAt(const int index); + //获取与ID为kid的Kernal相关的全部组件ID + QList getSetIDFromKernal(int kid); + /** + * @brief 判断MeshKernal是否存在 + * @param ker 需要判断的Kernal + * @return true 存在 + * @return false 不存在 + */ + bool isContainsKernal(PointCloudKernal* ker); + /** + * @brief 清空全部数据 + */ + void clear(); + QString getMD5(); + ///写出到工程文件 + QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override; + //写出二进制文件 + void writeBinaryFile(QDataStream* dataStream); + ///从工程文件读入数据 + void readFromProjectFile(QDomNodeList* nodelist); + //读入二进制文件 + void readBinaryFile(QDataStream* dataFile); + ///产生全部组件的显示模型 + void generateDisplayDataSet(); + + private: + PointCloudData() = default; + ~PointCloudData(); + + private: + static PointCloudData* _instance; + QList _pointcloudList{}; + QList _setList{}; + }; + + +} +#endif \ No newline at end of file diff --git a/src/PythonModule/CMakeLists.txt b/src/PythonModule/CMakeLists.txt index 868f371..d9767eb 100644 --- a/src/PythonModule/CMakeLists.txt +++ b/src/PythonModule/CMakeLists.txt @@ -77,7 +77,7 @@ endif() #----------------------------------------------------------------------------- install( FILES - ${CMAKE_CURRENT_SOURCE_DIR}/py/LAMPCAE.ini + ${CMAKE_CURRENT_SOURCE_DIR}/py/LAMPCAE.ini.bak2 ${CMAKE_CURRENT_SOURCE_DIR}/py/CAD.py ${CMAKE_CURRENT_SOURCE_DIR}/py/Case.py ${CMAKE_CURRENT_SOURCE_DIR}/py/ControlPanel.py diff --git a/src/PythonModule/py/MainWindow.py b/src/PythonModule/py/MainWindow.py index bc4f3e9..c3d90fd 100644 --- a/src/PythonModule/py/MainWindow.py +++ b/src/PythonModule/py/MainWindow.py @@ -37,6 +37,17 @@ def clearData(): def updateInterface(): mw.updateInterface() pass +def importPcl(filename,suffix,modelID): + str = bytes(filename,encoding='utf-8') + suf = bytes(suffix,encoding='utf-8') + mw.importPcl(str,suf,modelID) + pass + +def exportPcl(filename,suffix,modelID): + str = bytes(filename,encoding='utf-8') + suf = bytes(suffix,encoding='utf-8') + mw.exportPcl(str,suf,modelID) + pass def importMesh(filename,suffix,modelID): str = bytes(filename,encoding='utf-8') diff --git a/src/Settings/BusAPI.cpp b/src/Settings/BusAPI.cpp index eb0e9da..da60786 100644 --- a/src/Settings/BusAPI.cpp +++ b/src/Settings/BusAPI.cpp @@ -101,6 +101,7 @@ namespace Setting { return _mainSetting->getLanguage(); } + // 移除求解器管理 // SolverManager* BusAPI::getSolverManager() // { // return _solvers; diff --git a/src/Settings/DialogWorkingDir.cpp b/src/Settings/DialogWorkingDir.cpp index 00b5161..fc960ce 100644 --- a/src/Settings/DialogWorkingDir.cpp +++ b/src/Settings/DialogWorkingDir.cpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace Setting { @@ -79,6 +80,8 @@ namespace Setting return; } QDialog::reject(); + exit(-1); // 拒绝退出程序 + } void WorkingDirDialog::closeEvent(QCloseEvent *e) { diff --git a/src/WBCLFZSystemModule/AllHead.h b/src/WBCLFZSystemModule/AllHead.h index 03a9490..97dc9e4 100644 --- a/src/WBCLFZSystemModule/AllHead.h +++ b/src/WBCLFZSystemModule/AllHead.h @@ -57,21 +57,21 @@ //======================================================= #include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -79,88 +79,242 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include -#include +#include #include +//====================================== +// 点云 pcl +//====================================== + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include //添加QDateTime头文件 +#include +#include +#include +#include + +// Point Cloud Library +#include +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include //随机数 +#include +#include +#include // TicToc +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // 4PCS算法 +#include //K4PCS算法头文件 +#include +#include +#include +#include +#include //贪婪投影三角化算法类定义的头文件 +#include //移动立方体 +#include +#include //MLS +#include //泊松重建 +#include +#include +#include +#include +#include + +#include // TicToc +#include // 体素滤波 +#include // 体素滤波 +#include + +#include +#include +#include +#include +#include +#include //随机参数估计方法 +#include //模型定义 +#include //RANSAC分割 +#include +#include +#include //rand()头文件 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//可视化相关头文件 +#include +#include +#include +#include +#include +#include +#include +#include +// Boost +#include + +// Visualization Toolkit (VTK) +#include +#include "ui_pclvisualizer.h" +#include "inputdialog.h" +#include "BasePCL.h" +#include "ToolDialog.h" +#include "PointManagerClass.h" + + + + + + + class QObject; diff --git a/src/WBCLFZSystemModule/CMakeLists.txt b/src/WBCLFZSystemModule/CMakeLists.txt index 6796432..3b9571f 100644 --- a/src/WBCLFZSystemModule/CMakeLists.txt +++ b/src/WBCLFZSystemModule/CMakeLists.txt @@ -11,6 +11,9 @@ include_directories(C:/PCL/3rdParty/FLANN/include) include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3) include_directories(C:/PCL/include/pcl-1.14) +# FindOpenCASCADE +include_directories(${OpenCASCADE_INCLUDE_DIRS}) + # qt5 include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml) @@ -35,6 +38,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot) # qhexedit include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit) + # 内部结构 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SqliteDBProcess/src) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/modelProcess) @@ -62,7 +66,7 @@ link_directories("C:/PCL/lib") #----------------------------------------------------------------------------- set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization) -find_package(PCL ) +find_package(PCL) include_directories(${PCL_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) @@ -87,11 +91,13 @@ qt5_wrap_ui(_interface ${_ui}) #----------------------------------------------------------------------------- # 添加动态库目标 #----------------------------------------------------------------------------- -add_library(WBCLFZSystemModule STATIC +add_library(WBCLFZSystemModule ${_resource} ${_interface} ${_header} ${_source} + WBCLFZ.cpp + WBCLFZ.h ) #----------------------------------------------------------------------------- @@ -117,6 +123,10 @@ list(APPEND _runtimes_libraries Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport ) +list(APPEND _runtimes_libraries + OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKCAF OpenCASCADE::TKCDF OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIGES OpenCASCADE::TKLCAF OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKVCAF OpenCASCADE::TKXCAF OpenCASCADE::TKXDEIGES OpenCASCADE::TKXSBase OpenCASCADE::TKernel Qt5::Widgets Qt5::Xml VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib VTK::IOGeometry +) + target_include_directories(WBCLFZSystemModule PUBLIC ${Qwt_INCLUDE_DIRS}) diff --git a/src/WBCLFZSystemModule/OCCTModelOperator.cpp b/src/WBCLFZSystemModule/OCCTModelOperator.cpp index 92629d8..3f772bf 100644 --- a/src/WBCLFZSystemModule/OCCTModelOperator.cpp +++ b/src/WBCLFZSystemModule/OCCTModelOperator.cpp @@ -1,7 +1,7 @@ #include "OCCTModelOperator.h" -#include -#include -#include +#include +#include +#include OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext) diff --git a/src/WBCLFZSystemModule/OCCTopoShapeTreeViewer.cpp b/src/WBCLFZSystemModule/OCCTopoShapeTreeViewer.cpp index 7480bac..39f0b7d 100644 --- a/src/WBCLFZSystemModule/OCCTopoShapeTreeViewer.cpp +++ b/src/WBCLFZSystemModule/OCCTopoShapeTreeViewer.cpp @@ -2,8 +2,8 @@ #include "OCCTopoShapeTreeViewer.h" #include #include "SharedModuleLib/BaseUiTool.h" -#include -#include +#include +#include OCCTopoShapeTreeViewer::OCCTopoShapeTreeViewer(QWidget* parent) diff --git a/src/WBCLFZSystemModule/OCCViewer/DocumentCommon.cpp b/src/WBCLFZSystemModule/OCCViewer/DocumentCommon.cpp index 3a1364e..eee7a1c 100644 --- a/src/WBCLFZSystemModule/OCCViewer/DocumentCommon.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/DocumentCommon.cpp @@ -25,7 +25,7 @@ #include "DocumentCommon.h" #include "Transparency.h" #include "AllHead.h" -#include +#include diff --git a/src/WBCLFZSystemModule/OCCViewer/GeomWidget.cpp b/src/WBCLFZSystemModule/OCCViewer/GeomWidget.cpp index 4fb5201..ca88d53 100644 --- a/src/WBCLFZSystemModule/OCCViewer/GeomWidget.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/GeomWidget.cpp @@ -21,16 +21,16 @@ #include "GeomWidget.h" -#include +#include #include #include #include #include #include #include -#include -#include -#include +#include +#include +#include GeomWidget::GeomWidget (DocumentCommon* theDocument3d, QWidget* theParent) diff --git a/src/WBCLFZSystemModule/OCCViewer/GeomWidget.h b/src/WBCLFZSystemModule/OCCViewer/GeomWidget.h index c4670c1..ba077dc 100644 --- a/src/WBCLFZSystemModule/OCCViewer/GeomWidget.h +++ b/src/WBCLFZSystemModule/OCCViewer/GeomWidget.h @@ -25,17 +25,17 @@ #include "OCCViewer\View.h" #include "OCCViewer\DocumentCommon.h" -#include -#include +#include +#include #include -#include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include //! Qt widget for organize 3D & 2D documents diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.cpp b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.cpp index 1e281cc..4c6db7a 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.cpp @@ -26,15 +26,15 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include +#include #include -#include +#include const TCollection_AsciiString BaseSample::FILE_EXTENSION = "cxx"; diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.h b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.h index 193c34b..bad3941 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.h +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/BaseSample.h @@ -24,9 +24,9 @@ #include -#include -#include -#include +#include +#include +#include //! Base class for specified category classes class BaseSample: public Standard_Transient diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.cpp b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.cpp index 4906f53..79f9213 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.cpp @@ -21,59 +21,59 @@ #include "MakeBottle.h" -#include +#include -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include -#include +#include -#include +#include -#include -#include +#include +#include -#include -#include +#include +#include -#include -#include +#include +#include -#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include +#include +#include +#include +#include -#include -#include +#include +#include -#include +#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include +#include TopoDS_Shape MakeBottle (const Standard_Real theWidth, const Standard_Real theHeight, diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.h b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.h index 01d5552..a1e8853 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.h +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/MakeBottle.h @@ -22,8 +22,8 @@ #ifndef MAKEBOTTLE_H #define MAKEBOTTLE_H -#include -#include +#include +#include //! Returns sample bottle TopoDS_Shape TopoDS_Shape MakeBottle(const Standard_Real theWidth, diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.cpp b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.cpp index e5063b3..90a448d 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.cpp @@ -23,13 +23,13 @@ #include "MakeBottle.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include void Viewer3dSamples::ExecuteSample(const TCollection_AsciiString& theSampleName) { diff --git a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.h b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.h index 6950939..3c5d121 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.h +++ b/src/WBCLFZSystemModule/OCCViewer/OCCT_Test/Viewer3dSamples.h @@ -24,8 +24,8 @@ #include "BaseSample.h" -#include -#include +#include +#include //! Implements viewer 3D samples. class Viewer3dSamples : public BaseSample diff --git a/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.cpp b/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.cpp index 4ae67d7..5dcc887 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.cpp @@ -21,10 +21,10 @@ #include "OcctHighlighter.h" -#include +#include #include #include -#include +#include diff --git a/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.h b/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.h index 9070598..967fa49 100644 --- a/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.h +++ b/src/WBCLFZSystemModule/OCCViewer/OcctHighlighter.h @@ -22,15 +22,15 @@ #ifndef OCCTHIGHLIGHTER_H #define OCCTHIGHLIGHTER_H -#include +#include -#include +#include #include #include #include #include #include -#include +#include QT_BEGIN_NAMESPACE class QTextDocument; diff --git a/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.cpp b/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.cpp index 7d29e64..fdf0eef 100644 --- a/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.cpp @@ -21,9 +21,9 @@ #include "TranslateDialog.h" -#include +#include #include -#include +#include TranslateDialog::TranslateDialog(QWidget* parent, Qt::WindowFlags flags, bool modal) : QFileDialog(parent, flags) diff --git a/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.h b/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.h index 7f36410..df28094 100644 --- a/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.h +++ b/src/WBCLFZSystemModule/OCCViewer/TranslateDialog.h @@ -22,14 +22,14 @@ #ifndef TRANSLATEDIALOG_H #define TRANSLATEDIALOG_H -#include +#include #include #include #include #include #include #include -#include +#include //! Qt file dialog for save and restore sample files class TranslateDialog : public QFileDialog diff --git a/src/WBCLFZSystemModule/OCCViewer/Transparency.cpp b/src/WBCLFZSystemModule/OCCViewer/Transparency.cpp index 355ed3b..33fd02f 100644 --- a/src/WBCLFZSystemModule/OCCViewer/Transparency.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/Transparency.cpp @@ -21,10 +21,10 @@ #include "Transparency.h" -#include +#include #include #include -#include +#include DialogTransparency::DialogTransparency(QWidget* parent) : QDialog(parent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) diff --git a/src/WBCLFZSystemModule/OCCViewer/Transparency.h b/src/WBCLFZSystemModule/OCCViewer/Transparency.h index df7a1ef..fc21bfb 100644 --- a/src/WBCLFZSystemModule/OCCViewer/Transparency.h +++ b/src/WBCLFZSystemModule/OCCViewer/Transparency.h @@ -23,13 +23,13 @@ #define TRANSPARENCY_H -#include +#include #include #include #include -#include +#include -#include +#include class QSlider; diff --git a/src/WBCLFZSystemModule/OCCViewer/View.cpp b/src/WBCLFZSystemModule/OCCViewer/View.cpp index 39b8e7f..cdaeeac 100644 --- a/src/WBCLFZSystemModule/OCCViewer/View.cpp +++ b/src/WBCLFZSystemModule/OCCViewer/View.cpp @@ -22,12 +22,12 @@ #if !defined _WIN32 #define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */ #endif -#include +#include #include "OCCViewer\View.h" -#include +#include #include "Transparency.h" -#include -#include +#include +#include #include #include #include @@ -39,15 +39,15 @@ #include #include #include -#include +#include #if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && QT_VERSION < 0x050000 #include #endif -#include -#include -#include +#include +#include +#include namespace diff --git a/src/WBCLFZSystemModule/OCCViewer/View.h b/src/WBCLFZSystemModule/OCCViewer/View.h index 1a1909c..5bbb247 100644 --- a/src/WBCLFZSystemModule/OCCViewer/View.h +++ b/src/WBCLFZSystemModule/OCCViewer/View.h @@ -26,18 +26,18 @@ #include "AllHead.h" #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include #include diff --git a/src/WBCLFZSystemModule/PointCloudProcess/BasePCL.h b/src/WBCLFZSystemModule/PointCloudProcess/BasePCL.h index 8bc669e..2abcabe 100644 --- a/src/WBCLFZSystemModule/PointCloudProcess/BasePCL.h +++ b/src/WBCLFZSystemModule/PointCloudProcess/BasePCL.h @@ -119,7 +119,7 @@ //使用的点云格式 - + diff --git a/src/WBCLFZSystemModule/PointCloudProcess/pclvisualizer.cpp b/src/WBCLFZSystemModule/PointCloudProcess/pclvisualizer.cpp index 8e03793..2dad219 100644 --- a/src/WBCLFZSystemModule/PointCloudProcess/pclvisualizer.cpp +++ b/src/WBCLFZSystemModule/PointCloudProcess/pclvisualizer.cpp @@ -435,7 +435,7 @@ void PCLVisualizer::loadPCDFile() int return_status; showLogItem("点云加载中", "文件格式为:" + fileFormat); - return_status = cloudmanager->addPointCloud(filePathWithName, fileSuffix); + return_status = cloudmanager->addPointCloud(filePathWithName, fileSuffix); // 加载点云 //判断是否加载成功 if (return_status != 0) { @@ -1237,7 +1237,6 @@ int CloudPointManagerClass::addPointCloud(QString filePathWithName, QString file fileFormat = "PLY"; } - // 生成点云对象 std::shared_ptr cloudItem(new CloudPointItemClass); QFileInfo fileinfo(filePathWithName); diff --git a/src/WBCLFZSystemModule/QtSARAntModelSetting.cpp b/src/WBCLFZSystemModule/QtSARAntModelSetting.cpp index 295f948..1bd79b1 100644 --- a/src/WBCLFZSystemModule/QtSARAntModelSetting.cpp +++ b/src/WBCLFZSystemModule/QtSARAntModelSetting.cpp @@ -1,9 +1,9 @@ #include "QtSARAntModelSetting.h" #include "AllHead.h" #include -#include -#include -#include +#include +#include +#include #include "OCCTBase.h" antModelClass::antModelClass(QString filpath) diff --git a/src/WBCLFZSystemModule/SharedModuleLib/BaseUiTool.h b/src/WBCLFZSystemModule/SharedModuleLib/BaseUiTool.h index 5ea41a9..a2c6858 100644 --- a/src/WBCLFZSystemModule/SharedModuleLib/BaseUiTool.h +++ b/src/WBCLFZSystemModule/SharedModuleLib/BaseUiTool.h @@ -21,7 +21,7 @@ #include #include -#include +#include //-------------------- FEKO 基本参数 ------------------------- enum FEKOCoordinateSystem { None, diff --git a/src/WBCLFZSystemModule/WBCLFZ.cpp b/src/WBCLFZSystemModule/WBCLFZ.cpp new file mode 100644 index 0000000..340581a --- /dev/null +++ b/src/WBCLFZSystemModule/WBCLFZ.cpp @@ -0,0 +1,15 @@ +// +// 微波测量仿真分系统对外函数接口 +// +#include "WBCLFZ.h" +#include "AllHead.h" +#include "referenceHeader.h" + + + + +namespace WBCLFZ{ + + + +} \ No newline at end of file diff --git a/src/WBCLFZSystemModule/WBCLFZ.h b/src/WBCLFZSystemModule/WBCLFZ.h new file mode 100644 index 0000000..1e0cd76 --- /dev/null +++ b/src/WBCLFZSystemModule/WBCLFZ.h @@ -0,0 +1,33 @@ +// +// 微波测量仿真对外接口,考虑单例操作,原本这里存放了 +// + +#ifndef LAMPCAE_WBCLFZ_H +#define LAMPCAE_WBCLFZ_H +#include "WBCLFZ.h" +#include "AllHead.h" +#include "WBCLFZSystemModuleAPI.h" + +namespace WBCLFZ { + + // 点云操作类 + class WBCLFZSystemModuleAPI PointCloudOperator { + pcl::PointCloud::Ptr ReadPointCloudFromFile(QString filename); + + + }; + + // 属性表操作类 + class WBCLFZSystemModuleAPI sqlDBOperator { + + }; + + // FEKO仿真操作类 + class WBCLFZSystemModuleAPI FekoSimulationOperator { + + + + }; + +} // namespace WBCLFZ +#endif // LAMPCAE_WBCLFZ_H diff --git a/src/WBCLFZSystemModule/WBCLFZSystemModuleAPI.h b/src/WBCLFZSystemModule/WBCLFZSystemModuleAPI.h new file mode 100644 index 0000000..1e98697 --- /dev/null +++ b/src/WBCLFZSystemModule/WBCLFZSystemModuleAPI.h @@ -0,0 +1,13 @@ +#ifndef _WBCLFZSystemModule_H_ +#define _WBCLFZSystemModule_H_ + +#include + + +#if defined(WBCLFZSystemModule_API) +#define WBCLFZSystemModuleAPI Q_DECL_EXPORT +#else +#define WBCLFZSystemModuleAPI Q_DECL_IMPORT +#endif + +#endif diff --git a/src/WBCLFZSystemModule/modelProcess/ModelProcess.cpp b/src/WBCLFZSystemModule/modelProcess/ModelProcess.cpp index 75ee523..7c95b5b 100644 --- a/src/WBCLFZSystemModule/modelProcess/ModelProcess.cpp +++ b/src/WBCLFZSystemModule/modelProcess/ModelProcess.cpp @@ -2,8 +2,8 @@ #include "EchoShowProcess/FEKOResultImport.h" #include "TaskXml/TaskTreeClass.h" #include -#include -#include +#include +#include ModelProcess::ModelProcess(QWidget *parent)