Merge branch 'LAMPCAE-dev' into master

pull/2/head
chenzenghui 2024-07-23 14:18:10 +08:00
commit 494973e4d4
284 changed files with 26843 additions and 65665 deletions

View File

@ -1,7 +1,11 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="RIGHT_MARGIN" value="1000" />
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
<codeStyleSettings language="ObjectiveC">
<option name="RIGHT_MARGIN" value="1000" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -31,6 +31,25 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
#if(MSVC)
## add_definitions(-DPCL_NO_PRECOMPILE)
# # Visual Studio
# add_compile_options(/arch:AVX) # AVX
# # SSE2
## add_compile_options(/arch:SSE)
#
# # MARCH_NATIVE
# add_compile_options(/arch:AVX)
#elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# # GCC Clang
# add_compile_options(-mavx) # AVX
# # SSE
## set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
#
# # MARCH_NATIVE
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
#endif()
#-----------------------------------------------------------------------------
#
@ -88,6 +107,7 @@ if (POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif (POLICY CMP0091)
if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DUNICODE -D_UNICODE)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
@ -219,6 +239,8 @@ find_package(Python REQUIRED)
# OpenMesh
find_package(OpenMesh CONFIG REQUIRED)
# VCGLIB
find_path(VCGLIB_INCLUDE_DIRS "img/img.h")
@ -234,8 +256,16 @@ find_package(GDAL CONFIG REQUIRED)
# sqlite3
find_package(unofficial-sqlite3 CONFIG REQUIRED)
# openmesh
find_package(OpenMesh CONFIG REQUIRED)
# opencv
set(OpenCV_DIR "${VCPKG_INSTALLED_DIR}/x64-windows/share/opencv4")
find_package(OpenCV REQUIRED) # opencv
# QGIS
find_package(QGIS REQUIRED)
#find_package(QGIS REQUIRED)
message("CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}")
@ -253,6 +283,7 @@ include_directories(SYSTEM C:/PCL/include/pcl-1.14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Test Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization Network)
# PCL
find_package(PCL)
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${VCGLIB_INCLUDE_DIRS})

View File

@ -18,22 +18,12 @@
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"hidden": true,
"name": "Qt-Default",
"inherits": "5.15.2_msvc2019_64",
"vendor": {
"qt-project.org/Default": {
"checksum": "hFHqn7KAkQOhAQUh9kbJbv7R0NY="
}
}
},
{
"hidden": true,
"name": "5.15.2_msvc2019_64",
"inherits": "Qt",
"environment": {
"QTDIR": "C:/QT/5.15.2/MSVC2019_64"
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
@ -42,14 +32,60 @@
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "ptcEk6DrMo+x2qNR/kb8KvrnFFM="
"checksum": "YNIStcUN4HHJp37D1czaJOv62js="
}
}
},
{
"hidden": true,
"name": "Qt-Default",
"inherits": "qt5_applications_Qt",
"vendor": {
"qt-project.org/Default": {
"checksum": "vWQZGf1EL41MrzRk0/XOL4RtG+o="
}
}
},
{
"hidden": true,
"name": "qt5_applications_Qt",
"inherits": "Qt",
"environment": {
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "T2tyAvOKmucIMsIcfejT0g5G9Ak="
}
}
},
{
"hidden": true,
"name": "tools_qt5",
"inherits": "Qt",
"environment": {
"QTDIR": "D:/vcpkg/installed/x64-windows"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"generator": "Ninja",
"vendor": {
"qt-project.org/Version": {
"checksum": "NXPzuLDKd0Ogh1d8A052mZcXNgE="
}
}
}
],
"vendor": {
"qt-project.org/Presets": {
"checksum": "phjq3Wa78xncEM1Mjqgn2bZOHPo="
"checksum": "qqdzywvCP+sXDFmqOD/r0r4I9nM="
}
}
}

View File

@ -216,8 +216,8 @@
</message>
<message>
<location line="+56"/>
<source>Canvas %1mm * %2mm </source>
<translation> %1mm * %2mm </translation>
<source>Canvas %1m * %2m </source>
<translation> %1m * %2m </translation>
</message>
</context>
<context>

View File

@ -30,15 +30,6 @@
#### Windows
- <a href="https://www.bilibili.com/video/BV1U24y1R73n/" target="_blank">cmake 3.24.1 + Visual Studio Community 2017</a>
- <a href="https://www.bilibili.com/video/BV1FX4y1y7T4/" target="_blank">QtCreator编译</a>
#### Linux
- <a href="https://www.bilibili.com/video/BV1iW4y1Y79p/" target="_blank">cmake + GNU GCC + make</a>
- <a href="https://www.bilibili.com/video/BV1xd4y1q7Cm/" target="_blank">借助vscode构建、编译、安装、打包</a>
### 编译说明
- windows环境下使用vscode时编译工具链只能使用Visual Studio目前不支持MinGW工具
@ -69,21 +60,16 @@
### extlib获取方式
### Linux系统
```bash
git clone https://gitee.com/DISOGitee/LAMPCAELinuxExtlib.git extlib
```
### windows系统
extlib文件变更
1. OCCT 7.6.5 VTK 9.3 注意OCCT 依赖 VTK, 因此需要重新编译OCCT
2. QWT 升级到 6.2.0qwtpolar 内嵌到了qwt中需要重新编译
3. python 升级到的 3.11.5
4. 增加了QGIS 3.26 cmake,为后期引入raster处理进行准备
```bash
git clone https://gitee.com/DISOGitee/LAMPCAEWinExtlib.git extlib
```
## 编译打包
项目采用cmake构建系统组织代码可以直接使用cmake转换visual studio 2017工程或者生成Makefile文件或者可以直接使用支持cmake系统的IDE比如vscode、clion、visual studio、qtcreator等打开项目文件夹进行构建、编译。
@ -138,20 +124,8 @@ cmake --build build --target package
## 测试平台
| 序号 | 操作系统 | GLIBC版本 | 编译器 | Qt | 测试结果 | 备注 |
| :--: | :-----------: | :-------: | :---------: | :--: | :--: | :--: |
| 1 | Ubuntu18.04 | 2.27 | GNU GCC 7.5.0 | Qt5.14.2 | 通过 | |
| 2 | Ubuntu20.04 | 2.31 | GNU GCC 9.4.0 | Qt5.14.2 | 通过 | |
| 3 | Ubuntu22.04 | 2.35 | GNU GCC 11.2.0 | Qt5.14.2 | 通过 | deb成功打包 |
| 4 | CentOS 7.0.1406 | 2.17 | GNU GCC 8.3.1 | Qt5.14.2 | 通过 | 借助devtoolset-8升级GCC |
| 5 | CentOS 7.9.2009 | 2.17 | GNU GCC 7.5.0 | Qt5.14.2 | 通过 | |
| 6 | CentOS 8.5.2111 | 2.28 | GNU GCC 8.5.0 | Qt5.14.2 | 通过 | rpm成功打包 |
| 7 | RedHat Server 7.0 | | | | | 待测试 |
| 8 | RedHat 8.1 | 2.28 | GNU GCC 8.5.0 | Qt5.14.2 | 通过 | |
| 9 | RedHat 9.0 | | | | | 待测试 |
| 10 | Windows7 X64 | 无 | Visual Studio 2017 Community | Qt5.14.2 | 通过 | VS附带安装Windows 8.1SDK |
| 11 | Windows10 X64 | 无 | Visual Studio 2017 Community | Qt5.14.2 | 通过 | SDK 10.0.17763.0NSIS成功打包 |
| 12 | deepin 20.7社区版 | | | | | 待测试 |
| 13 | ubuntukylin 22.04 | 2.35 | GNU GCC 11.2.0 | Qt5.14.2 | 通过 | 基于Ubuntu22.04 |
|:--:| :-----------: | :-------: | :---------: | :--: | :--: | :--: |
| 1 | Windows10 X64 | 无 | Visual Studio 2022 Community | Qt5.15.5 | 通过 | SDK 10.0.17763.0NSIS成功打包 |
## 相关链接
@ -172,4 +146,4 @@ cmake --build build --target package
技术交流QQ群671925863
官方微信号LAMPCAE-DISO

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
[General]
CoordinateSystemName="Spheric(R,theta,phi)"
description=R半径theta 入射角phi 方位角
A1="9.3,90,0"
A2="9.3,90,180"
S1="9.3,45,14"
S3="9.3,45,45"
S5="9.3,45,60"
S8="9.3,45,120"
S10="9.3,45,135"
S12="9.3,45,166"
F1="9.3,75,15"
F2="9.3,75,30"
F3="9.3,75,45"
F4="9.3,75,60"
F5="9.3,75,75"
F6="9.3,75,86"
F7="9.3,75,94"
F8="9.3,75,105"
F9="9.3,75,120"
F10="9.3,75,135"
F11="9.3,75,151"
F12="9.3,75,165"

View File

@ -24,7 +24,11 @@
##
##
##
if(LAMPCAE_QGIS_ALREADY_INCLUDED)
return()
endif()
set(LAMPCAE_QGIS_ALREADY_INCLUDED 1)
#
SET(QGISPROGRAMFILES ${CMAKE_SOURCE_DIR}/extlib) # qgis
SET(OSGEO4W_QGIS_SUBDIR QGIS) # qgis
@ -220,4 +224,3 @@ set_target_properties(QGIS::Analysis PROPERTIES
IMPORTED_IMPLIB_DEBUG "${QGISPROGRAMFILES}/QGIS/lib/qgis_analysis.lib"
IMPORTED_LOCATION_DEBUG "${QGISPROGRAMFILES}/QGIS/bin/qgis_analysis.dll"
)

View File

@ -1,196 +0,0 @@
{
"dependencies": [
{
"name": "embree3",
"platform": "x64"
},
{
"name": "cgns",
"platform": "x64"
},
{
"name": "icu",
"platform": "x64"
},
{
"name": "gdal",
"platform": "x64"
},
{
"name": "zlib",
"platform": "x64"
},
{
"name": "cgal",
"platform": "x64"
},
{
"name": "openmesh",
"platform": "x64"
},
{
"name": "eigen3",
"platform": "x64"
},
{
"name": "mathgl",
"platform": "x64"
},
{
"name": "boost",
"platform": "x64"
},
{
"name": "openmesh",
"platform": "x64"
},
{
"name": "opencv4",
"platform": "x64"
},
{
"name": "opencv3",
"platform": "x64"
},
{
"name": "fftw3",
"platform": "x64"
},
{
"name": "vcglib",
"platform": "x64"
},
{
"name": "netcdf-c",
"platform": "x64"
},
{
"name": "netcdf-cxx4",
"platform": "x64"
},
{
"name": "rapidxml",
"platform": "x64"
},
{
"name": "gsl",
"platform": "x64"
},
{
"name": "tbb",
"platform": "x64"
},
{
"name": "openctm",
"platform": "x64"
},
{
"name": "levmar",
"platform": "x64"
},
{
"name": "libigl",
"platform": "x64"
},
{
"name": "openctm",
"platform": "x64"
},
{
"name": "tinygltf",
"platform": "x64"
},
{
"name": "glew",
"platform": "x64"
},
{
"name": "mpfr",
"platform": "x64"
},
{
"name": "atl",
"platform": "x64"
},
{
"name": "atlmfc",
"platform": "x64"
},
{
"name": "blas",
"platform": "x64"
},
{
"name": "lapack",
"platform": "x64"
},
{
"name": "gmp",
"platform": "x64"
},
{
"name": "qhull",
"platform": "x64"
},
{
"name": "xerces-c",
"platform": "x64"
},
{
"name": "tinyxml",
"platform": "x64"
},
{
"name": "libsvm",
"platform": "x64"
},
{
"name": "libkml",
"platform": "x64"
},
{
"name": "mpi",
"platform": "x64"
},
{
"name": "hdf5",
"platform": "x64"
},
{
"name": "muparser",
"platform": "x64"
},
{
"name": "glfw3",
"platform": "x64"
},
{
"name": "expat",
"platform": "x64"
},
{
"name": "libgeotiff",
"platform": "x64"
},
{
"name": "tiff",
"platform": "x64"
},
{
"name": "flann",
"platform": "x64"
},
{
"name": "gmsh",
"platform": "x64"
},
{
"name": "freetype",
"platform": "x64"
}
],
"overrides":[
],
"builtin-baseline": "cf4ebef2294e164875ce17d7937f44d3e3ea156e"
}

View File

@ -5,8 +5,8 @@ set(SOVERSION ${PROJECT_VERSION} ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINO
#
#-----------------------------------------------------------------------------
list(APPEND _libraries BaseCppLibrary 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 PointCloudOperator )
list(APPEND _libraries json qcustomplot qhexedit qscintilla2 llqgisbaselib)
list(APPEND _libraries PointCloudOperator)
list(APPEND _libraries json qcustomplot qhexedit qscintilla2 )
#[[if(_WIN_)
list(APPEND _libraries XGenerateReport License)
@ -33,7 +33,8 @@ list(APPEND LAMPCAE_Runtimes_Libraries Qt5::Qml Qt5::Network )
list(APPEND LAMPCAE_Runtimes_Libraries
OpenCASCADE::TKOpenGl OpenCASCADE::TKOffset OpenCASCADE::TKSTL 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
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
QGIS::App QGIS::Core QGIS::Gui QGIS::Analysis
${OpenCV_LIBRARIES}
OpenMeshCore OpenMeshTools
)
@ -60,6 +61,32 @@ foreach(_library ${_libraries})
endforeach()
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
list(APPEND _TestPlugins PointMeshAlgorithm)
foreach(_TestPlugin ${_TestPlugins})
list(APPEND LAMPCAE_TEST_Libraries ${LAMPCAE_${_TestPlugin}_Runtimes_Libraries})
add_subdirectory(${_TestPlugin})
set_target_properties(${_TestPlugin} PROPERTIES
MACOSX_RPATH ON
SKIP_BUILD_RPATH OFF
BUILD_WITH_INSTALL_RPATH ON
INSTALL_RPATH "${_lib_rpath}"
INSTALL_RPATH_USE_LINK_PATH ON
#POSITION_INDEPENDENT_CODE 1
#OUTPUT_NAME $<LOWER_CASE:${_library}>
#DEBUG_POSTFIX "_d"
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
FOLDER Modules
)
endforeach()
#-----------------------------------------------------------------------------
# LAMPCAE
#-----------------------------------------------------------------------------

View File

@ -1,9 +1,17 @@
#include "DebugLogger.h"
#include <boost/stacktrace.hpp>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <windows.h>
#include <dbghelp.h>
#include <stdio.h>
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define filename(x) strrchr(x, '\\') ? strrchr(x, '\\') + 1 : x
#else
@ -11,6 +19,14 @@
#endif
namespace Common {
void function_to_trace() {
std::cout << "Stack trace:" << std::endl;
std::cout << boost::stacktrace::stacktrace() << std::endl;
}
void DebugLogger::info(const char* file, int line, const char* format, ...)
{
va_list args;

View File

@ -25,8 +25,12 @@
#include "CommonAPI.h"
#include <cstdarg>
namespace Common {
class COMMONAPI DebugLogger {
public:
@ -42,6 +46,7 @@ namespace Common {
static char* currentTime();
static void output(const char* file, int line, const char* format, int level, va_list args);
};
void COMMONAPI function_to_trace();
} // namespace Common
// 用宏OUTPUT_DEBUG_INFO控制调试信息是否输出的开关

View File

@ -2,8 +2,8 @@
#define GEOON true;
#define GEOOFF false;
#define GEOIMPORT "stp;step;igs;iges;brep"
#define GEOEXPORT "stp;step;igs;iges;brep"
#define GEOIMPORT "stp;step;igs;iges;brep;stl"
#define GEOEXPORT "stp;step;igs;iges;brep;stl"
namespace ConfigOption
{

View File

@ -1,6 +1,6 @@
#include "MeshConfig.h"
#include <QDebug>
#include "Common/DebugLogger.h"
#define MESHON true;
#define MESHOFF false;
#define MESHIMPORT "cgns;msh;neu;stl;dat;vtk;inp"
@ -64,6 +64,7 @@ namespace ConfigOption
void MeshConfig::setImportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/)
{
// Common::function_to_trace();
switch(type) {
case MeshDataType::None :{
break;
@ -102,6 +103,7 @@ namespace ConfigOption
void MeshConfig::setExportSuffix(QString s,MeshDataType type/*=MeshDataType::vtkMesh*/)
{
switch(type) {
case MeshDataType::None :{
break ;

View File

@ -7,6 +7,7 @@
#include "GeometryDataExchange/STEPdataExchange.h"
#include "GeometryDataExchange/GeometryThreadBase.h"
#include "ModuleBase/ThreadControl.h"
#include "GeometryDataExchange/STLdataExchange.h"
#include <QFileInfo>
namespace Command
@ -112,6 +113,12 @@ namespace Command
connect(brepReader, SIGNAL(ShowSetSig(Geometry::GeometrySet *, bool)), this, SIGNAL(showSet(Geometry::GeometrySet *, bool)));
emit tc->threadStart(); // emit brepReader->start();
}
else if(suffix=="stl"){
auto stlReader = new Geometry::STLdataExchange(fileName, Geometry::GEOMETRY_READ, _mw, _resSet);
ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(stlReader);
connect(stlReader, SIGNAL(ShowSetSig(Geometry::GeometrySet *, bool)), this, SIGNAL(showSet(Geometry::GeometrySet *, bool)));
emit tc->threadStart(); // emit stlReader->start();
}
}
return true;
}
@ -143,6 +150,13 @@ namespace Command
connect(brepReader, SIGNAL(ShowSetSig(Geometry::GeometrySet *, bool)), this, SIGNAL(showSet(Geometry::GeometrySet *, bool)));
emit tc->threadStart(); // emit brepReader->start();
}
else if(suffix=="stl")
{
auto stlReader = new Geometry::STLdataExchange(_exportfile, Geometry::GEOMETRY_WRITE, _mw, _resSet);
ModuleBase::ThreadControl *tc = new ModuleBase::ThreadControl(stlReader);
connect(stlReader, SIGNAL(ShowSetSig(Geometry::GeometrySet *, bool)), this, SIGNAL(showSet(Geometry::GeometrySet *, bool)));
emit tc->threadStart(); // emit stlReader->start();
}
return true;
}

View File

@ -30,7 +30,7 @@ target_compile_definitions(GeometryDataExchange PRIVATE "GEOMETRYDATAEXCHANGE_AP
list(APPEND _depend_library Common PythonModule DataProperty Geometry ModuleBase)
list(APPEND _runtimes_libraries
OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKIGES OpenCASCADE::TKMath OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKXSBase OpenCASCADE::TKernel 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::IOGeometry 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
OpenCASCADE::TKSTL OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKIGES OpenCASCADE::TKMath OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKXSBase OpenCASCADE::TKernel 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::IOGeometry 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
)
#-----------------------------------------------------------------------------

View File

@ -3,7 +3,12 @@
#include "Geometry/geometryData.h"
#include <QFileInfo>
#include <vtkSTLReader.h>
#include <TopoDS_Shape.hxx>
#include <StlAPI_Reader.hxx>
#include <StlAPI_Writer.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <QDebug>
namespace Geometry
{
STLdataExchange::STLdataExchange(const QString & fileName, GeometryOperation operation,
@ -31,7 +36,7 @@ namespace Geometry
break;
case GEOMETRY_WRITE:
emit showInformation(tr("Export Geometry File From \"%1\"").arg(_fileName));
// _isWrite = writeBrep();
_isWrite = writeSTL();
break;
}
deriveGeometryTaskFinished();
@ -39,28 +44,55 @@ namespace Geometry
bool STLdataExchange::readSTL()
{
std::string str = _fileName.toStdString();
const char* c_fn = str.c_str();
auto reader = vtkSTLReader::New();
reader->SetFileName(c_fn);
reader->Update();
auto stlTris = reader->GetOutput();
const int nt = stlTris->GetNumberOfCells();
if (nt > 0)
QFileInfo info(_fileName);
const QString name = info.fileName();
StlAPI_Reader reader;
TopoDS_Shape stlshape;
Standard_Boolean readok=reader.Read(stlshape, _fileName.toLocal8Bit().constData());
qDebug()<<"read stl to memory success or not: "<<readok;
if (readok)
{
auto geoSet = new GeometrySet(STL);
vtkPolyData* p = vtkPolyData::New();
p->DeepCopy(stlTris);
geoSet->setPoly(p);
QFileInfo info(_fileName);
const QString name = info.fileName();
TopoDS_Shape *sh = new TopoDS_Shape;
*sh = stlshape;
geoSet->setShape(sh);
geoSet->setName(name);
GeometryData::getInstance()->appendGeometrySet(geoSet);
getResult().append(geoSet);
}
reader->Delete();
}else{
return nt > 0;
}
return readok;
}
bool STLdataExchange::writeSTL()
{
StlAPI_Writer stlWriter;
Geometry::GeometryData *data = Geometry::GeometryData::getInstance();
const int nset = data->getGeometrySetCount();
bool success = false;
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound(compound);
for (int i = 0; i < nset; ++i)
{
GeometrySet *set = data->getGeometrySetAt(i);
if (set == nullptr)
continue;
if(set->isVisible()){
continue;
}
TopoDS_Shape *shape = set->getShape();
builder.Add(compound, *shape);
success = true;
}
if (!success)
return false;
success=stlWriter.Write(compound, _fileName.toLocal8Bit().constData());
// success = stpWriter.Write(_fileName.toStdString().c_str());
return success;
}
void STLdataExchange::deriveGeometryTaskFinished()
@ -75,7 +107,6 @@ namespace Geometry
msg.type = Common::Message::Normal;
msg.message = QString("Successful Import Geometry From \"%1\"").arg(_fileName);
auto result = getResult();
for (auto set : result)
{
if (set != result.last())
@ -106,6 +137,7 @@ namespace Geometry
}
emit showGeometryMessageSig(msg);
defaultGeometryFinished();
qDebug()<<"stl read or write finished !!!";
}
}

View File

@ -47,7 +47,7 @@ namespace Geometry
private:
bool readSTL();
bool writeSTL();
void deriveGeometryTaskFinished();
private:
@ -71,8 +71,6 @@ namespace Geometry
* @since 2.5.0
*/
bool _isWrite{ false };
};

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SketchPointWidget</class>
<widget class="QDialog" name="SketchPointWidget">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>205</width>
<height>129</height>
<height>155</height>
</rect>
</property>
<property name="windowTitle">
@ -39,7 +39,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -64,7 +64,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBox</class>
<widget class="QDialog" name="CreateBox">
@ -84,7 +84,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -102,7 +102,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -120,7 +120,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateBoxComplex</class>
<widget class="QDialog" name="CreateBoxComplex">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>536</width>
<height>421</height>
<height>499</height>
</rect>
</property>
<property name="windowTitle">
@ -61,7 +61,7 @@
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -86,7 +86,7 @@
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -111,7 +111,7 @@
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -147,7 +147,7 @@
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -172,7 +172,7 @@
<item>
<widget class="QLabel" name="label_21">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -197,7 +197,7 @@
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -222,7 +222,7 @@
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -247,7 +247,7 @@
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -284,7 +284,7 @@
</sizepolicy>
</property>
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -309,7 +309,7 @@
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateCone</class>
<widget class="QDialog" name="CreateCone">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>307</height>
<height>367</height>
</rect>
</property>
<property name="windowTitle">
@ -75,7 +75,7 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxR2">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>100000000000000004384584304507619735463404765184.000000000000000</double>
@ -92,7 +92,7 @@
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxL">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>10000000000.000000000000000</double>
@ -105,7 +105,7 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxR">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>9999999999999999932209486743616279764617084419440640.000000000000000</double>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateCylinder</class>
<widget class="QDialog" name="CreateCylinder">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>292</height>
<height>336</height>
</rect>
</property>
<property name="windowTitle">
@ -68,7 +68,7 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxR">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>100000000000.000000000000000</double>
@ -88,7 +88,7 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxL">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>10000000000.000000000000000</double>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateCylindricalComplex</class>
<widget class="QDialog" name="CreateCylindricalComplex">
@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>355</width>
<height>420</height>
<width>356</width>
<height>426</height>
</rect>
</property>
<property name="windowTitle">
@ -53,7 +53,7 @@
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -74,7 +74,7 @@
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -95,7 +95,7 @@
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -125,7 +125,7 @@
<item>
<widget class="QLabel" name="label_13">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -146,7 +146,7 @@
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -167,7 +167,7 @@
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -188,7 +188,7 @@
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -222,7 +222,7 @@
</sizepolicy>
</property>
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreatePoint</class>
<widget class="QDialog" name="CreatePoint">
@ -84,7 +84,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -102,7 +102,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -120,7 +120,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateSphere</class>
<widget class="QDialog" name="CreateSphere">
@ -68,7 +68,7 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxR">
<property name="suffix">
<string>mm</string>
<string>m</string>
</property>
<property name="maximum">
<double>100000000000.000000000000000</double>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateChamferDialog</class>
<widget class="QDialog" name="CreateChamferDialog">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>225</height>
<height>261</height>
</rect>
</property>
<property name="windowTitle">
@ -110,7 +110,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -135,7 +135,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateFilterDialog</class>
<widget class="QDialog" name="CreateFilterDialog">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>171</height>
<height>200</height>
</rect>
</property>
<property name="windowTitle">
@ -86,7 +86,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -317,7 +317,7 @@
</size>
</property>
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -426,7 +426,7 @@
</size>
</property>
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -535,7 +535,7 @@
</size>
</property>
<property name="text">
<string>mm^2</string>
<string>m^2</string>
</property>
</widget>
</item>
@ -644,7 +644,7 @@
</size>
</property>
<property name="text">
<string>mm^3</string>
<string>m^3</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VariableFilletDialog</class>
<widget class="QDialog" name="VariableFilletDialog">
@ -89,7 +89,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -228,7 +228,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>geoPointWidget</class>
<widget class="QWidget" name="geoPointWidget">
@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>646</width>
<height>98</height>
<height>116</height>
</rect>
</property>
<property name="windowTitle">
@ -35,7 +35,7 @@
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -60,7 +60,7 @@
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>
@ -85,7 +85,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>mm</string>
<string>m</string>
</property>
</widget>
</item>

View File

@ -125,7 +125,7 @@ std::set<vtkIdType> vtkDataRelated::GetCoplanarPointId(vtkDataSet *data, vtkIdTy
std::set<VTKIDPAIR> seedNeibors = GetNeighborPointID(polyData, pSeedId);
vtkSmartPointer<vtkDataArray> pointNormals = GetVTKDataNormals(polyData, 0)->GetPointData()->GetNormals();
if (pointNormals->GetNumberOfTuples() == 0) return coplanarPointIds;
if (pointNormals==nullptr == 0) return coplanarPointIds;
coplanarPointIds.insert(pSeedId);
VTKIDPAIR inverse, self{ pSeedId, pSeedId };

View File

@ -1,24 +1,7 @@
/**
* @file main.cpp
* @brief LAMPCAE
* @author LAMPCAE(LAMPCAE@diso.cn)
* @version 2.5.0
* @date 2022-02-13 15:34
* @copyright Copyright (c) Since 2020 All rights reserved.
*
* ============================================================================
* Program: LAMPCAE
*
* Copyright (c) Since 2020 All rights reserved.
* See License or http://www.LAMPCAE.com/ for details.
*
* BSD 3-Clause License
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* ==================================================================================
*/
#include "CommandLine.h"
#include "LAMPCAEVersionMacros.h"

View File

@ -31,6 +31,12 @@ add_library(MainWidgets
${_interface}
${_header}
${_source}
fekocadTaskinit.cpp
fekocadTaskinit.h
fekocadTaskinit.ui
createfekocadmodel.cpp
createfekocadmodel.h
createfekocadmodel.ui
)
@ -47,14 +53,18 @@ endif()
list(APPEND _runtimes_libraries
OpenCASCADE::Freetype OpenCASCADE::TKBRep OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIVtk OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKernel 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::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersModeling 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::RenderingGL2PSOpenGL2 VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib
OpenMeshCore OpenMeshTools
)
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(MainWidgets PRIVATE
${_runtimes_libraries}
${_depend_library}
)
#-----------------------------------------------------------------------------

View File

@ -47,6 +47,8 @@ namespace MainWidget
repaintTitleBar();
_ui->propTabWidget->tabBar()->hide(); // 属性接口
MainWidgetPy::init(mainwindow, this, _geometryWidget, _meshWidget, _physicsWidget);
connect(_meshWidget,SIGNAL(ToOCCTItemSIGNAL(MeshData::MeshKernal *)),this,SIGNAL(MeshToGeometrySig(MeshData::MeshKernal *)));
}
ControlPanel::~ControlPanel()
@ -278,5 +280,21 @@ namespace MainWidget
_paraWidget = nullptr;
}
}
void ControlPanel::setphysicsTab(bool flag) {
_ui->projectTab->setTabVisible(2,flag);
}
void ControlPanel::setpostTab(bool flag) {
_ui->projectTab->setTabVisible(3, flag);
}
void ControlPanel::setplotTab(bool flag) {
_ui->projectTab->setTabVisible(4, flag);
}
size_t ControlPanel::getTabCount()
{
return _ui->projectTab->count();
}
}

