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