搞定了点云格式(pcd)的读取与加载
parent
057be2cc6f
commit
18e7c264bf
|
@ -6,3 +6,6 @@
|
|||
/cmake-build-debug
|
||||
/cmake-build-release
|
||||
/extlib/OpenCASCADE
|
||||
/extlib/OTB
|
||||
/extlib/lampcae
|
||||
/extlib/Python
|
|
@ -1,2 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python facet">
|
||||
<configuration sdkName="Python 3.7 (FastCAE)" />
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.7 (FastCAE)" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
|
@ -3,5 +3,7 @@
|
|||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/extlib" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/extlib/OTB" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/extlib/OTB_source" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -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搜索路径)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# 版本声明
|
||||
LAMPCAE软件是基于FastCAE 软件上开发得到,增加了点云、feko仿真、成像三个部分功能。注意FastCAE 遵循 BSD-3-Clause 协议。为了避免被其他的依赖库协议污染,这里将程序库进行了拆分。
|
||||
|
||||
## 点云功能部分依赖库
|
||||
点云部分依赖pcl,其中模型渲染部分重新用fastCAE软件的渲染重新适配。
|
||||
其中点云属性与点云实体分开存储,后期在考虑完全统一
|
||||
|
||||
## mesh网格处理
|
||||
依赖meshlab中库代码处理
|
||||
|
||||
## 模型处理
|
||||
|
||||
## 仿真成像
|
||||
1. 近场
|
||||
其中所有近场都是基于部分BP算法重新编写
|
||||
2. 远程
|
||||
专门为圆迹和ISAR构建,基于BP算法进行的适配
|
||||
|
||||
|
||||
## 后处理阶段
|
||||
|
||||
## 回波展示分析阶段
|
||||
|
||||
## 影像处理部分依赖库
|
||||
|
||||
|
||||
# V1.0
|
||||
1. 原来点云处理模块全部内置到FastCAE中
|
||||
|
|
@ -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
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()
|
||||
QString MeshConfig::getImportSuffix(MeshDataType type/*=MeshDataType::vtkMesh*/)
|
||||
{
|
||||
return _importSuffix;
|
||||
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;
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#include <IOConfig.h>
|
||||
|
||||
namespace IO
|
||||
{
|
||||
QHash<QString, WRITEINPFILE> IOConfigure::_inpWriteFun = QHash<QString, WRITEINPFILE>();
|
||||
QHash<QString, TRANSFEROUTFILE> IOConfigure::_outFileTransfer = QHash<QString, TRANSFEROUTFILE>();
|
||||
QHash<QString, IMPORTMESHFUN> IOConfigure::_inputmeshFuns = QHash<QString, IMPORTMESHFUN>();
|
||||
namespace IO {
|
||||
QHash<QString, WRITEINPFILE> IOConfigure::_inpWriteFun = QHash<QString, WRITEINPFILE>();
|
||||
QHash<QString, TRANSFEROUTFILE> IOConfigure::_outFileTransfer = QHash<QString, TRANSFEROUTFILE>();
|
||||
QHash<QString, IMPORTMESHFUN> IOConfigure::_inputmeshFuns = QHash<QString, IMPORTMESHFUN>(); // 网格
|
||||
QHash<QString, EXPORTMESHFUN> IOConfigure::_exportMeshFuns = QHash<QString, EXPORTMESHFUN>();
|
||||
QHash<QString, REPLACEKEYWORDFUN> IOConfigure::_replaceFuns = QHash<QString, REPLACEKEYWORDFUN>();
|
||||
|
||||
QHash<QString, IMPORTMESHFUN> IOConfigure::_inputPclFuns = QHash<QString, IMPORTMESHFUN>(); // 点云
|
||||
QHash<QString, EXPORTMESHFUN> IOConfigure::_exportPclFuns = QHash<QString, EXPORTMESHFUN>();
|
||||
|
||||
QHash<QString, REPLACEKEYWORDFUN> IOConfigure::_replaceFuns =QHash<QString, REPLACEKEYWORDFUN>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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<QString> ts = _inputPclFuns.keys();
|
||||
return QStringList(ts);
|
||||
}
|
||||
QStringList IOConfigure::getPclExporters()
|
||||
{
|
||||
QList<QString> ts = _exportPclFuns.keys();
|
||||
return QStringList(ts);
|
||||
}
|
||||
|
||||
} // namespace IO
|
||||
|
|
|
@ -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<QString, WRITEINPFILE> _inpWriteFun;
|
||||
static QHash<QString, TRANSFEROUTFILE> _outFileTransfer;
|
||||
static QHash<QString, IMPORTMESHFUN> _inputmeshFuns;
|
||||
|
||||
static QHash<QString, IMPORTMESHFUN> _inputPclFuns; // 点云
|
||||
static QHash<QString, EXPORTMESHFUN> _exportPclFuns;
|
||||
|
||||
static QHash<QString, IMPORTMESHFUN> _inputmeshFuns; // 网格
|
||||
static QHash<QString, EXPORTMESHFUN> _exportMeshFuns;
|
||||
|
||||
//关键字-替换方法
|
||||
static QHash<QString, REPLACEKEYWORDFUN> _replaceFuns;
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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{};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
/// 启动求解器
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
// 显示用户引导
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MeshData
|
|||
void writeBinaryFile(QDataStream* dataStream);
|
||||
///从工程文件读入数据
|
||||
void readFromProjectFile(QDomNodeList* nodelist);
|
||||
//读入二进制文件
|
||||
///读入二进制文件
|
||||
void readBinaryFile(QDataStream* dataFile);
|
||||
///产生全部组件的显示模型
|
||||
void generateDisplayDataSet();
|
||||
|
|
|
@ -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})
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 添加资源文件
|
||||
|
@ -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}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -10,6 +10,112 @@
|
|||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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; // 点云显示共享指针
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<QTreeWidgetItem*, ModelBase*> 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
|
||||
|
|
|
@ -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}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshKernal.h"
|
||||
#include "Common/Types.h"
|
||||
#include "Common/DebugLogger.h"
|
||||
|
||||
namespace MeshData
|
||||
{
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
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;
|
||||
|
@ -23,22 +23,19 @@ namespace MeshData{
|
|||
bool write();
|
||||
|
||||
private:
|
||||
QString _fileName{};
|
||||
// QTextStream* _stream{};
|
||||
QString _fileName{};
|
||||
// QTextStream* _stream{};
|
||||
|
||||
// int _nodeNum{ 0 };
|
||||
// int _cellNum{ 0 };
|
||||
//
|
||||
// QHash<int, int> _nodeIdIndex{};
|
||||
// int _nodeNum{ 0 };
|
||||
// int _cellNum{ 0 };
|
||||
//
|
||||
// QHash<int, int> _nodeIdIndex{};
|
||||
|
||||
MeshData* _meshData{};
|
||||
//vtkUnstructuredGrid* _gird{};
|
||||
int _modelId;
|
||||
MeshData* _meshData{};
|
||||
// vtkUnstructuredGrid* _gird{};
|
||||
int _modelId;
|
||||
MeshOperation _operation;
|
||||
|
||||
};
|
||||
}
|
||||
} // namespace MeshData
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
//
|
||||
// Created by 30453 on 2024/4/1.
|
||||
//
|
||||
|
||||
#include "PointClouddataExchange.h"
|
||||
#include "MeshData/meshSingleton.h"
|
||||
#include "MeshData/meshKernal.h"
|
||||
#include <QTextCodec>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkDataSetReader.h>
|
||||
#include <vtkDataSet.h>
|
||||
#include <cmath>
|
||||
#include <vtkGlyph3D.h>
|
||||
#include <vtkLODActor.h>
|
||||
#include <vtkLODActor.h>
|
||||
#include <vtkPDBReader.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkSphereSource.h>
|
||||
#include <vtkTubeFilter.h>
|
||||
#include <vtkAppendFilter.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkUnstructuredGridWriter.h>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
|
||||
|
||||
// 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<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
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<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
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<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
// 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<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
|
||||
// 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData
|
||||
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::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<vtkPolyData> polyData = geometryFilter->GetOutput();
|
||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
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<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
|
||||
// 使用 vtkGeometryFilter 提取几何信息并转换为 vtkPolyData
|
||||
vtkSmartPointer<vtkGeometryFilter> geometryFilter = vtkSmartPointer<vtkGeometryFilter>::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<vtkPolyData> polyData = geometryFilter->GetOutput();
|
||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
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
|
|
@ -0,0 +1,151 @@
|
|||
//
|
||||
// Created by 30453 on 2024/4/1.
|
||||
//
|
||||
|
||||
#ifndef LAMPCAE_POINTCLOUDDATAEXCHANGE_H
|
||||
#define LAMPCAE_POINTCLOUDDATAEXCHANGE_H
|
||||
|
||||
#include "MeshThreadBase.h"
|
||||
#include <QTextStream>
|
||||
#include <QHash>
|
||||
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/vtk_io.h>
|
||||
#include <pcl/io/vtk_lib_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Visualization Toolkit (VTK)
|
||||
#include <vtkRenderWindow.h>
|
||||
|
||||
|
||||
|
||||
|
||||
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
|
|
@ -13,6 +13,8 @@
|
|||
#include <vtkAppendFilter.h>
|
||||
#include <QFileInfo>
|
||||
#include <QTextCodec>
|
||||
#include <vtkSTLWriter.h>
|
||||
|
||||
|
||||
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<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::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<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
|
||||
writer->SetInputData(ungird);
|
||||
writer->SetFileTypeToBinary();
|
||||
writer->SetFileName(ba);
|
||||
writer->Write();
|
||||
return true;
|
||||
}
|
||||
bool VTKdataExchange::writeTecplot()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ namespace MeshData
|
|||
vtkDataSet* readSTL();
|
||||
vtkDataSet* readTecplot();
|
||||
|
||||
bool writeVTK();
|
||||
bool writeSTL();
|
||||
bool writeTecplot();
|
||||
|
||||
private:
|
||||
QString _fileName;
|
||||
MeshData* _meshData{};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "SU2dataExchange.h"
|
||||
#include "VTKdataExchange.h"
|
||||
#include "FoamDataExchange.h"
|
||||
#include "PointClouddataExchange.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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 $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
LIBRARY_OUTPUT_DIRECTORY_RELEASE $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
ARCHIVE_OUTPUT_DIRECTORY_DEBUG $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
LIBRARY_OUTPUT_DIRECTORY_DEBUG $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _OPENFOAMPLUGINAPI_H__
|
||||
#define _OPENFOAMPLUGINAPI_H__
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
|
||||
#if defined(PLUGINMOTORBIKE_API)
|
||||
#define OPENFOAMPLUGINAPI Q_DECL_EXPORT
|
||||
#else
|
||||
#define OPENFOAMPLUGINAPI Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,463 @@
|
|||
#include "PluginOpenFoamExtend.h"
|
||||
class IOConfigure;
|
||||
#include <QDebug>
|
||||
#include "mainWindow/mainWindow.h"
|
||||
#include "ModelData/modelDataFactory.h"
|
||||
#include "ModelData/modelDataSingleton.h"
|
||||
#include "ModelData/modelDataBase.h"
|
||||
#include "IO/IOConfig.h"
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <vtkSTLWriter.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <QTextCodec>
|
||||
#include "meshData/meshSingleton.h"
|
||||
#include "meshData/meshKernal.h"
|
||||
#include <vtkDataSet.h>
|
||||
#include <QTextStream>
|
||||
#include <QTextCodec>
|
||||
#include "IO/SolverIO.h"
|
||||
#include <QtMath>
|
||||
#include <QMessageBox>
|
||||
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<Plugins::PluginBase*>* 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;
|
||||
}
|
||||
|
|
@ -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<Plugins::PluginBase*>*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
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
export PATH=/opt/Qt5.4.2/5.4/gcc_64/bin/:$PATH
|
||||
|
||||
qmake -o Makefile PluginMotorBike.pro
|
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
#include "PointCloudChecker.h"
|
||||
#include "PointCloudKernal.h"
|
||||
#include "PointCloudSingleton.h"
|
||||
#include <vtkDataSet.h>
|
||||
#include <vtkCell.h>
|
||||
#include <vtkCellQuality.h>
|
||||
#include <vtkCellData.h>
|
||||
#include <vtkDoubleArray.h>
|
||||
#include <math.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <QDebug>
|
||||
|
||||
namespace PointCloudData
|
||||
{
|
||||
PointCloudChecker::PointCloudChecker()
|
||||
{
|
||||
_PointCloudData = PointCloudData::getInstance();
|
||||
_cellQuality = vtkSmartPointer<vtkCellQuality>::New();
|
||||
_qualityArray = vtkSmartPointer<vtkDoubleArray>::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<VTKCellType> 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<VTKCellType> 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<VTKCellType> 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<VTKCellType> 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<VTKCellType> 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<VTKCellType> 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<double> 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<double> PointCloudChecker::getTicks()
|
||||
{
|
||||
return _ticks;
|
||||
}
|
||||
|
||||
QVector<double> PointCloudChecker::getCountList(VTKCellType t)
|
||||
{
|
||||
QVector<double> d;
|
||||
if (_cellCount.contains(t))
|
||||
d = _cellCount.value(t);
|
||||
return d;
|
||||
}
|
||||
|
||||
QList<vtkDataSet*> PointCloudChecker::getResultList()
|
||||
{
|
||||
return _resultList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
#ifndef PointCloudCHECKER_H
|
||||
#define PointCloudCHECKER_H
|
||||
|
||||
#include <QThread>
|
||||
#include "PointCloudDataAPI.h"
|
||||
#include <vtkCellType.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#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<VTKCellType> getInputCellType();
|
||||
int getInputCellCount(VTKCellType type);
|
||||
int getInputCellCount();
|
||||
|
||||
QList<VTKCellType> getQualityCellType();
|
||||
int gettQualityCellCount(VTKCellType type);
|
||||
int gettQualityCellCount();
|
||||
|
||||
void getQualityRange(double* r);
|
||||
double getAverageQuality();
|
||||
|
||||
QVector<double> getTicks();
|
||||
QVector<double> getCountList(VTKCellType t);
|
||||
|
||||
QList<vtkDataSet*> getResultList();
|
||||
|
||||
private:
|
||||
void checkKernal(PointCloudKernal* k);
|
||||
void collectInfo(vtkDataSet* outInfo);
|
||||
void countResult();
|
||||
|
||||
|
||||
private:
|
||||
vtkSmartPointer<vtkCellQuality> _cellQuality{};
|
||||
PointCloudData* _PointCloudData{};
|
||||
QualityMeasure _measure{ NONE };
|
||||
|
||||
vtkSmartPointer<vtkDoubleArray> _qualityArray{};
|
||||
QHash<VTKCellType, int> _inputCount{};
|
||||
QHash<VTKCellType, QList<double>> _checkedCount{};
|
||||
QList<vtkDataSet*> _resultList{};
|
||||
|
||||
QVector<double> _ticks{};
|
||||
QHash<VTKCellType, QVector<double>> _cellCount{};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,76 @@
|
|||
#include "PointCloudCommon.h"
|
||||
#include <vtkCellType.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef _MESHCOMMON_H_
|
||||
#define _MESHCOMMON_H_
|
||||
|
||||
#include "PointCloudDataAPI.h"
|
||||
#include <QList>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int MESHDATAAPI VTKCellTypeToDim(int ctype);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _POINTCLOUDDATAAPI_H_
|
||||
#define _POINTCLOUDDATAAPI_H_
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
|
||||
#if defined(POINTCLOUDDATA_API)
|
||||
#define POINTCLOUDDATAAPI Q_DECL_EXPORT
|
||||
#else
|
||||
#define POINTCLOUDDATAAPI Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,44 @@
|
|||
#include "PointCloudFactory.h"
|
||||
#include "PointCloudSet.h"
|
||||
#include "CgnsBCZone.h"
|
||||
#include "CgnsFamily.h"
|
||||
|
||||
namespace PointCloudData
|
||||
{
|
||||
QHash<int, CREATEPointCloudSET> PointCloudFactory::_createSetFun = QHash<int, CREATEPointCloudSET>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _PointCloudFACTORY_H__
|
||||
#define _PointCloudFACTORY_H__
|
||||
|
||||
#include "PointCloudSet.h"
|
||||
#include <QHash>
|
||||
|
||||
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<int, CREATEPointCloudSET> _createSetFun;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,263 @@
|
|||
#include "PointCloudKernal.h"
|
||||
#include <vtkDataSet.h>
|
||||
#include <vtkPoints.h>
|
||||
#include <vtkCell.h>
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QDomAttr>
|
||||
#include <QDomText>
|
||||
#include <vtkIdList.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <QDebug>
|
||||
|
||||
namespace PointCloudData
|
||||
{
|
||||
int PointCloudKernal::idOffset = 0;
|
||||
int PointCloudKernal::pointIDOffset = 1;
|
||||
|
||||
PointCloudKernal::PointCloudKernal()
|
||||
{
|
||||
idOffset++;
|
||||
setID(idOffset);
|
||||
_pointIDOffset = pointIDOffset;
|
||||
// _PointCloud = vtkSmartPointer<vtkUnstructuredGrid>::New();
|
||||
_specificColor.first = false;
|
||||
appendProperty(QObject::tr("Visible"), _visible);
|
||||
}
|
||||
|
||||
void PointCloudKernal::setPointCloudData(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr dataset)
|
||||
{
|
||||
_PointCloud = dataset;
|
||||
_pointIDOffset = pointIDOffset;
|
||||
|
||||
pointIDOffset += dataset->size();
|
||||
|
||||
appendProperty(QObject::tr("Points"), (int)dataset->size());
|
||||
}
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGBA>::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<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
/*************************
|
||||
点云模块
|
||||
最终需要重新保存点云数据
|
||||
1. 读取并解析点云文件,只限于二进制文件
|
||||
2. 所有点云文件部件全部都是单独的文件
|
||||
*************************/
|
||||
#ifndef POINTCLOUDKERNAL_H
|
||||
#define POINTCLOUDKERNAL_H
|
||||
|
||||
#include "PointCloudDataAPI.h"
|
||||
#include "DataProperty/DataBase.h"
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QPair>
|
||||
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Visualization Toolkit (VTK)
|
||||
#include <vtkRenderWindow.h>
|
||||
|
||||
|
||||
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<pcl::PointXYZRGBA>::Ptr dataset);
|
||||
//获取网格数据,vtk表示
|
||||
pcl::PointCloud<pcl::PointXYZRGBA>::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<pcl::PointXYZRGBA>::Ptr _PointCloud{}; // 点云实体
|
||||
int _dimension{ 3 };
|
||||
QPair<bool, QColor> _specificColor;
|
||||
DataProperty::DataBase* _PointCloudSetting{};// 点云的属性
|
||||
|
||||
private:
|
||||
static int idOffset;
|
||||
static int pointIDOffset; // 点云id
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,360 @@
|
|||
#include "PointCloudSet.h"
|
||||
#include "PointCloudSingleton.h"
|
||||
#include "PointCloudKernal.h"
|
||||
#include "DataProperty/ParameterColor.h"
|
||||
#include <QDomElement>
|
||||
#include <QDataStream>
|
||||
#include <vtkIdTypeArray.h>
|
||||
#include <vtkAppendFilter.h>
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkDataSet.h>
|
||||
#include <vtkSelectionNode.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkSelection.h>
|
||||
#include <vtkExtractSelection.h>
|
||||
#include <vtkAppendFilter.h>
|
||||
#include <QDebug>
|
||||
|
||||
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<DataProperty::ParameterColor*>(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<int> PointCloudSet::getKernals()
|
||||
{
|
||||
return _members.uniqueKeys();
|
||||
}
|
||||
|
||||
QList<int> PointCloudSet::getKernalMembers(int k)
|
||||
{
|
||||
if (_members.contains(k))
|
||||
return _members.values(k);
|
||||
return QList<int>();
|
||||
}
|
||||
|
||||
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<int> kernalids = _members.uniqueKeys();
|
||||
for (int kid : kernalids)
|
||||
{
|
||||
QDomElement kele = doc->createElement("Kernal");
|
||||
kele.setAttribute("ID", kid);
|
||||
QDomElement memle = doc->createElement("Member");
|
||||
QList<int> 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<int> kids = _members.uniqueKeys();
|
||||
|
||||
|
||||
vtkSmartPointer<vtkAppendFilter> appendFliter = vtkSmartPointer<vtkAppendFilter>::New();
|
||||
for (int kid : kids)
|
||||
{
|
||||
QList<int> member = _members.values(kid);
|
||||
auto k = meshdata->getKernalByID(kid);
|
||||
if (member.isEmpty() || k ==nullptr) continue;
|
||||
vtkDataSet* dataset = k->getPointCloudData();
|
||||
if (dataset == nullptr) continue;
|
||||
|
||||
vtkSmartPointer<vtkIdTypeArray> idArray = vtkSmartPointer<vtkIdTypeArray>::New();
|
||||
for (int id : member) idArray->InsertNextValue(id);
|
||||
|
||||
vtkSmartPointer<vtkSelectionNode> selectionNode = vtkSmartPointer<vtkSelectionNode>::New();
|
||||
if (_type == Element)
|
||||
{
|
||||
selectionNode->SetFieldType(vtkSelectionNode::CELL);
|
||||
}
|
||||
else if (_type == Node)
|
||||
{
|
||||
selectionNode->SetFieldType(vtkSelectionNode::POINT);
|
||||
}
|
||||
selectionNode->SetContentType(vtkSelectionNode::INDICES);
|
||||
selectionNode->SetSelectionList(idArray);
|
||||
|
||||
vtkSmartPointer<vtkSelection> selection = vtkSmartPointer<vtkSelection>::New();
|
||||
selection->AddNode(selectionNode);
|
||||
|
||||
vtkSmartPointer<vtkExtractSelection> extractionSelection = vtkSmartPointer<vtkExtractSelection>::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<int> kids = _members.uniqueKeys();
|
||||
const int nk = kids.size();
|
||||
*dataStream << (int)_type << _id << _name << nk; //setID,setType,setName,KernalIDs
|
||||
|
||||
for (int kid : kids)
|
||||
{
|
||||
QList<int> 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<int> ks = set->getKernals();
|
||||
for (int k : ks)
|
||||
{
|
||||
QList<int> mem = set->getKernalMembers(k);
|
||||
for (int m : mem)
|
||||
this->appendMember(k, m);
|
||||
}
|
||||
}
|
||||
|
||||
void PointCloudSet::cut(PointCloudSet* set)
|
||||
{
|
||||
if (set->getSetType() != _type) return;
|
||||
QList<int> ks = set->getKernals();
|
||||
for (int k : ks)
|
||||
{
|
||||
if (!_members.contains(k)) continue;
|
||||
QList<int> 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<int, QVector<int>> cellFaces)
|
||||
{
|
||||
m_CellFaces = cellFaces;
|
||||
}
|
||||
|
||||
QMap<int, QVector<int>> BoundPointCloudSet::getCellFaces()
|
||||
{
|
||||
return m_CellFaces;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* 这是点云集合,默认由 PointCloudKernal组成,其中内存的由文件组决定
|
||||
*
|
||||
* */
|
||||
|
||||
#ifndef POINTCLOUDSET_H_
|
||||
#define POINTCLOUDSET_H_
|
||||
|
||||
#include "PointCloudDataAPI.h"
|
||||
#include "DataProperty/ComponentBase.h"
|
||||
#include <QString>
|
||||
#include <QMultiHash>
|
||||
#include <QColor>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Visualization Toolkit (VTK)
|
||||
#include <vtkRenderWindow.h>
|
||||
|
||||
|
||||
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<int> getKernals();
|
||||
//根据kernal ID获取成员
|
||||
QList<int> 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<int, int> _members{}; //keneralID - node/elementID
|
||||
|
||||
QList<int> _tempMemberID{};
|
||||
|
||||
vtkDataSet* _displayDataSet{};
|
||||
|
||||
private:
|
||||
// static int maxID;
|
||||
};
|
||||
|
||||
|
||||
//用于流体网格边界信息存储。边界由多个单元的一个或多个面组成。
|
||||
class POINTCLOUDDATAAPI BoundPointCloudSet : public PointCloudSet
|
||||
{
|
||||
public:
|
||||
BoundPointCloudSet();
|
||||
~BoundPointCloudSet() = default;
|
||||
void setCellFaces(const QMap<int, QVector<int>> cellFaces);
|
||||
QMap<int, QVector<int>> getCellFaces();
|
||||
protected:
|
||||
//key为单元索引,value为该单元的面索引
|
||||
QMap<int, QVector<int>> m_CellFaces{};
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,341 @@
|
|||
#include "PointCloudSingleton.h"
|
||||
#include "PointCloudKernal.h"
|
||||
#include "PointCloudSet.h"
|
||||
#include "PointCloudFactory.h"
|
||||
#include <assert.h>
|
||||
#include <QDataStream>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QDomNodeList>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
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<PointCloudSet*> 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<int> PointCloudData::getSetIDFromKernal(int kid)
|
||||
{
|
||||
QList<int> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
/***************************
|
||||
前处理点云数据
|
||||
1. 管理点云数据
|
||||
**************************/
|
||||
#ifndef POINTCLOUDDATA_H
|
||||
#define POINTCLOUDDATA_H
|
||||
|
||||
#include "PointCloudDataAPI.h"
|
||||
#include <QList>
|
||||
#include "DataProperty/DataBase.h"
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Visualization Toolkit (VTK)
|
||||
#include <vtkRenderWindow.h>
|
||||
|
||||
|
||||
|
||||
|
||||
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<int> 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<PointCloudKernal*> _pointcloudList{};
|
||||
QList<PointCloudSet*> _setList{};
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
#endif
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -101,6 +101,7 @@ namespace Setting
|
|||
{
|
||||
return _mainSetting->getLanguage();
|
||||
}
|
||||
// 移除求解器管理
|
||||
// SolverManager* BusAPI::getSolverManager()
|
||||
// {
|
||||
// return _solvers;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace Setting
|
||||
{
|
||||
|
@ -79,6 +80,8 @@ namespace Setting
|
|||
return;
|
||||
}
|
||||
QDialog::reject();
|
||||
exit(-1); // 拒绝退出程序
|
||||
|
||||
}
|
||||
void WorkingDirDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
|
|
|
@ -57,21 +57,21 @@
|
|||
//=======================================================
|
||||
#include <QDebug>
|
||||
#include <QDialog>
|
||||
#include <opencascade/BRepBuilderAPI_Copy.hxx>
|
||||
#include <opencascade/AIS_Shape.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <QObject>
|
||||
#include <opencascade/TopoDS.hxx>
|
||||
#include <opencascade/TopoDS_Shape.hxx>
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QListWidget>
|
||||
#include <QList>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <opencascade/AIS_TextLabel.hxx>
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <opencascade/Graphic3d_Texture2Dplane.hxx>
|
||||
#include <opencascade/Graphic3d_Text.hxx>
|
||||
#include <opencascade/V3d_View.hxx>
|
||||
#include <opencascade/V3d_Viewer.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#include <AIS_TextLabel.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_Texture2Dplane.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <QMap>
|
||||
|
@ -79,88 +79,242 @@
|
|||
#include <QCheckBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QDialog>
|
||||
#include <opencascade/BRepGProp.hxx>
|
||||
#include <opencascade/GProp_GProps.hxx>
|
||||
#include <opencascade/AIS_ViewCube.hxx>
|
||||
#include <opencascade/Geom_Axis2Placement.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
#include <AIS_ViewCube.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QStatusBar>
|
||||
#include <opencascade/StepGeom_Axis2Placement3d.hxx>
|
||||
#include <opencascade/AIS_InteractiveObject.hxx>
|
||||
#include <opencascade/Aspect_DisplayConnection.hxx>
|
||||
#include <opencascade/Graphic3d_NameOfMaterial.hxx>
|
||||
#include <opencascade/OpenGl_GraphicDriver.hxx>
|
||||
#include <opencascade/OSD_Environment.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <QFileDialog>
|
||||
#include <opencascade/TCollection_AsciiString.hxx>
|
||||
#include <opencascade/StlAPI_Reader.hxx>
|
||||
#include <opencascade/AIS_Trihedron.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <StlAPI_Reader.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <QtWidgets>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <opencascade/IGESControl_Reader.hxx>
|
||||
#include <opencascade/STEPControl_Reader.hxx>
|
||||
#include <opencascade/IGESControl_Writer.hxx>
|
||||
#include <opencascade/STEPControl_Writer.hxx>
|
||||
#include <opencascade/StlAPI_Writer.hxx>
|
||||
#include <opencascade/BRep_Builder.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_Collect.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <IGESControl_Reader.hxx>
|
||||
#include <STEPControl_Reader.hxx>
|
||||
#include <IGESControl_Writer.hxx>
|
||||
#include <STEPControl_Writer.hxx>
|
||||
#include <StlAPI_Writer.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_Collect.hxx>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <opencascade/TopExp_Explorer.hxx>
|
||||
#include <opencascade/gp_Pnt.hxx>
|
||||
#include <opencascade/gp_Ax1.hxx>
|
||||
#include <opencascade/gp_Dir.hxx>
|
||||
#include <opencascade/BRepAlgoAPI_Fuse.hxx>
|
||||
#include <opencascade/AIS_TexturedShape.hxx>
|
||||
#include <opencascade/Prs3d_Arrow.hxx>
|
||||
#include <opencascade/BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <opencascade/BRepPrimAPI_MakeCone.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_Transform.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <AIS_TexturedShape.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <QMessageBOx>
|
||||
#include <opencascade/StlAPI_Writer.hxx>
|
||||
#include <opencascade/AIS_ViewCube.hxx>
|
||||
#include <opencascade/AIS_Shape.hxx>
|
||||
#include <opencascade/Geom_Axis2Placement.hxx>
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <StlAPI_Writer.hxx>
|
||||
#include <AIS_ViewCube.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QColorDialog>
|
||||
#include <QStatusBar>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <opencascade/StepGeom_Axis2Placement3d.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
#include <QDebug>
|
||||
#include <opencascade/AIS_InteractiveObject.hxx>
|
||||
#include <opencascade/Aspect_DisplayConnection.hxx>
|
||||
#include <opencascade/Graphic3d_NameOfMaterial.hxx>
|
||||
#include <opencascade/OpenGl_GraphicDriver.hxx>
|
||||
#include <opencascade/OSD_Environment.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <QFileDialog>
|
||||
#include <opencascade/TCollection_AsciiString.hxx>
|
||||
#include <opencascade/StlAPI_Reader.hxx>
|
||||
#include <opencascade/AIS_Trihedron.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <StlAPI_Reader.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <QCheckBox>
|
||||
#include <QtWidgets>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_Copy.hxx>
|
||||
#include <opencascade/IGESControl_Reader.hxx>
|
||||
#include <opencascade/STEPControl_Reader.hxx>
|
||||
#include <opencascade/IGESControl_Writer.hxx>
|
||||
#include <opencascade/STEPControl_Writer.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <IGESControl_Reader.hxx>
|
||||
#include <STEPControl_Reader.hxx>
|
||||
#include <IGESControl_Writer.hxx>
|
||||
#include <STEPControl_Writer.hxx>
|
||||
#include <QMessageBox>
|
||||
#include <QtXml>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <QCloseEvent>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <QCommandLineParser>
|
||||
#include <QJSValueIterator>
|
||||
#include <opencascade/Geom_Plane.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <QSettings>
|
||||
|
||||
//======================================
|
||||
// 点云 pcl
|
||||
//======================================
|
||||
|
||||
#include <memory>
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QColor>
|
||||
#include <QComboBox>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFileDialog>
|
||||
#include <QFontComboBox>
|
||||
#include <QImage>
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QProgressDialog>
|
||||
#include <QRect>
|
||||
#include <QSettings>
|
||||
#include <QSpinBox>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextCharFormat>
|
||||
#include <QTime>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDateTime> //添加QDateTime头文件
|
||||
#include <QMovie>
|
||||
#include <QPixmap>
|
||||
#include <QSplashScreen>
|
||||
#include <QTextCodec>
|
||||
|
||||
// Point Cloud Library
|
||||
#include <QColorDialog>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/console/time.h>
|
||||
#include <pcl/filters/convolution_3d.h>
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/filters/radius_outlier_removal.h>
|
||||
#include <pcl/filters/statistical_outlier_removal.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
|
||||
#include <boost/random.hpp> //随机数
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <iostream>
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/features/normal_3d.h>
|
||||
#include <pcl/filters/bilateral.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/filters/fast_bilateral.h>
|
||||
#include <pcl/filters/fast_bilateral_omp.h>
|
||||
#include <pcl/filters/passthrough.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/io/ply_io.h>
|
||||
#include <pcl/kdtree/kdtree.h>
|
||||
#include <pcl/kdtree/kdtree_flann.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/registration/ia_fpcs.h> // 4PCS算法
|
||||
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
|
||||
#include <pcl/registration/icp.h>
|
||||
#include <pcl/registration/registration.h>
|
||||
#include <pcl/search/flann_search.h>
|
||||
#include <pcl/surface/concave_hull.h>
|
||||
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
|
||||
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
|
||||
#include <pcl/surface/marching_cubes_rbf.h>
|
||||
#include <pcl/surface/mls.h> //MLS
|
||||
#include <pcl/surface/poisson.h> //泊松重建
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <pcl/console/time.h> // TicToc
|
||||
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
|
||||
#include <pcl/filters/voxel_grid.h> // 体素滤波
|
||||
#include <vtkOutputWindow.h>
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
#include <pcl/filters/extract_indices.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法
|
||||
#include <pcl/sample_consensus/model_types.h> //模型定义
|
||||
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h> //rand()头文件
|
||||
#include <vtkMassProperties.h>
|
||||
#include <vtkPLYReader.h>
|
||||
#include <vtkSmartPointer.h>
|
||||
#include <vtkTriangleFilter.h>
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <iostream>
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/transforms.h>
|
||||
#include <pcl/features/moment_of_inertia_estimation.h>
|
||||
#include <pcl/filters/voxel_grid.h>
|
||||
#include <pcl/io/io.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
#include <pcl/visualization/pcl_visualizer.h>
|
||||
#include <string>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vtkAutoInit.h>
|
||||
//可视化相关头文件
|
||||
#include <vtkActor.h>
|
||||
#include <vtkAutoInit.h>
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
#include <vtkPolyDataMapper.h>
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkRenderWindow.h>
|
||||
#include <vtkRenderWindowInteractor.h>
|
||||
#include <vtkRenderer.h>
|
||||
// Boost
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
||||
// Visualization Toolkit (VTK)
|
||||
#include <vtkRenderWindow.h>
|
||||
#include "ui_pclvisualizer.h"
|
||||
#include "inputdialog.h"
|
||||
#include "BasePCL.h"
|
||||
#include "ToolDialog.h"
|
||||
#include "PointManagerClass.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QObject;
|
||||
|
||||
|
||||
|
|
|
@ -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})
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "OCCTModelOperator.h"
|
||||
#include <opencascade/BRepBuilderAPI_Transform.hxx>
|
||||
#include <opencascade/Bnd_Box.hxx>
|
||||
#include <opencascade/BRepBndLib.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
|
||||
OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "OCCTopoShapeTreeViewer.h"
|
||||
#include <qDebug>
|
||||
#include "SharedModuleLib/BaseUiTool.h"
|
||||
#include <opencascade/BRep_Tool.hxx>
|
||||
#include <opencascade/TopoDS_Vertex.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
|
||||
OCCTopoShapeTreeViewer::OCCTopoShapeTreeViewer(QWidget* parent)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "DocumentCommon.h"
|
||||
#include "Transparency.h"
|
||||
#include "AllHead.h"
|
||||
#include <opencascade/BRepBndLib.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
|
||||
#include "GeomWidget.h"
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QFrame>
|
||||
#include <QBoxLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QStackedLayout>
|
||||
#include <QToolBar>
|
||||
#include <QStackedWidget>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <opencascade/Quantity_Color.hxx>
|
||||
#include <opencascade/AIS_Shape.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
|
||||
|
||||
GeomWidget::GeomWidget (DocumentCommon* theDocument3d, QWidget* theParent)
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
#include "OCCViewer\View.h"
|
||||
#include "OCCViewer\DocumentCommon.h"
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#include <QGLWidget>
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <QtWidgets>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <opencascade/V3d_View.hxx>
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <opencascade/Graphic3d_GraphicDriver.hxx>
|
||||
#include <opencascade/OpenGl_GraphicDriver.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
//! Qt widget for organize 3D & 2D documents
|
||||
|
|
|
@ -26,15 +26,15 @@
|
|||
#include <exception>
|
||||
#include <stack>
|
||||
|
||||
#include <opencascade/AIS_ViewCube.hxx>
|
||||
#include <opencascade/Message.hxx>
|
||||
#include <opencascade/OSD_File.hxx>
|
||||
#include <opencascade/OSD_Path.hxx>
|
||||
#include <opencascade/OSD_Protection.hxx>
|
||||
#include <AIS_ViewCube.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <OSD_File.hxx>
|
||||
#include <OSD_Path.hxx>
|
||||
#include <OSD_Protection.hxx>
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QDir>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
const TCollection_AsciiString BaseSample::FILE_EXTENSION = "cxx";
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include <opencascade/AIS_InteractiveObject.hxx>
|
||||
#include <opencascade/NCollection_Vector.hxx>
|
||||
#include <opencascade/TCollection_AsciiString.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//! Base class for specified category classes
|
||||
class BaseSample: public Standard_Transient
|
||||
|
|
|
@ -21,59 +21,59 @@
|
|||
|
||||
#include "MakeBottle.h"
|
||||
|
||||
#include <opencascade/BRep_Tool.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <opencascade/BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
|
||||
#include <opencascade/BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <opencascade/BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
|
||||
#include <opencascade/BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
|
||||
#include <opencascade/BRepLib.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
|
||||
#include <opencascade/BRepOffsetAPI_MakeThickSolid.hxx>
|
||||
#include <opencascade/BRepOffsetAPI_ThruSections.hxx>
|
||||
#include <BRepOffsetAPI_MakeThickSolid.hxx>
|
||||
#include <BRepOffsetAPI_ThruSections.hxx>
|
||||
|
||||
#include <opencascade/BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
|
||||
#include <opencascade/GC_MakeArcOfCircle.hxx>
|
||||
#include <opencascade/GC_MakeSegment.hxx>
|
||||
#include <GC_MakeArcOfCircle.hxx>
|
||||
#include <GC_MakeSegment.hxx>
|
||||
|
||||
#include <opencascade/GCE2d_MakeSegment.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
|
||||
#include <opencascade/gp.hxx>
|
||||
#include <opencascade/gp_Ax1.hxx>
|
||||
#include <opencascade/gp_Ax2.hxx>
|
||||
#include <opencascade/gp_Ax2d.hxx>
|
||||
#include <opencascade/gp_Dir.hxx>
|
||||
#include <opencascade/gp_Dir2d.hxx>
|
||||
#include <opencascade/gp_Pnt.hxx>
|
||||
#include <opencascade/gp_Pnt2d.hxx>
|
||||
#include <opencascade/gp_Trsf.hxx>
|
||||
#include <opencascade/gp_Vec.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#include <opencascade/Geom_CylindricalSurface.hxx>
|
||||
#include <opencascade/Geom_Plane.hxx>
|
||||
#include <opencascade/Geom_Surface.hxx>
|
||||
#include <opencascade/Geom_TrimmedCurve.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
#include <opencascade/Geom2d_Ellipse.hxx>
|
||||
#include <opencascade/Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2d_Ellipse.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
|
||||
#include <opencascade/TopExp_Explorer.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <opencascade/TopoDS.hxx>
|
||||
#include <opencascade/TopoDS_Edge.hxx>
|
||||
#include <opencascade/TopoDS_Face.hxx>
|
||||
#include <opencascade/TopoDS_Wire.hxx>
|
||||
#include <opencascade/TopoDS_Shape.hxx>
|
||||
#include <opencascade/TopoDS_Compound.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <opencascade/TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
TopoDS_Shape MakeBottle (const Standard_Real theWidth,
|
||||
const Standard_Real theHeight,
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef MAKEBOTTLE_H
|
||||
#define MAKEBOTTLE_H
|
||||
|
||||
#include <opencascade/Standard_Macro.hxx>
|
||||
#include <opencascade/TopoDS_Shape.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//! Returns sample bottle TopoDS_Shape
|
||||
TopoDS_Shape MakeBottle(const Standard_Real theWidth,
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
|
||||
#include "MakeBottle.h"
|
||||
|
||||
#include <opencascade/AIS_Shape.hxx>
|
||||
#include <opencascade/AIS_ViewCube.hxx>
|
||||
#include <opencascade/OpenGl_GraphicDriver.hxx>
|
||||
#include <opencascade/V3d_SpotLight.hxx>
|
||||
#include <opencascade/V3d_PositionalLight.hxx>
|
||||
#include <opencascade/V3d_DirectionalLight.hxx>
|
||||
#include <opencascade/V3d_AmbientLight.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_ViewCube.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <V3d_SpotLight.hxx>
|
||||
#include <V3d_PositionalLight.hxx>
|
||||
#include <V3d_DirectionalLight.hxx>
|
||||
#include <V3d_AmbientLight.hxx>
|
||||
|
||||
void Viewer3dSamples::ExecuteSample(const TCollection_AsciiString& theSampleName)
|
||||
{
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "BaseSample.h"
|
||||
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <opencascade/V3d_View.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
//! Implements viewer 3D samples.
|
||||
class Viewer3dSamples : public BaseSample
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
#include "OcctHighlighter.h"
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QFont>
|
||||
#include <QStringList>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
#ifndef OCCTHIGHLIGHTER_H
|
||||
#define OCCTHIGHLIGHTER_H
|
||||
|
||||
#include <opencascade/Standard_Macro.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QRegExp>
|
||||
#include <QSyntaxHighlighter>
|
||||
#include <QString>
|
||||
#include <QTextDocument>
|
||||
#include <QTextCharFormat>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTextDocument;
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
#include "TranslateDialog.h"
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QGridLayout>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
TranslateDialog::TranslateDialog(QWidget* parent, Qt::WindowFlags flags, bool modal)
|
||||
: QFileDialog(parent, flags)
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
#ifndef TRANSLATEDIALOG_H
|
||||
#define TRANSLATEDIALOG_H
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
#include <QList>
|
||||
#include <QListView>
|
||||
#include <QShowEvent>
|
||||
#include <QWidget>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
//! Qt file dialog for save and restore sample files
|
||||
class TranslateDialog : public QFileDialog
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
|
||||
#include "Transparency.h"
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
DialogTransparency::DialogTransparency(QWidget* parent)
|
||||
: QDialog(parent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
#define TRANSPARENCY_H
|
||||
|
||||
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QDialog>
|
||||
#include <QSlider>
|
||||
#include <QWidget>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
class QSlider;
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
#if !defined _WIN32
|
||||
#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
|
||||
#endif
|
||||
#include <opencascade/AIS_ViewCube.hxx>
|
||||
#include <AIS_ViewCube.hxx>
|
||||
#include "OCCViewer\View.h"
|
||||
#include <opencascade/OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include "Transparency.h"
|
||||
#include <opencascade/WNT_Window.hxx>
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QApplication>
|
||||
#include <QBoxLayout>
|
||||
#include <QFileInfo>
|
||||
|
@ -39,15 +39,15 @@
|
|||
#include <QPainter>
|
||||
#include <QStyleFactory>
|
||||
#include <QDebug>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && QT_VERSION < 0x050000
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
|
||||
#include <opencascade/Aspect_DisplayConnection.hxx>
|
||||
#include <opencascade/Graphic3d_GraphicDriver.hxx>
|
||||
#include <opencascade/Graphic3d_TextureEnv.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_TextureEnv.hxx>
|
||||
|
||||
|
||||
namespace
|
||||
|
|
|
@ -26,18 +26,18 @@
|
|||
#include "AllHead.h"
|
||||
#include <functional>
|
||||
#include <QColor>
|
||||
#include <opencascade/Standard_WarningsDisable.hxx>
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QAction>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QWidget>
|
||||
#include <opencascade/Standard_WarningsRestore.hxx>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <opencascade/AIS_InteractiveContext.hxx>
|
||||
#include <opencascade/AIS_ViewController.hxx>
|
||||
#include <opencascade/V3d_View.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_ViewController.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <qDebug>
|
||||
|
||||
|
||||
|
|
|
@ -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<CloudPointItemClass> cloudItem(new CloudPointItemClass);
|
||||
QFileInfo fileinfo(filePathWithName);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "QtSARAntModelSetting.h"
|
||||
#include "AllHead.h"
|
||||
#include <QMessageBox>
|
||||
#include <opencascade/BRepBuilderAPI_MakeSolid.hxx>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <opencascade/BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include "OCCTBase.h"
|
||||
|
||||
antModelClass::antModelClass(QString filpath)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <complex>
|
||||
#include <QMap>
|
||||
|
||||
#include <opencascade/TopoDS.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
//-------------------- FEKO 基本参数 -------------------------
|
||||
enum FEKOCoordinateSystem {
|
||||
None,
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// 微波测量仿真分系统对外函数接口
|
||||
//
|
||||
#include "WBCLFZ.h"
|
||||
#include "AllHead.h"
|
||||
#include "referenceHeader.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace WBCLFZ{
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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<pcl::PointXYZRGBA>::Ptr ReadPointCloudFromFile(QString filename);
|
||||
|
||||
|
||||
};
|
||||
|
||||
// 属性表操作类
|
||||
class WBCLFZSystemModuleAPI sqlDBOperator {
|
||||
|
||||
};
|
||||
|
||||
// FEKO仿真操作类
|
||||
class WBCLFZSystemModuleAPI FekoSimulationOperator {
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace WBCLFZ
|
||||
#endif // LAMPCAE_WBCLFZ_H
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _WBCLFZSystemModule_H_
|
||||
#define _WBCLFZSystemModule_H_
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
|
||||
#if defined(WBCLFZSystemModule_API)
|
||||
#define WBCLFZSystemModuleAPI Q_DECL_EXPORT
|
||||
#else
|
||||
#define WBCLFZSystemModuleAPI Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -2,8 +2,8 @@
|
|||
#include "EchoShowProcess/FEKOResultImport.h"
|
||||
#include "TaskXml/TaskTreeClass.h"
|
||||
#include <QDebug>
|
||||
#include <opencascade/BRepPrimAPI_MakeBox.hxx>
|
||||
#include <opencascade/BRepOffsetAPI_DraftAngle.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepOffsetAPI_DraftAngle.hxx>
|
||||
|
||||
|
||||
ModelProcess::ModelProcess(QWidget *parent)
|
||||
|
|
Loading…
Reference in New Issue