View File

@ -9,6 +9,7 @@ libaojun
#include "mainWidgetsAPI.h"
#include "ModuleBase/dockWidgetBase.h"
#include "MeshData/meshKernal.h"
class PipelineObjTreeDockWidget;
class PipelineObjPropDockWidget;
@ -60,6 +61,7 @@ namespace MainWidget
signals:
void updateActionStates();
void MeshToGeometrySig(MeshData::MeshKernal *);
// void updataPropertyTab(DataProperty::DataBase* popList);
public:
@ -83,6 +85,14 @@ namespace MainWidget
//设置当前窗口
void setCurrentWidget(QWidget *w);
// 关闭算法接口
void setphysicsTab(bool flag);
// 关闭后处理接口
void setpostTab(bool flag);
// 关闭绘图接口
void setplotTab(bool flag);
size_t getTabCount();
Post::PostTreeWidget *getPostTreeWidget();
public slots:
//鼠标点击事件,包括左键单击双击及右键菜单

View File

@ -49,13 +49,13 @@ namespace MainWidget
if (_isGeo)
_ui->ConplanarCheckBox->setCheckable(false);
if (_model == ModuleBase::MeshNode || _model == ModuleBase::BoxMeshNode)
if (_model == ModuleBase::MeshNode || _model == ModuleBase::BoxMeshNode||_model==ModuleBase::BoxMeshSurfaceNode)
{
_ui->typeComboBox->setCurrentIndex(0);
_ui->label_id->setText(tr("PointId : "));
_ui->typeComboBox->setEnabled(false);
}
else if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell)
else if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell||_model==ModuleBase::BoxMeshSurfaceCell)
{
_ui->typeComboBox->setCurrentIndex(1);
_ui->label_id->setText(tr("CellId : "));
@ -289,7 +289,7 @@ namespace MainWidget
QString idstring = memList.join(";"); // id 节点列表
QString type = "Node";
if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell)
if (_model == ModuleBase::MeshCell || _model == ModuleBase::BoxMeshCell||_model==ModuleBase::BoxMeshSurfaceCell)
type = "Element";
QString name = this->getNameFromUi();
QString code = QString("MainWindow.createSet(\"%1\",\"%2\",\"%3\")").arg(name).arg(type).arg(idstring);

View File

@ -22,7 +22,9 @@ namespace MainWidget {
DialogSelectMeshDataComponents::DialogSelectMeshDataComponents(GUI::MainWindow* parent)
: QFDialog(parent)
,_ui(new Ui::DialogSelectMeshDataComponents)
{
_ui->setupUi(this);
setWindowTitle(tr("Select Components"));

View File

@ -16,7 +16,7 @@ MainWidget::DialogVTKTransform::DialogVTKTransform(GUI::MainWindow *parent) : QF
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Mesh Modeling"));
setWindowTitle(tr("Mesh Transform"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
disabledCustomRotateAxisSlot();

View File

@ -323,6 +323,9 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<number>-1000000000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
@ -361,6 +364,9 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<number>-1000000000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
@ -399,6 +405,9 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<number>-1000000000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
@ -483,6 +492,9 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-10000000000000000139372116959414099130712064.000000000000000</double>
</property>
<property name="maximum">
<double>10000000000000000139372116959414099130712064.000000000000000</double>
</property>
@ -521,6 +533,9 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-10000000000000000139372116959414099130712064.000000000000000</double>
</property>
<property name="maximum">
<double>10000000000000000139372116959414099130712064.000000000000000</double>
</property>
@ -559,8 +574,11 @@
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-10000000000000000139372116959414099130712064.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
<double>10000000000000000139372116959414099130712064.000000000000000</double>
</property>
</widget>
</item>
@ -618,12 +636,18 @@
<height>25</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
@ -659,12 +683,18 @@
<height>25</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
@ -700,12 +730,18 @@
<height>25</height>
</size>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
</layout>

View File

@ -174,6 +174,7 @@ namespace MainWidget
void MeshWidget::contextMenuEvent(QContextMenuEvent *event)
{
qDebug()<<"MeshWidget::contextMenuEvent(QContextMenuEvent *)";
Q_UNUSED(event)
_currentItem = currentItem();
if (_currentItem == nullptr)
@ -188,10 +189,15 @@ namespace MainWidget
edit->setVisible(isMeshEditable());
action = pop_menu.addAction(QIcon(), tr("Rename"));
connect(action, SIGNAL(triggered()), this, SLOT(rename()));
if (_currentItem->type() == MeshChild)
{
action = pop_menu.addAction(QIcon(), tr("Remove"));
connect(action, SIGNAL(triggered()), this, SLOT(removeMeshData()));
//
// action=pop_menu.addAction(QIcon(),tr("ToOCCT"));
// connect(action, SIGNAL(triggered()), this, SLOT(ToOCCTItemSLOT()));
}
else if (_currentItem->type() == MeshSetChild)
{
@ -472,4 +478,23 @@ namespace MainWidget
// emit clearHighLight();
}
void MeshWidget::ToOCCTItemSLOT() {
_currentItem = currentItem();
if (_currentItem == nullptr)
return;
int index = _meshRoot->indexOfChild(_currentItem);
if (index >= 0)
{
MeshData::MeshKernal *k = _data->getKernalAt(index);
if (k == nullptr)
return;
emit this->ToOCCTItemSIGNAL(k);
return;
}
}
}

View File

@ -63,6 +63,8 @@ namespace MainWidget
void removeCaseComponentSig(int componentID);
//重命名算例中的项(组件item和边界item)
void renameCaseComponentSig(int componentID);
// 模型转换
void ToOCCTItemSIGNAL(MeshData::MeshKernal* curItem);
// void showDialog(QDialog*);
@ -105,6 +107,7 @@ namespace MainWidget
*/
void removeVisibleMesh();
void ToOCCTItemSLOT();
private:
void contextMenuEvent(QContextMenuEvent *event) override;
bool isMeshEditable();

View File

@ -0,0 +1,222 @@
/**
* @file createfekocadmodel.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_CreateFEKOCADModel.h"
// resolved
#include "createfekocadmodel.h"
#include "ui_CreateFEKOCADModel.h"
#include "Settings/BusAPI.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QTextStream>
#include <QDebug>
#include <QProcess>
namespace MainWidget {
CreateFEKOCADModel::CreateFEKOCADModel(QWidget* parent)
: QDialog(parent)
, ui(new Ui::CreateFEKOCADModel)
{
ui->setupUi(this);
connect(ui->pushButton_OpenAntParams, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_OpenAntParams()));
connect(ui->pushButton_OpenLoadModel, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_OpenLoadModel()));
connect(ui->pushButton_SettingName, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_SettingName()));
connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_add()));
connect(ui->pushButton_Delete, SIGNAL(clicked()), this, SLOT(onclicked_pushButton_Delete()));
}
CreateFEKOCADModel::~CreateFEKOCADModel()
{
delete ui;
}
void CreateFEKOCADModel::setSTLFilePathList(const QStringList& stlfilePathList) {
for(QString filepath:stlfilePathList){
ui->listWidget->addItem(filepath);
}
}
void CreateFEKOCADModel::onclicked_pushButton_SettingName() {
QString cfxNamePath=QFileDialog::getSaveFileName(
this, // Parent widget
tr(u8"选择cfx工程作为模版"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("CFX Files (*.cfx)") // File filter
);
ui->lineEdit->setText(cfxNamePath);
}
void CreateFEKOCADModel::onclicked_pushButton_add() {
QStringList fileNames= QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择模型"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("STL(*.stl);;IGES Files (*.iges);;IGES Files (*.igs)") // File filter
);
// Add the selected file paths to the list widget
for (const QString &fileName : fileNames) {
ui->listWidget->addItem(fileName);
}
// Update the working directory
}
void CreateFEKOCADModel::onclicked_pushButton_Delete() {
if(ui->listWidget->count()==0){
return;
}else{
qDebug()<<"CreateFEKOCADModel::on_pushButton_Delete";
// int row = ui->listWidget->currentIndex().row();
ui->listWidget->takeItem(ui->listWidget->currentIndex().row());
}
}
void CreateFEKOCADModel::accept()
{
if(this->MergerScriptFilePath()) // 创建模型文件
{
if(QFile(_saveMergeFilepath).exists()){ // 确定文件一定存在
QStringList parames;
parames.append(this->ui->lineEdit->text());
parames.append("--run-script");
parames.append(_saveMergeFilepath);
QProcess* process=new QProcess(this);
process->start(Setting::BusAPI::instance()->getFekocadPath(),parames);
process->waitForFinished(-1);
qDebug()<<"CreateFEKOCADModel::accept";
}else{
QMessageBox::warning(this, QObject::tr("Error"), QObject::tr(u8"文件不存在: ")+_saveMergeFilepath);
return;
}
}else{}
QDialog::accept();
}
void CreateFEKOCADModel::onclicked_pushButton_OpenAntParams() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"仿真天线参数初始化文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_ant_init_script (*.lua)") // File filter
);
ui->lineEdit_loadAnt->setText(filePath);
}
void CreateFEKOCADModel::onclicked_pushButton_OpenLoadModel() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"加载模型导入文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_model_init_script (*.lua)") // File filter
);
ui->lineEdit_loadModel->setText(filePath);
}
void CreateFEKOCADModel::setAntParamsFilePath(const QString& filePath) {
ui->lineEdit_loadAnt->setText(filePath);
}
void CreateFEKOCADModel::setModelParamsFilePath(const QString& filePath)
{
ui->lineEdit_loadModel->setText(filePath);
// 文件解析
QFile modelfile(filePath);
QTextStream modelinStream(&modelfile);
while(!modelinStream.atEnd()) {
QString line = modelinStream.readLine();
QString geoline = line;
// 提取模型文件
QString geoFilter = "project.Importer.Geometry:Import";
if(geoline.contains(geoFilter)) {
geoline = geoline.remove("project.Importer.Geometry:Import");
geoline = geoline.remove(")");
geoline = geoline.remove("(");
ui->listWidget->addItem(geoline);
} else {
}
QString stlFilter = "project.Importer.Mesh:Import";
QString stlline = line;
if(line.contains(stlFilter)) {
stlline = stlline.remove("project.Importer.Mesh:Import");
stlline = stlline.remove(")");
stlline = stlline.remove("(");
ui->listWidget->addItem(stlline);
} else {
}
}
}
bool CreateFEKOCADModel::MergerScriptFilePath() {
// 合并文件
_saveMergeFilepath= QFileDialog::getSaveFileName(
this, // Parent widget
tr(u8"创建加载模型初始化文件"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("_cfx_init_script (*.lua)") // File filter
);
// 合并文件
QFile saveFile(_saveMergeFilepath);
if (!saveFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(this, QObject::tr("Error"), QObject::tr(u8"不能创建文件"));
return false;
}else{}
QTextStream outStream(&saveFile);
outStream << "------------- load model list----------------------------------------------------------------------------------"<<"\n";
// model
// 创建lua脚本内存
QString scripttext = "";
scripttext =scripttext +"app=cf.GetApplication()"+"\n";
scripttext =scripttext +"project=app.Project --- get current project"+"\n";
scripttext =scripttext +"solutionConfigurations = project.SolutionConfigurations "+"\n";
scripttext =scripttext +"solutionConfigurations:SetSourcesPerConfiguration()"+"\n";
for(size_t i=0;i<ui->listWidget->count();i++){
QListWidgetItem *item = ui->listWidget->item(i);
QString filepath = item->text();
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
if(fileinfo.exists()){
if(fileinfo.suffix()=="stl") {
scripttext =scripttext +QString("project.Importer.Mesh:Import(\"%1\")").arg(filepath);
scripttext=scripttext+"\n";
}else if(fileinfo.suffix()=="iges"||fileinfo.suffix()=="igs") {
scripttext = scripttext
+ QString("project.Importer.Geometry:Import(\"%1\")")
.arg(filepath);
scripttext = scripttext + "\n";
}else{}
}
else{
QMessageBox::warning(this, QObject::tr("Error"),u8"文件不存在: "+ filepath);
continue;
}
}
outStream << scripttext << "\n";
outStream << "------------- load ant params----------------------------------------------------------------------------------"<<"\n";
// ant
QFile antfile(this->ui->lineEdit_loadAnt->text());
if (!antfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::warning(this, QObject::tr("Error"),u8"不能打开加载天线参数文件: "+ this->ui->lineEdit_loadAnt->text());
return false; // Skip this file if it cannot be opened
}else {}
QTextStream antinStream(&antfile);
while (!antinStream.atEnd()) {
outStream << antinStream.readLine() << "\n";
}
outStream <<"--------------------- \" PRF configuration \"-----------------------------"<<"\n";
outStream <<""<<"\n";
outStream <<"-- Enable the parallel Solver"<<"\n";
outStream <<"project.Launcher.Settings.FEKO.Parallel.Enabled = true"<<"\n";
outStream <<""<<"\n";
outStream <<"-- Save the *.cfx file"<<"\n";
outStream <<"results = project.Launcher:RunPREFEKO()"<<"\n";
outStream <<QString("app:SaveAs([[%1]])").arg(this->ui->lineEdit->text())<<"\n";
outStream <<"results = project.Launcher:RunPREFEKO()"<<"\n";
antfile.close(); // Close the current file before moving to the next
// 设置求解参数
saveFile.close(); // Close the merged file
return true;
}
}

View File

@ -0,0 +1,49 @@
/**
* @file createfekocadmodel.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-22
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_CREATEFEKOCADMODEL_H
#define LAMPCAE_CREATEFEKOCADMODEL_H
#include "mainWidgetsAPI.h"
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class CreateFEKOCADModel;
}
QT_END_NAMESPACE
namespace MainWidget {
class MAINWIDGETSAPI CreateFEKOCADModel : public QDialog {
Q_OBJECT
public:
explicit CreateFEKOCADModel(QWidget* parent = nullptr);
~CreateFEKOCADModel() override;
public:
void setSTLFilePathList(const QStringList& stlfilePathList);
void setAntParamsFilePath(const QString& antParamsfilePath);
void setModelParamsFilePath(const QString& ModelParamsfilePath);
bool MergerScriptFilePath();
public slots:
void accept() override;
void onclicked_pushButton_OpenAntParams();
void onclicked_pushButton_OpenLoadModel();
void onclicked_pushButton_SettingName();
void onclicked_pushButton_add();
void onclicked_pushButton_Delete();
private:
Ui::CreateFEKOCADModel* ui;
QStringList stlfilePathList;
QString xmlParamsfilePath;
QString _saveMergeFilepath;
};
} // namespace MainWidget
#endif // LAMPCAE_CREATEFEKOCADMODEL_H

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CreateFEKOCADModel</class>
<widget class="QDialog" name="CreateFEKOCADModel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>557</height>
</rect>
</property>
<property name="windowTitle">
<string>CreateFEKOCADModel</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>天线构建脚本</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButton_Delete">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item row="3" column="0" rowspan="3" colspan="2">
<widget class="QListWidget" name="listWidget">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKO cfx文件</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_SettingName">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButton_add">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton_OpenAntParams">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择天线构建脚本</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_loadAnt">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>模型加载脚本</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_loadModel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_OpenLoadModel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择模型导入脚本</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CreateFEKOCADModel</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>417</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>417</x>
<y>278</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CreateFEKOCADModel</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>417</x>
<y>531</y>
</hint>
<hint type="destinationlabel">
<x>417</x>
<y>278</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,124 @@
/**
* @file fekocadTaskinit.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-21
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_fekocadTaskinit.h" resolved
#include <QFileDialog>
#include <QMessageBox>
#include <QProgressDialog>
#include <QProcess>
#include "fekocadTaskinit.h"
#include "ui_fekocadTaskinit.h"
#include "Settings/BusAPI.h"
#include <QDebug>
namespace MainWidget {
fekocadTaskinit::fekocadTaskinit(QWidget* parent)
: QDialog(parent)
, ui(new Ui::fekocadTaskinit)
{
ui->setupUi(this);
connect(ui->pushButton_Delete, SIGNAL(clicked()), this, SLOT(pushButton_Delete_clicked()));
connect(ui->pushButton_add, SIGNAL(clicked()), this, SLOT(pushButton_add_clicked()));
connect(ui->pushButton_Select, SIGNAL(clicked()), this, SLOT(pushButton_Select_clicked()));
}
fekocadTaskinit::~fekocadTaskinit()
{
delete ui;
}
void fekocadTaskinit::pushButton_Delete_clicked() {
if(ui->listWidget->count()==0){
return;
}else{
ui->listWidget->removeItemWidget(ui->listWidget->takeItem(ui->listWidget->currentIndex().row()));
}
}
void fekocadTaskinit::pushButton_add_clicked() {
QStringList fileNames= QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择生成的模型构建脚本"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("Lua Files (*.lua)") // File filter
);
// Add the selected file paths to the list widget
for (const QString &fileName : fileNames) {
ui->listWidget->addItem(fileName);
}
// Update the working directory
}
void fekocadTaskinit::pushButton_Select_clicked() {
QString filePath= QFileDialog::getOpenFileName(
this, // Parent widget
tr(u8"选择cfx工程作为模版"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr("cad feko model (*.cfx)") // File filter
);
if(QFile(filePath).exists()){
ui->lineEdit->setText(filePath);
_workcfxfilepath=filePath;
}else{
return;
}
}
void fekocadTaskinit::accept()
{
if(QFile(_workcfxfilepath).exists())
{
qDebug()<<"accept:"+_workcfxfilepath;
// 指令程序,
// cadfeko 目标与场景模型.cfx --non-interactive --run-script StripImage_STRIP_POLAR_VT_PRF_0_T_99.lua
QString workspaceDir = QDir(_workcfxfilepath).dirName();
QString cadfekoPath = Setting::BusAPI::instance()->getFekocadPath();
QStringList luaFiles;
for (int i = 0; i < ui->listWidget->count(); i++) {
luaFiles.append(ui->listWidget->item(i)->text());
}
QProgressDialog progressDialog(u8"模型工程生成", u8"终止", 0, luaFiles.count());
progressDialog.setWindowTitle(u8"生成中");
progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true);
progressDialog.setValue(0);
progressDialog.setMaximum(luaFiles.count());
progressDialog.setMinimum(0);
progressDialog.show();
// 逐个执行lua文件
for (int i = 0; i < luaFiles.count(); i++) {
QString luaFile = luaFiles.at(i);
QStringList parames;
parames.append(_workcfxfilepath);
parames.append("--non-interactive");
parames.append("--run-script");
parames.append(luaFile);
QProcess* process=new QProcess(this);
process->start(Setting::BusAPI::instance()->getFekocadPath(),parames);
process->waitForFinished(-1);
progressDialog.setValue(i);
qDebug()<<"excute lua file:"+luaFile;
QCoreApplication::processEvents(); // 允许事件处理,以便取消按钮响应
// 检查是否点击了取消按钮
if (progressDialog.wasCanceled()) {
qDebug() << "User canceled operation.";
break; // 退出任务循环
}
}
}
else{
QMessageBox::warning(this, tr("Warning"), tr("Please select a valid CAD FEKO model file."));
return;
}
QDialog::accept();
}
} // namespace MainWidget

View File

@ -0,0 +1,39 @@
/**
* @file fekocadinit.h
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 24-7-21
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
#ifndef LAMPCAE_FEKOCADTASKINIT_H
#define LAMPCAE_FEKOCADTASKINIT_H
#include "mainWidgetsAPI.h"
#include <QDialog>
namespace Ui {
class fekocadTaskinit;
}
namespace MainWidget {
class MAINWIDGETSAPI fekocadTaskinit : public QDialog {
Q_OBJECT
public:
explicit fekocadTaskinit(QWidget* parent = nullptr);
~fekocadTaskinit() override;
public slots:
void accept() override;
void pushButton_Delete_clicked();
void pushButton_add_clicked();
void pushButton_Select_clicked();
private:
Ui::fekocadTaskinit* ui;
QString _workcfxfilepath;
};
} // namespace MainWidget
#endif // LAMPCAE_FEKOCADTASKINIT_H

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>fekocadTaskinit</class>
<widget class="QDialog" name="fekocadTaskinit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>638</width>
<height>367</height>
</rect>
</property>
<property name="windowTitle">
<string>计算任务初始化</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Select">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>FEKO cfx文件</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_add">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton_Delete">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="3" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>PRFList</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QListWidget" name="listWidget">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>fekocadTaskinit</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>318</x>
<y>341</y>
</hint>
<hint type="destinationlabel">
<x>318</x>
<y>183</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>fekocadTaskinit</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>318</x>
<y>341</y>
</hint>
<hint type="destinationlabel">
<x>318</x>
<y>183</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -45,6 +45,7 @@
#include <QMenu>
#include "geometryViewData.h"
#include "geometryViewObject.h"
#include "Common/DebugLogger.h"
namespace MainWidget
{
@ -145,6 +146,7 @@ namespace MainWidget
void GeometryViewProvider::showGeoSet(Geometry::GeometrySet *set, bool render /*= true*/)
{
DebugInfo("showGeoSet start \n");
QList<vtkPolyData *> viewPolys = _viewData->transferToPoly(set);
vtkPolyData *facePoly = viewPolys.at(0);
vtkPolyData *edgePoly = viewPolys.at(1);
@ -200,6 +202,7 @@ namespace MainWidget
_geoViewHash.insert(set, viewObj);
if (render)
_preWindow->resetCamera();
DebugInfo("showGeoSet finish \n");
}
void GeometryViewProvider::showDatum(Geometry::GeometryDatum *datm)

View File

@ -4,6 +4,7 @@
#include "MeshData/meshSet.h"
#include "Settings/BusAPI.h"
#include "Settings/GraphOption.h"
#include "Common/DebugLogger.h"
#include <vtkUnstructuredGrid.h>
#include <vtkActor.h>
#include <vtkUnsignedCharArray.h>
@ -18,16 +19,29 @@
#include <vtkExtractSelection.h>
#include <vtkDoubleArray.h>
#include <QThread>
#include <QDebug>
#include <set>
#include <QDateTime>
#include <vtkPolyData.h>
#include <vtkThreshold.h>
#include <vtkGeometryFilter.h>
#include <vtkVertexGlyphFilter.h>
#include <vtkVertex.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
#include <vtkDataSetMapper.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkPolyDataWriter.h>
#include <vtkSTLWriter.h>
#ifdef LAMPCAE_HAS_OPENMP
#include <omp.h>
#endif
#include <QDebug>
namespace MainWidget
{
MeshKernalViewObj::MeshKernalViewObj(MeshData::MeshKernal *k)
: _kernal(k), _displayData(vtkUnstructuredGrid::New()),
_meshData(MeshData::MeshData::getInstance())
namespace MainWidget {
MeshKernalViewObj::MeshKernalViewObj(MeshData::MeshKernal* k)
: _kernal(k)
, _displayData(vtkUnstructuredGrid::New())
, _meshData(MeshData::MeshData::getInstance())
{
_actor[0] = vtkActor::New();
_actor[1] = vtkActor::New();
@ -39,26 +53,25 @@ namespace MainWidget
MeshKernalViewObj::~MeshKernalViewObj()
{
// if (_actor != nullptr) _actor->Delete();
if (_displayData != nullptr)
if(_displayData != nullptr)
_displayData->Delete();
}
vtkDataSet *MeshKernalViewObj::getDisplayData()
vtkDataSet* MeshKernalViewObj::getDisplayData()
{
return _displayData;
}
vtkActor **MeshKernalViewObj::getActor()
vtkActor** MeshKernalViewObj::getActor()
{
return _actor;
}
void MeshKernalViewObj::setPointColor(const QColor &c, bool disOnly)
void MeshKernalViewObj::setPointColor(const QColor& c, bool disOnly)
{
vtkDataArray *dpointColor = _displayData->GetPointData()->GetScalars();
double col[3]{c.red()*1.0, c.green()*1.0, c.blue()*1.0};
if (nullptr == dpointColor)
{
vtkDataArray* dpointColor = _displayData->GetPointData()->GetScalars();
double col[3]{ c.red() * 1.0, c.green() * 1.0, c.blue() * 1.0 };
if(nullptr == dpointColor) {
dpointColor = vtkUnsignedCharArray::New();
dpointColor->SetNumberOfComponents(3);
_displayData->GetPointData()->SetScalars(dpointColor);
@ -69,12 +82,11 @@ namespace MainWidget
dpointColor->FillComponent(2, col[2]);
_displayData->Modified();
if (disOnly)
if(disOnly)
return;
auto dataset = _kernal->getMeshData();
vtkDataArray *pointColor = dataset->GetPointData()->GetScalars();
if (nullptr == pointColor)
{
auto dataset = _kernal->getMeshData();
vtkDataArray* pointColor = dataset->GetPointData()->GetScalars();
if(nullptr == pointColor) {
pointColor = vtkUnsignedCharArray::New();
pointColor->SetNumberOfComponents(3);
pointColor->SetNumberOfTuples(dataset->GetNumberOfPoints());
@ -85,36 +97,50 @@ namespace MainWidget
pointColor->FillComponent(2, col[2]);
}
void MeshKernalViewObj::setPointDisplayColor(QList<int> &indexs, const QColor &color)
void MeshKernalViewObj::setPointDisplayColor(QList<int>& indexs, const QColor& color,
bool isModitfy)
{
vtkDataArray *colorArray = _displayData->GetPointData()->GetScalars();
vtkDataArray *indexArray = _displayData->GetPointData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setPointDisplayColor start ";
std::set<int> indexSet(indexs.begin(), indexs.end()); // 转换为 set-- std 实现是B+树
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setPointDisplayColor create set ";
vtkDataArray* colorArray = _displayData->GetPointData()->GetScalars();
vtkDataArray* indexArray =
_displayData->GetPointData()->GetArray("IDS"); // display data , kernel idx, point idx
// vtkDataArray *selectArray = _displayData->GetPointData()->GetArray("SELECT"); // select
// state array
if(nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
const int nPoint = indexArray->GetNumberOfTuples();
for (int i = 0; i < nPoint; ++i)
double col[3]{ color.red() * 1.0, color.green() * 1.0, color.blue() * 1.0 }; // color
const int nPoint = indexArray->GetNumberOfTuples(); // 所有显示 点的数量
for(int i = 0; i < nPoint; ++i) // 遍历所有的显示点
{
if (indexs.isEmpty())
if(indexs.isEmpty())
break;
int pointindex = indexArray->GetComponent(i, 1);
if (indexs.contains(pointindex))
if(indexSet.find(pointindex)
!= indexSet.end()) // 选择点是否在 渲染 点集中, 选中 && 渲染 修改
{
colorArray->SetComponent(i, 0, col[0]);
colorArray->SetComponent(i, 1, col[1]);
colorArray->SetComponent(i, 2, col[2]);
indexs.removeOne(pointindex);
// indexs.removeOne(pointindex);
}
}
_displayData->Modified();
if(isModitfy) {
_displayData->Modified();
}
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setPointDisplayColor finish ";
}
void MeshKernalViewObj::setCellColor(const QColor &c, bool disOnly)
void MeshKernalViewObj::setCellColor(const QColor& c, bool disOnly)
{
double col[3]{c.red()*1.0, c.green()*1.0, c.blue()*1.0};
vtkDataArray *dcellcolor = _displayData->GetCellData()->GetScalars();
if (dcellcolor == nullptr)
{
double col[3]{ c.red() * 1.0, c.green() * 1.0, c.blue() * 1.0 };
vtkDataArray* dcellcolor = _displayData->GetCellData()->GetScalars();
if(dcellcolor == nullptr) {
dcellcolor = vtkUnsignedCharArray::New();
dcellcolor->SetNumberOfComponents(3);
_displayData->GetCellData()->SetScalars(dcellcolor);
@ -126,12 +152,11 @@ namespace MainWidget
dcellcolor->FillComponent(2, col[2]);
_displayData->Modified();
if (disOnly)
if(disOnly)
return;
auto dataset = _kernal->getMeshData();
vtkDataArray *cellcolor = dataset->GetCellData()->GetScalars();
if (nullptr == cellcolor)
{
auto dataset = _kernal->getMeshData();
vtkDataArray* cellcolor = dataset->GetCellData()->GetScalars();
if(nullptr == cellcolor) {
cellcolor = vtkUnsignedCharArray::New();
cellcolor->SetNumberOfComponents(3);
dataset->GetCellData()->SetScalars(cellcolor);
@ -142,38 +167,43 @@ namespace MainWidget
cellcolor->FillComponent(2, col[2]);
}
void MeshKernalViewObj::setCellDisplayColor(QList<int> &indexs, const QColor &color)
void MeshKernalViewObj::setCellDisplayColor(QList<int>& indexs, const QColor& color,
bool isModitfy)
{
vtkDataArray *colorArray = _displayData->GetCellData()->GetScalars();
vtkDataArray *indexArray = _displayData->GetCellData()->GetArray("IDS");
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
if (nullptr == colorArray || nullptr == indexArray)
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setCellDisplayColor start ";
std::set<int> indexSet(indexs.begin(), indexs.end()); // 转换为 set-- std 实现是B+树
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setPointDisplayColor create set ";
vtkDataArray* colorArray = _displayData->GetCellData()->GetScalars();
vtkDataArray* indexArray =
_displayData->GetCellData()->GetArray("IDS"); // display data , kernel idx, cell idx
double col[3]{ color.red() * 1.0, color.green() * 1.0, color.blue() * 1.0 };
if(nullptr == colorArray || nullptr == indexArray)
return;
const int nCell = indexArray->GetNumberOfTuples();
const int nCell = indexArray->GetNumberOfTuples();
int nprocess = 1;
int nprocess = 4;
#ifdef LAMPCAE_HAS_OPENMP
int ncore = QThread::idealThreadCount();
nprocess = ncore - 1 > 0 ? ncore - 1 : ncore;
nprocess = ncore - 1 > 0 ? ncore - 1 : ncore;
omp_set_num_threads(nprocess);
#endif
QList<int> spliters{0};
const int countPart = nCell / nprocess;
while (spliters.last() < nCell - 1)
{
QList<int> spliters{ 0 };
const int countPart = nCell / nprocess;
while(spliters.last() < nCell - 1) {
int cu = spliters.last() + countPart;
if (abs(cu - nCell) < 0.2 * countPart)
if(abs(cu - nCell) < 0.2 * countPart)
cu = nCell - 1;
spliters.append(cu);
}
auto serial = [=](int beg, int end)
{
for (int i = beg; i <= end; ++i)
{
auto serial = [=](int beg, int end) {
for(int i = beg; i <= end; ++i) {
int cellid = indexArray->GetComponent(i, 1);
if (indexs.contains(cellid))
// if(indexs.contains(cellid))
if(indexSet.find(cellid) != indexSet.end()) // 判断是否在显示对象中
{
colorArray->SetComponent(i, 0, col[0]);
colorArray->SetComponent(i, 1, col[1]);
@ -184,25 +214,29 @@ namespace MainWidget
#ifdef LAMPCAE_HAS_OPENMP
#pragma omp parallel for shared(colorArray, spliters)
#endif
for (int i = 0; i < nprocess; ++i)
{
for(int i = 0; i < nprocess; ++i) {
int beg = spliters[i];
int end = spliters[i + 1];
serial(beg, end);
}
_displayData->Modified();
if(isModitfy) {
_displayData->Modified();
}
// qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"
// MeshKernalViewObj::setCellDisplayColor finish ";
}
void MeshKernalViewObj::setPointDisplayColorByDisplayIndex(QList<int> &indexs, const QColor &color)
void MeshKernalViewObj::setPointDisplayColorByDisplayIndex(QList<int>& indexs,
const QColor& color)
{
vtkDataArray *colorArray = _displayData->GetPointData()->GetScalars();
vtkDataArray *indexArray = _displayData->GetPointData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
vtkDataArray* colorArray = _displayData->GetPointData()->GetScalars();
vtkDataArray* indexArray = _displayData->GetPointData()->GetArray("IDS");
if(nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
for (int index : indexs)
{
double col[3]{ color.red() * 1.0, color.green() * 1.0, color.blue() * 1.0 };
for(int index : indexs) {
colorArray->SetComponent(index, 0, col[0]);
colorArray->SetComponent(index, 1, col[1]);
colorArray->SetComponent(index, 2, col[2]);
@ -210,15 +244,15 @@ namespace MainWidget
_displayData->Modified();
}
void MeshKernalViewObj::setCellDisplayColorByDisplayIndex(QList<int> &indexs, const QColor &color)
void MeshKernalViewObj::setCellDisplayColorByDisplayIndex(QList<int>& indexs,
const QColor& color)
{
vtkDataArray *colorArray = _displayData->GetCellData()->GetScalars();
vtkDataArray *indexArray = _displayData->GetCellData()->GetArray("IDS");
if (nullptr == colorArray || nullptr == indexArray)
vtkDataArray* colorArray = _displayData->GetCellData()->GetScalars();
vtkDataArray* indexArray = _displayData->GetCellData()->GetArray("IDS");
if(nullptr == colorArray || nullptr == indexArray)
return;
double col[3]{color.red()*1.0, color.green()*1.0, color.blue()*1.0};
for (int index : indexs)
{
double col[3]{ color.red() * 1.0, color.green() * 1.0, color.blue() * 1.0 };
for(int index : indexs) {
colorArray->SetComponent(index, 0, col[0]);
colorArray->SetComponent(index, 1, col[1]);
colorArray->SetComponent(index, 2, col[2]);
@ -226,24 +260,31 @@ namespace MainWidget
_displayData->Modified();
}
void MeshKernalViewObj::showCells(const QList<int> &indexs, bool show)
void MeshKernalViewObj::showCells(const QList<int>& indexs, bool show)
{
auto dataSet = _kernal->getMeshData();
vtkDataArray *showArray = dataSet->GetCellData()->GetArray("SHOW");
if (showArray == nullptr)
auto dataSet = _kernal->getMeshData();
vtkDataArray* showArray = dataSet->GetCellData()->GetArray("SHOW");
vtkDataArray* IDSArray = dataSet->GetCellData()->GetArray("IDS");
if(nullptr==IDSArray||nullptr == showArray)
return;
int value = 0;
if (show)
if(show)
value = 1;
for (int index : indexs)
showArray->SetComponent(index, 0, value);
std::set<int> indexSet(indexs.begin(), indexs.end());
for(int i = 0; i < showArray->GetNumberOfTuples(); ++i) {
int cellid = IDSArray->GetComponent(i, 1);
if(indexSet.find(cellid) != indexSet.end()) // 判断是否正确
{
showArray->SetComponent(i, 0, value);
}
}
this->updateDisplayMember();
}
void MeshKernalViewObj::highLight()
{
auto gp = Setting::BusAPI::instance()->getGraphOption();
auto gp = Setting::BusAPI::instance()->getGraphOption();
QColor color = gp->getHighLightColor();
_actor[POINTACTOR]->GetMapper()->SetScalarVisibility(false);
_actor[EDGEACTOR]->GetMapper()->SetScalarVisibility(false);
@ -258,13 +299,12 @@ namespace MainWidget
void MeshKernalViewObj::clearHighLight()
{
auto gp = Setting::BusAPI::instance()->getGraphOption();
auto gp = Setting::BusAPI::instance()->getGraphOption();
QColor color = gp->getMeshEdgeColor();
_actor[POINTACTOR]->GetMapper()->SetScalarVisibility(true);
_actor[EDGEACTOR]->GetMapper()->SetScalarVisibility(true);
_actor[FACEACTOR]->GetMapper()->SetScalarVisibility(true);
if (gp->isShowMeshEdge() && gp->isShowMeshFace())
{
if(gp->isShowMeshEdge() && gp->isShowMeshFace()) {
_actor[EDGEACTOR]->GetMapper()->SetScalarVisibility(false);
_actor[EDGEACTOR]->GetProperty()->SetColor(color.red(), color.green(), color.blue());
}
@ -279,37 +319,70 @@ namespace MainWidget
void MeshKernalViewObj::generateIDProp()
{
auto dataset = _kernal->getMeshData();
const int id = _kernal->getID();
auto dataset = _kernal->getMeshData();
const int id = _kernal->getID(); // IDS (kernalid,pointId)
// cell ID与显示隐藏状态
vtkSmartPointer<vtkUnsignedIntArray> kcellid_index = vtkSmartPointer<vtkUnsignedIntArray>::New();
vtkSmartPointer<vtkUnsignedIntArray> kcellid_index =
vtkSmartPointer<vtkUnsignedIntArray>::New();
kcellid_index->SetNumberOfComponents(2); // 设置 dimension
kcellid_index->SetName("IDS");
const int ncell = dataset->GetNumberOfCells();
for (int i = 0; i < ncell; ++i)
for(int i = 0; i < ncell; ++i)
kcellid_index->InsertNextTuple2(id, i); // 这里添加 网格id ,与 cell 序号
dataset->GetCellData()->AddArray(kcellid_index);
vtkSmartPointer<vtkUnsignedIntArray> cstatesArray = vtkSmartPointer<vtkUnsignedIntArray>::New();
vtkSmartPointer<vtkUnsignedIntArray> cstatesArray =
vtkSmartPointer<vtkUnsignedIntArray>::New();
cstatesArray->SetName("SHOW");
cstatesArray->SetNumberOfValues(ncell);
cstatesArray->Fill(1);
dataset->GetCellData()->AddArray(cstatesArray);
vtkSmartPointer<vtkIntArray> metralArray =
vtkSmartPointer<vtkIntArray>::New();
metralArray->SetName("MATERIAL");
metralArray->SetNumberOfValues(ncell);
metralArray->Fill(-1);
dataset->GetCellData()->AddArray(metralArray);
// vtkSmartPointer<vtkUnsignedCharArray> selectSateArray =
// vtkSmartPointer<vtkUnsignedCharArray>::New(); selectSateArray->SetName("SELECT");
// selectSateArray->SetNumberOfValues(ncell);
// selectSateArray->Fill(0);
// dataset->GetCellData()->AddArray(selectSateArray); // select
// point ID与显示隐藏状态
vtkSmartPointer<vtkUnsignedIntArray> kpointid_index = vtkSmartPointer<vtkUnsignedIntArray>::New();
vtkSmartPointer<vtkUnsignedIntArray> kpointid_index =
vtkSmartPointer<vtkUnsignedIntArray>::New();
kpointid_index->SetNumberOfComponents(2);
kpointid_index->SetName("IDS");
const int npoint = dataset->GetNumberOfPoints();
for (int i = 0; i < npoint; ++i)
for(int i = 0; i < npoint; ++i)
kpointid_index->InsertNextTuple2(id, i);
dataset->GetPointData()->AddArray(kpointid_index);
vtkSmartPointer<vtkUnsignedIntArray> pstatesArray = vtkSmartPointer<vtkUnsignedIntArray>::New();
vtkSmartPointer<vtkUnsignedIntArray> pstatesArray =
vtkSmartPointer<vtkUnsignedIntArray>::New();
pstatesArray->SetName("SHOW");
pstatesArray->SetNumberOfValues(npoint);
pstatesArray->Fill(1);
dataset->GetPointData()->AddArray(pstatesArray);
vtkSmartPointer<vtkIntArray> pmetralArray =
vtkSmartPointer<vtkIntArray>::New();
pmetralArray->SetName("MATERIAL"); // 材料
pmetralArray->SetNumberOfValues(ncell);
pmetralArray->Fill(-1);
dataset->GetPointData()->AddArray(pmetralArray);
// vtkSmartPointer<vtkUnsignedCharArray> pselectSateArray =
// vtkSmartPointer<vtkUnsignedCharArray>::New(); pselectSateArray->SetName("SELECT");
// pselectSateArray->SetNumberOfValues(ncell);
// pselectSateArray->Fill(0);
// dataset->GetPointData()->AddArray(pselectSateArray); // select
}
void MeshKernalViewObj::init()
@ -317,7 +390,7 @@ namespace MainWidget
vtkSmartPointer<vtkAppendFilter> filter = vtkSmartPointer<vtkAppendFilter>::New();
filter->AddInputData(_kernal->getMeshData());
filter->Update();
_displayData->DeepCopy(filter->GetOutput());
_displayData->DeepCopy(filter->GetOutput()); // 深拷贝
auto gp = Setting::BusAPI::instance()->getGraphOption();
@ -345,33 +418,70 @@ namespace MainWidget
void MeshKernalViewObj::updateDisplayMember()
{
auto dataset = _kernal->getMeshData();
vtkDataArray *array = dataset->GetCellData()->GetArray("SHOW");
if (array == nullptr)
return;
DebugInfo("void MeshKernalViewObj::updateDisplayMember()\n");
auto dataset = _kernal->getMeshData();
qDebug() << QString("point number %1").arg(dataset->GetNumberOfPoints());
qDebug() << QString("cell number %1").arg(dataset->GetNumberOfCells());
vtkSmartPointer<vtkIdTypeArray> idArray = vtkSmartPointer<vtkIdTypeArray>::New();
const int n = array->GetNumberOfTuples();
for (int i = 0; i < n; ++i)
{
double v = fabs(array->GetComponent(i, 0));
if (v > 0.5)
idArray->InsertNextValue(i);
}
vtkSmartPointer<vtkSelectionNode> selectionNode = vtkSmartPointer<vtkSelectionNode>::New();
selectionNode->SetFieldType(vtkSelectionNode::CELL);
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();
_displayData->DeepCopy(extractionSelection->GetOutput());
vtkPolyData* dataold = vtkPolyData::SafeDownCast(dataset);
vtkPolyData* datanew = nullptr;
DebugInfo("void MeshKernalViewObj::updateDisplayMember()\n");
// 创建 vtkThreshold 过滤器
vtkSmartPointer<vtkThreshold> threshold = vtkSmartPointer<vtkThreshold>::New();
threshold->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, "SHOW");
threshold->SetInputData(dataset);
threshold->SetLowerThreshold(0.5); // 设置筛选条件,大于 100 的面将被保留
threshold->SetUpperThreshold(1.5);
threshold->Update();
_displayData->DeepCopy(threshold->GetOutput());
_displayData->Modified();
qDebug() << QString("update _displayData point number %1").arg(_displayData->GetNumberOfPoints());
qDebug() << QString("update _displayData cell number %1").arg(_displayData->GetNumberOfCells());
}
void MeshKernalViewObj::modifyPointDisplay()
{
_displayData->Modified();
}
void MeshKernalViewObj::showPoints(const QList<int>& index, bool show)
{
std::set<int> indexSet(index.begin(), index.end());
// 判断是否需要显示
auto dataSet = _kernal->getMeshData();
vtkDataArray* showArray = dataSet->GetPointData()->GetArray("SHOW");
vtkDataArray* IDSArray=dataSet->GetPointData()->GetArray("IDS");
if(nullptr==IDSArray||nullptr == showArray)
return;
int value = 0;
if(show)
value = 1;
int pointid = -1;
for(int i = 0; i < showArray->GetNumberOfTuples(); ++i) {
int pointid =IDSArray->GetComponent(i, 1);
if(indexSet.find(pointid) != indexSet.end()) // 判断是否正确
{
showArray->SetComponent(i, 0, value);
}
}
// 更新cell显示
QList<int> hideCells;
hideCells.clear();
// 计算联通单元
size_t ncell = dataSet->GetNumberOfCells();
vtkDataArray* cids = dataSet->GetCellData()->GetArray("IDS");
for(size_t cellId = 0; cellId < ncell; cellId++) {
vtkCell* cell = dataSet->GetCell(cellId);
vtkIdList* pointIds = cell->GetPointIds();
for(vtkIdType j = 0; j < pointIds->GetNumberOfIds(); ++j) {
vtkIdType pointId = pointIds->GetId(j);
if(fabs(showArray->GetComponent(pointId, 0)) < 0.5) // 存在一个隐藏
{
hideCells.push_back(cids->GetComponent(cellId, 1));
break;
}
}
}
this->showCells(hideCells, show);
}
}
} // namespace MainWidget

View File

@ -26,6 +26,7 @@
#define EDGEACTOR 1
#define FACEACTOR 2
#include "mainWidgetsAPI.h"
#include <QObject>
#include "meshViewProvider.h"
@ -40,7 +41,7 @@ namespace MeshData
namespace MainWidget
{
class MeshKernalViewObj :public QObject
class MAINWIDGETSAPI MeshKernalViewObj :public QObject
{
Q_OBJECT
public:
@ -94,13 +95,13 @@ namespace MainWidget
* @param indexs Kernal
* @param color
*/
void setPointDisplayColor(QList<int>& indexs, const QColor& color);
void setPointDisplayColor(QList<int>& indexs, const QColor& color,bool isModitfy=true);
/**
* @brief
* @param indexs Kernal
* @param color
*/
void setCellDisplayColor(QList<int>& indexs, const QColor& color);
void setCellDisplayColor(QList<int>& indexs, const QColor& color,bool isModitfy=true);
/**
* @brief
* @param indexs
@ -119,7 +120,13 @@ namespace MainWidget
* @param show
*/
void showCells(const QList<int>& index, bool show);
void showPoints(const QList<int>& index, bool show);
/**
* @brief
*/
void modifyPointDisplay();
private:
/**
* @brief DataSetID

View File

@ -7,14 +7,22 @@
#include "MeshData/meshKernal.h"
#include "Settings/BusAPI.h"
#include "Settings/GraphOption.h"
#include "Common/DebugLogger.h"
#include "PythonModule/PyAgent.h"
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkDataSet.h>
#include <vtkProperty.h>
#include <vtkPointData.h>
#include <vtkDataArray.h>
#include <vtkSelectionNode.h>
#include <QDebug>
#include <assert.h>
#include <vtkExtractSelection.h>
#include <vtkAppendFilter.h>
#include <QFileDialog>
#include <vtkUnstructuredGridWriter.h>
#include <QMessageBox>
namespace MainWidget
{
@ -24,20 +32,17 @@ namespace MainWidget
connect(_preWindow, SIGNAL(updateMeshActorSig()), this, SLOT(updateMeshActorSlot()));
// connect(_preWindow, SIGNAL(removeSetDataSig(int)), this, SLOT(removeSetData(int)));
// connect(_preWindow, SIGNAL(highLightActorDispalyPoint(bool)), this,
//SLOT(highLightActorDispalyPoint(bool)));
// connect(_preWindow, SIGNAL(highLightActorDispalyPoint(bool)), this,SLOT(highLightActorDispalyPoint(bool)));
connect(_preWindow, SIGNAL(clearMeshSetHighLight()), this, SLOT(clearHighLight()));
connect(_preWindow, SIGNAL(clearAllHighLight()), this, SLOT(clearHighLight()));
connect(_preWindow, SIGNAL(highLighMeshSet(MeshData::MeshSet*)), this,
SLOT(highLighMeshSet(MeshData::MeshSet*)));
connect(_preWindow, SIGNAL(highLighKernel(MeshData::MeshKernal*)), this,
SLOT(highLighKernel(MeshData::MeshKernal*)));
// connect(_preWindow, SIGNAL(highLighDataSet(vtkDataSet*)), this,
//SLOT(highLighDataSet(vtkDataSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetVisibleSig(MeshData::MeshSet*)), this,
SLOT(updateMeshSetVisibily(MeshData::MeshSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetColorSig(int)), this,
SLOT(updateMeshSetColor(int)));
connect(_preWindow, SIGNAL(highLighMeshSet(MeshData::MeshSet*)), this,SLOT(highLighMeshSet(MeshData::MeshSet*)));
connect(_preWindow, SIGNAL(highLighKernel(MeshData::MeshKernal*)), this,SLOT(highLighKernel(MeshData::MeshKernal*)));
// connect(_preWindow, SIGNAL(highLighDataSet(vtkDataSet*)), this,SLOT(highLighDataSet(vtkDataSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetVisibleSig(MeshData::MeshSet*)), this,SLOT(updateMeshSetVisibily(MeshData::MeshSet*)));
connect(_mainWindow, SIGNAL(updateMeshSetColorSig(int)), this,SLOT(updateMeshSetColor(int)));
}
MeshViewProvider::~MeshViewProvider()
@ -55,7 +60,7 @@ namespace MainWidget
auto Kernal = _meshData->getKernalAt(i);
if (!_viewObjects.contains(Kernal))
{
auto vobj = new MeshKernalViewObj(Kernal);
auto vobj = new MeshKernalViewObj(Kernal); // 创建一个新的视图
_viewObjects.insert(Kernal, vobj);
updateDisplayModel(Kernal);
updateGraphOption(Kernal);
@ -144,13 +149,13 @@ namespace MainWidget
QList<int> members = _highLightSelectItems.values();
if (vObjs == nullptr)
continue;
if (_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode)
if (_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode)
{
QColor c = Setting::BusAPI::instance()->getGraphOption()->getMeshNodeColor();
vObjs->setPointDisplayColor(members, c);
}
else if (_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell)
else if (_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell)
{
QColor c = Setting::BusAPI::instance()->getGraphOption()->getMeshFaceColor();
vObjs->setCellDisplayColor(members, c);
@ -358,38 +363,67 @@ namespace MainWidget
acs[EDGEACTOR]->SetPickable(false);
acs[FACEACTOR]->SetPickable(false);
if (m == ModuleBase::MeshNode || m == ModuleBase::BoxMeshNode)
if(m == ModuleBase::MeshNode || m == ModuleBase::BoxMeshNode
|| m == ModuleBase::BoxMeshSurfaceNode) {
acs[POINTACTOR]->SetPickable(true);
else if (m == ModuleBase::MeshCell || m == ModuleBase::BoxMeshCell)
DebugInfo(QString("acs[POINTACTOR]->SetPickable(true) %1 \n")
.arg(_selectModel)
.toLocal8Bit()
.data());
} else if(m == ModuleBase::MeshCell || m == ModuleBase::BoxMeshCell
|| m == ModuleBase::BoxMeshSurfaceCell) {
acs[FACEACTOR]->SetPickable(true);
DebugInfo(QString("acs[FACEACTOR]->SetPickable(true) %1 \n")
.arg(_selectModel)
.toLocal8Bit()
.data());
} else{};
}
}
void MeshViewProvider::highLighSelectItem(QMultiHash<int, int> *items)
{
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<" MeshViewProvider::highLighSelectItem start ";
if (items->isEmpty())
return;
_highLightSelectItems = *items;
QColor c = Setting::BusAPI::instance()->getGraphOption()->getHighLightColor();
QList<int> datasetList = items->uniqueKeys();
QList<int> datasetList = items->uniqueKeys(); // 获取所有的key
qDebug()<<QString("kernel size: %1").arg(datasetList.size());
for (auto dataset : datasetList)
{
auto k = _meshData->getKernalByID(dataset);
auto vObjs = _viewObjects.value(k);
QList<int> members = items->values();
auto k = _meshData->getKernalByID(dataset); // 获取对应的kernal
auto vObjs = _viewObjects.value(k); // 获取对应的view对象
QList<int> members = items->values(); //
if (vObjs == nullptr)
continue;
if (_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode)
vObjs->setPointDisplayColor(members, c);
else if (_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell)
vObjs->setCellDisplayColor(members, c);
if(members.isEmpty()){
continue;
}
if(_selectModel == ModuleBase::BoxMeshNode || _selectModel == ModuleBase::MeshNode||_selectModel==ModuleBase::BoxMeshSurfaceNode) { // 绘制 points
vObjs->setPointDisplayColor(members, c,true);
} else if(_selectModel == ModuleBase::BoxMeshCell || _selectModel == ModuleBase::MeshCell||_selectModel==ModuleBase::BoxMeshSurfaceCell) { // 绘制cell
vObjs->setCellDisplayColor(members, c,true);
}
vObjs->modifyPointDisplay();
}
_preWindow->reRender();
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<" MeshViewProvider::highLighSelectItem finish ";
}
QMultiHash<int, int> *MeshViewProvider::getSelectItem()
{
return &_highLightSelectItems;
}
MeshKernalViewObj* MeshViewProvider::getViewObjects(MeshData::MeshKernal* k)
{
if(_viewObjects.contains(k)){
return _viewObjects.value(k);
}else{
return nullptr;
}
}
}

View File

@ -102,6 +102,9 @@ namespace MainWidget
*/
QMultiHash<int, int> *getSelectItem();
MeshKernalViewObj * getViewObjects(MeshData::MeshKernal * k);
public slots:
/**
* @brief
@ -134,6 +137,7 @@ namespace MainWidget
*/
void updateMeshSetColor(int setid);
private:
/**
* @brief

View File

@ -53,6 +53,17 @@ namespace MainWidget
connect(mw, SIGNAL(highLightGeoComponentSig(Geometry::GeoComponent *)), this, SLOT(highLightGeoComponentSlot(Geometry::GeoComponent *)));
connect(mw, SIGNAL(highLightKernelSig(MeshData::MeshKernal *)), this, SIGNAL(highLighKernel(MeshData::MeshKernal *)));
connect(mw, SIGNAL(highLightDataSetSig(vtkDataSet *)), this, SIGNAL(highLighDataSet(vtkDataSet *)));
// 模型的世界坐标系
connect(this, SIGNAL(WorldPointMouseMove(double, double, double)),mw,SIGNAL(showStateToolbarPositionSIGNGAL(double, double, double)));
// 网格操作
// connect(this, SIGNAL(deleteMeshSig(GUI::MainWindow *)), this, SLOT(deleteMesh(GUI::MainWindow *)));
// connect(this, SIGNAL(copyMeshSig(GUI::MainWindow *)), this, SLOT(copyMesh(GUI::MainWindow *)));
// connect(this, SIGNAL(clipMeshSig(GUI::MainWindow *)), this, SLOT(clipMesh(GUI::MainWindow *)));
connect(this->_meshProvider, SIGNAL(importMeshDataSetSig(vtkDataSet*)), this, SIGNAL(importMeshDataSetSig(vtkDataSet*)));
}
PreWindow::~PreWindow()
@ -129,7 +140,7 @@ namespace MainWidget
void PreWindow::setSelectModel(int mode)
{
_selectModel = (ModuleBase::SelectModel)mode;
_meshProvider->setMeshSelectMode(_selectModel);
_meshProvider->setMeshSelectMode(_selectModel); // 设置网格选择模式
}
ModuleBase::SelectModel PreWindow::getSelectModel()
@ -230,4 +241,6 @@ namespace MainWidget
}
}
}
}

View File

@ -89,8 +89,10 @@ namespace MainWidget
void setMeshSelectMode(int model);
void highLighDataSet(vtkDataSet *dataset);
void clearMeshSetHighLight();
//
void highLightGeoComponentSig(Geometry::GeoComponent *aGC);
// 网格
void importMeshDataSetSig(vtkDataSet* dataset);
public slots:
//设置选择模式
@ -120,6 +122,7 @@ namespace MainWidget
//草图
void startSketch(bool start, double *loc, double *dir);
private:
// QList<vtkActor*> _meshActors{};
// QList<vtkActor*> _geometryActors{};

View File

@ -41,7 +41,7 @@ add_library(MainWindow
#-----------------------------------------------------------------------------
target_compile_definitions(MainWindow PRIVATE "MAINWINDOW_API")
list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
list(APPEND _depend_library PointCloudOperator Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common)
if(_WIN_)
list(APPEND _depend_library XGenerateReport)
endif()

View File

@ -44,7 +44,7 @@ namespace GUI {
_menuList.append(_ui->menuWindows);
_menuList.append(_ui->menuSettings);
_menuList.append(_ui->menuPlugins);
_menuList.append(_ui->menuHelp);
// _menuList.append(_ui->menuHelp);
_toolBarList.append(_ui->FileToolBar);
_toolBarList.append(_ui->SolveToolBar);
@ -369,6 +369,9 @@ namespace GUI {
_ui->actionSelectMeshCell->setVisible(on);
_ui->actionBoxMeshCell->setVisible(on);
_ui->actionBoxMeshNode->setVisible(on);
_ui->actionBoxMeshSurfaceNode->setVisible(on);
_ui->actionBoxMeshSurfaceCell->setVisible(on);
}
} // namespace GUI

View File

@ -31,6 +31,8 @@
#include "CustomizerHelper.h"
#include "DialogAbout.h"
#include "Geometry/geometryData.h"
#include "Geometry/geometrySet.h"
#include "DataProperty/DataBase.h"
#include "GeometryWidgets/dialogSketchPlane.h"
#include "GmshModule/GmshModule.h"
#include "IO/IOConfig.h"
@ -43,6 +45,9 @@
#include "MainWidgets/preWindow.h"
#include "MainWidgets/ProcessWindow.h"
#include "MainWidgets/projectSolveDialog.h"
#include "MainWidgets/meshViewProvider.h"
#include "MainWidgets/meshKernalViewObject.h"
#include "MainWindowPy.h"
#include "MeshData/meshKernal.h"
#include "MeshData/meshSet.h"
@ -59,6 +64,8 @@
#include "Settings/GraphOption.h"
#include "SignalHandler.h"
#include "SolverControl/DialogSolverManager.h"
#include "PointCloudOperator/MeshOpearatorCommon.h"
#include "MainWidgets/createfekocadmodel.h"
#include "SubWindowManager.h"
#include "Translator.h"
@ -75,6 +82,7 @@
#include <QTreeWidgetItem>
#include <vtkCellDataToPointData.h>
#include <pcl/io/vtk_lib_io.h>
#include <TopTools_HSequenceOfShape.hxx>
// ribbon
#include "SARibbonBar/SARibbonBar.h"
#include "SARibbonBar/SARibbonCategory.h"
@ -95,6 +103,9 @@
// logger
#include "Common/DebugLogger.h"
#include "PluginWBFZExchangePlugin/OCCTBase.h"
#include "PointCloudOperator/MeshOpearatorCommon.h"
#include "MainWidgets/fekocadTaskinit.h"
namespace GUI {
MainWindow::MainWindow(bool useRibbon)
@ -166,6 +177,18 @@ namespace GUI {
QApplication::applicationDirPath() + "/customization.xml";
sa_apply_customize_from_xml_file(strCostomizePath, this, m_ribbonActionMgr);
}
// 控制菜单,这些功能后期开发仿真算法之后,再开放功能
{
qDebug() << " V1.2";
_ui->postEditorTtoolBar->hide();
_ui->postToolBar->hide();
_ui->postViewerToolBar->hide();
_postToolBar->hide();
_controlPanel->setphysicsTab(false);
_controlPanel->setpostTab(false);
_controlPanel->setplotTab(false);
qDebug() << "_controlPaneld has tab : " + QString::number(_controlPanel->getTabCount());
}
}
MainWindow::~MainWindow()
@ -231,6 +254,7 @@ 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->actionScaneExport, SIGNAL(triggered()), this, SLOT(on_exportMesh()));
connect(_ui->actionLoadPointCloud, SIGNAL(triggered()), this, SLOT(on_importPcl())); // 点云
connect(_ui->actionSavePointCloud, SIGNAL(triggered()), this, SLOT(on_exportPcl()));
@ -254,22 +278,38 @@ namespace GUI {
connect(_ui->actionVTKTranslation, SIGNAL(triggered()), this, SLOT(on_VTKTranslation()));
// 点云
connect(_ui->actionPCLStatisticalRemoveFilter,SIGNAL(triggered()),this,SLOT(on_pclStatisticalRemoveFilter()));
connect(_ui->actionPCLRadiusOutlierRemoval,SIGNAL(triggered()),this,SLOT(on_pclRadiusOutlierRemoval()));
connect(_ui->actionPCLGuassFilter,SIGNAL(triggered()),this,SLOT(on_pclGuassFilter()));
connect(_ui->actionPCLBilateralFilter,SIGNAL(triggered()),this,SLOT(on_pclBilateralFilter()));
connect(_ui->actionPCLGPMesh,SIGNAL(triggered()),this,SLOT(on_pclGPMesh()));
connect(_ui->actionPCLStatisticalRemoveFilter, SIGNAL(triggered()), this,
SLOT(on_pclStatisticalRemoveFilter()));
connect(_ui->actionPCLRadiusOutlierRemoval, SIGNAL(triggered()), this,
SLOT(on_pclRadiusOutlierRemoval()));
connect(_ui->actionPCLGuassFilter, SIGNAL(triggered()), this, SLOT(on_pclGuassFilter()));
connect(_ui->actionPCLBilateralFilter, SIGNAL(triggered()), this,
SLOT(on_pclBilateralFilter()));
connect(_ui->actionPCLGPMesh, SIGNAL(triggered()), this, SLOT(on_pclGPMesh()));
// connect(_ui->actionLoadPointCloudText,SIGNAL(triggered()),this,SLOT(on_actionLoadPointCloudText()));
connect(_ui->actionPCLPoissonMesh, SIGNAL(triggered()), this, SLOT(on_pclPoissonMesh()));
// feko 参数
connect(_ui->actionImageSetting,SIGNAL(triggered()),this,SLOT(on_actionImageSetting()));
connect(_ui->actionFEKO2csv,SIGNAL(triggered()),this,SLOT(on_actionFEKO2csv()));
connect(_ui->actionScatterExport,SIGNAL(triggered()),this,SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImage,SIGNAL(triggered()),this,SLOT(on_actionFEKOImage()));
connect(_ui->actionantScatteringFEKOSetting,SIGNAL(triggered()),this,SLOT(on_actionantScatteringFEKOSetting()));
// 属性表
connect(_ui->actionAttriutionDBShow,SIGNAL(triggered()),this,SLOT(on_AttriutionDBShow()));
connect(_ui->actionImageSetting, SIGNAL(triggered()), this, SLOT(on_actionImageSetting()));
connect(_ui->actionFEKO2csv, SIGNAL(triggered()), this, SLOT(on_actionFEKO2csv()));
connect(_ui->actionScatterExport, SIGNAL(triggered()), this,
SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImage, SIGNAL(triggered()), this, SLOT(on_actionFEKOImage()));
connect(_ui->actionantScatteringFEKOSetting, SIGNAL(triggered()), this,
SLOT(on_actionantScatteringFEKOSetting()));
connect(_ui->actionFEKOScatterSetting, SIGNAL(triggered()), this,
SLOT(on_actionantScatteringFEKOSetting()));
connect(_ui->actionLoadFEKOScatterResult, SIGNAL(triggered()), this,
SLOT(on_actionFEKO2csv()));
connect(_ui->actionExportRCS, SIGNAL(triggered()), this, SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImageSetting, SIGNAL(triggered()), this,
SLOT(on_actionImageSetting()));
connect(_ui->actionLoadFEKOImageResult, SIGNAL(triggered()), this, SLOT(on_actionFEKO2csv()));
connect(_ui->actionExportFEKOResultToEcho, SIGNAL(triggered()), this, SLOT(on_actionScatterExport()));
connect(_ui->actionFEKOImageCreate, SIGNAL(triggered()), this, SLOT(on_actionFEKOImage()));
// 属性表
connect(_ui->actionAttriutionDBShow, SIGNAL(triggered()), this,
SLOT(on_AttriutionDBShow()));
// 设置视角
_viewSignalMapper = new QSignalMapper(this);
@ -299,6 +339,11 @@ namespace GUI {
connect(_ui->actionBoxMeshNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshCell, SIGNAL(triggered()), _selectSignalMapper, SLOT(map()));
connect(_ui->actionBoxMeshSurfaceNode, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map())); // 多选
connect(_ui->actionBoxMeshSurfaceCell, SIGNAL(triggered()), _selectSignalMapper,
SLOT(map()));
_selectSignalMapper->setMapping(_ui->actionSelectOff, (int)ModuleBase::SelectModel::None);
//_selectSignalMapper->setMapping(_ui->actionSelectGeoBody,
//(int)ModuleBase::SelectModel::GeometryBody);
@ -311,9 +356,16 @@ namespace GUI {
(int)ModuleBase::SelectModel::BoxMeshNode);
_selectSignalMapper->setMapping(_ui->actionBoxMeshCell,
(int)ModuleBase::SelectModel::BoxMeshCell);
_selectSignalMapper->setMapping(_ui->actionBoxMeshSurfaceNode,
(int)ModuleBase::SelectModel::BoxMeshSurfaceNode);
_selectSignalMapper->setMapping(_ui->actionBoxMeshSurfaceCell,
(int)ModuleBase::SelectModel::BoxMeshSurfaceCell);
connect(_selectSignalMapper, SIGNAL(mapped(int)), this,
SIGNAL(selectModelChangedSig(int))); // 选择模式更改信号
connect(_selectSignalMapper, SIGNAL(mapped(int)), this,
SLOT(selectModelChanged(int))); // 选择模型更改为
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SIGNAL(selectModelChangedSig(int))); // 选择模式更改信号
connect(_selectSignalMapper, SIGNAL(mapped(int)), this, SLOT(selectModelChanged(int))); // 选择模型更改为
// 网格显示模式
// _displayModeSignalMapper = new QSignalMapper(this);
connect(_ui->actionDisplayNode, SIGNAL(triggered()), this, SLOT(setMeshDisplay()));
@ -333,6 +385,7 @@ namespace GUI {
connect(_ui->actionSelectFace, SIGNAL(triggered()), _selectGeometryModeMapper, SLOT(map()));
connect(_ui->actionSelectGeometryBody, SIGNAL(triggered()), _selectGeometryModeMapper,
SLOT(map()));
_selectGeometryModeMapper->setMapping(_ui->actionSelectOff,
(int)ModuleBase::SelectModel::None);
_selectGeometryModeMapper->setMapping(_ui->actionSelectPoint,
@ -368,7 +421,75 @@ namespace GUI {
connect(this, SIGNAL(openPlot()), _signalHandler, SLOT(openPlotFile()));
// 点云模块
connect(this, SIGNAL(importMeshSIGN(QString, QString, int)), this,
SLOT(importMesh(QString, QString, int)));
// 导入点云
connect(this, SIGNAL(importPclSIGN(QString, QString, int)), this,
SLOT(importPcl(QString, QString, int)));
// 绑定 vtk 中世界坐标系
connect(this, SIGNAL(showStateToolbarPositionSIGNGAL(double, double, double)), this,
SLOT(showStateToolbarPosition(double, double, double)));
// 采样相关事件
connect(_ui->actionvtkPointSamplor, SIGNAL(triggered()), this,
SLOT(on_actionvtkPointSamplor()));
connect(_ui->actionImageShowTool, SIGNAL(triggered()), this,
SLOT(on_actionImageShowTool()));
connect(_ui->actionRCShowTool, SIGNAL(triggered()), this, SLOT(on_actionRCShowTool()));
// 加载预制模型
connect(_ui->actionLoadPreForestMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreForestMeshFile_triggereds()));
connect(_ui->actionLoadPreCropMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreCropMeshFile_triggereds()));
connect(_ui->actionLoadPreGrasslandMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreGrasslandMeshFile_triggereds()));
connect(_ui->actionLoadPreWaterBodyMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreSoilMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreSoilMeshFile_triggereds()));
connect(_ui->actionLoadPreDynamicWaterBodyMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreDynamicWaterBodyMeshFile_triggereds()));
connect(_ui->actionLoadPreRoadMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreRoadMeshFile_triggereds()));
connect(_ui->actionLoadPreArtificialMeshFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadPreArtificialMeshFile_triggereds()));
connect(_ui->actionLoadForestPointCloudFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadForestPointCloudFile_triggereds()));
connect(_ui->actionLoadRhounessPointCloudFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadRhounessPointCloudFile_triggereds()));
connect(_ui->actionLoadGeometricCorrectionFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadGeometricCorrectionFile_triggereds()));
connect(_ui->actionLoadRadioModelFile, SIGNAL(triggered()), this,
SLOT(on_actionLoadRadioModelFile_triggereds()));
// 网格操作
connect(_ui->actionMeshDelete, SIGNAL(triggered()), this, SLOT(on_deleteMesh()));
connect(_ui->actionMeshCopy, SIGNAL(triggered()), this, SLOT(on_copyMesh()));
connect(_ui->actionMeshClip, SIGNAL(triggered()), this, SLOT(on_clipMesh()));
connect(_ui->actionMeshSave, SIGNAL(triggered()), this, SLOT(on_saveMeshEdit()));
// 网格三角网
connect(_ui->actionMeshTriangleSurface, SIGNAL(triggered()), this,
SLOT(on_actionMeshTriangleSurface()));
// 网格转换为几何
connect(_controlPanel, SIGNAL(MeshToGeometrySig(MeshData::MeshKernal*)), this,
SLOT(on_MeshToGeo(MeshData::MeshKernal*)));
// 网格
connect(_ui->action_generatorWaterPlane, SIGNAL(triggered()), this,
SLOT(on_action_generatorWaterPlane()));
// connect(_ui->actionMeshToOCCT,SIGNAL(triggered()),this,SLOT(on_actionMeshToOCCT()));
connect(_ui->actionBatchStartFEKOCADModel, SIGNAL(triggered()), this,
SLOT(on_actionBatchStartFEKOCADModel()));
connect(_ui->actionCreateLoadModelScript, SIGNAL(triggered()), this,
SLOT(on_actionCreateLoadModelScript()));
connect(_ui->actionCreateCADModel, SIGNAL(triggered()), this,
SLOT(on_actionCreateCADModel()));
}
@ -387,6 +508,9 @@ namespace GUI {
_processWindow = new MainWidget::ProcessWindow(this);
_processWindow->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea);
addDockWidget(Qt::BottomDockWidgetArea, _processWindow);
}
Ui::MainWindowRibbon* MainWindow::getUi()
@ -616,7 +740,8 @@ namespace GUI {
}
}
void MainWindow::importMesh(QString fileName,QString aSuffix,int modelID){
void MainWindow::importMesh(QString fileName, QString aSuffix, int modelID)
{
if(fileName.isEmpty())
return;
QString pyCode = QString("MainWindow.importMesh(\"%1\",\"%2\",%3)")
@ -626,6 +751,17 @@ namespace GUI {
Py::PythonAgent::getInstance()->submit(pyCode);
}
void MainWindow::importPcl(QString fileName, QString aSuffix, int modelID)
{
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_importMesh()
{
QStringList suffixlist = IO::IOConfigure::getMeshImporters();
@ -635,20 +771,23 @@ namespace GUI {
return;
}
QStringList meshsuffix =
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getImportSuffix().split(
";");
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getImportSuffix(ConfigOption::MeshDataType::vtkMesh)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
if(suffix.contains(s)) {
list.append(suffix);
}
}
}
std::sort(list.begin(), list.end());
// DebugInfo("import mesh data file format : %s \n ",
// list.join(";;").toUtf8().constData());
QString suffixes = list.join(";;");
QString senderName = sender()->objectName();
int modelID = -1;
@ -656,7 +795,7 @@ namespace GUI {
suffixes = list.at(0);
modelID = senderName.right(1).toInt();
}
// DebugInfo("import mesh data file format : %s \n ", suffixes.toUtf8().constData());
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Import Mesh"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptOpen);
@ -675,17 +814,6 @@ namespace GUI {
Py::PythonAgent::getInstance()->submit(pyCode);
}
void MainWindow::importPcl(QString fileName,QString aSuffix,int modelID){
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_importPcl()
{
QStringList suffixlist = IO::IOConfigure::getPclImporters();
@ -766,7 +894,15 @@ namespace GUI {
void MainWindow::on_exportMesh()
{
// 根据用户的选择做出响应
if(QMessageBox::question(nullptr, "info", u8"是否保存网格模型修改?",
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
this->on_saveMeshEdit();
// 执行相关操作
} else {
// this->on_saveMeshEdit();
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
@ -811,6 +947,7 @@ namespace GUI {
QString aFileName = dlg.selectedFiles().join(",");
if(aFileName.isEmpty())
return;
QString pyCode = QString("MainWindow.exportMesh(\"%1\",\"%2\",%3)")
.arg(aFileName)
.arg(aSuffix)
@ -994,7 +1131,8 @@ namespace GUI {
_ui->actionSelectMeshCell->setChecked(false);
_ui->actionBoxMeshNode->setChecked(false);
_ui->actionBoxMeshCell->setChecked(false);
_ui->actionBoxMeshSurfaceNode->setChecked(false);
_ui->actionBoxMeshSurfaceCell->setChecked(false);
switch(model) {
case(int)ModuleBase::SelectModel::None:
_ui->actionSelectOff->setChecked(true);
@ -1011,7 +1149,12 @@ namespace GUI {
case(int)ModuleBase::SelectModel::BoxMeshCell:
_ui->actionBoxMeshCell->setChecked(true);
break;
case(int)ModuleBase::SelectModel::BoxMeshSurfaceNode:
_ui->actionBoxMeshSurfaceNode->setChecked(true);
break;
case(int)ModuleBase::SelectModel::BoxMeshSurfaceCell:
_ui->actionBoxMeshSurfaceCell->setChecked(true);
break;
default:
break;
}
@ -1330,6 +1473,10 @@ namespace GUI {
void MainWindow::printMessage(Common::Message type, QString m)
{
// 比较长的 提示 做截断
if(m.size() > 100) {
m = m.left(100) + "...";
}
ModuleBase::Message s(type, m);
emit printMessageToMessageWindow(s);
}
@ -1412,7 +1559,8 @@ namespace GUI {
_graphRange = new QLabel(this);
_ui->statusbar->addPermanentWidget(_graphRange);
}
QString text = QString(tr("Canvas %1mm * %2mm ")).arg(w).arg(h);
QString text = QString(tr("Canvas %1m * %2m ")).arg(w).arg(h);
_graphRange->setText(text);
}
@ -1543,34 +1691,394 @@ namespace GUI {
}
// FEKO
void MainWindow::on_actionImageSetting() {
void MainWindow::on_actionImageSetting()
{
DebugInfo("on_actionImageSetting\n");
emit this->on_actionImageSetting(this);
}
void MainWindow::on_actionFEKO2csv() {
void MainWindow::on_actionFEKO2csv()
{
DebugInfo("on_actionFEKO2csv\n");
emit this->on_actionFEKO2csv(this);
}
void MainWindow::on_actionScatterExport() {
void MainWindow::on_actionScatterExport()
{
DebugInfo("on_actionScatterExport\n");
emit this->on_actionScatterExport(this);
}
void MainWindow::on_actionFEKOImage() {
void MainWindow::on_actionFEKOImage()
{
DebugInfo("on_actionFEKOImage\n");
emit this->on_actionFEKOImage(this);
}
void MainWindow::on_actionantScatteringFEKOSetting() {
void MainWindow::on_actionantScatteringFEKOSetting()
{
DebugInfo("on_actionantScatteringFEKOSetting\n");
emit this->on_actionantScatteringFEKOSetting(this);
}
void MainWindow::on_AttriutionDBShow() {
void MainWindow::on_AttriutionDBShow()
{
DebugInfo("on_AttriutionDBShow\n");
emit this->on_actionAttriutionDBShow(this);
}
void MainWindow::showStateToolbarPosition(double x, double y, double z)
{
if(_vtkworldPostion == nullptr) {
_vtkworldPostion = new QLabel(this);
_ui->statusbar->addPermanentWidget(_vtkworldPostion);
}
QString text = QString(tr("model world position : %2m, %3m, %4m ")).arg(x).arg(y).arg(z);
_vtkworldPostion->setText(text);
}
void MainWindow::on_actionvtkPointSamplor()
{
DebugInfo("on_actionvtkPointSamplor\n");
emit this->on_actionvtkPointSamplorTriggleSIGNAL(this);
}
void MainWindow::on_actionImageShowTool()
{
DebugInfo("on_actionImageShowTool\n");
emit this->on_actionImageShowToolTriggleSIGNAL(this);
}
void MainWindow::on_actionRCShowTool()
{
DebugInfo("on_actionRCShowTool\n");
emit this->on_actionRCShowToolSIGNAL(this);
}
void MainWindow::on_pclPoissonMesh()
{
DebugInfo("on_pclPoissonMesh\n");
emit this->on_pclPoissonMesh(this);
}
void MainWindow::on_actionLoadPointCloudText()
{
DebugInfo("on_actionLoadPointCloudText\n");
// emit this->actionLoadPointCloudText(this);
}
//"forest", "crop", "grass", "uav", "water", "dwater", "road", "geo", "radi", "soil", "land",
//"vegetation", "water_scene"
void MainWindow::on_actionLoadPreForestMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreForestMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "forest");
}
void MainWindow::on_actionLoadPreCropMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreCropMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "crop");
}
void MainWindow::on_actionLoadPreGrasslandMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreGrasslandMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "grass");
}
void MainWindow::on_actionLoadPreWaterBodyMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "water");
}
void MainWindow::on_actionLoadPreSoilMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreSoilMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "soil");
}
void MainWindow::on_actionLoadPreDynamicWaterBodyMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreDynamicWaterBodyMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "dwater");
}
void MainWindow::on_actionLoadPreRoadMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreRoadMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "road");
}
void MainWindow::on_actionLoadPreArtificialMeshFile_triggereds()
{
DebugInfo("on_actionLoadPreArtificialMeshFile_triggered\n");
emit this->on_loadPreMeshFile(this, "uav");
}
void MainWindow::on_actionLoadForestPointCloudFile_triggereds()
{
DebugInfo("on_actionLoadForestPointCloudFile_triggered\n"); // 加载点云
on_importPcl();
}
void MainWindow::on_actionLoadRhounessPointCloudFile_triggereds()
{ // 加载粗糙度点云
DebugInfo("on_actionLoadRhounessPointCloudFile_triggered\n");
on_importPcl();
}
void MainWindow::on_actionLoadGeometricCorrectionFile_triggereds()
{
DebugInfo("on_actionLoadGeometricCorrectionFile_triggered\n");
emit this->on_loadPreMeshFile(this, "geo");
}
void MainWindow::on_actionLoadRadioModelFile_triggereds()
{
DebugInfo("on_actionLoadRadioModelFile_triggered\n");
emit this->on_loadPreMeshFile(this, "radi");
}
void MainWindow::on_deleteMesh()
{
DebugInfo("MainWindow::on_deleteMesh\n");
emit this->on_deleteMeshSIGNAL(this);
}
void MainWindow::on_copyMesh()
{
DebugInfo("MainWindow::on_copyMesh\n");
emit this->on_copyMeshSIGNAL(this);
}
void MainWindow::on_clipMesh()
{
DebugInfo("MainWindow::on_clipMesh\n");
emit this->on_clipMeshSIGNAL(this);
}
void MainWindow::on_saveMeshEdit()
{
DebugInfo("MainWindow::on_saveMeshEdit\n");
MeshData::MeshData* _meshData = MeshData::MeshData::getInstance();
MainWidget::MeshViewProvider* _meshProvider =
this->getSubWindowManager()->getPreWindow()->getMeshViewProvider();
// 更新保存模型
int nKernal = _meshData->getKernalCount();
if(nKernal == 0)
return;
for(int i = 0; i < nKernal; ++i) {
auto k = _meshData->getKernalAt(i); // 获取对应的kernal
auto vObjs = _meshProvider->getViewObjects(k); // 获取对应的view对象
if(!(k->isVisible()) || nullptr == vObjs)
continue;
// 根据显示更新实体
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->AddInputData(vObjs->getDisplayData());
geometryFilter->Update();
k->setMeshData(geometryFilter->GetOutput());
qDebug() << QString("%1 Point Number %2,Cel Number %3")
.arg(k->getName())
.arg(k->getMeshData()->GetNumberOfPoints())
.arg(k->getMeshData()->GetNumberOfCells());
// k->getMeshData()->DeepCopy(vObjs->getDisplayData());
}
// emit this->on_saveMeshSIGNAL(this);
}
void MainWindow::on_actionMeshTriangleSurface()
{
DebugInfo("MainWindow::on_actionMeshTriangleSurface\n");
emit this->on_actionMeshTriangleSurfaceSIGNAL(this);
}
void MainWindow::on_MeshToGeo(MeshData::MeshKernal* k)
{
DebugInfo("MainWindow::on_MeshToGeo\n");
vtkDataSet* meshdata = k->getMeshData();
TopoDS_Shape* polyshp = MeshOpearator::MeshOpearatorCommon::vtkdataSetToOCC(meshdata);
if(nullptr == polyshp) {
return;
}
Geometry::GeometrySet* geoSet =
new Geometry::GeometrySet(Geometry::GeometryType::STL, true);
qDebug() << "Model geoSet";
geoSet->setShape(polyshp);
geoSet->setName(k->getName() + "_mesh2OCCT");
Geometry::GeometryData::getInstance()->appendGeometrySet(geoSet);
qDebug() << "Model geoSet";
emit this->updateActionStatesSig();
emit this->_subWindowManager->getPreWindow()->showGeoSet(geoSet, true);
emit this->updateGeometryTreeSig();
qDebug() << "Model over";
}
void MainWindow::on_action_generatorWaterPlane()
{
DebugInfo("MainWindow::on_action_generatorWaterPlane\n");
emit this->on_action_generatorWaterPlaneSIGNAL(this);
}
void MainWindow::on_actionBatchStartFEKOCADModel() {
MainWidget::fekocadTaskinit* dlg=new MainWidget::fekocadTaskinit(this);
dlg->exec();
}
void MainWindow::on_actionCreateCADModel() {
DebugInfo("MainWindow::on_actionCreateCADModel\n");
QStringList stlList;
{
// 弹出对话框,询问是否导入场景中模型
if(MeshData::MeshData::getInstance()->getKernalCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的网格模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
stlList = this->on_saveMesh2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择stl文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"STL(*.stl)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
stlList.append(fileName);
}
}
}
QStringList geoList;
{
if(Geometry::GeometryData::getInstance()->getGeometrySetCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的几何模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
geoList = this->on_saveGeometryModel2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择iges文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"IGES(*.igs)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
geoList.append(fileName);
}
}
}
for(QString igsname:geoList){
stlList.append(igsname);
}
MainWidget::CreateFEKOCADModel* DialogcreateFekoCAD=new MainWidget::CreateFEKOCADModel(this);
DialogcreateFekoCAD->setSTLFilePathList(stlList);
DialogcreateFekoCAD->exec();
}
QStringList MainWindow::on_saveGeometryModel2StlFile_InScane()
{
QStringList geofileList;
QString geoPath=QFileDialog::getSaveFileName(this, "Save Geometry in FEKOCAD WorkSpace", "", "IGES(*.igs)");
if(geoPath.isEmpty())
{
return QStringList();
}
QString pycode = QString("MainWindow.exportGeometry(\"%1\")").arg(geoPath);
Py::PythonAgent::getInstance()->submit(pycode);
geofileList.append(geoPath);
return geofileList;
}
QStringList MainWindow::on_saveMesh2StlFile_InScane()
{
int KernalCount=MeshData::MeshData::getInstance()->getKernalCount();
QStringList stlfileList;
for(int ki=0;ki<KernalCount;ki++){
MeshData::MeshKernal* k=MeshData::MeshData::getInstance()->getKernalAt(ki);
if(k->isVisible()) {
MainWidget::MeshKernalViewObj* viewObj = this->getSubWindowManager()
->getPreWindow()
->getMeshViewProvider()
->getViewObjects(k);
if(viewObj->getDisplayData()->GetNumberOfCells()!=k->getMeshData()->GetNumberOfCells()||viewObj->getDisplayData()->GetNumberOfPoints()!=k->getMeshData()->GetNumberOfPoints()) {
if(QMessageBox::information(this, tr("Warning"), tr(u8"模型已经修改是否保存模型并导入到FEKOCAD中?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// 根据显示更新实体
k->getMeshData()->Initialize();
vtkSmartPointer<vtkGeometryFilter> geometryFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
geometryFilter->AddInputData(viewObj->getDisplayData());
geometryFilter->Update();
k->setMeshData(geometryFilter->GetOutput());
}
}else{}
QString stlPath=QFileDialog::getSaveFileName(this, "Save File in FEKOCAD WorkSpace", Setting::BusAPI::instance()->getWorkingDir()+"/"+k->getName(), "STL(*.stl)");
if(stlPath.isEmpty())
{
continue;
}
else{
// 保存模型
if(MeshOpearator::MeshOpearatorCommon::saveMeshDataToSTL( stlPath,k->getMeshData())){
this->printMessageToMessageWindow(ModuleBase::Message(Common::Message::Normal,QString(tr("Save %1 success!")).arg(stlPath)));
stlfileList.append(stlPath);
}else{
this->printMessageToMessageWindow(ModuleBase::Message(Common::Message::Error,QString(tr("Save %1 failed!")).arg(stlPath)));
}
}
}
else{}
}
return stlfileList;
}
void MainWindow::on_actionCreateLoadModelScript()
{
QStringList stlList;
{
// 弹出对话框,询问是否导入场景中模型
if(MeshData::MeshData::getInstance()->getKernalCount()!=0 && QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的网格模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
stlList = this->on_saveMesh2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择stl文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
tr(u8"STL(*.stl)") // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
stlList.append(fileName);
}
}
}
QStringList geoList;
{
if(Geometry::GeometryData::getInstance()->getGeometrySetCount()!=0 &&QMessageBox::information(this, tr("Warning"), tr(u8"是否导入当前场景中的几何模型?"),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes) {
// 根据显示更新实体
geoList = this->on_saveGeometryModel2StlFile_InScane();
} else {
QStringList fileNames = QFileDialog::getOpenFileNames(
this, // Parent widget
tr(u8"选择IGES文件导入到FEKOCAD中"), // Dialog title
Setting::BusAPI::instance()->getWorkingDir(), // Starting directory
u8"IGES(*.igs)" // File filter
);
// Add the selected file paths to the list widget
for(const QString& fileName : fileNames) {
geoList.append(fileName);
}
}
}
if(stlList.count()!=0||geoList.count()!=0) {
// 生成FEKO模型加载参数
QString scriptPath = QFileDialog::getSaveFileName(
this, u8"保存为CAD模型创建文件", Setting::BusAPI::instance()->getWorkingDir(),
"_model_init_script(*.lua)");
if(scriptPath.isEmpty()) {
return;
} else {
}
Setting::TaskDesc* newTaskDesc = Setting::BusAPI::instance()->getNewTask();
newTaskDesc->setTaskClass(Setting::TaskClassDesc::WriteTask);
newTaskDesc->setState(Setting::TaskDescState::Running);
newTaskDesc->setTaskName(scriptPath);
emit actionGenerateImportModelScript(newTaskDesc->getTaskId(), this, stlList, geoList,
scriptPath);
}else{}
}
} // namespace GUI

View File

@ -35,6 +35,7 @@
// ribbon customize
#include "SARibbonBar/SARibbonActionsManager.h"
#include "SARibbonBar/SARibbonCustomizeWidget.h"
#include "MainWidgets/meshKernalViewObject.h"
class XToolManger;
class QTreeWidgetItem;
@ -85,6 +86,7 @@ namespace Post {
namespace XReport {
class ReportWindow;
}
namespace GUI {
class SubWindowManager;
class SignalHandler;
@ -160,6 +162,11 @@ namespace GUI {
signals:
// 网格操作
void on_deleteMeshSIGNAL(GUI::MainWindow* m);
void on_copyMeshSIGNAL(GUI::MainWindow* m);
void on_clipMeshSIGNAL(GUI::MainWindow* m);
void on_saveMeshSIGNAL(GUI::MainWindow* m);
/*更新注册接口*/
void updateInterfaces();
/*发送信息给状态栏 */
@ -305,8 +312,8 @@ namespace GUI {
// 打开二维曲线绘制信号
void openPlot();
// 点云处理信号
void on_actionLoadPointCloudText(GUI::MainWindow* m);
// 统计滤波
void on_pclStatisticalRemoveFilter(GUI::MainWindow* m);
// 半径滤波
@ -317,7 +324,7 @@ namespace GUI {
void on_pclBilateralFilter(GUI::MainWindow* m);
// GP网格重建
void on_pclGPMesh(GUI::MainWindow* m);
void on_pclPoissonMesh(GUI::MainWindow* m);
// FEKO仿真参数的
void on_actionImageSetting(GUI::MainWindow* m);
void on_actionFEKO2csv(GUI::MainWindow* m);
@ -328,7 +335,36 @@ namespace GUI {
// Tool Show
void on_actionAttriutionDBShow(GUI::MainWindow* m);
// 导入网格
void importMeshSIGN(QString filepath,QString aSuffix,int modelID);
/// 导入点云
void importPclSIGN(QString filepath,QString aSuffix,int modelID);
// 显示前处理窗口中的世界坐标值
void showStateToolbarPositionSIGNGAL(double x,double y,double z);
void on_actionvtkPointSamplorTriggleSIGNAL(GUI::MainWindow* m);
void on_actionImageShowToolTriggleSIGNAL(GUI::MainWindow* m);
void on_actionRCShowToolSIGNAL(GUI::MainWindow* m);
void on_loadPreMeshFile(GUI::MainWindow* m,QString modeltype);
void on_actionMeshTriangleSurfaceSIGNAL(GUI::MainWindow* m);
void on_actionMeshToOCCTSIGNAL(GUI::MainWindow* m);
void on_action_generatorWaterPlaneSIGNAL(GUI::MainWindow* m);
void exportMeshKernel2FEKOCAD(int taskID,QString FilePath,GUI::MainWindow* m,MeshData::MeshKernal* k,MainWidget::MeshKernalViewObj* viewObj);
void actionGenerateImportModelScript(int TaskID,GUI::MainWindow* m,QStringList stlPath,QStringList geoList,QString scriptPath);
public slots:
void on_actionCreateLoadModelScript();
/*状态栏显示信息 */
void setStatusBarInfo(QString);
/// 切换语言
@ -365,7 +401,7 @@ namespace GUI {
void exportGeometry(QString f);
// 更新工具栏信息
// void updateActionsStates();
void on_actionLoadPointCloudText();
// 统计滤波
void on_pclStatisticalRemoveFilter();
// 半径滤波
@ -376,9 +412,44 @@ namespace GUI {
void on_pclBilateralFilter();
// GP网格重建
void on_pclGPMesh();
void on_pclPoissonMesh();
// feko 设置
void on_AttriutionDBShow();
// 导入mesh
void importMesh(QString filepath,QString aSuffix,int modelID);
// 导入点云
void importPcl(QString filepath,QString aSuffix,int modelID);
// 在状态栏中显示坐标
void showStateToolbarPosition(double x,double y,double z);
// 加载预制模型
void on_actionLoadPreForestMeshFile_triggereds();
void on_actionLoadPreCropMeshFile_triggereds();
void on_actionLoadPreGrasslandMeshFile_triggereds();
void on_actionLoadPreWaterBodyMeshFile_triggereds();
void on_actionLoadPreSoilMeshFile_triggereds();
void on_actionLoadPreDynamicWaterBodyMeshFile_triggereds();
void on_actionLoadPreRoadMeshFile_triggereds();
void on_actionLoadPreArtificialMeshFile_triggereds();
void on_actionLoadForestPointCloudFile_triggereds();
void on_actionLoadRhounessPointCloudFile_triggereds();
void on_actionLoadGeometricCorrectionFile_triggereds();
void on_actionLoadRadioModelFile_triggereds();
// 网格操作
void on_deleteMesh();
void on_copyMesh();
void on_clipMesh();
void on_saveMeshEdit();
void on_actionMeshTriangleSurface();
QStringList on_saveMesh2StlFile_InScane();
//void on_actionMeshToOCCT();
QStringList on_saveGeometryModel2StlFile_InScane();
private slots:
/*关闭主窗口 */
void closeWindow();
@ -395,8 +466,8 @@ namespace GUI {
/// 导入点云
void on_importPcl();
void on_actionBatchStartFEKOCADModel();
void on_actionCreateCADModel();
// 导入网格
void importMeshDataset(vtkDataSet* dataset);
// 导出网格
@ -452,7 +523,18 @@ namespace GUI {
// 散射界面设置
void on_actionantScatteringFEKOSetting();
//重采样算法相关
void on_actionvtkPointSamplor();
// 图像
void on_actionImageShowTool();
void on_actionRCShowTool();
// meshtoGeo
void on_MeshToGeo(MeshData::MeshKernal *k);
void on_action_generatorWaterPlane();
private:
/*初始化Menu*/
// void initMenu();
@ -567,6 +649,11 @@ namespace GUI {
* @since 2.5.0
*/
QLabel* _graphRange{};
/**
* @brief vtk
* @since 2.5.0
*/
QLabel* _vtkworldPostion{};
///< MG tool manger
// MainWidget::ControlPanel* _controlPanel{};
// MainWidget::ProcessWindow* _processWindow{};

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1678</width>
<height>921</height>
<width>1156</width>
<height>900</height>
</rect>
</property>
<property name="windowTitle">
@ -41,7 +41,6 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionImportMesh"/>
@ -99,6 +98,8 @@
<addaction name="actionSelectMeshCell"/>
<addaction name="actionBoxMeshNode"/>
<addaction name="actionBoxMeshCell"/>
<addaction name="actionBoxMeshSurfaceNode"/>
<addaction name="actionBoxMeshSurfaceCell"/>
<addaction name="separator"/>
<addaction name="actionSelectPoint"/>
<addaction name="actionSelectCurve"/>
@ -271,7 +272,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1678</width>
<width>1156</width>
<height>26</height>
</rect>
</property>
@ -279,7 +280,6 @@
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionClose"/>
<addaction name="separator"/>
@ -314,14 +314,6 @@
<addaction name="actionViewZMinus"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionUser_Guidance"/>
<addaction name="actionUser_Manual"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuSolve">
<property name="enabled">
<bool>true</bool>
@ -381,6 +373,13 @@
<addaction name="actionSelectMeshCell"/>
<addaction name="actionBoxMeshNode"/>
<addaction name="actionBoxMeshCell"/>
<addaction name="actionBoxMeshSurfaceNode"/>
<addaction name="actionBoxMeshSurfaceCell"/>
</widget>
<widget class="QMenu" name="menuMeshEdit">
<property name="title">
<string>MeshEdit</string>
</property>
</widget>
<addaction name="actionSurfaceMesh"/>
<addaction name="actionSolidMesh"/>
@ -393,15 +392,15 @@
<addaction name="actionVTKTranslation"/>
<addaction name="menuView_2"/>
<addaction name="menuSelect"/>
<addaction name="menuMeshEdit"/>
</widget>
<widget class="QMenu" name="menuWindows">
<property name="title">
<string>Windows</string>
</property>
<addaction name="actionPre_Window"/>
<addaction name="action2DPlot"/>
<addaction name="action3DGraph"/>
<addaction name="actionAttriutionDBShow"/>
<addaction name="actionImageShowTool"/>
</widget>
<widget class="QMenu" name="menuGeometry">
<property name="title">
@ -529,9 +528,17 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/tree.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/tree.png</iconset>
</property>
<addaction name="actionPCLGPMesh"/>
<addaction name="actionPCLPoissonMesh"/>
</widget>
<widget class="QMenu" name="menusampling">
<property name="title">
<string>sampling</string>
</property>
<addaction name="actionvtkPointSamplor"/>
</widget>
<addaction name="menuPCLFilter"/>
<addaction name="menureSurfaceMesh"/>
<addaction name="menusampling"/>
</widget>
<widget class="QMenu" name="menuFEKOSimulation">
<property name="title">
@ -543,8 +550,566 @@
<addaction name="actionFEKOImage"/>
<addaction name="separator"/>
<addaction name="actionantScatteringFEKOSetting"/>
<addaction name="separator"/>
<addaction name="actionCreateLoadModelScript"/>
<addaction name="actionCreateCADModel"/>
<addaction name="actionBatchStartFEKOCADModel"/>
</widget>
<widget class="QMenu" name="menuTarget">
<property name="title">
<string>目标与场景</string>
</property>
<widget class="QMenu" name="MenuForestTarget">
<property name="title">
<string>森林目标</string>
</property>
<widget class="QMenu" name="menuWBZB_ForestTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreForestMeshFile"/>
<addaction name="separator"/>
<addaction name="actionGeoProcess"/>
<addaction name="actionMeshProcess"/>
<addaction name="actionPointCloudProcess"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_ForestTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_ForestTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_ForestTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_ForestTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_ForestTarget"/>
</widget>
<widget class="QMenu" name="MenuCropTarget">
<property name="title">
<string>农作物目标</string>
</property>
<widget class="QMenu" name="menuWBZB_CropTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreCropMeshFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_CropTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_CropTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_CropTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_CropTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_CropTarget"/>
</widget>
<widget class="QMenu" name="MenuGrasslandTarget">
<property name="title">
<string>草地目标</string>
</property>
<widget class="QMenu" name="menuWBZB_GrasslandTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreGrasslandMeshFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_GrasslandTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_GrasslandTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_GrasslandTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_GrasslandTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_GrasslandTarget"/>
</widget>
<widget class="QMenu" name="MenuWaterBodyTarget">
<property name="title">
<string>水体目标</string>
</property>
<widget class="QMenu" name="menuWBZB_WaterBodyTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_WaterBodyTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_WaterBodyTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_WaterBodyTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_WaterBodyTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_WaterBodyTarget"/>
</widget>
<widget class="QMenu" name="MenuSoilTarget">
<property name="title">
<string>土壤目标</string>
</property>
<widget class="QMenu" name="menuWBZB_SoilTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_SoilTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_SoilTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_SoilTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_SoilTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_SoilTarget"/>
</widget>
<widget class="QMenu" name="MenuDynamicWaterBodyTarget">
<property name="title">
<string>动态水体目标</string>
</property>
<widget class="QMenu" name="menuWBZB_DynamicWaterBodyTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreDynamicWaterBodyMeshFile"/>
<addaction name="action_generatorWaterPlane"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_DynamicWaterBodyTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_DynamicWaterBodyTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_DynamicWaterBodyTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_DynamicWaterBodyTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_DynamicWaterBodyTarget"/>
</widget>
<widget class="QMenu" name="MenuRoadTarget">
<property name="title">
<string>道路目标</string>
</property>
<widget class="QMenu" name="menuWBZB_RoadTarget">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreRoadMeshFile"/>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_RoadTarget">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_RoadTarget">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_RoadTarget"/>
<addaction name="separator"/>
<addaction name="menuWBCL_RoadTarget"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_RoadTarget"/>
</widget>
<widget class="QMenu" name="MenuArtificialTarget">
<property name="title">
<string>人工目标</string>
</property>
<widget class="QMenu" name="menuWBZB">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB"/>
<addaction name="separator"/>
<addaction name="menuWBCL"/>
<addaction name="separator"/>
<addaction name="menuWBFZ"/>
</widget>
<widget class="QMenu" name="MenuGeometricCorrectionScene">
<property name="title">
<string>几何校正场景</string>
</property>
<widget class="QMenu" name="menuWBZB_GeometricCorrectionScene">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadGeometricCorrectionFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_GeometricCorrectionScene">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_GeometricCorrectionScene">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_GeometricCorrectionScene"/>
<addaction name="separator"/>
<addaction name="menuWBCL_GeometricCorrectionScene"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_GeometricCorrectionScene"/>
</widget>
<widget class="QMenu" name="MenuRadiometricCorrectionScene">
<property name="title">
<string>辐射定标场景</string>
</property>
<widget class="QMenu" name="menuWBZB">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadRadioModelFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB"/>
<addaction name="separator"/>
<addaction name="menuWBCL"/>
<addaction name="separator"/>
<addaction name="menuWBFZ"/>
</widget>
<widget class="QMenu" name="MenuLandSurfaceScene">
<property name="title">
<string>陆地场景</string>
</property>
<widget class="QMenu" name="menuWBZB_LandSurfaceScene">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreForestMeshFile"/>
<addaction name="actionLoadPreCropMeshFile"/>
<addaction name="actionLoadPreGrasslandMeshFile"/>
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="actionLoadPreSoilMeshFile"/>
<addaction name="actionLoadPreRoadMeshFile"/>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_LandSurfaceScene">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_LandSurfaceScene">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_LandSurfaceScene"/>
<addaction name="separator"/>
<addaction name="menuWBCL_LandSurfaceScene"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_LandSurfaceScene"/>
</widget>
<widget class="QMenu" name="MenuWaterBodyScene">
<property name="title">
<string>水体场景</string>
</property>
<widget class="QMenu" name="menuWBZB_WaterBodyScene">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_WaterBodyScene">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_WaterBodyScene">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_WaterBodyScene"/>
<addaction name="separator"/>
<addaction name="menuWBCL_WaterBodyScene"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_WaterBodyScene"/>
</widget>
<widget class="QMenu" name="MenuVegetationScene">
<property name="title">
<string>植被场景</string>
</property>
<widget class="QMenu" name="menuWBZB_VegetationScene">
<property name="title">
<string>制备</string>
</property>
<addaction name="actionLoadPreForestMeshFile"/>
<addaction name="actionLoadPreCropMeshFile"/>
<addaction name="actionLoadPreGrasslandMeshFile"/>
<addaction name="actionLoadPreWaterBodyMeshFile"/>
<addaction name="actionLoadPreSoilMeshFile"/>
<addaction name="actionLoadPreRoadMeshFile"/>
<addaction name="actionLoadPreArtificialMeshFile"/>
<addaction name="actionLoadForestPointCloudFile"/>
<addaction name="actionLoadRhounessPointCloudFile"/>
<addaction name="separator"/>
<addaction name="actionExportMesh"/>
</widget>
<widget class="QMenu" name="menuWBCL_VegetationScene">
<property name="title">
<string>测量与后向散射系数仿真</string>
</property>
<addaction name="actionFEKOScatterSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOScatterResult"/>
<addaction name="separator"/>
<addaction name="actionExportRCS"/>
</widget>
<widget class="QMenu" name="menuWBFZ_VegetationScene">
<property name="title">
<string>成像仿真</string>
</property>
<addaction name="actionFEKOImageSetting"/>
<addaction name="separator"/>
<addaction name="actionLoadFEKOImageResult"/>
<addaction name="actionExportFEKOResultToEcho"/>
<addaction name="separator"/>
<addaction name="actionFEKOImageCreate"/>
</widget>
<addaction name="menuWBZB_VegetationScene"/>
<addaction name="separator"/>
<addaction name="menuWBCL_VegetationScene"/>
<addaction name="separator"/>
<addaction name="menuWBFZ_VegetationScene"/>
</widget>
<addaction name="MenuForestTarget"/>
<addaction name="MenuCropTarget"/>
<addaction name="MenuGrasslandTarget"/>
<addaction name="MenuWaterBodyTarget"/>
<addaction name="MenuSoilTarget"/>
<addaction name="MenuDynamicWaterBodyTarget"/>
<addaction name="MenuRoadTarget"/>
<addaction name="MenuArtificialTarget"/>
<addaction name="separator"/>
<addaction name="MenuGeometricCorrectionScene"/>
<addaction name="MenuRadiometricCorrectionScene"/>
<addaction name="MenuLandSurfaceScene"/>
<addaction name="MenuWaterBodyScene"/>
<addaction name="MenuVegetationScene"/>
<addaction name="separator"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuTarget"/>
<addaction name="menuView"/>
<addaction name="menuGeometry"/>
<addaction name="menuMesher"/>
@ -554,7 +1119,6 @@
<addaction name="menuWindows"/>
<addaction name="menuSettings"/>
<addaction name="menuPlugins"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="GeometryEditToolBar">
<property name="windowTitle">
@ -631,6 +1195,106 @@
<addaction name="actionCreateCalculator"/>
<addaction name="actionCreateReflection"/>
</widget>
<action name="actionLoadPreForestMeshFile">
<property name="text">
<string>加载预制森林网格</string>
</property>
</action>
<action name="actionLoadPreCropMeshFile">
<property name="text">
<string>加载预制农作物网格数据</string>
</property>
</action>
<action name="actionLoadPreGrasslandMeshFile">
<property name="text">
<string>加载预制草地网格数据</string>
</property>
</action>
<action name="actionLoadPreWaterBodyMeshFile">
<property name="text">
<string>加载预制水体网格数据</string>
</property>
</action>
<action name="actionLoadPreSoilMeshFile">
<property name="text">
<string>加载预制土壤目标网格数据</string>
</property>
</action>
<action name="actionLoadPreDynamicWaterBodyMeshFile">
<property name="text">
<string>加载预制动态水体网格数据</string>
</property>
</action>
<action name="actionLoadPreRoadMeshFile">
<property name="text">
<string>加载预制道路网格数据</string>
</property>
</action>
<action name="actionLoadPreArtificialMeshFile">
<property name="text">
<string>加载预制人工目标网格数据</string>
</property>
</action>
<action name="actionLoadForestPointCloudFile">
<property name="text">
<string>加载场景监测装置点云数据</string>
</property>
</action>
<action name="actionLoadRhounessPointCloudFile">
<property name="text">
<string>加载粗糙度测量装置数据</string>
</property>
</action>
<action name="actionLoadGeometricCorrectionFile">
<property name="text">
<string>加载预制几何定标装置数据</string>
</property>
</action>
<action name="actionLoadRadioModelFile">
<property name="text">
<string>加载预制辐射定标装置数据</string>
</property>
</action>
<action name="actionScaneExport">
<property name="text">
<string>场景导出</string>
</property>
</action>
<action name="actionFEKOScatterSetting">
<property name="text">
<string>FEKO散射仿真参数设置</string>
</property>
</action>
<action name="actionLoadFEKOScatterResult">
<property name="text">
<string>加载FEKO散射仿真结果</string>
</property>
</action>
<action name="actionExportRCS">
<property name="text">
<string>输出RCS</string>
</property>
</action>
<action name="actionFEKOImageSetting">
<property name="text">
<string>成像仿真设置</string>
</property>
</action>
<action name="actionLoadFEKOImageResult">
<property name="text">
<string>加载FEKO图像回波仿真结果</string>
</property>
</action>
<action name="actionExportFEKOResultToEcho">
<property name="text">
<string>切分回波结果</string>
</property>
</action>
<action name="actionFEKOImageCreate">
<property name="text">
<string>FEKO成像结果</string>
</property>
</action>
<action name="actionNew">
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
@ -940,7 +1604,7 @@
<normaloff>:/QUI/icon/graphOption.png</normaloff>:/QUI/icon/graphOption.png</iconset>
</property>
<property name="text">
<string>Graph Options</string>
<string>参数设置</string>
</property>
</action>
<action name="actionSurfaceMesh">
@ -1923,7 +2587,7 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/Histogram.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/Histogram.png</iconset>
</property>
<property name="text">
<string>StatisticalRemoveFilter</string>
<string>统计滤波</string>
</property>
</action>
<action name="actionPCLRadiusOutlierRemoval">
@ -1932,7 +2596,7 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/KMeans.png</iconset>
</property>
<property name="text">
<string>RadiusOutlierRemoval</string>
<string>密度滤波</string>
</property>
</action>
<action name="actionPCLGuassFilter">
@ -1941,7 +2605,7 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/nihe.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/nihe.png</iconset>
</property>
<property name="text">
<string>GuassFilter</string>
<string>中值滤波</string>
</property>
</action>
<action name="actionPCLBilateralFilter">
@ -1950,7 +2614,7 @@
<normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</normaloff>:/PointCloudProcess/PointCloudProcess/images/algorithm/DBSCAN.png</iconset>
</property>
<property name="text">
<string>BilateralFilter</string>
<string>双边滤波</string>
</property>
</action>
<action name="actionPCLGPMesh">
@ -1997,6 +2661,143 @@
<string>Attriution DB Show</string>
</property>
</action>
<action name="actionloadModel">
<property name="text">
<string>loadModel</string>
</property>
</action>
<action name="actionvtkPointSamplor">
<property name="text">
<string>vtkPointSamplor</string>
</property>
</action>
<action name="actionImageShowTool">
<property name="text">
<string>ImageShowTool</string>
</property>
</action>
<action name="actionRCShowTool">
<property name="text">
<string>RCShowTool</string>
</property>
</action>
<action name="actionPCLPoissonMesh">
<property name="text">
<string>泊松重建</string>
</property>
</action>
<action name="actionGeo1">
<property name="text">
<string>Geo1</string>
</property>
</action>
<action name="actionCloud">
<property name="text">
<string>Cloud</string>
</property>
</action>
<action name="actionGeoProcess">
<property name="text">
<string>几何模型处理</string>
</property>
</action>
<action name="actionMeshProcess">
<property name="text">
<string>网格处理模块</string>
</property>
</action>
<action name="actionPointCloudProcess">
<property name="text">
<string>点云处理模块</string>
</property>
</action>
<action name="actionLoadPointCloudText">
<property name="text">
<string>加载点云文本文件</string>
</property>
</action>
<action name="actionBoxMeshSurfaceNode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/mesh/mesh/select_vertex.png</normaloff>:/mesh/mesh/select_vertex.png</iconset>
</property>
<property name="text">
<string>BoxMeshSurfaceNode</string>
</property>
</action>
<action name="actionBoxMeshSurfaceCell">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qrc/qianfan.qrc">
<normaloff>:/mesh/mesh/select_face.png</normaloff>:/mesh/mesh/select_face.png</iconset>
</property>
<property name="text">
<string>BoxMeshSurfaceCell</string>
</property>
</action>
<action name="actionMeshDelete">
<property name="text">
<string>MeshDelete</string>
</property>
</action>
<action name="actionMeshCopy">
<property name="text">
<string>MeshCopy</string>
</property>
</action>
<action name="actionMeshClip">
<property name="text">
<string>MeshClip</string>
</property>
</action>
<action name="actionMeshTriangleSurface">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>MeshTriangleSurface</string>
</property>
</action>
<action name="actionMeshToOCCT">
<property name="text">
<string>MeshToOCCT</string>
</property>
</action>
<action name="action_generatorWaterPlane">
<property name="text">
<string>生成动态水面</string>
</property>
</action>
<action name="actionMeshSave">
<property name="text">
<string>MeshSave</string>
</property>
</action>
<action name="actionMeshUndo">
<property name="text">
<string>MeshReLoading</string>
</property>
</action>
<action name="actionBatchStartFEKOCADModel">
<property name="text">
<string>批量生成计算任务</string>
</property>
</action>
<action name="actionCreateCADModel">
<property name="text">
<string>创建FEKOCAD模型</string>
</property>
</action>
<action name="actionCreateLoadModelScript">
<property name="text">
<string>生成加载模型参数文件</string>
</property>
</action>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>

View File

@ -1666,25 +1666,41 @@ namespace GUI {
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
if(!meshSet)
if(!meshSet){
qDebug()<<"nullptr==meshSet";
continue;
}
meshSet->generateDisplayDataSet();
vtkSmartPointer<vtkDataSet> tempDisplayDataSet=meshSet->getDisplayDataSet();
if(nullptr==tempDisplayDataSet){
qDebug()<<"DisplayDataSet nullptr ";
return ;
}else{
qDebug()<<"DisplayDataSet , cell count "+QString::number(tempDisplayDataSet->GetNumberOfCells());
}
vtkRela.SetData(meshSet->getDisplayDataSet());
vtkRela.SetData(tempDisplayDataSet);
vtkSmartPointer<vtkDataSet> transformed = vtkRela.StartTransform();
meshKernal = new MeshData::MeshKernal;
kernalName = QString("transfrom%1_%2").arg(meshSet->getName()).arg(meshKernal->getID());
meshKernal->setName(kernalName);
meshKernal->setMeshData(transformed);
meshData->appendMeshKernal(meshKernal);
transformedName =
QString(meshSet->getName() + "_transform%1").arg(meshSet->getMaxID() + 1);
qDebug()<<"transfrom kernalName :\t "<<kernalName;
transformedName =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;
if(setType == "Node")
nCount = transformed->GetNumberOfPoints();

View File

@ -593,6 +593,8 @@ namespace GUI {
ui->actionSelectMeshCell->setEnabled(false);
ui->actionBoxMeshNode->setEnabled(false);
ui->actionBoxMeshCell->setEnabled(false);
ui->actionBoxMeshSurfaceNode->setEnabled(false);
ui->actionBoxMeshSurfaceCell->setEnabled(false);
// ui->actionSelectGeoBody->setEnabled(false);
ui->actionGenMesh->setEnabled(false);
ui->actionSurfaceMesh->setEnabled(false);
@ -661,6 +663,8 @@ namespace GUI {
// ui->actionSelectGeoBody->setEnabled(true);
ui->actionBoxMeshNode->setEnabled(true);
ui->actionBoxMeshCell->setEnabled(true);
ui->actionBoxMeshSurfaceNode->setEnabled(true);
ui->actionBoxMeshSurfaceCell->setEnabled(true);
}
if(ngeo > 0 && subwins->isPreWindowOpened()) {
ui->actionSurfaceMesh->setEnabled(true);

View File

@ -47,6 +47,10 @@ namespace GUI {
connect(this, SIGNAL(setViewValueSig(int, QString, int, int, int, int, int, int, int, int, int)), this, SLOT(setViewValue(int, QString, int, int, int, int, int, int, int, int, int)));
connect(this, SIGNAL(saveImageSig(int, int, int, QString, QString)), this, SLOT(saveImage(int, int, int, QString, QString)));
connect(this, SIGNAL(openPreWindowSig()), this, SLOT(openPreWindow()));
}
SubWindowManager::~SubWindowManager() {}

View File

@ -6,9 +6,11 @@
#include <QHash>
#include <QObject>
#include <QPair>
#include <QMdiArea>
#include <QMdiSubWindow>
class QMdiSubWindow;
class QMdiArea;
//class QMdiArea;
class QToolBar;
class SARibbonCategory;
@ -88,6 +90,7 @@ namespace GUI {
void openPreWindowSig();
void clearSelectModelSig();
public slots:
/*打开前处理窗口 */
@ -122,6 +125,9 @@ namespace GUI {
/// 设置视角
void setView(QString view);
// 保存图片
void saveImage(QString fileName, int winType, Post::PostWindowBase* winhandle, int w,
int h);
@ -153,7 +159,7 @@ namespace GUI {
QHash<QMdiSubWindow*, Post::RealTimeWindowBase*> _realTimeWindow{};
QHash<QMdiSubWindow*, XReport::ReportWindow*> _reportWindow{};
QPair<QMdiSubWindow*, GenerateGeometry::GenerateGeometryWidget*> _geometryWindow{};
// QHash<QMdiSubWindow*, GenerateGeometry::GenerateGeometryWidget*> _geometryWindow{};
// QHash<QMdiSubWindow*, GenerateGeometry::GenerateGeometryWidget*> _geometryWindow{};
QList<QToolBar*> _currentToolBars{};
SARibbonCategory* _threeD_render_page{};

View File

@ -118,7 +118,7 @@ void MaterialSingleton::appendToMaterialLib(const int id)
if (m == nullptr) return;
QHash<QString, Material*> mahash = this->loadMaterilLib();
qDebug() << mahash.keys();
//qDebug() << mahash.keys();
qDebug() << m->getName();
if (mahash.contains(m->getName()))
{

View File

@ -16,6 +16,7 @@ namespace MeshData
///添加子set
void appendDataSet(vtkDataSet* set);
// 构建显示数据集合
void generateDisplayDataSet() override;
virtual QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* parent) override;

View File

@ -83,7 +83,7 @@ namespace MeshData
QString _path{};
int _pointIDOffset{ -1 }; //起始ID终止ID=起始ID+mesh.pointnum-1
int _cellIDOffset{ -1 };
vtkSmartPointer<vtkDataSet> _mesh{};
vtkSmartPointer<vtkDataSet> _mesh{}; // 网格颜色
int _dimension{ 3 };
QPair<bool, QColor> _specificColor;
DataProperty::DataBase* _gmshSetting{};//gmsh网格划分的属性

View File

@ -15,6 +15,8 @@
#include <vtkExtractSelection.h>
#include <vtkAppendFilter.h>
#include <QDebug>
#include <QDateTime>
namespace MeshData
{
@ -188,6 +190,8 @@ void MeshSet::readDataFromProjectFile(QDomElement* setEle)
void MeshSet::generateDisplayDataSet()
{
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<" MeshSet::generateDisplayDataSet() start ";
if (_displayDataSet != nullptr) return;
if (_members.isEmpty()) return;
appendProperty("Count", _members.values().size());
@ -232,7 +236,8 @@ void MeshSet::generateDisplayDataSet()
appendFliter->Update();
_displayDataSet = vtkUnstructuredGrid::New();
_displayDataSet->DeepCopy(appendFliter->GetOutput());
_displayDataSet->DeepCopy(appendFliter->GetOutput()); // 为什么要深拷贝
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<" MeshSet::generateDisplayDataSet() finish ";
}
vtkDataSet* MeshSet::getDisplayDataSet()

View File

@ -24,7 +24,19 @@ namespace MeshData
UserDef = 101,
EndType = 100000,
};
enum vtkDataFieldName{
IDS,
SHOW,
MATERIAL
};
const char* const vtkDataFieldNameStr[] = {
"IDS", // 索引
"SHOW", // 可见性
"MATERIAL" //材料
};
class SetMember;
class MESHDATAAPI MeshSet : public DataProperty::ComponentBase
@ -93,7 +105,7 @@ namespace MeshData
SetType _type{ None };
bool _visible{ true };
QMultiHash<int, int> _members{}; //keneralID - node/elementID
QMultiHash<int, int> _members{}; // keneralID - node/elementID
QList<int> _tempMemberID{};

View File

@ -81,8 +81,8 @@ namespace MeshData
private:
static MeshData* _instance;
QList<MeshKernal*> _meshList{};
QList<MeshSet*> _setList{};
QList<MeshKernal*> _meshList{}; // kernel 列表 单个mesh对象
QList<MeshSet*> _setList{}; // 面片集合 -- 多个网格对象
};

View File

@ -82,6 +82,7 @@ add_library(ModuleBase
${_interface}
${_header}
${_source}
)
#-----------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
#include "CommonFunctions.h"
#include <QDir>
#include <QDebug>
#include <QRandomGenerator>
bool RemoveDir(QString fullpath)
{
@ -33,3 +34,16 @@ QString MODULEBASEAPI doubleToString(double v, int acc)
QString vs = QString::asprintf(ba.data(), v);
return vs;
}
QString MODULEBASEAPI generateRandomString(int length) {
const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
const int randomStringLength = possibleCharacters.length();
QString randomString;
for(int i = 0; i < length; ++i) {
int index = QRandomGenerator::global()->bounded(randomStringLength);
randomString.append(possibleCharacters.at(index));
}
return randomString;
}

View File

@ -10,6 +10,8 @@ extern "C"
bool MODULEBASEAPI RemoveDir(QString fullpath);
//将浮点数转化为字符串acc-小数点后位数
QString MODULEBASEAPI doubleToString(double v, int acc);
// 生成随机字符串
QString MODULEBASEAPI generateRandomString(int length);
}
#endif

View File

@ -53,6 +53,8 @@ namespace ModuleBase
BoxMeshNode,
BoxMeshCell,
DrawSketch,
BoxMeshSurfaceNode, // 表面点
BoxMeshSurfaceCell // 表面网格
};
/**

View File

@ -40,11 +40,39 @@
#include <vtkCellData.h>
#include "Geometry/geometryData.h"
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleRubberBandPick.h>
#include <vtkAreaPicker.h>
#include <vtkCommand.h>
#include <vtkCallbackCommand.h>
#include <vtkIdFilter.h>
#include <vtkExtractPolyDataGeometry.h>
#include <vtkSphereSource.h>
#include <vtkPlanes.h>
#include <vtkDataSetMapper.h>
#include <vtkProperty.h>
#include <vtkCellLocator.h>
#include <vtkCamera.h>
#include <vtkPolyDataConnectivityFilter.h>
#include <vtkThresholdPoints.h>
#include <vtkPolyDataNormals.h>
#include <vtkSelectVisiblePoints.h>
#include <vtkExtractSelectedPolyDataIds.h>
#include <vtkConnectivityFilter.h>
#include "Common/DebugLogger.h"
#include <vtkWorldPointPicker.h>
namespace ModuleBase
{
PropPickerInteractionStyle::PropPickerInteractionStyle()
{
_worldPointPicker=vtkSmartPointer<vtkWorldPointPicker>::New();
_picked=new double[3];
_actor = nullptr;
_property = vtkProperty::New();
// _selectItemIDs = vtkSmartPointer<vtkIdTypeArray>::New();
@ -66,6 +94,12 @@ namespace ModuleBase
delete _dataProp;
_property->Delete();
_coordinate->Delete();
if(nullptr!=_picked){
delete[] _picked;
_picked=nullptr;
}
}
/*
@ -76,7 +110,7 @@ namespace ModuleBase
_mainWindow = mw;
_parent = p;
// connect(this, SIGNAL(clearAllHighLight()), mw, SIGNAL(clearAllHighLight()));
connect(mw, SIGNAL(selectModelChangedSig(int)), this, SLOT(setSelectModel(int)));
connect(mw, SIGNAL(selectModelChangedSig(int)), this, SLOT(setSelectModel(int))); // 绑定主窗体 与 本类的setSelectModel槽
// connect(this, SIGNAL(dispalyInfo(DataProperty::PropertyList*)), mw, SIGNAL(updateProperty(DataProperty::PropertyList*)));
}
@ -85,6 +119,7 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::setSelectModel(int m)
{
DebugInfo(QString("PropPickerInteractionStyle::setSelectModel %1 \n ").arg(m).toLocal8Bit().data());
_selectModel = (SelectModel)m;
this->CurrentMode = 0;
if (_actor != nullptr)
@ -111,6 +146,8 @@ namespace ModuleBase
break;
case ModuleBase::BoxMeshNode:
case ModuleBase::BoxMeshCell:
case ModuleBase::BoxMeshSurfaceNode:
case ModuleBase::BoxMeshSurfaceCell:
case ModuleBase::DrawSketch:
this->CurrentMode = 1;
break;
@ -188,6 +225,12 @@ namespace ModuleBase
case ModuleBase::BoxMeshCell:
// boxSelectMeshCell();
break;
case ModuleBase::BoxMeshSurfaceNode:
//boxSelectMeshNode();
break;
case ModuleBase::BoxMeshSurfaceCell:
//boxSelectMeshCell();
break;
default:
break;
}
@ -198,11 +241,12 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::OnLeftButtonUp()
{
DebugInfo(QString("void PropPickerInteractionStyle::OnLeftButtonUp %1 \n").arg(_selectModel).toLocal8Bit().data());
vtkInteractorStyleRubberBandPick::OnLeftButtonUp();
if (_selectModel == None && !_mouseMoved)
emit this->clearAllHighLight();
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode) && (_selectModel != DrawSketch))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode) && (_selectModel != DrawSketch)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
if (this->CurrentMode == 0)
return;
@ -211,7 +255,7 @@ namespace ModuleBase
int *endPos = this->GetInteractor()->GetEventPosition();
_endPos[0] = endPos[0];
_endPos[1] = endPos[1];
// qDebug() << "end " << _endPos[0] << " " << _endPos[1];
qDebug() << "end " << _endPos[0] << " " << _endPos[1];
if (_selectModel != DrawSketch)
{
vtkActor *ac = nullptr;
@ -228,6 +272,12 @@ namespace ModuleBase
case ModuleBase::BoxMeshCell:
boxSelectMeshCell();
break;
case ModuleBase::BoxMeshSurfaceNode:
boxSelectMeshSurfaceNode();
break;
case ModuleBase::BoxMeshSurfaceCell:
boxSelectMeshSurfaceCell();
break;
case ModuleBase::DrawSketch:
_coordinate->SetCoordinateSystemToDisplay();
_coordinate->SetValue(endPos[0], endPos[1], 0);
@ -235,6 +285,7 @@ namespace ModuleBase
emit mouseReleasePoint(d);
break;
}
_mouseMoved = false;
_leftButtonDown = false;
}
@ -244,6 +295,18 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::OnMouseMove()
{
// 获取坐标系
_worldPointPicker->Pick(this->Interactor->GetEventPosition()[0],
this->Interactor->GetEventPosition()[1],
0, // always zero.
this->Interactor->GetRenderWindow()
->GetRenderers()
->GetFirstRenderer());
_worldPointPicker->GetPickPosition(_picked);
emit MouseMoveInWorldPoint(_picked[0],_picked[1],_picked[2]);
_mouseMoved = true;
vtkInteractorStyleRubberBandPick::OnMouseMove();
if ((_selectModel == BoxMeshCell) || (_selectModel == BoxMeshNode) || (_selectModel == DrawSketch) /*&& _leftButtonDown*/)
@ -397,8 +460,11 @@ namespace ModuleBase
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
if (!actor->GetVisibility())
continue;
continue;
if (!(actor->GetVisibility())) {
qDebug() << "Hide actor\n";
continue;
}
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
@ -428,14 +494,17 @@ namespace ModuleBase
int range[4];
this->getBoxRange(range);
vtkActorCollection *actors = _renderer->GetActors();
actors->InitTraversal();
actors->InitTraversal(); // 初始化指针
const int nac = actors->GetNumberOfItems();
for (int i = 0; i < nac; ++i)
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
if (!actor->GetVisibility())
continue;
if (!(actor->GetVisibility())) {
qDebug() << "Hide actor\n";
continue;
}
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
@ -450,9 +519,150 @@ namespace ModuleBase
this->selectMesh(dataset, range);
}
emit highLight(&_selectItems);
emit highLight(&_selectItems); // 绑定高亮事件
}
void PropPickerInteractionStyle::boxSelectMeshSurfaceNode() {
emit clearAllHighLight();
_selectItems.clear();
int range[4];
this->getBoxRange(range);
vtkActorCollection *actors = _renderer->GetActors();
actors->InitTraversal(); // 初始化指针
const int nac = actors->GetNumberOfItems();
for (int i = 0; i < nac; ++i)
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
continue;
if (!(actor->GetVisibility())) {
qDebug() << "Hide actor\n";
continue;
}
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
if (mapper == nullptr)
continue;
vtkDataSet *dataset = mapper->GetInputAsDataSet();
if (dataset == nullptr)
continue;
vtkDataArray *IDS = dataset->GetCellData()->GetArray("IDS");
if (IDS == nullptr)
continue;
// 进行可见性分析
vtkSmartPointer<vtkSelectVisiblePoints> visiblePointsFilter = vtkSmartPointer<vtkSelectVisiblePoints>::New();
visiblePointsFilter->SetInputData(dataset);
visiblePointsFilter->SetRenderer(_renderer);
visiblePointsFilter->Update();
if (!visiblePointsFilter->GetOutput()->GetPolys())
{
continue;
}
vtkDataSet* visibleData = visiblePointsFilter->GetOutput();
this->selectMesh(visibleData, range);
}
emit highLight(&_selectItems); // 绑定高亮事件
}
void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() {
DebugInfo("void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() start\n");
emit clearAllHighLight();
_selectItems.clear();
int range[4];
this->getBoxRange(range);
vtkActorCollection *actors = _renderer->GetActors();
if(nullptr==actors){
return;
}
actors->InitTraversal(); // 初始化指针
const int nac = actors->GetNumberOfItems();
for (int i = 0; i < nac; ++i)
{
vtkActor *actor = actors->GetNextActor();
if (actor == nullptr)
continue;
if (!(actor->GetVisibility())) {
qDebug() << "Hide actor\n";
continue;
}
if (!actor->GetPickable())
continue;
vtkMapper *mapper = actor->GetMapper();
if (mapper == nullptr)
continue;
vtkDataSet *dataset = mapper->GetInputAsDataSet();
if (dataset == nullptr)
continue;
vtkDataArray *IDS = dataset->GetCellData()->GetArray("IDS");
if (nullptr==IDS )
continue;
// 进行可见性分析
vtkSmartPointer<vtkSelectVisiblePoints> visiblePointsFilter = vtkSmartPointer<vtkSelectVisiblePoints>::New();
visiblePointsFilter->SetInputData(dataset);
visiblePointsFilter->SetRenderer(_renderer);
visiblePointsFilter->Update();
vtkDataSet* visiablePoints=visiblePointsFilter->GetOutput();
if(nullptr==visiablePoints){
DebugInfo("visiablePoints is null\n");
continue;
}
// 选择范围分析
QMultiHash<int,int> visiable_select{};
vtkRenderer *render = this->GetInteractor()->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
vtkSmartPointer<vtkCoordinate> coordinate = vtkSmartPointer<vtkCoordinate>::New();
coordinate->SetCoordinateSystemToWorld();
vtkDataArray *ids = visiablePoints->GetPointData()->GetArray("IDS");
if(nullptr==ids){
DebugInfo("visiablePoints->GetPointData()->GetArray(IDS) cids or pids is null\n");
continue;
}
const int npoint = visiablePoints->GetNumberOfPoints();
for (int i = 0; i < npoint; ++i)
{
double coor[3];
visiablePoints->GetPoint(i, coor);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
visiable_select.insert(k_id[0], k_id[1]); // kernelid pid
}
}
// 计算联通单元
size_t ncell=dataset->GetNumberOfCells();
vtkDataArray* cids=dataset->GetCellData()->GetArray("IDS");
vtkDataArray* pids=dataset->GetPointData()->GetArray("IDS");
if(nullptr==cids||nullptr==pids){
DebugInfo("void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() cids or pids is null\n");
continue;
}
for(size_t cellId=0;cellId<ncell;cellId++){
vtkCell* cell = dataset->GetCell(cellId);
double* c_id=cids->GetTuple2(cellId);
vtkIdList* pointIds = cell->GetPointIds();
for (vtkIdType j = 0; j < pointIds->GetNumberOfIds(); ++j)
{
vtkIdType pointId = pointIds->GetId(j);
double *k_id = pids->GetTuple2(pointId);
if(visiable_select.contains(k_id[0],k_id[1])){ // 存在就保存
_selectItems.insert(c_id[0],c_id[1]);
break;
}else{}
}
}
}
emit highLight(&_selectItems); // 绑定高亮事件
DebugInfo("void PropPickerInteractionStyle::boxSelectMeshSurfaceCell() finish\n");
}
/*
*/
@ -484,13 +694,12 @@ namespace ModuleBase
*/
void PropPickerInteractionStyle::selectMesh(vtkDataSet *dataSet, int *range)
{
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"PropPickerInteractionStyle::selectMesh start ";
vtkRenderer *render = this->GetInteractor()->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
vtkSmartPointer<vtkCoordinate> coordinate = vtkSmartPointer<vtkCoordinate>::New();
coordinate->SetCoordinateSystemToWorld();
/*int* va = */ coordinate->GetComputedDisplayValue(render);
if (_selectModel == BoxMeshNode)
if (_selectModel == ModuleBase::BoxMeshNode)
{
vtkDataArray *ids = dataSet->GetPointData()->GetArray("IDS");
const int npoint = dataSet->GetNumberOfPoints();
@ -503,11 +712,12 @@ namespace ModuleBase
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
_selectItems.insert(k_id[0], k_id[1]);
_selectItems.insert(k_id[0], k_id[1]); // kernelid pid
//pselectids->SetTuple1(i, 1);
}
}
}
else if (_selectModel == BoxMeshCell)
else if (_selectModel == ModuleBase::BoxMeshCell)
{
vtkDataArray *ids = dataSet->GetCellData()->GetArray("IDS");
const int ncell = dataSet->GetNumberOfCells();
@ -522,14 +732,36 @@ namespace ModuleBase
cell->EvaluateLocation(subid, pcenter, coor, w);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
int *va = coordinate->GetComputedDisplayValue(render); // 坐标->窗口坐标
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
_selectItems.insert(k_id[0], k_id[1]);
// cselectids->SetTuple1(i, 1); // 更新选择状态
}
}
}
else if(_selectModel==ModuleBase::BoxMeshSurfaceNode){ // 表面点
vtkDataArray *ids = dataSet->GetPointData()->GetArray("IDS");
const int npoint = dataSet->GetNumberOfPoints();
for (int i = 0; i < npoint; ++i)
{
double coor[3];
dataSet->GetPoint(i, coor);
coordinate->SetValue(coor);
int *va = coordinate->GetComputedDisplayValue(render);
if (isPointInRange(va, range))
{
double *k_id = ids->GetTuple2(i);
_selectItems.insert(k_id[0], k_id[1]); // kernelid pid
//pselectids->SetTuple1(i, 1);
}
}
}
else if(_selectModel==ModuleBase::BoxMeshSurfaceCell){
}
qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")<<"PropPickerInteractionStyle::selectMesh finish,size: "+QString::number(_selectItems.size());
}
/*
@ -539,7 +771,6 @@ namespace ModuleBase
{
bool isx = p[0] >= range[0] && p[0] <= range[1] ? true : false;
bool isy = p[1] >= range[2] && p[1] <= range[3] ? true : false;
return isx && isy;
}
@ -551,7 +782,7 @@ namespace ModuleBase
_mouseMoved = false;
_leftButtonDown = false;
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
if (this->CurrentMode == 0)
@ -574,7 +805,7 @@ namespace ModuleBase
return;
}
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode))
if ((_selectModel != BoxMeshCell) && (_selectModel != BoxMeshNode)&&(_selectModel != BoxMeshSurfaceNode)&&(_selectModel != BoxMeshSurfaceCell))
return;
this->CurrentMode = 1;
}
@ -725,4 +956,5 @@ namespace ModuleBase
same = false;
return same;
}
}

View File

@ -34,6 +34,7 @@
#include <vtkUnstructuredGrid.h>
#include <vtkVertexGlyphFilter.h>
#include <vtkIdFilter.h>
#include <vtkWorldPointPicker.h>
class vtkActor;
class vtkProperty;
@ -97,7 +98,7 @@ namespace ModuleBase
void mouseWhellMove();
void rightDownMenu();
void clearAllHighLight();
void MouseMoveInWorldPoint(double x,double y,double z);
private:
virtual void OnLeftButtonDown() override;
virtual void OnLeftButtonUp() override;
@ -123,9 +124,10 @@ namespace ModuleBase
void clickSelectGeometry(bool preSelect = false);
void clickSelectMeshNode();
void clickSelectMeshCell();
void boxSelectMeshNode();
void boxSelectMeshCell();
void boxSelectMeshNode(); // 框选 Node
void boxSelectMeshCell();// 框选 cell
void boxSelectMeshSurfaceNode(); // 框选 Node
void boxSelectMeshSurfaceCell();// 框选 cell
// xmin xmax ymin ymax
void getBoxRange(int *);
void selectMesh(vtkDataSet *dataset, int *range);
@ -153,6 +155,9 @@ namespace ModuleBase
bool _selected{false};
vtkActor *_preGeoSeltctActor{};
vtkCoordinate *_coordinate{};
double* _picked;
vtkSmartPointer<vtkWorldPointPicker> _worldPointPicker;
// QList<vtkActor*> _tempActorContainer{};
// QMultiHash<vtkActor*, double*> _actorPickedPoints{};

View File

@ -19,8 +19,6 @@ namespace ModuleBase
void clearThreadTaskList();
void appendToThreadTaskList(ThreadTask* t);
void clearThreadControlList();
void appendToThreadContolList(ThreadControl* tc);
// signals:

View File

@ -35,6 +35,18 @@
#include <vtkAreaPicker.h>
#include <vtkProperty2D.h>
#include <vtkAppendFilter.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderWindow.h>
#include <vtkSmartPointer.h>
#include <vtkProperty.h>
#include <vtkCubeAxesActor2D.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkCubeAxesActor.h>
#include "PreWindowInteractorStyle.h"
#include "MainWindow/MainWindow.h"
#include "MeshData/meshSet.h"
@ -42,6 +54,7 @@
#include "MeshData/meshSingleton.h"
#include "PreWindowInteractorStyle.h"
#include <vtkVersionMacros.h>
#include <vtkWorldPointPicker.h>
namespace ModuleBase
{
@ -49,7 +62,8 @@ namespace ModuleBase
: _ui(new Ui::Graph3DWindow), GraphWindowBase(mainwindow, id, type, connentToMainWindow)
{
_ui->setupUi(this);
setMouseTracking(true); // 启用鼠标跟踪,以便能够捕获鼠标进入事件
setAttribute(Qt::WA_Hover); // 启用悬停事件,以便能够在鼠标悬停时获取焦点
init();
_render->GlobalWarningDisplayOff();
this->setFocusPolicy(Qt::ClickFocus);
@ -86,8 +100,11 @@ namespace ModuleBase
_renderWindow = _ui->qvtkWidget->renderWindow();
#endif
_render = vtkSmartPointer<vtkRenderer>::New();
_render = vtkSmartPointer<vtkOpenGLRenderer>::New();
_render->SetGradientBackground(true);
// 开启硬件加速特性
_render->UseDepthPeelingOn();
_render->SetUseFXAA(true);
// _render->SetBackground2(0.0, 0.333, 1.0);
// _render->SetBackground(1.0, 1.0, 1.0);
_interactor = _renderWindow->GetInteractor();
@ -98,6 +115,15 @@ namespace ModuleBase
_viewer->setupInteractor(_interactor, _renderWindow);
_viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR, 3); // 初始化为点云颜色
// 创建立方体网格坐标系
_cubeAxesActor = vtkSmartPointer<vtkCubeAxesActor>::New();
//createCubeAxes();
// // 世界坐标轴
_worldPointPicker=vtkSmartPointer<vtkWorldPointPicker>::New();
_interactor->SetPicker(_worldPointPicker);
if (_graphWindowType == PreWindows)
{
PropPickerInteractionStyle *style = PropPickerInteractionStyle::New();
@ -105,18 +131,22 @@ namespace ModuleBase
style->SetDefaultRenderer(_render);
style->setRender(_render);
style->setRenderWindow(_renderWindow);
_interactor->SetInteractorStyle(style);
vtkSmartPointer<vtkAreaPicker> areaPicker = vtkSmartPointer<vtkAreaPicker>::New();
vtkSmartPointer<vtkAreaPicker> areaPicker = vtkSmartPointer<vtkAreaPicker>::New(); // 面积拾取器
_interactor->SetPicker(areaPicker);
_interactionStyle = style;
//
//关联信号
// connect(style, SIGNAL(selectGeometry(bool)), this, SIGNAL(selectGeometry(bool)));
connect(style, SIGNAL(selectGeometry(bool, vtkActor *, int)), this, SIGNAL(selectGeometry(bool, vtkActor *, int)));
connect(this, SIGNAL(keyEvent(int, QKeyEvent *)), style, SLOT(keyEvent(int, QKeyEvent *)));
connect(style, SIGNAL(highLight(QMultiHash<int, int> *)), this, SIGNAL(highLighSet(QMultiHash<int, int> *)));
// connect(style, SIGNAL(higtLightActorDisplayPoint(bool)), this, SIGNAL(highLightActorDispalyPoint(bool)));
// connect(style, SIGNAL(higtLightActorDisplayPoint(bool)), this, SIGNAL(highLightActorDispalyPoint(bool)));
connect(style, SIGNAL(clearAllHighLight()), this, SIGNAL(clearAllHighLight()));
connect(_mainWindow, SIGNAL(selectModelChangedSig(int)), this, SLOT(setSelectType(int)));
@ -125,7 +155,8 @@ namespace ModuleBase
connect(style, SIGNAL(mouseWhellMove()), this, SLOT(mouseWheelMove()));
connect(style, SIGNAL(rightDownMenu()), this, SIGNAL(rightDownMenuSig()));
// pointcloud
// 世界坐标系
connect(style, SIGNAL(MouseMoveInWorldPoint(double ,double ,double )),this, SIGNAL(WorldPointMouseMove(double ,double ,double )));
}
@ -470,4 +501,75 @@ namespace ModuleBase
double h = this->getWorldHight();
emit showGraphRange(w, h);
}
void Graph3DWindow::createCubeAxes(double minx, double maxx, double miny, double maxy,
double minz, double maxz)
{
_cubeAxesActor->SetCamera(_render->GetActiveCamera());
//
//轴的设置
//设置x、y、z轴的起始和终止值
_cubeAxesActor->SetXAxisRange(minx, maxx);
_cubeAxesActor->SetYAxisRange(miny, maxy);
_cubeAxesActor->SetZAxisRange(minz, maxz);
//设置坐标轴线的宽度
_cubeAxesActor->GetXAxesLinesProperty()->SetLineWidth(0.5);
_cubeAxesActor->GetYAxesLinesProperty()->SetLineWidth(0.5);
_cubeAxesActor->GetZAxesLinesProperty()->SetLineWidth(0.5);
//设置标题和标签文本的屏幕大小。默认值为10.0。
_cubeAxesActor->SetScreenSize(6);
//指定标签与轴之间的距离。默认值为20.0。
_cubeAxesActor->SetLabelOffset(5);
//显示坐标轴
_cubeAxesActor->SetVisibility(true);
//指定一种模式来控制轴的绘制方式
_cubeAxesActor->SetFlyMode(0);
//设置惯性因子,该惯性因子控制轴切换位置的频率(从一个轴跳到另一个轴)
//m_cubeAxesActor->SetInertia(1);
//
//网格设置
//开启x、y、z轴的网格线绘制
_cubeAxesActor->DrawXGridlinesOn();
_cubeAxesActor->DrawYGridlinesOn();
_cubeAxesActor->DrawZGridlinesOn();
//设置x、y、z轴的内部网格线不绘制
_cubeAxesActor->SetDrawXInnerGridlines(false);
_cubeAxesActor->SetDrawYInnerGridlines(false);
_cubeAxesActor->SetDrawZInnerGridlines(false);
//设置x、y、z轴网格线的颜色
_cubeAxesActor->GetXAxesGridlinesProperty()->SetColor(0.5, 0.5, 0.5);
_cubeAxesActor->GetYAxesGridlinesProperty()->SetColor(0.5, 0.5, 0.5);
_cubeAxesActor->GetZAxesGridlinesProperty()->SetColor(0.5, 0.5, 0.5);
//指定网格线呈现的样式
_cubeAxesActor->SetGridLineLocation(2);
//
//刻度的设置
//不显示x、y、z轴的次刻度
_cubeAxesActor->XAxisMinorTickVisibilityOff();
_cubeAxesActor->YAxisMinorTickVisibilityOff();
_cubeAxesActor->ZAxisMinorTickVisibilityOff();
//设置刻度标签的显示方式(参数1为false刻度标签按0-200000显示为true时按0-200显示)
_cubeAxesActor->SetLabelScaling(false, 0, 0, 0);
//设置刻度线显示的位置(内部、外部、两侧)
_cubeAxesActor->SetTickLocation(1);
//
_render->AddActor(_cubeAxesActor);
_render->ResetCamera();
_render->ResetCameraClippingRange();
_renderWindow->Render();
}
void Graph3DWindow::mouseMoveEvent(QMouseEvent* event)
{
// // 获取鼠标当前位置
// QPointF pos=event->pos();
// double dispCoord[2] = {pos.x(), pos.y()};
// vtkSmartPointer<vtkCoordinate> pCoorPress = vtkSmartPointer<vtkCoordinate>::New();
// pCoorPress->SetCoordinateSystemToDisplay();
// pCoorPress->SetValue(dispCoord);
// double *worldCoord = pCoorPress->GetComputedWorldValue(_render);
//// qDebug() << worldCoord[0] << worldCoord[1] << worldCoord[2];
// emit this->WorldPointMouseMove(worldCoord[0],worldCoord[1],worldCoord[2]);
}
}

View File

@ -1,6 +1,6 @@
#ifndef _GRAPH3DWINDOW_H_
#define _GRAPH3DWINDOW_H_
//#define PCL_NO_PRECOMPILE
#include <QWidget>
#include <vtkSmartPointer.h>
#include <vtkAutoInit.h>
@ -9,11 +9,12 @@
#include "ModuleType.h"
#include <QString>
#include <QStringList>
#include <vtkOpenGLRenderer.h>
#include <QMouseEvent>
// Point Cloud Library
#include <QColorDialog>
#include <iostream>
#include <pcl/common/common.h>
#include <pcl/console/time.h> // TicToc
#include <pcl/console/time.h>
@ -34,29 +35,12 @@
#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>
@ -64,15 +48,11 @@
#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分割
@ -89,7 +69,6 @@
#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>
@ -111,10 +90,8 @@
#include <vtkRenderer.h>
// Boost
#include <boost/math/special_functions/round.hpp>
#include <vtkCubeAxesActor.h>
#include <vtkWorldPointPicker.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
@ -199,6 +176,9 @@ namespace ModuleBase
double getWorldHight();
//获取窗体世界坐标系下宽度
double getWorldWidth();
// 创建立方体网格坐标系
void createCubeAxes(double minx=-1000,double maxx=1000,double miny=-1000,double maxy=1000,double minz=-1000,double maxz=1000);
public slots:
//重绘
@ -245,14 +225,17 @@ namespace ModuleBase
void highLighSet(QMultiHash<int,int>* items);
// void highLightActorDispalyPoint(bool on);
void WorldPointMouseMove(double x,double y,double z);
protected:
Ui::Graph3DWindow* _ui{};
// QStringList m_ltFilePath = QStringList();
vtkSmartPointer<vtkRenderer> _render{};
//vtkSmartPointer<vtkRenderer> _render{};
vtkSmartPointer<vtkOpenGLRenderer> _render{};
vtkSmartPointer<vtkCubeAxesActor> _cubeAxesActor{};
vtkSmartPointer<vtkRenderWindow> _renderWindow{};
vtkSmartPointer< vtkRenderWindowInteractor > _interactor{};
vtkSmartPointer<vtkOrientationMarkerWidget> _axesWidget{};
vtkSmartPointer<vtkTextWidget> _textWidget{};
vtkSmartPointer<vtkScalarBarWidget> _scalarBarWidget{};
@ -263,11 +246,15 @@ namespace ModuleBase
PropPickerInteractionStyle* _interactionStyle{};
SelectModel _selectModel{ None };
// 世界坐标系
vtkSmartPointer<vtkWorldPointPicker> _worldPointPicker;
/*** 点云处理***/
pcl::visualization::PCLVisualizer::Ptr _viewer; // 点云显示共享指针
protected:
void mouseMoveEvent(QMouseEvent* event) override;
};
}

View File

@ -428,10 +428,11 @@ namespace LAMPCAEDesigner
//_meshConfig->enableExportMesh(meshConfig->isExportMeshEnabled());
_exportMeshSuffix = meshConfig->getExportSuffix();
_meshConfig->setExportSuffix(meshConfig->getExportSuffix());
_importPclSuffix=meshConfig->getImportSuffix(ConfigOption::MeshDataType::PointCloud);
_meshConfig->setImportSuffix(_importPclSuffix);
_importPclSuffix=meshConfig->getImportSuffix(ConfigOption::MeshDataType::PointCloud); // 点云
_meshConfig->setImportSuffix(_importPclSuffix,ConfigOption::MeshDataType::PointCloud);
_exportPclSuffix=meshConfig->getExportSuffix(ConfigOption::MeshDataType::PointCloud);
_meshConfig->setExportSuffix(_exportPclSuffix);
_meshConfig->setExportSuffix(_exportPclSuffix,ConfigOption::MeshDataType::PointCloud);
// _meshConfig->enableMeshGeneration(meshConfig->isMeshGenerationEnabled());
_isSurfaceMesh = meshConfig->isSurfaceMeshEnabled();

View File

@ -5,7 +5,7 @@
#include "Settings/BusAPI.h"
#include <QDir>
#include <QMessageBox>
#include <QDebug>
namespace Plugins
{
PluginManageDialog::PluginManageDialog(GUI::MainWindow *mw, PluginManager *m)
@ -146,8 +146,10 @@ namespace Plugins
QStringList failins;
for (QString name : selectedNames)
{
qDebug()<< QString("check loading plugin :")+name;
if (!commonList.contains(name))
{
qDebug()<< QString("start loading plugin :")+name;
bool ok = _manager->loadPlugin(name);
if (!ok)
{

Some files were not shown because too many files have changed in this diff Show More