完成微波仿真、点云构网、模型导出、仿真成像功能移植

master
剑古敛锋 2024-04-11 16:13:53 +08:00
parent b43460b576
commit a6b5ce7003
917 changed files with 6450 additions and 6408 deletions

View File

@ -3,7 +3,5 @@
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/extlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$/extlib/OTB" vcs="Git" />
<mapping directory="$PROJECT_DIR$/extlib/OTB_source" vcs="Git" />
</component>
</project>

View File

@ -26,6 +26,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
set(BUILD_SHARED_LIBS ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
#-----------------------------------------------------------------------------
@ -223,7 +226,8 @@ find_package(FFTW3 CONFIG REQUIRED)
find_package(GSL REQUIRED)
#GDAL
find_package(GDAL CONFIG REQUIRED)
#
find_package(unofficial-sqlite3 CONFIG REQUIRED)
@ -242,7 +246,7 @@ include_directories(SYSTEM C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(SYSTEM C:/PCL/include/pcl-1.14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Test Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
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)
find_package(PCL)
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${VCGLIB_INCLUDE_DIRS})

View File

@ -36,7 +36,7 @@ endif()
set(LAMPCAE_Python_ALREADY_INCLUDED 1)
set(Python_VERSION_MAJOR 3)
set(Python_VERSION_MINOR 7)
set(Python_VERSION_MINOR 9)
set(Python_VERSION_PATCH 0)
# find_path
# <VAR>-NOTFOUND
@ -150,3 +150,4 @@ find_package_handle_standard_args(Python
VERSION_VAR
Python_VERSION
)

View File

@ -6,8 +6,8 @@ set(SOVERSION ${PROJECT_VERSION} ${PROJECT_VERSION_MAJOR} ${PROJECT_VERSION_MINO
#-----------------------------------------------------------------------------
list(APPEND _libraries Common PythonModule SARibbonBar Settings DataProperty MeshData SelfDefObject Material Geometry BCBase ConfigOptions ParaClassFactory ModelData ModuleBase PostAlgorithm PostRenderData PostInterface PostCurveDataManager PostPlotWidget PostWidgets GeometryDataExchange ProjectTree ProjectTreeExtend GeometryCommand GeometryWidgets PluginManager GmshModule IO SolverControl MainWidgets UserGuidence)
list(APPEND _libraries PointCloudOperator )
list(APPEND _libraries json qcustomplot qhexedit qscintilla2 LAMPTool WBCLFZSystemModule )
list(APPEND _libraries PluginMotorBike )
list(APPEND _libraries json qcustomplot qhexedit qscintilla2 )
#[[if(_WIN_)
list(APPEND _libraries XGenerateReport License)
endif()]]
@ -29,8 +29,11 @@ file(TO_NATIVE_PATH "${_rpath}/${INSTALL_LIBDIR}" _lib_rpath)
#
list(APPEND LAMPCAE_Runtimes_Libraries VTK::loguru VTK::gl2ps Qt5::DBus VTK::IOChemistry )
list(APPEND LAMPCAE_Runtimes_Libraries Qt5::Qml )
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
)
foreach(_library ${_libraries})
@ -66,7 +69,7 @@ install(
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
)
list(APPEND _plugins PluginCustomizer PluginMeshDataExchange PluginWBFZExchangePlugin)
list(APPEND _plugins PluginCustomizer PluginMeshDataExchange PluginWBFZExchangePlugin PluginMotorBike)
foreach(_plugin ${_plugins})
list(APPEND LAMPCAE_Runtimes_Libraries ${LAMPCAE_${_plugin}_Runtimes_Libraries})

View File

@ -32,6 +32,8 @@ set_property(DIRECTORY ${CMAKE_SOURCE_DIR}
)
list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence MainWindow)
list(APPEND _depend_library )
if(_WIN_)
#list(APPEND _depend_library XGenerateReport License)
endif()

View File

@ -1,20 +0,0 @@
#pragma once
#ifndef _BACKSCATTERMODEL_H_
#define _BACKSCATTERMODEL_H_
#include "LAMPToolAPI.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include "LAMPToolAPI.h"
double LAMPTOOLAPI MuhlemanSimulationBackScatter(double incidentAngle);
Eigen::MatrixXd LAMPTOOLAPI MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle);
#endif

View File

@ -1,147 +0,0 @@
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
# boost
include_directories(D:/vcpkg/installed/x64-windows/include)
# pcl
include_directories(C:/PCL/3rdParty/FLANN/include)
include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(C:/PCL/include/pcl-1.14)
# FindOpenCASCADE
include_directories(${OpenCASCADE_INCLUDE_DIRS})
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)
# qscintilla2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src)
# lamptool
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include)
# qcustomplot
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot)
# qhexedit
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit)
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SqliteDBProcess/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/modelProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/EchoShowProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/OCCViewer)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/PointCloudProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SharedModuleLib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TableProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TaskXml)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
# pcl
link_directories("C:/PCL/3rdParty/FLANN/lib")
link_directories("C:/VTK/lib")
link_directories("C:/PCL/lib")
#
#-----------------------------------------------------------------------------
# include
#-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
find_package(PCL)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/WBCLFZSystemModule.qrc")
set(_qrc "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/qianfan.qrc")
set(_lang "${CMAKE_CURRENT_SOURCE_DIR}/../qrc/translations.qrc")
qt5_add_resources(_resource ${_qrc} ${_lang})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
file(GLOB_RECURSE _ui "*.ui" )
file(GLOB_RECURSE _header "*.h" )
file(GLOB_RECURSE _source "*.cpp" )
qt5_wrap_ui(_interface ${_ui})
#-----------------------------------------------------------------------------
# -- lib
#-----------------------------------------------------------------------------
add_library(LAMPTool STATIC
${_resource}
${_interface}
${_header}
${_source}
)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
target_compile_definitions(LAMPTool PUBLIC LAMPTOOL_API)
#-----------------------------------------------------------------------------
# Qt
#-----------------------------------------------------------------------------
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
list(APPEND _depend_library qcustomplot)
list(APPEND _runtimes_libraries
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport
)
list(APPEND _runtimes_libraries
OpenCASCADE::TKOpenGl OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKBool OpenCASCADE::TKCAF OpenCASCADE::TKCDF OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIGES OpenCASCADE::TKLCAF OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKVCAF OpenCASCADE::TKXCAF OpenCASCADE::TKXDEIGES OpenCASCADE::TKXSBase OpenCASCADE::TKernel Qt5::Widgets Qt5::Xml VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib VTK::IOGeometry
)
target_include_directories(LAMPTool PRIVATE ${Qwt_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
target_link_libraries(LAMPTool PRIVATE
${_runtimes_libraries}
${_depend_library}
${PCL_LIBRARIES}
FFTW3::fftw3
GSL::gsl GSL::gslcblas
)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
add_dependencies(LAMPTool ${_depend_library})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
set(LAMPCAE_LAMPTool_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -1,50 +0,0 @@
#pragma once
#ifndef FILEOPERATOR_H
#define FILEOPERATOR_H
#include "../LAMPTool/referenceHeader.h"
#include <string.h>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <QString>
#include <QDir>
#include <QFile>
#include <QDebug>
bool LAMPTOOLAPI isDirectory(const QString& path);
bool LAMPTOOLAPI isExists(const QString& path);
bool LAMPTOOLAPI isFile(const QString& path);
void LAMPTOOLAPI removeFile(const QString& filePath);
unsigned long LAMPTOOLAPI convertToULong(const QString& input);
/// <summary>
/// 获取文件(绝对路径)
/// </summary>
/// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param>
/// <returns></returns>
std::vector<QString> LAMPTOOLAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr);
QString LAMPTOOLAPI getParantFolderNameFromPath(const QString& path);
QString LAMPTOOLAPI getFileNameFromPath(const QString& path);
int LAMPTOOLAPI write_binfile(char* filepath, char* data, size_t data_len);
LAMPTOOLAPI char* read_textfile(char* text_path, int* length);
bool LAMPTOOLAPI exists_test(const QString& name);
size_t LAMPTOOLAPI fsize(FILE* fp);
QString LAMPTOOLAPI getParantFromPath(const QString& path);
void LAMPTOOLAPI copyFile(const QString& sourcePath, const QString& destinationPath);
// QT FileOperator
#endif

View File

@ -1,111 +0,0 @@
#pragma once
#ifndef _GEOOPERATOR_H
#define _GEOOPERATOR_H
#include "LAMPToolAPI.h"
#include "BaseConstVariable.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
/// <summary>
/// 三维向量,坐标表达
/// </summary>
struct Landpoint // 点 SAR影像的像素坐标
{
/// <summary>
/// 经度x
/// </summary>
double lon; // 经度x lon pixel_col
/// <summary>
/// 纬度y
/// </summary>
double lat; // 纬度y lat pixel_row
/// <summary>
/// 高度z
/// </summary>
double ati; // 高程z ati pixel_time
};
struct Point_3d {
double x;
double y;
double z;
};
/// <summary>
/// 将经纬度转换为地固参心坐标系
/// </summary>
/// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns>
Landpoint LAMPTOOLAPI LLA2XYZ(const Landpoint& LLA);
Eigen::MatrixXd LAMPTOOLAPI LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary>
/// 将地固参心坐标系转换为经纬度
/// </summary>
/// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns>
Landpoint LAMPTOOLAPI XYZ2LLA(const Landpoint& XYZ);
Landpoint LAMPTOOLAPI operator +(const Landpoint& p1, const Landpoint& p2);
Landpoint LAMPTOOLAPI operator -(const Landpoint& p1, const Landpoint& p2);
bool LAMPTOOLAPI operator ==(const Landpoint& p1, const Landpoint& p2);
Landpoint LAMPTOOLAPI operator *(const Landpoint& p, double scale);
double LAMPTOOLAPI getAngle(const Landpoint& a, const Landpoint& b);
double LAMPTOOLAPI dot(const Landpoint& p1, const Landpoint& p2);
double LAMPTOOLAPI getlength(const Landpoint& p1);
Landpoint LAMPTOOLAPI crossProduct(const Landpoint& a, const Landpoint& b);
Landpoint LAMPTOOLAPI getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4);
float LAMPTOOLAPI cross2d(Point_3d a, Point_3d b);
Point_3d LAMPTOOLAPI operator -(Point_3d a, Point_3d b);
Point_3d LAMPTOOLAPI operator +(Point_3d a, Point_3d b);
double LAMPTOOLAPI operator /(Point_3d a, Point_3d b);
// 矢量计算
struct Vector3D {
double x, y, z;
};
// 计算两点之间的距离
double LAMPTOOLAPI distance(const Vector3D& p1, const Vector3D& p2);
// 计算点到直线的最短距离
double LAMPTOOLAPI pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection);
struct CartesianCoordinates {
double x, y, z;
};
struct SphericalCoordinates {
double r, theta, phi;
};
SphericalCoordinates LAMPTOOLAPI cartesianToSpherical(const CartesianCoordinates& cartesian);
CartesianCoordinates LAMPTOOLAPI sphericalToCartesian(const SphericalCoordinates& spherical);
#endif

View File

@ -1,13 +0,0 @@
#ifndef _LAMPTOOLAPI_H_
#define _LAMPTOOLAPI_H_
#include <QtCore/QtGlobal>
#if defined(LAMPTOOL_API)
#define LAMPTOOLAPI Q_DECL_EXPORT
#else
#define LAMPTOOLAPI Q_DECL_IMPORT
#endif
#endif

View File

@ -1,97 +0,0 @@
#pragma once
#ifndef OCCTBASELAMP_H
#define OCCTBASELAMP_H
#include "LAMPToolAPI.h"
#include "referenceHeader.h"
//====================
// 系统支持的模型导出类型
//=====================
enum OCCTShapeType
{
STL,
STEP,
IGES,
NoneType,
};
OCCTShapeType LAMPTOOLAPI str2OCCTShapeType(QString str);
QStringList LAMPTOOLAPI getOCCTShapeTypeEmnu();
QString LAMPTOOLAPI getOCCTShapeTypeFilterString();
QString LAMPTOOLAPI get_STL_FilterString();
QString LAMPTOOLAPI get_STEP_FilterString();
QString LAMPTOOLAPI get_IGES_FilterString();
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(OCCTShapeType t);
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(QString str);
// 常用静态函数
bool LAMPTOOLAPI SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape);
bool LAMPTOOLAPI SaveTopoDs(QString FilePath,const TopoDS_Shape& shape, OCCTShapeType type);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_IGES(QString Filepath);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Stl(QString Filepath);
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Step(QString Filepath);
OCCTShapeType LAMPTOOLAPI ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs);
// 模型合并
TopoDS_Shape LAMPTOOLAPI MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist);
// 修改模型显示
void LAMPTOOLAPI ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor);
//// 创建箭头
TopoDS_Shape LAMPTOOLAPI CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius);
//
// OCCT 根据向量A和B,计算变换矩阵
gp_Trsf LAMPTOOLAPI GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B);
TopoDS_Shape LAMPTOOLAPI Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi,double X,double Y,double Z);
//TopoDS_Shape Createpyramid(double width=10.0,double depth=5.0, double mouthWidth=1.0, double mouthHeight=0.5, double height = 15.0);
// 创建一个笛卡尔坐标系
TopoDS_Shape LAMPTOOLAPI CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength);
// 常见模型创建
TopoDS_Shape LAMPTOOLAPI CreateBox(double x, double y, double z);
TopoDS_Shape LAMPTOOLAPI CreateCylinder(double radius, double height);
TopoDS_Shape LAMPTOOLAPI CreateCone(double radius_bottom, double radius_top, double height);
TopoDS_Shape LAMPTOOLAPI CreateSphere(double radius);
TopoDS_Shape LAMPTOOLAPI CreateTorus(double majorRadius, double minorRadius);
// 常见模型操作
TopoDS_Shape LAMPTOOLAPI Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape LAMPTOOLAPI Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
// 常见操作 -- 模型旋转、平移、缩放
TopoDS_Shape LAMPTOOLAPI Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle);
TopoDS_Shape LAMPTOOLAPI Translate(TopoDS_Shape& shape, gp_Vec move_vec);
TopoDS_Shape LAMPTOOLAPI Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale);
// 创建散射体雷达
// 创建一个坐标原点为圆心的
TopoDS_Shape LAMPTOOLAPI createConicalHorn(double bottomRadius,double bottomHeight,double topRadius,double topHeight);
TopoDS_Shape LAMPTOOLAPI createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl);
#endif // OCCTBASELAMP_H

View File

@ -1,80 +0,0 @@

#define __TEST_IMAGEPROCESS
//#define __TESTMATHGL
//#define __TEST_FARFIELDFILEREADPROCESS
#ifdef __TESTMATHGL
#include <mgl2/mgl.h>
int main()
{
mglGraph gr;
gr.FPlot("sin(pi*x)");
gr.WriteFrame("D:\\codestorage\\LAMPSARtool\\CPluseCpluse\\WBCLFZProgram\\WBCLFZProgram\\test.png");
}
#endif
#ifdef __TEST_IMAGEPROCESS
#include "LAMPTool.h"
#include <QtWidgets/QApplication>
#include "LampToolTest.h"
#include "FEKOSimulationSARClass.h"
#include <cmath>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
//LAMPTool w;
//w.show();
//a.exec();
//TestImageBP_main(argc, argv);
//====================================
// 测试FEKO模型加载结果
//====================================
//QString antXmlPath = "D:\\codestorage\\LAMPSARtool\\CPluseCpluse\\WBCLFZProgram\\WBCLFZProgram\\help\\FEKOImageSettingTask.xml";
//QString echocsvpath = u8"D:\\德清研究院加密\\项目\\项目文档归档\\FEKO知识库\\模型\\远场条带\\ball_001\\ball001_X_strip.csv";
//QString thetafilepath = "";
QString phifilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProject.phi";
QString tifffilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProjectImage_phi.dat";
FEKOBase::FEKOImageSettingParams imageparams{ -2.0, 2.0, -2.0, 2.0, 0.0, 201, 201 };
//FEKOBase::NearFieldEchoCSVParser nearfilePraseclass;
//nearfilePraseclass.parseCSV(echocsvpath);
//nearfilePraseclass.toPhiPolar(phifilepath);
FEKOBase::EchoDataClass data;
data.loadEchoData(phifilepath);
FEKOBase::FEKOImageProcess(data, imageparams, tifffilepath);
return 0;
}
#endif
#ifdef __TEST_FARFIELDFILEREADPROCESS
#include "LAMPTool.h"
#include "FEKOBaseToolClass.h"
#include "FEKOFarFieldFileClass.h"
#include "FEKOSimulationSARClass.h"
int main() {
QString ffe_filepath = u8"D:\\德清研究院加密\\项目\\项目文档归档\\FEKO知识库\\模型\\条带脉冲模型\\trihedral\\ant_SAR_new\\ant_SAR_Move\\ant_SAR_new_Horn_conical1_FarField.ffe";
FEKOBase::FEKOFarFieldFileClass ffefile;
std::cout << ffe_filepath.toLocal8Bit().constData()<< std::endl;
ffefile.parseFarFieldFile(ffe_filepath);
std::cout << "__TEST_FARFIELDFILEREADPROCESS" << std::endl;
}
#endif

View File

@ -1,2 +0,0 @@
# 说明
此模块主要是通用基础模块

View File

@ -1,108 +0,0 @@
/**
* @file DialogPCLBilateralFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLBilateralFilter.h" resolved
#include "DialogPCLBilateralFilter.h"
#include "ui_DialogPCLBilateralFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLBilateralFilter::DialogPCLBilateralFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLBilateralFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Fast Bilateral Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLBilateralFilter::~DialogPCLBilateralFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLBilateralFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double sigmaS=_ui->SigmaS->value();
double sigmaR=_ui->SigmaR->value();
emit excuteAlg( componentIds, sigmaR, sigmaS);
QFDialog::accept();
}
void DialogPCLBilateralFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLBilateralFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLBilateralFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -1,113 +0,0 @@
/**
* @file DialogPCLGPMesh.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGPMesh.h"
// resolved
#include "DialogPCLGPMesh.h"
#include "ui_DialogPCLGPMesh.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGPMesh::DialogPCLGPMesh(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLGPMesh),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("GP Meshing"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLGPMesh::~DialogPCLGPMesh()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGPMesh::accept()
{
if (_components.size() == 0)
return;
QString componentIds;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double SearchRadius=_ui->SearchRadius->value();
double Mu=_ui->Mu->value();
int MaximumNearestNeighbors=_ui->MaximumNearestNeighbors->value();
double MaximumSurfaceAngle=_ui->MaximumSurfaceAngle->value();
double MaximumAngle=_ui->MaximumAngle->value();
double MinimumAngle=_ui->MinimumAngle->value();
// excuteAlg( QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
emit excuteAlg( componentIds , SearchRadius, Mu, MaximumNearestNeighbors, MaximumSurfaceAngle, MaximumAngle, MinimumAngle);
QFDialog::accept();
}
void DialogPCLGPMesh::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGPMesh::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGPMesh::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -1,112 +0,0 @@
/**
* @file DialogPCLGuassFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGuassFilter.h"
// resolved
#include "DialogPCLGuassFilter.h"
#include "ui_DialogPCLGuassFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGuassFilter::DialogPCLGuassFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLGuassFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Guass Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLGuassFilter::~DialogPCLGuassFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGuassFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double Sigma=_ui->Sigma->value();
double threshold=_ui->threshold->value();
emit excuteAlg( componentIds, Sigma, threshold);
QString code = QString("MainWindow.createVTKTransform(\"%1\",\"%2\",\"%3\",\"%4\")").arg(componentIds).arg(rotate).arg(moveLocation).arg(scale);
Py::PythonAgent::getInstance()->submit(code);
QFDialog::accept();
}
void DialogPCLGuassFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGuassFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGuassFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -1,112 +0,0 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLRadiusOutlierRemoval.h"
#include "ui_DialogPCLRadiusOutlierRemoval.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
namespace MainWidget {
DialogPCLRadiusOutlierRemoval::DialogPCLRadiusOutlierRemoval(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLRadiusOutlierRemoval),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Radius Outlier Removal"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLRadiusOutlierRemoval::~DialogPCLRadiusOutlierRemoval()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLRadiusOutlierRemoval::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double RadiusSearch=_ui->RadiusSearch->value();
double MinNeighborsInRadius=_ui->MinNeighborsInRadius->value();
emit excuteAlg(componentIds,RadiusSearch, MinNeighborsInRadius);
QFDialog::accept();
}
void DialogPCLRadiusOutlierRemoval::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLRadiusOutlierRemoval::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLRadiusOutlierRemoval::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -1,113 +0,0 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLStatisticalRemoveFilter.h"
#include "ui_DialogPCLStatisticalRemoveFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLStatisticalRemoveFilter::DialogPCLStatisticalRemoveFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLStatisticalRemoveFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Statistical Remove Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLStatisticalRemoveFilter::~DialogPCLStatisticalRemoveFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLStatisticalRemoveFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double MeanK=_ui->MeanK->value();
double stddev=_ui->Stddev->value();
emit excuteAlg(componentIds,MeanK,stddev);
QFDialog::accept();
}
void DialogPCLStatisticalRemoveFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLStatisticalRemoveFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLStatisticalRemoveFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget

View File

@ -49,6 +49,13 @@ namespace MainWidget
this->addTopLevelItem(_gcroot);
_gcroot->setExpanded(true);
// _antroot = new QTreeWidgetItem(this, TreeItemType::GeoComponentRoot);
// _antroot->setText(0, tr("antModel"));
// _antroot->setIcon(0, QIcon(":/QUI/icon/geometry.png"));
// this->addTopLevelItem(_antroot);
// _antroot->setExpanded(true);
connect(_mainWindow, SIGNAL(updateGeometryTreeSig()), this, SLOT(updateTree()));
// connect(_mainWindow, SIGNAL(updateGeometryTreeSig()), this, SLOT(updateTree()));
connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(singleClicked(QTreeWidgetItem *, int)));

View File

@ -107,6 +107,7 @@ namespace MainWidget
QTreeWidgetItem* _root{};
QTreeWidgetItem* _datumroot{};
QTreeWidgetItem* _gcroot{};
QTreeWidgetItem* _antroot{};
Geometry::GeometryData* _data{};
QTreeWidgetItem* _currentItem{};

View File

@ -2,6 +2,9 @@
#
#-----------------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
# FindOpenCASCADE
include_directories(${OpenCASCADE_INCLUDE_DIRS})
message("OpenCASCADE_INCLUDE_DIRS ${OpenCASCADE_INCLUDE_DIRS}")
#-----------------------------------------------------------------------------
# include
@ -38,7 +41,7 @@ add_library(MainWindow
#-----------------------------------------------------------------------------
target_compile_definitions(MainWindow PRIVATE "MAINWINDOW_API")
list(APPEND _depend_library Common LAMPTool WBCLFZSystemModule 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 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()
@ -47,6 +50,13 @@ list(APPEND _runtimes_libraries
Qt5::Core Qt5::Gui Qt5::Widgets 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
)
list(APPEND _runtimes_libraries
OpenCASCADE::TKOffset OpenCASCADE::TKSTL OpenCASCADE::TKOpenGl OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::Freetype OpenCASCADE::TKBO OpenCASCADE::TKBRep OpenCASCADE::TKFillet OpenCASCADE::TKBool OpenCASCADE::TKCAF OpenCASCADE::TKCDF OpenCASCADE::TKG2d OpenCASCADE::TKG3d OpenCASCADE::TKGeomAlgo OpenCASCADE::TKGeomBase OpenCASCADE::TKHLR OpenCASCADE::TKIGES OpenCASCADE::TKLCAF OpenCASCADE::TKMath OpenCASCADE::TKMesh OpenCASCADE::TKPrim OpenCASCADE::TKSTEP OpenCASCADE::TKSTEP209 OpenCASCADE::TKSTEPAttr OpenCASCADE::TKSTEPBase OpenCASCADE::TKService OpenCASCADE::TKShHealing OpenCASCADE::TKTopAlgo OpenCASCADE::TKV3d OpenCASCADE::TKVCAF OpenCASCADE::TKXCAF OpenCASCADE::TKXDEIGES OpenCASCADE::TKXSBase OpenCASCADE::TKernel Qt5::Widgets Qt5::Xml
VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersSources VTK::FiltersStatistics VTK::IOCore VTK::IOLegacy VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingMath VTK::InteractionStyle VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::RenderingFreeType VTK::RenderingOpenGL2 VTK::RenderingUI VTK::RenderingVolume VTK::RenderingVolumeOpenGL2 VTK::doubleconversion VTK::expat VTK::freetype VTK::glew VTK::lz4 VTK::lzma VTK::sys VTK::zlib VTK::IOGeometry
)
target_include_directories(MainWindow PRIVATE ${Qwt_INCLUDE_DIRS})
#-----------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@ namespace GUI {
_menuList.append(_ui->menuView);
_menuList.append(_ui->menuGeometry);
_menuList.append(_ui->menuMesher);
_menuList.append(_ui->menuPointCloud);
_menuList.append(_ui->menuSolve);
_menuList.append(_ui->menuWindows);
_menuList.append(_ui->menuSettings);
@ -186,8 +187,6 @@ namespace GUI {
this->enableMeshCheck(ok);
_ui->SetToolBar->setVisible(ok || meshOption->isComponentEnabled());
ok = meshOption->isFilterMeshEnabled();
_ui->actionFilterMesh->setVisible(ok);

View File

@ -86,13 +86,12 @@
#include "PostInterface/AnimationToolBar.h"
#include "PostInterface/RenderDirector.h"
// pcl
#include "MainWidgets/DialogPCLBilateralFilter.h"
#include "MainWidgets/DialogPCLGPMesh.h"
#include "MainWidgets/DialogPCLGuassFilter.h"
#include "MainWidgets/DialogPCLRadiusOutlierRemoval.h"
#include "MainWidgets/DialogPCLStatisticalRemoveFilter.h"
#include "PluginWBFZExchangePlugin/DialogPCLBilateralFilter.h"
#include "PluginWBFZExchangePlugin/DialogPCLGPMesh.h"
#include "PluginWBFZExchangePlugin/DialogPCLGuassFilter.h"
#include "PluginWBFZExchangePlugin/DialogPCLRadiusOutlierRemoval.h"
#include "PluginWBFZExchangePlugin/DialogPCLStatisticalRemoveFilter.h"
#include "IO/vtkDataRelated.h"
#include "LAMPTool/BaseTool.h"
// logger
#include "Common/DebugLogger.h"
@ -255,7 +254,21 @@ 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()));
// 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()));
// 设置视角
@ -732,6 +745,13 @@ namespace GUI {
void MainWindow::on_exportMesh()
{
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList suffixlist = IO::IOConfigure::getMeshExporters();
// QStringList list = IO::IOConfigure::getMeshImporters();
if(suffixlist.isEmpty()) {
@ -739,11 +759,6 @@ namespace GUI {
return;
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList meshsuffix =
ConfigOption::ConfigOption::getInstance()->getMeshConfig()->getExportSuffix().split(
";");
@ -1479,73 +1494,61 @@ namespace GUI {
{
return m_ribbonActionMgr;
}
void MainWindow::on_pclStatisticalRemoveFilter() {
MainWidget::DialogPCLStatisticalRemoveFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclRadiusOutlierRemoval() {
MainWidget::DialogPCLRadiusOutlierRemoval dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclGuassFilter() {
MainWidget::DialogPCLGuassFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclBilateralFilter() {
MainWidget::DialogPCLBilateralFilter dlg(this);
connect(&dlg, SIGNAL(excuteAlg(QString ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg(QString ,double ,double )));
dlg.exec();
}
void MainWindow::on_pclGPMesh() {
MainWidget::DialogPCLGPMesh dlg(this);
connect(&dlg, SIGNAL(excuteAlg( QString , double , double ,int ,double ,double ,double )),this,SLOT(PCLStatisticalRemoveFilterAlg( QString , double , double ,int ,double ,double ,double )));
dlg.exec();
}
void MainWindow::PCLStatisticalRemoveFilterAlg(QString componentIds, double MeanK,double StddevThresh) {
}
void MainWindow::PCLRadiusOutlierRemovalFilterAlg(QString componentIds, double RadiusSearch,
double MinNeighborsInRadius)
// 点云
void MainWindow::on_pclStatisticalRemoveFilter()
{
emit this->printMessage(Common::Message::Normal,"PCLRadiusOutlierRemovalFilterAlg");
DebugInfo("on_pclStatisticalRemoveFilter\n");
emit this->on_pclStatisticalRemoveFilter(this);
}
void MainWindow::PCLGuassFilterAlg(QString componentIds, double sigma, double threshold) {
emit this->printMessage(Common::Message::Normal,"PCLGuassFilterAlg");
}
void MainWindow::PCLGPMeshAlg(QString componentIds, double SearchRadius, double Mu,
int MaximumNearestNeighbors, double MaximumSurfaceAngle,
double MaximumAngle, double MinimumAngle)
void MainWindow::on_pclRadiusOutlierRemoval()
{
emit this->printMessage(Common::Message::Normal,"PCLGPMeshAlg");
DebugInfo("on_pclRadiusOutlierRemoval\n");
emit this->on_pclRadiusOutlierRemoval(this);
}
void MainWindow::on_pclGuassFilter()
{
DebugInfo("on_pclGuassFilter\n");
emit this->on_pclGuassFilter(this);
}
void MainWindow::on_pclBilateralFilter()
{
DebugInfo("on_pclBilateralFilter\n");
emit this->on_pclBilateralFilter(this);
}
void MainWindow::on_pclGPMesh()
{
DebugInfo("on_pclGPMesh\n");
emit this->on_pclGPMesh(this);
}
void MainWindow::PCLBilateralFilterAlg(QString componentIds, double sigmaR, double sigmaS) {
emit this->printMessage(Common::Message::Normal,"PCLBilateralFilterAlg");
// FEKO
void MainWindow::on_actionImageSetting() {
DebugInfo("on_actionImageSetting\n");
emit this->on_actionImageSetting(this);
}
void MainWindow::on_actionFEKO2csv() {
DebugInfo("on_actionFEKO2csv\n");
emit this->on_actionFEKO2csv(this);
}
void MainWindow::on_actionScatterExport() {
DebugInfo("on_actionScatterExport\n");
emit this->on_actionScatterExport(this);
}
void MainWindow::on_actionFEKOImage() {
DebugInfo("on_actionFEKOImage\n");
emit this->on_actionFEKOImage(this);
}
void MainWindow::on_actionantScatteringFEKOSetting() {
DebugInfo("on_actionantScatteringFEKOSetting\n");
emit this->on_actionantScatteringFEKOSetting(this);
}
void MainWindow::on_AttriutionDBShow() {
DebugInfo("on_AttriutionDBShow\n");
emit this->on_actionAttriutionDBShow(this);
}

View File

@ -299,6 +299,29 @@ namespace GUI {
// 打开二维曲线绘制信号
void openPlot();
// 点云处理信号
// 统计滤波
void on_pclStatisticalRemoveFilter(GUI::MainWindow* m);
// 半径滤波
void on_pclRadiusOutlierRemoval(GUI::MainWindow* m);
// 高斯滤波
void on_pclGuassFilter(GUI::MainWindow* m);
// 双边滤波
void on_pclBilateralFilter(GUI::MainWindow* m);
// GP网格重建
void on_pclGPMesh(GUI::MainWindow* m);
// FEKO仿真参数的
void on_actionImageSetting(GUI::MainWindow* m);
void on_actionFEKO2csv(GUI::MainWindow* m);
void on_actionScatterExport(GUI::MainWindow* m);
void on_actionFEKOImage(GUI::MainWindow* m);
void on_actionantScatteringFEKOSetting(GUI::MainWindow* m);
// Tool Show
void on_actionAttriutionDBShow(GUI::MainWindow* m);
public slots:
/*状态栏显示信息 */
void setStatusBarInfo(QString);
@ -347,8 +370,8 @@ namespace GUI {
void on_pclBilateralFilter();
// GP网格重建
void on_pclGPMesh();
// feko 设置
void on_AttriutionDBShow();
private slots:
/*关闭主窗口 */
@ -411,17 +434,17 @@ namespace GUI {
// 创建VTK空间变换窗口
void on_VTKTranslation();
// StatisticalRemoveFilter
void PCLStatisticalRemoveFilterAlg(QString componentIds,double MeanK,double stddev);
// PCLRadiusOutlierRemoval
void PCLRadiusOutlierRemovalFilterAlg(QString componentIds,double RadiusSearch,double MinNeighborsInRadius);
// PCLGuassFilter
void PCLGuassFilterAlg(QString componentIds,double sigma,double threshold);
// PCLGPMesh
void PCLGPMeshAlg( QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
// PCLBilateralFilter
void PCLBilateralFilterAlg(QString componentIds,double sigmaR,double sigmaS);
// FEKO仿真参数的
// FEKO 成像模式参数设置
void on_actionImageSetting();
// FEKO 仿真结果抽取
void on_actionFEKO2csv();
// FEKO 仿真结果导出
void on_actionScatterExport();
// 成像
void on_actionFEKOImage();
// 散射界面设置
void on_actionantScatteringFEKOSetting();
private:

View File

@ -268,7 +268,7 @@
<x>0</x>
<y>0</y>
<width>1678</width>
<height>26</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -397,6 +397,7 @@
<addaction name="actionPre_Window"/>
<addaction name="action2DPlot"/>
<addaction name="action3DGraph"/>
<addaction name="actionAttriutionDBShow"/>
</widget>
<widget class="QMenu" name="menuGeometry">
<property name="title">
@ -528,11 +529,23 @@
<addaction name="menuPCLFilter"/>
<addaction name="menureSurfaceMesh"/>
</widget>
<widget class="QMenu" name="menuFEKOSimulation">
<property name="title">
<string>SimulationSetting</string>
</property>
<addaction name="actionImageSetting"/>
<addaction name="actionFEKO2csv"/>
<addaction name="actionScatterExport"/>
<addaction name="actionFEKOImage"/>
<addaction name="separator"/>
<addaction name="actionantScatteringFEKOSetting"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
<addaction name="menuGeometry"/>
<addaction name="menuMesher"/>
<addaction name="menuPointCloud"/>
<addaction name="menuFEKOSimulation"/>
<addaction name="menuSolve"/>
<addaction name="menuWindows"/>
<addaction name="menuSettings"/>
@ -1950,6 +1963,36 @@
<string>LoadFile</string>
</property>
</action>
<action name="actionImageSetting">
<property name="text">
<string>Image FEKO Simulation Setting</string>
</property>
</action>
<action name="actionFEKOImage">
<property name="text">
<string>Feko Result Image</string>
</property>
</action>
<action name="actionantScatteringFEKOSetting">
<property name="text">
<string>LAMP Scattering Ant Setting</string>
</property>
</action>
<action name="actionFEKO2csv">
<property name="text">
<string>FEKO Result Import</string>
</property>
</action>
<action name="actionScatterExport">
<property name="text">
<string>FEKO Scatter Data Export</string>
</property>
</action>
<action name="actionAttriutionDBShow">
<property name="text">
<string>Attriution DB Show</string>
</property>
</action>
</widget>
<resources>
<include location="../qrc/qianfan.qrc"/>

View File

@ -46,9 +46,6 @@ namespace Plugins
signals:
void treePrintMessageToMessageWindowSignal(ModuleBase::Message message);
};
}

View File

@ -1,9 +1,9 @@
#include "AllHead.h"
WBCLFZSYSTEMMODULEAPI QSettings* getQSetting()
QSettings* getQSetting()
{
QString fileName = QCoreApplication::applicationDirPath() + "/Config.ini";
QString fileName = QCoreApplication::applicationDirPath() + "/WBCLFZConfig.ini";
QSettings* setting = new QSettings(fileName, QSettings::IniFormat);
setting->setIniCodec(QTextCodec::codecForName("UTF-8"));
@ -19,7 +19,7 @@ WBCLFZSYSTEMMODULEAPI QSettings* getQSetting()
return setting;
}
QString WBCLFZSYSTEMMODULEAPI getOpenFilePath(QWidget* parent, const QString& caption, const QString& filter)
QString getOpenFilePath(QWidget* parent, const QString& caption, const QString& filter)
{
QSettings* setting = getQSetting();
QString curpath = u8".";
@ -38,7 +38,7 @@ QString WBCLFZSYSTEMMODULEAPI getOpenFilePath(QWidget* parent, const QString& ca
return filepath;
}
QString WBCLFZSYSTEMMODULEAPI getSaveFilePath(QWidget* parent, const QString& caption, const QString& filter)
QString getSaveFilePath(QWidget* parent, const QString& caption, const QString& filter)
{
QSettings* setting = getQSetting();
QString curpath = u8".";
@ -56,3 +56,34 @@ QString WBCLFZSYSTEMMODULEAPI getSaveFilePath(QWidget* parent, const QString& ca
}
return filepath;
}
bool AddOrRemoveScatterAntModel(GUI::MainWindow* _mainWindows, Geometry::GeometryData* _geoData,
Geometry::GeometrySet* set, bool flag)
{
if(_mainWindows==nullptr || _geoData==nullptr|| set== nullptr){
return false;
}else{}
MainWidget::PreWindow* pre = _mainWindows->getSubWindowManager()->getPreWindow();
if(flag){
Geometry::GeometryData::getInstance()->appendGeometrySet(set);
emit _mainWindows->updateActionStatesSig();
emit pre->showGeoSet(set, true);
emit _mainWindows->updateGeometryTreeSig();
return true;
}
else {
int id=Geometry::GeometryData::getInstance()->getIndexByGeoometrySet(set);
//auto geo = Geometry::GeometryData::getInstance()->getGeometrySetByID(set);
Geometry::GeometryData::getInstance()->removeGeometrySet(id);
emit _mainWindows->updateActionStatesSig();
emit pre->showGeoSet(set, false);
if(pre != nullptr)
emit pre->removeGemoActors(set);
emit _mainWindows->updateGeometryTreeSig();
emit _mainWindows->updateActionStatesSig();
emit _mainWindows->updateGraphOptionsSig();
emit _mainWindows->updateGeometryTreeSig();
return true;
}
return false;
}

View File

@ -2,8 +2,13 @@
#ifndef ALLHEAD_H
#define ALLHEAD_H
#include "WBCLFZSystemModuleAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "Common/DebugLogger.h"
#include "Geometry/geometryData.h"
#include "Geometry/geometrySet.h"
#include "MainWindow/MainWindow.h"
#include "MainWindow/SubWindowManager.h"
#include "MainWidgets/preWindow.h"
//==================================
// 线性计算库优化
//===============================
@ -14,8 +19,8 @@
// 内部库 LAMPTool
//=====================================================
#include "../LAMPTool/referenceHeader.h"
#include "BaseConstVariable.h"
#include "referenceHeader.h"
//#include "BaseConstVariable.h"
// Basetoollib
#include "BaseConstVariable.h"
#include "BaseTool.h"
@ -28,14 +33,14 @@
//#include "BackScatterModel.h"
//#include "SARBaseTool.h"
//#include "SARCalibration.h"
#include "LAMPTool/SARImageBase.h"
#include "SARImageBase.h"
// SARImage
#include "LAMPTool/FEKOBaseToolClass.h"
#include "LAMPTool/FEKONearBPBasic.h"
#include "LAMPTool/FEKOSimulationSARClass.h"
#include "LAMPTool/OCCTBase.h"
#include "LAMPTool/FEKOFarFieldFileClass.h"
#include "FEKOBaseToolClass.h"
#include "FEKONearBPBasic.h"
#include "FEKOSimulationSARClass.h"
#include "OCCTBase.h"
#include "FEKOFarFieldFileClass.h"
//=====================================================
// 内部库 SharedModuleLib
@ -304,15 +309,21 @@
// Visualization Toolkit (VTK)
#include <vtkRenderWindow.h>
#include "inputdialog.h"
#include "PointCloudProcess/inputdialog.h"
#include "BasePCL.h"
#include "ToolDialog.h"
#include "PointManagerClass.h"
#include "WBCLFZSystemModuleAPI.h"
#include "WBFZExchangePluginAPI.h"
enum TaskStatusEnum {
wait,
success,
fail,
excuting,
finish,
};
class QObject;
@ -342,11 +353,11 @@ class QObject;
//=======================================================
// 常用基础函数
//======================================================= ]
WBCLFZSYSTEMMODULEAPI QSettings* getQSetting();
QSettings* getQSetting();
QString WBCLFZSYSTEMMODULEAPI getOpenFilePath(QWidget* parent = nullptr, const QString& caption = QString(), const QString& filter = QString());
QString getOpenFilePath(QWidget* parent = nullptr, const QString& caption = QString(), const QString& filter = QString());
QString WBCLFZSYSTEMMODULEAPI getSaveFilePath(QWidget* parent = nullptr, const QString& caption = QString(), const QString& filter = QString());
QString getSaveFilePath(QWidget* parent = nullptr, const QString& caption = QString(), const QString& filter = QString());
/*
@ -356,11 +367,10 @@ QString WBCLFZSYSTEMMODULEAPI getSaveFilePath(QWidget* parent = nullptr, const Q
".",
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));
GUI::MainWindow* _mainWindows;
Geometry::GeometryData * _geoData;
*/
bool AddOrRemoveScatterAntModel(GUI::MainWindow* _mainWindows,Geometry::GeometryData * _geoData,Geometry::GeometrySet * set,bool flag);
#endif // ! ALLHEAD_H

View File

@ -1,15 +1,15 @@
#include "LAMPToolAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "BackScatterModel.h"
#include <complex>
#include <math.h>
double LAMPTOOLAPI MuhlemanSimulationBackScatter(double incidentAngle)
double MuhlemanSimulationBackScatter(double incidentAngle)
{
return 0.0133*cos(incidentAngle)/pow(sin(incidentAngle)+0.1*cos(incidentAngle), 3);
}
Eigen::MatrixXd LAMPTOOLAPI MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle)
Eigen::MatrixXd MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle)
{
return 0.0133 * (incidentAngle.array().cos()) / ((incidentAngle.array().sin()) + cos(incidentAngle.array().cos()*0.1).pow(3));
}

View File

@ -0,0 +1,20 @@
#pragma once
#ifndef _BACKSCATTERMODEL_H_
#define _BACKSCATTERMODEL_H_
#include "WBFZExchangePluginAPI.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include "WBFZExchangePluginAPI.h"
double MuhlemanSimulationBackScatter(double incidentAngle);
Eigen::MatrixXd MuhlemanSimulationBackScatter(Eigen::MatrixXd incidentAngle);
#endif

View File

@ -2,7 +2,7 @@
#ifndef BASECONSTVARIABLE_H
#define BASECONSTVARIABLE_H
#include "LAMPToolAPI.h"
#include "WBFZExchangePluginAPI.h"
#include <complex>
#include <math.h>

View File

@ -36,7 +36,7 @@ using namespace Eigen;
QString LAMPTOOLAPI getCurrentTimeString() {
QString getCurrentTimeString() {
struct tm ConversionTime;
std::time_t t = std::time(NULL);
char mbstr[100];
@ -46,7 +46,7 @@ QString LAMPTOOLAPI getCurrentTimeString() {
return strTime;
}
QString LAMPTOOLAPI getCurrentShortTimeString() {
QString getCurrentShortTimeString() {
struct tm ConversionTime;
std::time_t t = std::time(NULL);
char mbstr[100];
@ -56,14 +56,14 @@ QString LAMPTOOLAPI getCurrentShortTimeString() {
return strTime;
}
std::vector<QString> LAMPTOOLAPI splitString(const QString& str, char delimiter)
std::vector<QString> splitString(const QString& str, char delimiter)
{
QStringList tokens = str.split(delimiter);
return convertQStringListToStdVector(tokens);
}
complex<double> LAMPTOOLAPI Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img)
complex<double> Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img)
{
if (img.rows() != 4 || img.cols() != 4) {
throw exception("the size of img's block is not right");
@ -80,7 +80,7 @@ complex<double> LAMPTOOLAPI Cubic_Convolution_interpolation(double u, double v,
return interValue(0, 0);
}
complex<double> LAMPTOOLAPI Cubic_kernel_weight(double s)
complex<double> Cubic_kernel_weight(double s)
{
s = abs(s);
if (s <= 1) {
@ -111,7 +111,7 @@ complex<double> LAMPTOOLAPI Cubic_kernel_weight(double s)
/// <param name="p3">x,y,z</param>
/// <param name="p4">x,y,z</param>
/// <returns></returns>
double LAMPTOOLAPI Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22)
double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22)
{
return p11.ati * (1 - p0.lon) * (1 - p0.lat) +
@ -122,7 +122,7 @@ double LAMPTOOLAPI Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint
bool LAMPTOOLAPI onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q)
bool onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q)
{
if ((Q.x - Pi.x) * (Pj.y - Pi.y) == (Pj.x - Pi.x) * (Q.y - Pi.y) //叉乘
//保证Q点坐标在pi,pj之间
@ -133,7 +133,7 @@ bool LAMPTOOLAPI onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q)
return false;
}
Point_3d LAMPTOOLAPI invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d)
Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d)
{
Point_3d res;
@ -215,18 +215,18 @@ Point_3d LAMPTOOLAPI invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c,
return p;
}
double LAMPTOOLAPI sind(double degree)
double sind(double degree)
{
return sin(degree * d2r);
}
double LAMPTOOLAPI cosd(double d)
double cosd(double d)
{
return cos(d * d2r);
}
string LAMPTOOLAPI Convert(float Num)
string Convert(float Num)
{
ostringstream oss;
oss << Num;
@ -234,7 +234,7 @@ string LAMPTOOLAPI Convert(float Num)
return str;
}
QString LAMPTOOLAPI JoinPath(const QString& path, const QString& filename)
QString JoinPath(const QString& path, const QString& filename)
{
QDir dir(path);
@ -244,7 +244,7 @@ QString LAMPTOOLAPI JoinPath(const QString& path, const QString& filename)
return dir.filePath(filename);
}
std::vector<QString> LAMPTOOLAPI convertQStringListToStdVector(const QStringList& qStringList)
std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList)
{
std::vector<QString> stdVector;

View File

@ -36,17 +36,17 @@ using namespace Eigen;
///////////////////////////////////// 运行时间打印 //////////////////////////////////////////////////////////
QString LAMPTOOLAPI getCurrentTimeString();
QString LAMPTOOLAPI getCurrentShortTimeString();
QString getCurrentTimeString();
QString getCurrentShortTimeString();
std::vector<QString> LAMPTOOLAPI splitString(const QString& str, char delimiter);
std::vector<QString> splitString(const QString& str, char delimiter);
/////////////////////////////// 基本图像类 结束 //////////////////////////////////////////////////////////
string LAMPTOOLAPI Convert(float Num);
QString LAMPTOOLAPI JoinPath(const QString& path, const QString& filename);
string Convert(float Num);
QString JoinPath(const QString& path, const QString& filename);
////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
@ -56,15 +56,15 @@ QString LAMPTOOLAPI JoinPath(const QString& path, const QString& filename);
////////////////////////////// 插值 ////////////////////////////////////////////
complex<double> LAMPTOOLAPI Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img);
complex<double> Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX<complex<double>> img);
complex<double> LAMPTOOLAPI Cubic_kernel_weight(double s);
complex<double> Cubic_kernel_weight(double s);
double LAMPTOOLAPI Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22);
double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22);
bool LAMPTOOLAPI onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q);
bool onSegment(Point_3d Pi, Point_3d Pj, Point_3d Q);
Point_3d LAMPTOOLAPI invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d);
Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d);
@ -87,8 +87,8 @@ step 5: 瞬时平天球坐标系转换为协议天球坐标系J2000
**/
double LAMPTOOLAPI sind(double degree);
double sind(double degree);
double LAMPTOOLAPI cosd(double d);
double cosd(double d);
#endif

View File

@ -21,6 +21,38 @@ include_directories(C:/PCL/include/pcl-1.14)
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)
# qscintilla2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src)
# qcustomplot
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot)
# qhexedit
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit)
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SqliteDBProcess/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/modelProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/EchoShowProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/OCCViewer)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/PointCloudProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/SharedModuleLib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TableProcess)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/TaskXml)
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
@ -35,7 +67,9 @@ link_directories("C:/PCL/lib")
# include
#-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@ -49,11 +83,14 @@ qt5_add_resources(_resource ${_qrc} ${_lang})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
file(GLOB _ui "*.ui")
file(GLOB _header "*.h")
file(GLOB _source "*.cpp")
file(GLOB_RECURSE _ui "*.ui")
file(GLOB_RECURSE _header "*.h" )
file(GLOB_RECURSE _source "*.cpp")
qt5_wrap_ui(_interface ${_ui})
qt5_wrap_cpp(MOC_SOURCES ${_header})
# MOC
list(APPEND SOURCES ${MOC_SOURCES})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
@ -62,6 +99,7 @@ add_library(PluginWBFZExchangePlugin
${_interface}
${_header}
${_source}
${SOURCES}
)
@ -77,6 +115,7 @@ link_directories("C:/PCL/lib")
find_package(Qt5 REQUIRED COMPONENTS Core Quick Sql Core Xml Opengl Gui Svg Xmlpatterns Uitools Widgets Qml Printsupport Sensors Quickwidgets Quick Concurrent Openglextensions Charts Datavisualization)
find_package(PCL )
# boost
include_directories(D:/vcpkg/installed/x64-windows/include)
@ -97,29 +136,43 @@ add_definitions(${PCL_DEFINITIONS})
#-----------------------------------------------------------------------------
target_compile_definitions(PluginWBFZExchangePlugin PRIVATE "NOMINMAX") # vc++ min max pcl std::minpcl::max
target_compile_definitions(PluginWBFZExchangePlugin PRIVATE "WBFZ_API")
target_compile_definitions(PluginWBFZExchangePlugin PRIVATE "WBCLFZSYSTEMMODULE_API")
target_compile_definitions(PluginWBFZExchangePlugin PRIVATE "LAMPTOOL_API")
#-----------------------------------------------------------------------------
# Qt
#-----------------------------------------------------------------------------
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
list(APPEND _depend_library
LAMPTool WBCLFZSystemModule Common PointCloudOperator PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow
qcustomplot qhexedit qscintilla2 Common PointCloudOperator Settings PythonModule DataProperty MeshData Material Geometry BCBase ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GeometryCommand GeometryWidgets IO MainWidgets MainWindow
)
list(APPEND _runtimes_libraries
LAMPCAE::CGNS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml
)
# pcl
list(APPEND _runtimes_libraries
list(APPEND _runtimes_libraries
Qt5::Network Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport Qt5::Test
)
list(APPEND _runtimes_libraries
OpenCASCADE::TKOpenGl OpenCASCADE::TKOffset OpenCASCADE::TKSTL OpenCASCADE::TKFillet 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
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_include_directories(PluginWBFZExchangePlugin PRIVATE ${Qwt_INCLUDE_DIRS})
#-----------------------------------------------------------------------------
#
#-----------------------------------------------------------------------------
@ -127,6 +180,11 @@ target_link_libraries(PluginWBFZExchangePlugin PRIVATE
${_runtimes_libraries}
${_depend_library}
${PCL_LIBRARIES}
unofficial::sqlite3::sqlite3
GDAL::GDAL
FFTW3::fftw3
GSL::gsl GSL::gslcblas
)
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,291 @@
/**
* @file DialogPCLBilateralFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLBilateralFilter.h" resolved
#include "DialogPCLBilateralFilter.h"
#include "ui_DialogPCLBilateralFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
#include <pcl/filters/statistical_outlier_removal.h>
#include <QtWidgets>
#include <QFileDialog>
#include <QFileInfo>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include "ModuleBase/ThreadControl.h"
#include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/MeshConfig.h"
#include "Common/DebugLogger.h"
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLBilateralFilter::DialogPCLBilateralFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLBilateralFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Fast Bilateral Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLBilateralFilter::~DialogPCLBilateralFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLBilateralFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double sigmaS=_ui->SigmaS->value();
double sigmaR=_ui->SigmaR->value();
QString outfilename="filter";
for (auto component : _components)
outfilename.append(QString("_%1").arg(component->getName()));
// 确定是否保存结果文件
QMessageBox::StandardButton result=QMessageBox::critical(this, "info","save as result ?");
QString filepath= JoinPath(Setting::BusAPI::instance()->getWorkingDir() ,outfilename+"_tmep.pcd");
QString AbFileName;
if(result==QMessageBox::StandardButton::Ok||result==QMessageBox::StandardButton::Yes){
QStringList suffixlist = IO::IOConfigure::getPclExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
list.append(suffix);
}
}
std::sort(list.begin(), list.end());
QString suffixes = list.join(";;");
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Export Pcl"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptSave);
if(dlg.exec() != QFileDialog::FileName)
return;
QString aSuffix = dlg.selectedNameFilter();
QString aFileName = dlg.selectedFiles().join(",");
if(!(aFileName.isEmpty())){
filepath=aFileName;
}else{}
AbFileName=filepath;
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
}else{ // 不保存成点云数据
}
// 启动线程
auto pclfilter = new WBFZ::PCLBilateralFilter(
AbFileName,WBFZ::PointCloudOperation::POINTCLOUD_FILTER,_mainWindow,componentIds, sigmaR, sigmaS);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pclfilter);
emit tc->threadStart(); // emit MSHwriter->start();
QFDialog::accept();
}
void DialogPCLBilateralFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLBilateralFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLBilateralFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget
WBFZ::PCLBilateralFilter::PCLBilateralFilter(const QString& fileName,
WBFZ::PointCloudOperation operation,
GUI::MainWindow* mw, QString componentIds,
double sigmaR, double sigmaS)
: PointCloudThreadBase(fileName, operation, mw)
, _fileName(fileName)
, _operation(operation)
, _componentIds(componentIds)
, _sigmaR(sigmaR)
, _sigmaS(sigmaS)
{
}
vtkDataSet* WBFZ::PCLBilateralFilter::filter()
{
return PCLBilateralFilterAlg( _componentIds, _sigmaR, _sigmaS);
}
vtkDataSet* WBFZ::PCLBilateralFilter::PCLBilateralFilterAlg(QString componentIds, double sigmaR,
double sigmaS)
{
emit _mainwindow->printMessage(Common::Message::Normal,"PCLBilateralFilterAlg");
// 获取vtdataset
QStringList qCompontIds = QString(componentIds).split(',');
MeshData::MeshSet* meshSet = NULL;
MeshData::MeshKernal* meshKernal = NULL;
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
// 筛选其中的点云数据
// 创建 vtkCellDataToPointData 过滤器
vtkSmartPointer<vtkGeometryFilter> cellToPointFilter = vtkSmartPointer<vtkGeometryFilter>::New();
QString outfilename;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
DebugInfo("point count %d : %d ",compontId.toInt(),meshSet==nullptr);
if(!meshSet)
continue;
outfilename=meshSet->getName();
vtkPolyData* temppolyData=PointCloudOperator::PointCloudCommon::meshSetToVtkDataset(meshSet);
cellToPointFilter->SetInputData(temppolyData);
DebugInfo("point count %d : %d ",compontId.toInt(),temppolyData==nullptr);
}
// 执行过滤操作
cellToPointFilter->Update();
DebugInfo("cellToPointFilter ");
// 获取过滤后的 vtkPolyData
vtkPolyData* outpolyData = cellToPointFilter->GetOutput();
DebugInfo("outpolyData ");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outpolyData,*cloud_with_rgba);
// 创建滤波器对象
pcl::FastBilateralFilter<pcl::PointXYZRGBA> fbf;
fbf.setInputCloud(cloud_with_rgba);
fbf.setSigmaS(sigmaS);
fbf.setSigmaR(sigmaR);
fbf.filter(*cloud_filtered);
// 转换处理结果
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_filtered,polydata);
vtkDataSet* dataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
size_t pointCount = dataset->GetNumberOfPoints();
if(pointCount==0){
return nullptr;
}
emit _mainwindow->printMessage(Common::Message::Normal,"PCLBilateralFilterAlg successfully!! Point Count : "+QString::number(pointCount));
outpolyData->Delete(); // 释放指针
QString filepath=_fileName;
// 加载文件
QFileInfo info(filepath);
QString name = info.fileName();
QString path = info.filePath();
QString suffix = info.suffix().toLower();
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
if (suffix == "pcd")
{
pcl::io::savePCDFileBinary(outFileName,*cloud_filtered);
}
else if (suffix == "ply")
{
pcl::io::savePLYFileBinary(outFileName,*cloud_filtered);
}
else{}
return dataset;
}
WBFZ::PCLBilateralFilter::~PCLBilateralFilter() {}

View File

@ -9,9 +9,17 @@
#ifndef LAMPCAE_DIALOGPCLBILATERALFILTER_H
#define LAMPCAE_DIALOGPCLBILATERALFILTER_H
#include "mainWidgetsAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
#include "MainWidgets/DialogVTKTransform.h"
#include "PointCloudThreadBase.h"
namespace WBFZ{
class PointCloudThreadBase;
}
class QListWidgetItem;
@ -26,9 +34,32 @@ namespace MeshData
}
namespace WBFZ{
class PCLBilateralFilter : public PointCloudThreadBase
{
public:
PCLBilateralFilter(const QString &fileName, PointCloudOperation operation, GUI::MainWindow *mw, QString componentIds, double sigmaR,double sigmaS);
~PCLBilateralFilter();
private:
vtkDataSet* filter() override;
vtkDataSet* PCLBilateralFilterAlg(QString componentIds,double sigmaR,double sigmaS);
private:
QString _fileName;
PointCloudOperation _operation;
QString _componentIds;
double _sigmaR;
double _sigmaS;
};
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLBilateralFilter : public QFDialog {
class DialogPCLBilateralFilter : public QFDialog {
Q_OBJECT
public:
@ -55,6 +86,14 @@ namespace MainWidget {
private:
Ui::DialogPCLBilateralFilter* _ui;
};
} // namespace MainWidget
#endif // LAMPCAE_DIALOGPCLBILATERALFILTER_H

View File

@ -0,0 +1,449 @@
/**
* @file DialogPCLGPMesh.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGPMesh.h"
// resolved
#include "DialogPCLGPMesh.h"
#include "ui_DialogPCLGPMesh.h"
#include "ModuleBase/ThreadTask.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
#include <pcl/filters/statistical_outlier_removal.h>
#include <QtWidgets>
#include <QFileDialog>
#include <QFileInfo>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include "ModuleBase/ThreadControl.h"
#include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/MeshConfig.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshKernal.h"
#include <vtkSmartPointer.h>
#include <vtkDataSetReader.h>
#include <vtkDataSet.h>
#include <vtkSTLReader.h>
#include <vtkTecplotReader.h>
#include <vtkMultiBlockDataSet.h>
#include <vtkAppendFilter.h>
#include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkAppendFilter.h>
#include <QFileInfo>
#include <QTextCodec>
#include <vtkSTLWriter.h>
#include "Common/DebugLogger.h"
// auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGPMesh::DialogPCLGPMesh(GUI::MainWindow* parent)
: QFDialog(parent)
, _ui(new Ui::DialogPCLGPMesh)
, _mw(parent)
, _selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("GP Meshing"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]() {
_selectdlg->clearSelectItems();
_selectdlg->exec();
});
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet*>)), this,
SLOT(selectedComponentsSlot(QList<MeshData::MeshSet*>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this,
SLOT(customContextMenuRequestedSlot(const QPoint&)));
}
DialogPCLGPMesh::~DialogPCLGPMesh()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGPMesh::accept()
{
if(_components.size() == 0)
return;
QString componentIds;
for(auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double SearchRadius = _ui->SearchRadius->value();
double Mu = _ui->Mu->value();
int MaximumNearestNeighbors = _ui->MaximumNearestNeighbors->value();
double MaximumSurfaceAngle = _ui->MaximumSurfaceAngle->value();
double MaximumAngle = _ui->MaximumAngle->value();
double MinimumAngle = _ui->MinimumAngle->value();
QString outfilename = "filter";
for(auto component : _components)
outfilename.append(QString("_%1").arg(component->getName()));
// 确定是否保存结果文件
QMessageBox::StandardButton result =
QMessageBox::critical(this, "info", "save as result ?");
QString filepath =
JoinPath(Setting::BusAPI::instance()->getWorkingDir(), outfilename + "_tmep.pcd");
QString AbFileName = filepath;
if(result == QMessageBox::StandardButton::Ok
|| result == QMessageBox::StandardButton::Yes) {
DebugInfo("outfilename ok ok \n");
QStringList suffixlist = IO::IOConfigure::getMeshExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(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))
list.append(suffix);
}
}
std::sort(list.begin(), list.end());
QString suffixes = list.join(";;");
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Export mesh"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptSave);
if(dlg.exec() != QFileDialog::FileName)
return;
QString aSuffix = dlg.selectedNameFilter();
QString aFileName = dlg.selectedFiles().join(",");
if(!(aFileName.isEmpty())) {
filepath = aFileName;
} else {
}
AbFileName = filepath;
} else { // 不保存成点云数据
}
DebugInfo("outfilename %s \n", AbFileName.toStdString().c_str());
// 启动线程
auto pclremesh =
new WBFZ::PCLGPMesh(AbFileName, WBFZ::PointCloudOperation::POINTCLOUD_MESH, _mainWindow,
componentIds, SearchRadius, Mu, MaximumNearestNeighbors,
MaximumSurfaceAngle, MaximumAngle, MinimumAngle);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pclremesh);
emit tc->threadStart(); // emit MSHwriter->start();
QFDialog::accept();
}
void DialogPCLGPMesh::selectedComponentsSlot(QList<MeshData::MeshSet*> components)
{
for(MeshData::MeshSet* set : components) {
if(_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGPMesh::customContextMenuRequestedSlot(const QPoint& point)
{
QListWidgetItem* curItem = _ui->listWidget->itemAt(point);
if(!curItem)
return;
QMenu* menu = new QMenu(this);
QAction* deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]() { removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGPMesh::removeCurrentItem(QListWidgetItem* curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if(!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget
namespace WBFZ {
PCLGPMesh::PCLGPMesh(const QString& fileName, WBFZ::PointCloudOperation operation,
GUI::MainWindow* mw, QString componentIds, double SearchRadius, double Mu,
int MaximumNearestNeighbors, double MaximumSurfaceAngle,
double MaximumAngle, double MinimumAngle)
: ModuleBase::ThreadTask(mw)
, _operation(operation)
, _fileName(fileName)
, _componentIds(componentIds)
, _SearchRadius(SearchRadius)
, _Mu(Mu)
, _MaximumNearestNeighbors(MaximumNearestNeighbors)
, _MaximumSurfaceAngle(MaximumSurfaceAngle)
, _MaximumAngle(MaximumAngle)
, _MinimumAngle(MinimumAngle)
{
}
PCLGPMesh::~PCLGPMesh() {}
void PCLGPMesh::defaultMeshFinished()
{
if(_threadRuning) {
QString information{};
ModuleBase::Message msg;
if(_operation == POINTCLOUD_FILTER || _operation == POINTCLOUD_MESH) {
if(_success) {
emit _mainwindow->updateMeshTreeSig();
emit _mainwindow->updateSetTreeSig();
emit _mainwindow->updateActionStatesSig();
// emit _mainwindow->updateActionsStatesSig();
emit _mainwindow->getSubWindowManager()->openPreWindowSig();
emit _mainwindow->updatePreMeshActorSig();
information = QString("Successful Import Mesh From \"%1\"").arg(_fileName);
msg.type = Common::Message::Normal;
msg.message = information;
auto meshdata = MeshData::MeshData::getInstance();
// meshdata->generateDisplayDataSet();
const int nk = meshdata->getKernalCount();
if(nk <= 0)
return;
auto k = meshdata->getKernalAt(nk - 1);
if(k != nullptr)
k->setPath(_fileName);
} else {
information = QString("Failed Filter From \"%1\"").arg(_fileName);
msg.type = Common::Message::Error;
msg.message = information;
}
} else {
}
}
// emit showInformation(information);
// emit _mainwindow->printMessageToMessageWindow(msg);
ModuleBase::ThreadTask::threadTaskFinished();
Py::PythonAgent::getInstance()->unLock();
}
void PCLGPMesh::setThreadRunState(bool flag)
{
_success = flag;
}
void PCLGPMesh::run()
{
ModuleBase::ThreadTask::run();
bool result = false;
switch(_operation) {
case POINTCLOUD_MESH:
emit showInformation(tr("POINTCLOUD_MESH From \"%1\"").arg(_fileName));
result = remeshtaskProcess();
setThreadRunState(result);
break;
default:
break;
}
DebugInfo("run ok _success %d _threadRuning %d \n", _success, _threadRuning);
defaultMeshFinished();
}
bool PCLGPMesh::remeshtaskProcess()
{
QString componentIds = _componentIds;
double SearchRadius = _SearchRadius;
double Mu = _Mu;
int MaximumNearestNeighbors = _MaximumNearestNeighbors;
double MaximumSurfaceAngle = _MaximumSurfaceAngle;
double MaximumAngle = _MaximumAngle;
double MinimumAngle = _MinimumAngle;
emit _mainwindow->printMessage(Common::Message::Normal, "PCLGPMeshAlg");
// 获取vtdataset
QStringList qCompontIds = QString(componentIds).split(',');
MeshData::MeshSet* meshSet = NULL;
MeshData::MeshKernal* meshKernal = NULL;
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
// 筛选其中的点云数据
// 创建 vtkCellDataToPointData 过滤器
vtkSmartPointer<vtkGeometryFilter> cellToPointFilter =
vtkSmartPointer<vtkGeometryFilter>::New();
QString outfilename;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
DebugInfo("point count %d : %d \n", compontId.toInt(), meshSet == nullptr);
if(!meshSet)
continue;
outfilename = meshSet->getName();
vtkPolyData* temppolyData =
PointCloudOperator::PointCloudCommon::meshSetToVtkDataset(meshSet);
cellToPointFilter->SetInputData(temppolyData);
DebugInfo("point count %d : %d \n", compontId.toInt(), temppolyData == nullptr);
}
// 执行过滤操作
cellToPointFilter->Update();
DebugInfo("cellToPointFilter \n");
// 获取过滤后的 vtkPolyData
vtkPolyData* outpolyData = cellToPointFilter->GetOutput();
DebugInfo("outpolyData ");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(
new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(
new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outpolyData, *cloud_with_rgba);
// 创建滤波器对象
// 计算点云滤波结果
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output(
new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果
pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(
new pcl::PointCloud<pcl::PointNormal>);
pcl::PolygonMesh* mesh = new pcl::PolygonMesh;
// 估计法线
PointCloudOperator::PointCloudCommon::NormalEstimation(cloud_with_rgba, cloud_with_normals);
//------------------定义搜索树对象------------------------
pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new pcl::search::KdTree<pcl::PointNormal>);
tree2->setInputCloud(cloud_with_normals);
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; // 定义三角化对象
gp3.setSearchRadius(SearchRadius); // 设置连接点之间的最大距离(即三角形的最大边长)
gp3.setMu(Mu); // 设置被样本点搜索其临近点的最远距离,为了适应点云密度的变化
gp3.setMaximumNearestNeighbors(MaximumNearestNeighbors); // 设置样本点可搜索的邻域个数
gp3.setMaximumSurfaceAngle(
MaximumSurfaceAngle); // 设置某点法线方向偏离样本点法线方向的最大角度
gp3.setMinimumAngle(MinimumAngle); // 设置三角化后得到三角形内角的最小角度
gp3.setMaximumAngle(MaximumAngle); // 设置三角化后得到三角形内角的最大角度
gp3.setNormalConsistency(false); // 设置该参数保证法线朝向一致
// qDebug() << "[GP] start reconstruct :" << cloud_in->points.size();
// Get result
DebugInfo("setInputCloud point count : %d \n", cloud_with_normals->size());
gp3.setInputCloud(cloud_with_normals); // 设置输入点云为有向点云
gp3.setSearchMethod(tree2); // 设置搜索方式
gp3.reconstruct(*mesh); // 重建提取三角化
emit _mainwindow->printMessageToMessageWindow(
QString("edge count %1 ").arg(QString::number(mesh->polygons.size())));
DebugInfo("remesh over ,conver init %d \n", mesh->polygons.size());
// 转换处理结果
vtkPolyData* polydata = vtkPolyData::New(); // 创建新的指针,智能指针会释放
size_t pointcount = PointCloudOperator::PointCloudCommon::mesh2vtk(*mesh, polydata);
DebugInfo("remesh over ,conver over polydata %d , pointcount %d\n", polydata == nullptr,
pointcount);
vtkDataSet* dataset =
vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
// outpolyData->Delete(); // 释放指针 ,
// 千万不能释放这个指针,不然程序回调时,会直接内存崩溃
DebugInfo("PCLGPMeshAlg successfully!! wait for writing file \n");
// vtkDataSet*
// dataset=PCLGPMeshAlg(_componentIds,_SearchRadius,_Mu,_MaximumNearestNeighbors,_MaximumSurfaceAngle,_MaximumAngle,_MinimumAngle);
DebugInfo("remesh \n");
QString filepath = _fileName;
// 加载文件
QFileInfo info(filepath);
QString name = info.fileName();
QString path = info.filePath();
QString suffix = info.suffix().toLower();
QTextCodec* codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName = ba.data();
DebugInfo("writing %s suffix %s !! \n", ba.data(), suffix.toStdString().c_str());
if(suffix == "vtk") {
vtkSmartPointer<vtkUnstructuredGridWriter> writer =
vtkSmartPointer<vtkUnstructuredGridWriter>::New();
writer->SetInputData(dataset);
writer->SetFileTypeToBinary();
writer->SetFileName(ba);
writer->Write();
DebugInfo("writing vtk !! \n");
} else if(suffix == "stl") {
QTextCodec* codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(_fileName);
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
writer->SetInputData(dataset);
writer->SetFileTypeToBinary();
writer->SetFileName(ba);
writer->Write();
DebugInfo("writing stl !! \n");
} else {
}
DebugInfo("writing finish !! %d \n", dataset == nullptr);
// 回调函数
DebugInfo("remeshtaskProcess !! %d \n", dataset == nullptr);
// QFileInfo info(_fileName);
// QString name = info.fileName();
// QString path = info.filePath();
// QString suffix = info.suffix().toLower();
DebugInfo("dataset %d _fileName %s \n", dataset == nullptr,
_fileName.toStdString().c_str());
// 保存流程文件
if(dataset != nullptr) {
DebugInfo("load result in meshKernal \n");
auto* k = new MeshData::MeshKernal;
k->setName(name);
k->setPath(path);
auto meshData = MeshData::MeshData::getInstance();
int nKernal = meshData->getKernalCount();
for(int iKernal = 0; iKernal < nKernal; ++iKernal) {
MeshData::MeshKernal* temp = meshData->getKernalAt(iKernal);
if(temp->getPath() == path) { ///< MG same file update
meshData->removeKernalAt(iKernal);
break;
}
}
k->setMeshData(dataset);
meshData->appendMeshKernal(k);
DebugInfo("load result in meshKernal \n");
return true;
} else {
return false;
}
return false;
}
} // namespace WBFZ

View File

@ -10,9 +10,16 @@
#ifndef LAMPCAE_DIALOGPCLGPMESH_H
#define LAMPCAE_DIALOGPCLGPMESH_H
#include "mainWidgetsAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
#include "MainWidgets/DialogVTKTransform.h"
#include "PointCloudThreadBase.h"
#include "MainWindow/MainWindow.h"
#include "MainWindow/SubWindowManager.h"
namespace WBFZ{
class PointCloudThreadBase;
}
class QListWidgetItem;
@ -27,9 +34,45 @@ namespace MeshData
class MeshSet;
}
namespace GUI
{
class MainWindow;
class SubWindowManager;
}
namespace WBFZ{
class PCLGPMesh : public ModuleBase::ThreadTask
{
public:
PCLGPMesh(const QString &fileName, PointCloudOperation operation, GUI::MainWindow *mw, QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
~PCLGPMesh();
public:
virtual void run();
void defaultMeshFinished();
void setThreadRunState(bool);
bool remeshtaskProcess();
// vtkDataSet* remesh() ;
// vtkDataSet* PCLGPMeshAlg(QString componentIds , double SearchRadius, double Mu,int MaximumNearestNeighbors,double MaximumSurfaceAngle,double MaximumAngle,double MinimumAngle);
private:
bool _success{false};
QString _fileName;
PointCloudOperation _operation;
QString _componentIds;
double _SearchRadius;
double _Mu;
int _MaximumNearestNeighbors;
double _MaximumSurfaceAngle;
double _MaximumAngle;
double _MinimumAngle;
};
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLGPMesh : public QFDialog {
class DialogPCLGPMesh : public QFDialog {
Q_OBJECT
public:

View File

@ -69,7 +69,7 @@
</size>
</property>
<property name="text">
<string>Search Radius: </string>
<string>Triangle edge: </string>
</property>
</widget>
</item>
@ -93,6 +93,9 @@
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
@ -134,6 +137,12 @@
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
</property>
<property name="value">
<double>2.500000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
@ -169,6 +178,15 @@
<height>25</height>
</size>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::DefaultStepType</enum>
</property>
<property name="value">
<number>10000</number>
</property>
</widget>
</item>
<item row="3" column="0">
@ -210,6 +228,9 @@
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
@ -251,6 +272,9 @@
<property name="maximum">
<double>360.000000000000000</double>
</property>
<property name="value">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">

View File

@ -0,0 +1,321 @@
/**
* @file DialogPCLGuassFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get "ui_DialogPCLGuassFilter.h"
// resolved
#include "DialogPCLGuassFilter.h"
#include "ui_DialogPCLGuassFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
#include <QFileDialog>
#include <QFileInfo>
#include <pcl/filters/statistical_outlier_removal.h>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include <pcl/filters/convolution_3d.h>
#include <QFileDialog>
#include <QFileInfo>
#include <pcl/filters/statistical_outlier_removal.h>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include "ModuleBase/ThreadControl.h"
#include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/MeshConfig.h"
#include "Common/DebugLogger.h"
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLGuassFilter::DialogPCLGuassFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLGuassFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Guass Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLGuassFilter::~DialogPCLGuassFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLGuassFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double Sigma=_ui->Sigma->value();
double threshold=_ui->threshold->value();
double radius=_ui->radius->value();
QString outfilename="filter";
for (auto component : _components)
outfilename.append(QString("_%1").arg(component->getName()));
// 确定是否保存结果文件
QMessageBox::StandardButton result=QMessageBox::critical(this, "info","save as result ?");
QString filepath= JoinPath(Setting::BusAPI::instance()->getWorkingDir() ,outfilename+"_tmep.pcd");
QString AbFileName;
if(result==QMessageBox::StandardButton::Ok||result==QMessageBox::StandardButton::Yes){
QStringList suffixlist = IO::IOConfigure::getPclExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
list.append(suffix);
}
}
std::sort(list.begin(), list.end());
QString suffixes = list.join(";;");
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Export Pcl"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptSave);
if(dlg.exec() != QFileDialog::FileName)
return;
QString aSuffix = dlg.selectedNameFilter();
QString aFileName = dlg.selectedFiles().join(",");
if(!(aFileName.isEmpty())){
filepath=aFileName;
}else{}
AbFileName=filepath;
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
}else{ // 不保存成点云数据
}
// 启动线程
auto pclfilter = new WBFZ::PCLGuassFilter(
AbFileName,WBFZ::PointCloudOperation::POINTCLOUD_FILTER,_mainWindow,componentIds, Sigma, threshold,radius);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pclfilter);
emit tc->threadStart(); // emit MSHwriter->start();
QFDialog::accept();
}
void DialogPCLGuassFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLGuassFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLGuassFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget
WBFZ::PCLGuassFilter::PCLGuassFilter(const QString& fileName, WBFZ::PointCloudOperation operation,
GUI::MainWindow* mw, QString componentIds, double sigma,
double threshold,double radius)
: PointCloudThreadBase(fileName, operation, mw)
, _fileName(fileName)
, _operation(operation)
, _componentIds(componentIds)
, _sigma(sigma)
, _threshold(threshold)
, _radius(radius)
{
}
vtkDataSet* WBFZ::PCLGuassFilter::filter()
{
return PointCloudThreadBase::filter();
}
vtkDataSet* WBFZ::PCLGuassFilter::PCLGuassFilterAlg(QString componentIds, double sigma,
double threshold,double radius)
{
emit _mainwindow->printMessage(Common::Message::Normal,"PCLGuassFilterAlg");
// 获取vtdataset
QStringList qCompontIds = QString(componentIds).split(',');
MeshData::MeshSet* meshSet = NULL;
MeshData::MeshKernal* meshKernal = NULL;
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
// 筛选其中的点云数据
// 创建 vtkCellDataToPointData 过滤器
vtkSmartPointer<vtkGeometryFilter> cellToPointFilter = vtkSmartPointer<vtkGeometryFilter>::New();
QString outfilename;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
DebugInfo("point count %d : %d ",compontId.toInt(),meshSet==nullptr);
if(!meshSet)
continue;
outfilename=meshSet->getName();
vtkPolyData* temppolyData=PointCloudOperator::PointCloudCommon::meshSetToVtkDataset(meshSet);
cellToPointFilter->SetInputData(temppolyData);
DebugInfo("point count %d : %d ",compontId.toInt(),temppolyData==nullptr);
}
// 执行过滤操作
cellToPointFilter->Update();
DebugInfo("cellToPointFilter ");
// 获取过滤后的 vtkPolyData
vtkPolyData* outpolyData = cellToPointFilter->GetOutput();
DebugInfo("outpolyData ");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outpolyData,*cloud_with_rgba);
// 创建滤波器对象
/*double radius = 0.02;*/
// Set up the Gaussian Kernel
pcl::filters::GaussianKernel<pcl::PointXYZRGBA, pcl::PointXYZRGBA>::Ptr kernel(
new pcl::filters::GaussianKernel<pcl::PointXYZRGBA, pcl::PointXYZRGBA>);
(*kernel).setSigma(sigma);
(*kernel).setThresholdRelativeToSigma(threshold);
emit _mainwindow->printMessage(Common::Message::Normal,"Kernel made" );
// Set up the KDTree
pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr kdtree(
new pcl::search::KdTree<pcl::PointXYZRGBA>);
(*kdtree).setInputCloud(cloud_with_rgba);
emit _mainwindow->printMessage(Common::Message::Normal,"KdTree made" );
// Set up the Convolution Filter
pcl::filters::Convolution3D<
pcl::PointXYZRGBA,
pcl::PointXYZRGBA,
pcl::filters::GaussianKernel<pcl::PointXYZRGBA, pcl::PointXYZRGBA>>
convolution;
convolution.setKernel(*kernel);
convolution.setInputCloud(cloud_with_rgba);
convolution.setSearchMethod(kdtree);
convolution.setRadiusSearch(radius);
convolution.setNumberOfThreads(
10); // important! Set Thread number for openMP
emit _mainwindow->printMessage(Common::Message::Normal,"Convolution Start");
convolution.convolve(*cloud_filtered);
emit _mainwindow->printMessage(Common::Message::Normal,"Convoluted" );
// 转换处理结果
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_filtered,polydata);
vtkDataSet* dataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
size_t pointCount = dataset->GetNumberOfPoints();
if(pointCount==0){
return nullptr;
}
emit _mainwindow->printMessage(Common::Message::Normal,"PCLGuassFilterAlg successfully!! Point Count : "+QString::number(pointCount));
outpolyData->Delete(); // 释放指针
QString filepath=_fileName;
// 加载文件
QFileInfo info(filepath);
QString name = info.fileName();
QString path = info.filePath();
QString suffix = info.suffix().toLower();
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
if (suffix == "pcd")
{
pcl::io::savePCDFileBinary(outFileName,*cloud_filtered);
}
else if (suffix == "ply")
{
pcl::io::savePLYFileBinary(outFileName,*cloud_filtered);
}
else{}
return dataset;
}
WBFZ::PCLGuassFilter::~PCLGuassFilter() {}

View File

@ -10,9 +10,13 @@
#ifndef LAMPCAE_DIALOGPCLGUASSFILTER_H
#define LAMPCAE_DIALOGPCLGUASSFILTER_H
#include "mainWidgetsAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
#include "MainWidgets/DialogVTKTransform.h"
#include "PointCloudThreadBase.h"
namespace WBFZ{
class PointCloudThreadBase;
}
class QListWidgetItem;
@ -25,10 +29,38 @@ namespace MeshData
{
class MeshSet;
}
namespace WBFZ{
class PCLGuassFilter : public PointCloudThreadBase
{
public:
PCLGuassFilter(const QString &fileName, PointCloudOperation operation, GUI::MainWindow *mw, QString componentIds, double sigma,double threshold,double radius);
~PCLGuassFilter();
private:
vtkDataSet* filter() override;
vtkDataSet* PCLGuassFilterAlg(QString componentIds,double sigmaR,double sigmaS,double radius);
private:
QString _fileName;
PointCloudOperation _operation;
QString _componentIds;
double _sigma;
double _threshold;
double _radius;
};
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLGuassFilter : public QFDialog {
class DialogPCLGuassFilter : public QFDialog {
Q_OBJECT
public:
@ -37,7 +69,7 @@ namespace MainWidget {
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double sigma,double threshold);
void excuteAlg(QString componentIds,double sigma,double threshold,double radius);
private slots:
virtual void accept();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>446</height>
<height>601</height>
</rect>
</property>
<property name="minimumSize">
@ -128,35 +128,13 @@
<property name="maximumSize">
<size>
<width>600</width>
<height>120</height>
<height>200</height>
</size>
</property>
<property name="title">
<string>params</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="Sigma">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="SigmaLabel">
<property name="minimumSize">
@ -176,8 +154,8 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="threshold">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="Sigma">
<property name="minimumSize">
<size>
<width>238</width>
@ -217,6 +195,69 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="threshold">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="radiusLabel">
<property name="minimumSize">
<size>
<width>91</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>search radius : </string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="radius">
<property name="minimumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>238</width>
<height>25</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -0,0 +1,296 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLRadiusOutlierRemoval.h"
#include "ui_DialogPCLRadiusOutlierRemoval.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include <QMenu>
#include <QDebug>
#include <pcl/filters/convolution_3d.h>
#include <QFileDialog>
#include <QFileInfo>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl/filters/radius_outlier_removal.h>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include "ModuleBase/ThreadControl.h"
#include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/MeshConfig.h"
#include "Common/DebugLogger.h"
namespace MainWidget {
DialogPCLRadiusOutlierRemoval::DialogPCLRadiusOutlierRemoval(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLRadiusOutlierRemoval),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Radius Outlier Removal"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLRadiusOutlierRemoval::~DialogPCLRadiusOutlierRemoval()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLRadiusOutlierRemoval::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components)
componentIds.append(QString(",%1").arg(component->getID()));
componentIds.remove(0, 1);
double RadiusSearch=_ui->RadiusSearch->value();
double MinNeighborsInRadius=_ui->MinNeighborsInRadius->value();
QString outfilename="filter";
for (auto component : _components)
outfilename.append(QString("_%1").arg(component->getName()));
// 确定是否保存结果文件
QMessageBox::StandardButton result=QMessageBox::critical(this, "info","save as result ?");
QString filepath= JoinPath(Setting::BusAPI::instance()->getWorkingDir() ,outfilename+"_tmep.pcd");
QString AbFileName;
if(result==QMessageBox::StandardButton::Ok||result==QMessageBox::StandardButton::Yes){
QStringList suffixlist = IO::IOConfigure::getPclExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
list.append(suffix);
}
}
std::sort(list.begin(), list.end());
QString suffixes = list.join(";;");
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Export Pcl"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptSave);
if(dlg.exec() != QFileDialog::FileName)
return;
QString aSuffix = dlg.selectedNameFilter();
QString aFileName = dlg.selectedFiles().join(",");
if(!(aFileName.isEmpty())){
filepath=aFileName;
}else{}
AbFileName=filepath;
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
}else{ // 不保存成点云数据
}
// 启动线程
auto pclfilter = new WBFZ::PCLRadiusOutlierRemoval(
AbFileName,WBFZ::PointCloudOperation::POINTCLOUD_FILTER,_mainWindow,componentIds, RadiusSearch,MinNeighborsInRadius);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pclfilter);
emit tc->threadStart(); // emit MSHwriter->start();
QFDialog::accept();
}
void DialogPCLRadiusOutlierRemoval::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLRadiusOutlierRemoval::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLRadiusOutlierRemoval::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget
namespace WBFZ{
WBFZ::PCLRadiusOutlierRemoval::PCLRadiusOutlierRemoval(const QString &fileName, WBFZ::PointCloudOperation operation,
GUI::MainWindow* mw, QString componentIds,
double RadiusSearch,double MinNeighborsInRadius)
: PointCloudThreadBase(fileName, operation, mw)
, _fileName(fileName)
, _operation(operation)
, _componentIds(componentIds)
, _RadiusSearch(RadiusSearch)
, _MinNeighborsInRadius(MinNeighborsInRadius)
{
}
vtkDataSet* WBFZ::PCLRadiusOutlierRemoval::PCLRadiusOutlierRemovalAlg(QString componentIds, double RadiusSearch,
double MinNeighborsInRadius)
{
emit _mainwindow->printMessage(Common::Message::Normal,"PCLRadiusOutlierRemovalAlg");
// 获取vtdataset
QStringList qCompontIds = QString(componentIds).split(',');
MeshData::MeshSet* meshSet = NULL;
MeshData::MeshKernal* meshKernal = NULL;
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
// 筛选其中的点云数据
// 创建 vtkCellDataToPointData 过滤器
vtkSmartPointer<vtkGeometryFilter> cellToPointFilter = vtkSmartPointer<vtkGeometryFilter>::New();
QString outfilename;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
DebugInfo("point count %d : %d ",compontId.toInt(),meshSet==nullptr);
if(!meshSet)
continue;
outfilename=meshSet->getName();
vtkPolyData* temppolyData=PointCloudOperator::PointCloudCommon::meshSetToVtkDataset(meshSet);
cellToPointFilter->SetInputData(temppolyData);
DebugInfo("point count %d : %d ",compontId.toInt(),temppolyData==nullptr);
}
// 执行过滤操作
cellToPointFilter->Update();
DebugInfo("cellToPointFilter ");
// 获取过滤后的 vtkPolyData
vtkPolyData* outpolyData = cellToPointFilter->GetOutput();
DebugInfo("outpolyData ");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outpolyData,*cloud_with_rgba);
// 创建滤波器对象
pcl::RadiusOutlierRemoval<pcl::PointXYZRGBA> sor;
sor.setInputCloud(cloud_with_rgba); //设置待滤波的点云
sor.setRadiusSearch(RadiusSearch); //设置在进行统计时考虑查询点邻居点数K个最近邻点
sor.setMinNeighborsInRadius(MinNeighborsInRadius); //设置判断是否为离群点的阈值
sor.filter(*cloud_filtered); //将滤波结果保存在cloud_filtered中
// 转换处理结果
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_filtered,polydata);
vtkDataSet* dataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
size_t pointCount = dataset->GetNumberOfPoints();
if(pointCount==0){
return nullptr;
}
emit _mainwindow->printMessage(Common::Message::Normal,"PCLRadiusOutlierRemovalAlg successfully!! Point Count : "+QString::number(pointCount));
outpolyData->Delete(); // 释放指针
QString filepath=_fileName;
// 加载文件
QFileInfo info(filepath);
QString name = info.fileName();
QString path = info.filePath();
QString suffix = info.suffix().toLower();
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
if (suffix == "pcd")
{
pcl::io::savePCDFileBinary(outFileName,*cloud_filtered);
}
else if (suffix == "ply")
{
pcl::io::savePLYFileBinary(outFileName,*cloud_filtered);
}
else{}
return dataset;
}
vtkDataSet* PCLRadiusOutlierRemoval::filter()
{
return PCLRadiusOutlierRemovalAlg( _componentIds, _RadiusSearch,_MinNeighborsInRadius);
}
PCLRadiusOutlierRemoval::~PCLRadiusOutlierRemoval() {}
}

View File

@ -10,9 +10,13 @@
#ifndef LAMPCAE_DIALOGPCLRADIUSOUTLIERREMOVAL_H
#define LAMPCAE_DIALOGPCLRADIUSOUTLIERREMOVAL_H
#include "mainWidgetsAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
#include "MainWidgets/DialogVTKTransform.h"
#include "PointCloudThreadBase.h"
namespace WBFZ{
class PointCloudThreadBase;
}
class QListWidgetItem;
@ -25,10 +29,32 @@ namespace MeshData
{
class MeshSet;
}
namespace WBFZ{
class PCLRadiusOutlierRemoval : public PointCloudThreadBase
{
public:
PCLRadiusOutlierRemoval(const QString &fileName, PointCloudOperation operation, GUI::MainWindow *mw, QString componentIds, double RadiusSearch,double MinNeighborsInRadius);
~PCLRadiusOutlierRemoval();
private:
vtkDataSet* filter() override;
vtkDataSet* PCLRadiusOutlierRemovalAlg(QString componentIds,double RadiusSearch,double MinNeighborsInRadius);
private:
QString _fileName;
PointCloudOperation _operation;
QString _componentIds;
double _RadiusSearch;
double _MinNeighborsInRadius;
};
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLRadiusOutlierRemoval : public QFDialog {
class DialogPCLRadiusOutlierRemoval : public QFDialog {
Q_OBJECT
public:

View File

@ -0,0 +1,297 @@
/**
* @file DialogPCLStatisticalRemoveFilter.cpp
* @brief None
* @author (3045316072@qq.com)
* @version 2.5.0
* @date 2024/4/5
* @copyright Copyright (c) Since 2024 All rights reserved.
*/
// You may need to build the project (run Qt uic code generator) to get
// "ui_DialogPCLStatisticalRemoveFilter.h" resolved
#include "DialogPCLStatisticalRemoveFilter.h"
#include "ui_DialogPCLStatisticalRemoveFilter.h"
#include "PythonModule/PyAgent.h"
#include "MeshData/meshSingleton.h"
#include "MeshData/meshSet.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "DialogPCLBilateralFilter.h"
#include "ModuleBase/ThreadControl.h"
#include "IO/IOConfig.h"
#include <QMenu>
#include <QDebug>
#include "ConfigOptions/ConfigOptions.h"
#include "ConfigOptions/MeshConfig.h"
#include <pcl/filters/convolution_3d.h>
#include <QFileDialog>
#include <QFileInfo>
#include <pcl/filters/statistical_outlier_removal.h>
#include "MeshData/meshKernal.h"
#include "PointCloudOperator/PointCloudCommon.h"
#include "Settings/BusAPI.h"
#include "BaseTool.h"
#include "IO/IOConfig.h"
#include "Common/DebugLogger.h"
//auto meshData = MeshData::MeshData::getInstance();
namespace MainWidget {
DialogPCLStatisticalRemoveFilter::DialogPCLStatisticalRemoveFilter(GUI::MainWindow *parent)
: QFDialog(parent),
_ui(new Ui::DialogPCLStatisticalRemoveFilter),
_mw(parent),
_selectdlg(new DialogSelectComponents(parent))
{
_ui->setupUi(this);
_ui->geoSelectPoint->setToolTip(tr("Clicked Button Selected Components"));
setWindowTitle(tr("Statistical Remove Filter"));
_ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(_ui->geoSelectPoint, &QPushButton::clicked, [=]()
{ _selectdlg->clearSelectItems(); _selectdlg->exec(); });
connect(_selectdlg, SIGNAL(selectedComponentsSig(QList<MeshData::MeshSet *>)), this, SLOT(selectedComponentsSlot(QList<MeshData::MeshSet *>)));
connect(_ui->listWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequestedSlot(const QPoint &)));
}
DialogPCLStatisticalRemoveFilter::~DialogPCLStatisticalRemoveFilter()
{
delete _ui;
_ui = NULL;
delete _selectdlg;
_selectdlg = NULL;
}
void DialogPCLStatisticalRemoveFilter::accept()
{
if (_components.size() == 0)
return;
QString componentIds, rotate, moveLocation, scale;
for (auto component : _components) {
componentIds.append(QString(",%1").arg(component->getID()));
}
componentIds.remove(0, 1);
double MeanK=_ui->MeanK->value();
double stddev=_ui->Stddev->value();
QString outfilename="filter";
for (auto component : _components)
outfilename.append(QString("_%1").arg(component->getName()));
// 确定是否保存结果文件
QMessageBox::StandardButton result=QMessageBox::critical(this, "info","save as result ?");
QString filepath= JoinPath(Setting::BusAPI::instance()->getWorkingDir() ,outfilename+"_tmep.pcd");
QString AbFileName;
if(result==QMessageBox::StandardButton::Ok||result==QMessageBox::StandardButton::Yes){
QStringList suffixlist = IO::IOConfigure::getPclExporters();
if(suffixlist.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("The MeshPlugin is not installed !"));
return;
}
if(MeshData::MeshData::getInstance()->getKernalCount() == 0) {
QMessageBox::warning(this, tr("Warning"), tr("No one has any grid!"));
return;
}
QStringList meshsuffix = ConfigOption::ConfigOption::getInstance()
->getMeshConfig()
->getExportSuffix(ConfigOption::MeshDataType::PointCloud)
.split(";");
QStringList list;
for(QString s : meshsuffix) {
for(int i = 0; i < suffixlist.size(); i++) {
QString suffix = suffixlist.at(i);
if(suffix.contains(s))
list.append(suffix);
}
}
std::sort(list.begin(), list.end());
QString suffixes = list.join(";;");
QString workDir = Setting::BusAPI::instance()->getWorkingDir();
QFileDialog dlg(this, tr("Export Pcl"), workDir, suffixes);
dlg.setAcceptMode(QFileDialog::AcceptSave);
if(dlg.exec() != QFileDialog::FileName)
return;
QString aSuffix = dlg.selectedNameFilter();
QString aFileName = dlg.selectedFiles().join(",");
if(!(aFileName.isEmpty())){
filepath=aFileName;
}else{}
AbFileName=filepath;
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
}else{ // 不保存成点云数据
}
// 启动线程
auto pclfilter = new WBFZ::PCLStatisticalRemoveFilter(
AbFileName,WBFZ::PointCloudOperation::POINTCLOUD_FILTER,_mainWindow,componentIds, MeanK,stddev);
ModuleBase::ThreadControl* tc = new ModuleBase::ThreadControl(pclfilter);
emit tc->threadStart(); // emit MSHwriter->start();
QFDialog::accept();
}
void DialogPCLStatisticalRemoveFilter::selectedComponentsSlot(QList<MeshData::MeshSet *> components)
{
for (MeshData::MeshSet *set : components)
{
if (_components.contains(set))
continue;
_components.append(set);
_ui->listWidget->addItem(set->getName());
}
}
void DialogPCLStatisticalRemoveFilter::customContextMenuRequestedSlot(const QPoint &point)
{
QListWidgetItem *curItem = _ui->listWidget->itemAt(point);
if (!curItem)
return;
QMenu *menu = new QMenu(this);
QAction *deleteItem = new QAction(tr("delete this item"));
menu->addAction(deleteItem);
connect(menu, &QMenu::triggered, [=]()
{ removeCurrentItem(curItem); });
menu->exec(QCursor::pos());
}
void DialogPCLStatisticalRemoveFilter::removeCurrentItem(QListWidgetItem *curItem)
{
auto meshData = MeshData::MeshData::getInstance();
auto meshSet = meshData->getMeshSetByName(curItem->text());
if (!meshSet)
return;
_components.removeOne(meshSet);
_ui->listWidget->removeItemWidget(curItem);
delete curItem;
}
} // namespace MainWidget
namespace WBFZ{
WBFZ::PCLStatisticalRemoveFilter::PCLStatisticalRemoveFilter(const QString &fileName, WBFZ::PointCloudOperation operation,
GUI::MainWindow* mw, QString componentIds,
double MeanK, double StddevThresh)
: PointCloudThreadBase(fileName, operation, mw)
, _fileName(fileName)
, _operation(operation)
, _componentIds(componentIds)
, _MeanK(MeanK)
, _StddevThresh(StddevThresh)
{
}
vtkDataSet* WBFZ::PCLStatisticalRemoveFilter::PCLStatisticalRemoveFilterAlg(QString componentIds, double MeanK,
double StddevThresh)
{
emit _mainwindow->printMessage(Common::Message::Normal,"PCLStatisticalRemoveFilterAlg");
// 获取vtdataset
QStringList qCompontIds = QString(componentIds).split(',');
MeshData::MeshSet* meshSet = NULL;
MeshData::MeshKernal* meshKernal = NULL;
MeshData::MeshData* meshData = MeshData::MeshData::getInstance();
QString kernalName, transformedName, setType, ids;
// 筛选其中的点云数据
// 创建 vtkCellDataToPointData 过滤器
vtkSmartPointer<vtkGeometryFilter> cellToPointFilter = vtkSmartPointer<vtkGeometryFilter>::New();
QString outfilename;
for(QString compontId : qCompontIds) {
meshSet = meshData->getMeshSetByID(compontId.toInt());
DebugInfo("point count %d : %d ",compontId.toInt(),meshSet==nullptr);
if(!meshSet)
continue;
outfilename=meshSet->getName();
vtkPolyData* temppolyData=PointCloudOperator::PointCloudCommon::meshSetToVtkDataset(meshSet);
cellToPointFilter->SetInputData(temppolyData);
DebugInfo("point count %d : %d ",compontId.toInt(),temppolyData==nullptr);
}
// 执行过滤操作
cellToPointFilter->Update();
DebugInfo("cellToPointFilter ");
// 获取过滤后的 vtkPolyData
vtkPolyData* outpolyData = cellToPointFilter->GetOutput();
DebugInfo("outpolyData ");
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_with_rgba(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::io::vtkPolyDataToPointCloud(outpolyData,*cloud_with_rgba);
// 创建滤波器对象
pcl::StatisticalOutlierRemoval<pcl::PointXYZRGBA> sor;
sor.setInputCloud(cloud_with_rgba); //设置待滤波的点云
sor.setMeanK(MeanK); //设置在进行统计时考虑查询点邻居点数K个最近邻点
sor.setStddevMulThresh(StddevThresh); //设置判断是否为离群点的阈值
sor.filter(*cloud_filtered); //将滤波结果保存在cloud_filtered中
// 转换处理结果
vtkPolyData* polydata=nullptr;
polydata=vtkPolyData::New(); // 创建新的指针,智能指针会释放
pcl::io::pointCloudTovtkPolyData(*cloud_filtered,polydata);
vtkDataSet* dataset= vtkDataSet::SafeDownCast(polydata); // 默认完成 vtkpolydata --> vtkdataset
size_t pointCount = dataset->GetNumberOfPoints();
if(pointCount==0){
return nullptr;
}
emit _mainwindow->printMessage(Common::Message::Normal,"PCLStatisticalRemoveFilterAlg successfully!! Point Count : "+QString::number(pointCount));
outpolyData->Delete(); // 释放指针
QString filepath=_fileName;
// 加载文件
QFileInfo info(filepath);
QString name = info.fileName();
QString path = info.filePath();
QString suffix = info.suffix().toLower();
QTextCodec *codec = QTextCodec::codecForName("GB18030");
QByteArray ba = codec->fromUnicode(filepath);
std::string outFileName=ba.data();
if (suffix == "pcd")
{
pcl::io::savePCDFileBinary(outFileName,*cloud_filtered);
}
else if (suffix == "ply")
{
pcl::io::savePLYFileBinary(outFileName,*cloud_filtered);
}
else{}
return dataset;
}
vtkDataSet* PCLStatisticalRemoveFilter::filter()
{
return PCLStatisticalRemoveFilterAlg( _componentIds, _MeanK,_StddevThresh);
}
PCLStatisticalRemoveFilter::~PCLStatisticalRemoveFilter() {}
}

View File

@ -10,9 +10,13 @@
#ifndef LAMPCAE_DIALOGPCLSTATISTICALREMOVEFILTER_H
#define LAMPCAE_DIALOGPCLSTATISTICALREMOVEFILTER_H
#include "mainWidgetsAPI.h"
#include "WBFZExchangePluginAPI.h"
#include "SelfDefObject/QFDialog.h"
#include "DialogVTKTransform.h"
#include "MainWidgets/DialogVTKTransform.h"
#include "PointCloudThreadBase.h"
namespace WBFZ{
class PointCloudThreadBase;
}
class QListWidgetItem;
@ -25,10 +29,31 @@ namespace MeshData
{
class MeshSet;
}
namespace WBFZ{
class PCLStatisticalRemoveFilter : public PointCloudThreadBase
{
public:
PCLStatisticalRemoveFilter(const QString &fileName, PointCloudOperation operation, GUI::MainWindow *mw, QString componentIds, double MeanK,double StddevThresh);
~PCLStatisticalRemoveFilter();
private:
vtkDataSet* filter() override;
vtkDataSet* PCLStatisticalRemoveFilterAlg(QString componentIds,double MeanK,double stddev);
private:
QString _fileName;
PointCloudOperation _operation;
QString _componentIds;
double _MeanK;
double _StddevThresh;
};
}
namespace MainWidget {
class DialogSelectComponents;
class MAINWIDGETSAPI DialogPCLStatisticalRemoveFilter : public QFDialog {
class DialogPCLStatisticalRemoveFilter : public QFDialog {
Q_OBJECT
public:
@ -36,8 +61,7 @@ namespace MainWidget {
~DialogPCLStatisticalRemoveFilter();
private:
void removeCurrentItem(QListWidgetItem* curItem);
signals: // 这里采用信号来直接与 主界面通信,避免参数浪费
void excuteAlg(QString componentIds,double MeanK,double stddev);
private slots:
virtual void accept();

View File

@ -1,4 +1,5 @@
#include "FEKOBaseToolClass.h"
#include "WBFZExchangePluginAPI.h"
#include "FEKOBaseToolClass.h"
#include <math.h>
#include "BaseConstVariable.h"
#include <QMessageBox>
@ -14,11 +15,7 @@
QString LAMPTOOLAPI FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode mode)
QString FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode mode)
{
switch (mode) {
case Strip:
@ -34,7 +31,7 @@ QString LAMPTOOLAPI FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode
return "UNKNOW"; // 默认返回Unknown
}
FEKOBase::FEKOCoordinateSystem LAMPTOOLAPI FEKOBase::FEKOCoordinateSystemString2Enum(QString str)
FEKOBase::FEKOCoordinateSystem FEKOBase::FEKOCoordinateSystemString2Enum(QString str)
{
if (str.toUpper() == "SPHERICAL") { return FEKOBase::Spherical; }
else if (str.toUpper() == "CARTESIAN") { return FEKOBase::Cartesian; }
@ -44,7 +41,7 @@ FEKOBase::FEKOCoordinateSystem LAMPTOOLAPI FEKOBase::FEKOCoordinateSystemString2
}
QString LAMPTOOLAPI FEKOBase::QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode)
QString FEKOBase::QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode)
{
switch (mode) {
case FEKOBase::Spherical:
@ -57,7 +54,7 @@ QString LAMPTOOLAPI FEKOBase::QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordin
}
}
FEKOBase::FEKOImageMode LAMPTOOLAPI FEKOBase::FEKOImageModeString2Enum(QString str)
FEKOBase::FEKOImageMode FEKOBase::FEKOImageModeString2Enum(QString str)
{
if (str.toUpper() == "STRIP") {
return FEKOBase::FEKOImageMode::Strip;
@ -75,7 +72,7 @@ FEKOBase::FEKOImageMode LAMPTOOLAPI FEKOBase::FEKOImageModeString2Enum(QString s
return FEKOBase::FEKOImageMode::UNKNOW; // 默认返回UNKNOW
}
FEKOBase::freqParams LAMPTOOLAPI FEKOBase::getFreqSetting(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution) {
FEKOBase::freqParams FEKOBase::getFreqSetting(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution) {
FEKOBase::freqParams result{ 0,0,0 };
{
@ -93,7 +90,7 @@ FEKOBase::freqParams LAMPTOOLAPI FEKOBase::getFreqSetting(double centerFreq, dou
return result;
}
FEKOBase::FEKOSatelliteParams LAMPTOOLAPI FEKOBase::createFEKOSatelliteParams(double Px, double Py, double Pz, double Vx, double Vy, double Vz, double incidenceAngle, double AzAngle, double theta, double phi, bool isRight, size_t PRFIdx)
FEKOBase::FEKOSatelliteParams FEKOBase::createFEKOSatelliteParams(double Px, double Py, double Pz, double Vx, double Vy, double Vz, double incidenceAngle, double AzAngle, double theta, double phi, bool isRight, size_t PRFIdx)
{
FEKOBase::FEKOSatelliteParams result{
PRFIdx,
@ -108,7 +105,7 @@ FEKOBase::FEKOSatelliteParams LAMPTOOLAPI FEKOBase::createFEKOSatelliteParams(do
return result;
}
FEKOBase::FEKOSatelliteParams LAMPTOOLAPI FEKOBase::createFEKOSatelliteParams(SatelliteState pose, double incidenceAngle, double AzAngle, FEKOantPitionDirect antpos, size_t PRFIdx)
FEKOBase::FEKOSatelliteParams FEKOBase::createFEKOSatelliteParams(SatelliteState pose, double incidenceAngle, double AzAngle, FEKOantPitionDirect antpos, size_t PRFIdx)
{
FEKOBase::FEKOSatelliteParams result{
PRFIdx,pose,incidenceAngle,AzAngle,antpos
@ -116,17 +113,17 @@ FEKOBase::FEKOSatelliteParams LAMPTOOLAPI FEKOBase::createFEKOSatelliteParams(Sa
return result;
}
FEKOBase::SatelliteState LAMPTOOLAPI FEKOBase::FEKOSatelliteParams2SatelliteState(FEKOSatelliteParams parmas)
FEKOBase::SatelliteState FEKOBase::FEKOSatelliteParams2SatelliteState(FEKOSatelliteParams parmas)
{
return parmas.pose;
}
FEKOBase::FEKOantPitionDirect LAMPTOOLAPI FEKOBase::FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas)
FEKOBase::FEKOantPitionDirect FEKOBase::FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas)
{
return parmas.antpos;
}
TopoDS_Shape LAMPTOOLAPI FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double incidenceAngle, double AzAngle, bool isRIGHT, FEKOantPitionDirect* antposition_Direct, TopoDS_Shape antModel)
TopoDS_Shape FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double incidenceAngle, double AzAngle, bool isRIGHT, FEKOantPitionDirect* antposition_Direct, TopoDS_Shape antModel)
{
incidenceAngle = incidenceAngle * M_PI / 180; // 转换为弧度
AzAngle = AzAngle * M_PI / 180; // 扫描角度转换为弧度
@ -267,25 +264,25 @@ TopoDS_Shape LAMPTOOLAPI FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepo
return tempShape;
}
bool LAMPTOOLAPI FEKOBase::compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b)
bool FEKOBase::compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b)
{
return a.frequency < b.frequency;
}
bool LAMPTOOLAPI FEKOBase::comparePRFPluseDataInPRFIdx(const PRFPluseData& a, const PRFPluseData& b)
bool FEKOBase::comparePRFPluseDataInPRFIdx(const PRFPluseData& a, const PRFPluseData& b)
{
return a.prfidx < b.prfidx;
}
LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::NearFieldEchoCSVParser()
FEKOBase::NearFieldEchoCSVParser::NearFieldEchoCSVParser()
{
}
LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::~NearFieldEchoCSVParser()
FEKOBase::NearFieldEchoCSVParser::~NearFieldEchoCSVParser()
{
}
bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
{
qDebug() << u8"正在检查是否可以采用脉冲计数模式 configuration Name PRF_{脉冲计数}";
@ -351,7 +348,7 @@ bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
return true;
}
bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
{
qDebug() << u8"根据数据文件,重新整理成脉冲形式";
@ -441,7 +438,7 @@ bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
}
bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
{
std::vector<ElectricFieldData> dataList;
@ -607,23 +604,23 @@ bool LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& fileP
}
void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::toThetapolar(const QString& filePath)
void FEKOBase::NearFieldEchoCSVParser::toThetapolar(const QString& filePath)
{
this->toEchoData(filePath, 2);
}
void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::toPhiPolar(const QString& filePath)
void FEKOBase::NearFieldEchoCSVParser::toPhiPolar(const QString& filePath)
{
this->toEchoData(filePath, 1);
}
void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::toRPolar(const QString& filePath)
void FEKOBase::NearFieldEchoCSVParser::toRPolar(const QString& filePath)
{
this->toEchoData(filePath, 0);
}
void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::saveCSV(const QString& filePath)
void FEKOBase::NearFieldEchoCSVParser::saveCSV(const QString& filePath)
{
}
@ -632,7 +629,7 @@ void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::saveCSV(const QString& filePa
/// </summary>
/// <param name="filePath">文件路径</param>
/// <param name="outDataName">0: R,1: phi,2: theta</param>
void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::toEchoData(const QString& filePath, size_t outDataName)
void FEKOBase::NearFieldEchoCSVParser::toEchoData(const QString& filePath, size_t outDataName)
{
// 脉冲整理
Eigen::MatrixXcd echoData = Eigen::MatrixXcd::Zero(this->prfData.size(), this->freqPoints);
@ -667,7 +664,7 @@ void LAMPTOOLAPI FEKOBase::NearFieldEchoCSVParser::toEchoData(const QString& fil
echodataTemp.SaveEchoData(filePath);
}
LAMPTOOLAPI FEKOBase::EchoDataClass::EchoDataClass(const FEKOBase::EchoDataClass& inecho)
FEKOBase::EchoDataClass::EchoDataClass(const FEKOBase::EchoDataClass& inecho)
{
this->echoData = inecho.getEchoData();
@ -679,69 +676,69 @@ LAMPTOOLAPI FEKOBase::EchoDataClass::EchoDataClass(const FEKOBase::EchoDataClass
LAMPTOOLAPI FEKOBase::EchoDataClass::EchoDataClass()
FEKOBase::EchoDataClass::EchoDataClass()
{
}
LAMPTOOLAPI FEKOBase::EchoDataClass::~EchoDataClass()
FEKOBase::EchoDataClass::~EchoDataClass()
{
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::setEchoData(Eigen::MatrixXcd echoData)
void FEKOBase::EchoDataClass::setEchoData(Eigen::MatrixXcd echoData)
{
this->echoData = echoData;
}
Eigen::MatrixXcd LAMPTOOLAPI FEKOBase::EchoDataClass::getEchoData() const
Eigen::MatrixXcd FEKOBase::EchoDataClass::getEchoData() const
{
return this->echoData;
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::setAntPos(Eigen::MatrixXd antPos)
void FEKOBase::EchoDataClass::setAntPos(Eigen::MatrixXd antPos)
{
this->antPos = antPos;
}
Eigen::MatrixXd LAMPTOOLAPI FEKOBase::EchoDataClass::getAntPos() const
Eigen::MatrixXd FEKOBase::EchoDataClass::getAntPos() const
{
return this->antPos;
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::setFreqStart(double freqStart)
void FEKOBase::EchoDataClass::setFreqStart(double freqStart)
{
this->freqStart = freqStart;
}
double LAMPTOOLAPI FEKOBase::EchoDataClass::getFreqStart() const
double FEKOBase::EchoDataClass::getFreqStart() const
{
return this->freqStart;
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::setFreqEnd(double freqEnd)
void FEKOBase::EchoDataClass::setFreqEnd(double freqEnd)
{
this->freqEnd = freqEnd;
}
double LAMPTOOLAPI FEKOBase::EchoDataClass::getFreqEnd() const
double FEKOBase::EchoDataClass::getFreqEnd() const
{
return this->freqEnd;
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::setFreqpoints(int freqpoints)
void FEKOBase::EchoDataClass::setFreqpoints(int freqpoints)
{
this->freqpoints = freqpoints;
}
int LAMPTOOLAPI FEKOBase::EchoDataClass::getFreqpoints() const
int FEKOBase::EchoDataClass::getFreqpoints() const
{
return this->freqpoints;
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::loadEchoData(const QString& filePath)
void FEKOBase::EchoDataClass::loadEchoData(const QString& filePath)
{
std::ifstream file(reinterpret_cast<const wchar_t*>(filePath.utf16()), std::ios::binary);
@ -773,7 +770,7 @@ void LAMPTOOLAPI FEKOBase::EchoDataClass::loadEchoData(const QString& filePath)
}
}
void LAMPTOOLAPI FEKOBase::EchoDataClass::SaveEchoData(const QString& filePath)
void FEKOBase::EchoDataClass::SaveEchoData(const QString& filePath)
{
if (echoData.rows() != antPos.rows() || antPos.cols() != 5) {
qDebug() << "Error: antPos.size()!=echoData.rows()*5"
@ -809,7 +806,7 @@ void LAMPTOOLAPI FEKOBase::EchoDataClass::SaveEchoData(const QString& filePath)
Eigen::MatrixXd LAMPTOOLAPI FEKOBase::WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun)
Eigen::MatrixXd FEKOBase::WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun)
{
size_t Nxa = echo.rows();
size_t Nf = echo.cols();
@ -826,7 +823,7 @@ Eigen::MatrixXd LAMPTOOLAPI FEKOBase::WINDOWFun(Eigen::MatrixXcd& echo, ImageAlg
return normw;
}
QList<QString> LAMPTOOLAPI FEKOBase::getFEKOImageAlgorithmList()
QList<QString> FEKOBase::getFEKOImageAlgorithmList()
{
QList<QString> list;
FEKOImageAlgorithm alg;
@ -836,7 +833,7 @@ QList<QString> LAMPTOOLAPI FEKOBase::getFEKOImageAlgorithmList()
return list;
}
FEKOBase::FEKOImageAlgorithm LAMPTOOLAPI FEKOBase::String2FEKOImageAlgorithm(QString str)
FEKOBase::FEKOImageAlgorithm FEKOBase::String2FEKOImageAlgorithm(QString str)
{
FEKOImageAlgorithm alg;
for (alg = FEKOImageAlgorithm::TBP_TIME; alg < FEKOImageAlgorithm::UNKONW; alg = (FEKOImageAlgorithm)(alg + 1)) {
@ -848,7 +845,7 @@ FEKOBase::FEKOImageAlgorithm LAMPTOOLAPI FEKOBase::String2FEKOImageAlgorithm(QSt
return alg;
}
QString LAMPTOOLAPI FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg)
QString FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg)
{
// 将FEKOImageAlgorithm 枚举转换为字符串
switch (alg)
@ -864,7 +861,7 @@ QString LAMPTOOLAPI FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg)
// 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数
QList<QString> LAMPTOOLAPI FEKOBase::getImageAlgWindowFunList()
QList<QString> FEKOBase::getImageAlgWindowFunList()
{
QList<QString> list;
ImageAlgWindowFun alg;
@ -874,7 +871,7 @@ QList<QString> LAMPTOOLAPI FEKOBase::getImageAlgWindowFunList()
return list;
}
FEKOBase::ImageAlgWindowFun LAMPTOOLAPI FEKOBase::String2ImageAlgWindowFun(QString str)
FEKOBase::ImageAlgWindowFun FEKOBase::String2ImageAlgWindowFun(QString str)
{
ImageAlgWindowFun alg;
for (alg = ImageAlgWindowFun::UNKONWWINDOW; alg < ImageAlgWindowFun::UNKONWWINDOW; alg = (ImageAlgWindowFun)(alg + 1)) {
@ -886,7 +883,7 @@ FEKOBase::ImageAlgWindowFun LAMPTOOLAPI FEKOBase::String2ImageAlgWindowFun(QStri
return alg;
}
QString LAMPTOOLAPI FEKOBase::ImageAlgWindowFun2String(FEKOBase::ImageAlgWindowFun alg)
QString FEKOBase::ImageAlgWindowFun2String(FEKOBase::ImageAlgWindowFun alg)
{
switch (alg)
{
@ -900,7 +897,7 @@ QString LAMPTOOLAPI FEKOBase::ImageAlgWindowFun2String(FEKOBase::ImageAlgWindowF
}
bool LAMPTOOLAPI FEKOBase::BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun)
bool FEKOBase::BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun)
{
// BP成像算法
const double c = 0.299792458; // 光速
@ -908,7 +905,7 @@ bool LAMPTOOLAPI FEKOBase::BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd&
return true;
}
bool LAMPTOOLAPI FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun)
bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun)
{
// BP成像算法
@ -937,7 +934,7 @@ bool LAMPTOOLAPI FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd&
#ifdef __SHOWIMAGEPROCESSRESULT // 加窗处理
#ifdef __IMAGEWINDOWSPROCESS // 加窗处理
Eigen::MatrixXd normw = WINDOWFun(echoData, winfun);
#endif

View File

@ -40,8 +40,8 @@ namespace FEKOBase {
Cartesian, // 笛卡尔坐标系
UNKONWFEKOCOORDINATESYSTEM // 必须为最后一个表示未知
};
FEKOBase::FEKOCoordinateSystem LAMPTOOLAPI FEKOCoordinateSystemString2Enum(QString str);
QString LAMPTOOLAPI QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode);
FEKOBase::FEKOCoordinateSystem FEKOCoordinateSystemString2Enum(QString str);
QString QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode);
//==========================================================
@ -56,8 +56,8 @@ namespace FEKOBase {
UNKNOW
};
FEKOImageMode LAMPTOOLAPI FEKOImageModeString2Enum(QString str);
QString LAMPTOOLAPI FEKOImageModeenumToString(FEKOImageMode mode);
FEKOImageMode FEKOImageModeString2Enum(QString str);
QString FEKOImageModeenumToString(FEKOImageMode mode);
@ -147,13 +147,13 @@ namespace FEKOBase {
/// <param name="scenceRange">分辨率 米</param>
/// <param name="isResolution"></param>
/// <returns></returns>
freqParams LAMPTOOLAPI getFreqSetting(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false);
freqParams getFreqSetting(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false);
FEKOSatelliteParams LAMPTOOLAPI createFEKOSatelliteParams(double Px, double Py, double Pz, double Vx, double Vy, double Vz, double incidenceAngle, double AzAngle, double theta, double phi, bool isRight, size_t PRFIdx = 0);
FEKOSatelliteParams LAMPTOOLAPI createFEKOSatelliteParams(SatelliteState pose, double incidenceAngle, double AzAngle, FEKOantPitionDirect antpos, size_t PRFIdx = 0);
FEKOSatelliteParams createFEKOSatelliteParams(double Px, double Py, double Pz, double Vx, double Vy, double Vz, double incidenceAngle, double AzAngle, double theta, double phi, bool isRight, size_t PRFIdx = 0);
FEKOSatelliteParams createFEKOSatelliteParams(SatelliteState pose, double incidenceAngle, double AzAngle, FEKOantPitionDirect antpos, size_t PRFIdx = 0);
SatelliteState LAMPTOOLAPI FEKOSatelliteParams2SatelliteState(FEKOSatelliteParams parmas);
FEKOantPitionDirect LAMPTOOLAPI FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas);
SatelliteState FEKOSatelliteParams2SatelliteState(FEKOSatelliteParams parmas);
FEKOantPitionDirect FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas);
/// <summary>
/// 将卫星姿态转换为 FEKO 天线坐标,
@ -166,7 +166,7 @@ namespace FEKOBase {
/// <param name="antposition_Direct">结果文件</param>
/// <param name="inDs">输入模型</param>
/// <returns></returns>
TopoDS_Shape LAMPTOOLAPI SatellitePos2FEKOAntPos(SatelliteState satepos, double incidenceAngle, double AzAngle, bool isRIGHT, FEKOantPitionDirect* antposition_Direct, TopoDS_Shape inDs);
TopoDS_Shape SatellitePos2FEKOAntPos(SatelliteState satepos, double incidenceAngle, double AzAngle, bool isRIGHT, FEKOantPitionDirect* antposition_Direct, TopoDS_Shape inDs);
@ -214,10 +214,10 @@ namespace FEKOBase {
std::vector<ElectricFieldData> electricFieldDataList; // 单频点信息
};
bool LAMPTOOLAPI compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b);
bool LAMPTOOLAPI comparePRFPluseDataInPRFIdx(const PRFPluseData& a, const PRFPluseData& b);
bool compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b);
bool comparePRFPluseDataInPRFIdx(const PRFPluseData& a, const PRFPluseData& b);
class LAMPTOOLAPI NearFieldEchoCSVParser {
class NearFieldEchoCSVParser {
public:
NearFieldEchoCSVParser();
~NearFieldEchoCSVParser();
@ -259,7 +259,7 @@ namespace FEKOBase {
// 。
// 注意Bp并不关心脉冲的顺序只是关注脉冲的坐标位置默认按照脉冲的解析顺序进行组织
//========================================================================
class LAMPTOOLAPI EchoDataClass {
class EchoDataClass {
private: // 成像变量
Eigen::MatrixXcd echoData; // 回波数据
Eigen::MatrixXd antPos;// 每个脉冲的坐标
@ -314,7 +314,7 @@ namespace FEKOBase {
/// </summary>
/// <param name="echo">行:脉冲,列:频点</param>
/// <returns></returns>
Eigen::MatrixXd LAMPTOOLAPI WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
Eigen::MatrixXd WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
enum FEKOImageAlgorithm
{
@ -323,18 +323,18 @@ namespace FEKOBase {
UNKONW // 必须为最后一个表示未知
};
QList<QString> LAMPTOOLAPI getFEKOImageAlgorithmList();
FEKOImageAlgorithm LAMPTOOLAPI String2FEKOImageAlgorithm(QString str);
QString LAMPTOOLAPI FEKOImageAlgorithm2String(FEKOImageAlgorithm alg);
QList<QString> getFEKOImageAlgorithmList();
FEKOImageAlgorithm String2FEKOImageAlgorithm(QString str);
QString FEKOImageAlgorithm2String(FEKOImageAlgorithm alg);
// 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数
QList<QString> LAMPTOOLAPI getImageAlgWindowFunList();
ImageAlgWindowFun LAMPTOOLAPI String2ImageAlgWindowFun(QString str);
QString LAMPTOOLAPI ImageAlgWindowFun2String(ImageAlgWindowFun alg);
QList<QString> getImageAlgWindowFunList();
ImageAlgWindowFun String2ImageAlgWindowFun(QString str);
QString ImageAlgWindowFun2String(ImageAlgWindowFun alg);
bool LAMPTOOLAPI BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // BP成像
bool LAMPTOOLAPI FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // FBP成像
bool BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // BP成像
bool FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, Eigen::MatrixXd& antPos, Eigen::MatrixXd& freqmatrix, Eigen::MatrixXd& X, Eigen::MatrixXd& Y, Eigen::MatrixXd& Z, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); // FBP成像

View File

@ -1,16 +1,16 @@
#include "FEKOFarFieldFileClass.h"
LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass()
FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass()
{
}
LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::~FEKOFarFieldFileClass()
FEKOBase::FEKOFarFieldFileClass::~FEKOFarFieldFileClass()
{
}
void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
void FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
{
QFile file(fileName);
// 加载文本文件中的所有数据到一个 QString 中
@ -76,7 +76,7 @@ void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QStrin
file.close();
}
void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fileName)
void FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fileName)
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
@ -91,7 +91,7 @@ void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fi
}
FEKOBase::FEKOFARFIELDRESULTTYPE LAMPTOOLAPI FEKOBase::FEKOFARFIELDRESULTTYPEString2Enum(QString str)
FEKOBase::FEKOFARFIELDRESULTTYPE FEKOBase::FEKOFARFIELDRESULTTYPEString2Enum(QString str)
{
if (str.toUpper() == "GAIN") { return FEKOBase::GAIN; }
else if (str.toUpper() == "DIRECTIVITY") { return FEKOBase::DIRECTIVITY; }
@ -103,7 +103,7 @@ void LAMPTOOLAPI FEKOBase::FEKOFarFieldFileClass::outputToFile(const QString& fi
return FEKOBase::FEKOFARFIELDRESULTTYPE();
}
QString LAMPTOOLAPI FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode)
QString FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode)
{
switch (mode) {
case FEKOBase::GAIN:
@ -120,7 +120,7 @@ QString LAMPTOOLAPI FEKOBase::QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFI
}
}
LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
{
this->dataList.clear();
this->thetaSamples = 0;
@ -136,12 +136,12 @@ LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::FEKOFARFIELDFEKODATABLOCK()
this->resultType = FEKOBase::FEKOFARFIELDRESULTTYPEUNKOWN;
}
LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::~FEKOFARFIELDFEKODATABLOCK()
FEKOBase::FEKOFARFIELDFEKODATABLOCK::~FEKOFARFIELDFEKODATABLOCK()
{
}
int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr)
int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr)
{
// 按行进行解析
QList<QString> lines= blockstr.split("\n");
@ -150,7 +150,7 @@ int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock
}
int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QList<QString>& lines)
int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QList<QString>& lines)
{
bool in_readHeaderState = false;
size_t headerlineCount = 0;
@ -267,7 +267,7 @@ int LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock
return 0;
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderString(QString headerstr)
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderString(QString headerstr)
{
headerstr = headerstr.replace("'", "").replace(u8"\"",u8"");
if(headerstr.indexOf("#Configuration Name") != -1)
@ -408,7 +408,7 @@ QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::normalizationHeaderStri
;
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock()
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock()
{
switch (this->resultType) {
@ -425,22 +425,22 @@ QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlo
}
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Gain()
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Gain()
{
return QString();
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Directivity()
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_Directivity()
{
return QString();
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_RCS()
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_RCS()
{
return QString();
}
QString LAMPTOOLAPI FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_FarFieldValues()
QString FEKOBase::FEKOFARFIELDFEKODATABLOCK::saveFEKOFarFieldDataBlock_FarFieldValues()
{
return QString();
}

View File

@ -21,8 +21,8 @@ namespace FEKOBase {
FARFIELDVALUES,// 远场值
FEKOFARFIELDRESULTTYPEUNKOWN
};
FEKOBase::FEKOFARFIELDRESULTTYPE LAMPTOOLAPI FEKOFARFIELDRESULTTYPEString2Enum(QString str);
QString LAMPTOOLAPI QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode);
FEKOBase::FEKOFARFIELDRESULTTYPE FEKOFARFIELDRESULTTYPEString2Enum(QString str);
QString QString2FEKOFARFIELDRESULTTYPE(FEKOBase::FEKOFARFIELDRESULTTYPE mode);
@ -63,7 +63,7 @@ namespace FEKOBase {
double RCS_total = 0;
};
class LAMPTOOLAPI FEKOFARFIELDFEKODATABLOCK { // 数据块
class FEKOFARFIELDFEKODATABLOCK { // 数据块
public:
FEKOFARFIELDFEKODATABLOCK();
~FEKOFARFIELDFEKODATABLOCK();
@ -100,9 +100,9 @@ namespace FEKOBase {
class LAMPTOOLAPI FEKOFarFieldFileClass: public QObject
class FEKOFarFieldFileClass: public QObject
{
Q_OBJECT
// Q_OBJECT
public:
FEKOFarFieldFileClass();
~FEKOFarFieldFileClass();

View File

@ -26,7 +26,7 @@
// 定义插值函数,以处理复数值
std::complex<double> LAMPTOOLAPI InterpolateComplex(Eigen::MatrixXd& xi, Eigen::MatrixXd& yi, Eigen::MatrixXcd& data, double x, double y) {
std::complex<double> InterpolateComplex(Eigen::MatrixXd& xi, Eigen::MatrixXd& yi, Eigen::MatrixXcd& data, double x, double y) {
int m = xi.rows();
int n = xi.cols();
@ -69,7 +69,7 @@ std::complex<double> LAMPTOOLAPI InterpolateComplex(Eigen::MatrixXd& xi, Eigen::
}
Eigen::MatrixXd LAMPTOOLAPI Cartesian2Spherical(Eigen::MatrixXd CartesianPoint)
Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint)
{
Eigen::MatrixXd result = CartesianPoint;
size_t rows = result.rows();
@ -100,7 +100,7 @@ Eigen::MatrixXd LAMPTOOLAPI Cartesian2Spherical(Eigen::MatrixXd CartesianPoint)
return result;
}
int LAMPTOOLAPI BP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
int BP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
{
BP2DProcessClass process;
process.initProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
@ -109,7 +109,7 @@ int LAMPTOOLAPI BP2DProcess(QString in_path, QString out_path, double Rref, doub
}
int LAMPTOOLAPI FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
int FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
{
FBP2DProcessClass process;
process.initProcess(in_path, out_path, Rref, minX, maxX, minY, maxY, PlaneZ, ImageHeight, ImageWidth);
@ -117,7 +117,7 @@ int LAMPTOOLAPI FBP2DProcess(QString in_path, QString out_path, double Rref, dou
return -1;
}
int LAMPTOOLAPI build2Bin(QString path, int width, int height, std::vector<double>& freqs, Eigen::MatrixXd AntPostion, Eigen::MatrixXcd echo)
int build2Bin(QString path, int width, int height, std::vector<double>& freqs, Eigen::MatrixXd AntPostion, Eigen::MatrixXcd echo)
{
/*
* %
@ -173,7 +173,7 @@ fclose(fid);
}
template<typename T>
Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss)
Eigen::MatrixXcd BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss)
{
bool logfun = !(nullptr == logclss); // 空指针
double delta_x = (maxX - minX) / (ImageWidth - 1);
@ -242,7 +242,7 @@ Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::
template<typename T>
Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss)
Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss)
{
bool logfun = !(nullptr == logclss);
double delta_x = (maxX - minX) / (ImageWidth - 1);
@ -430,7 +430,7 @@ Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::
}
int LAMPTOOLAPI BP2DProcessClass::initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
int BP2DProcessClass::initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth)
{
// 初始化参数
this->readEchoFile(in_path);
@ -456,7 +456,7 @@ int LAMPTOOLAPI BP2DProcessClass::initProcess(QString in_path, QString out_path,
return -1;
}
int LAMPTOOLAPI BP2DProcessClass::readEchoFile(QString in_path)
int BP2DProcessClass::readEchoFile(QString in_path)
{
std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary);
if (!fin.is_open()) exit(2);
@ -501,7 +501,7 @@ int LAMPTOOLAPI BP2DProcessClass::readEchoFile(QString in_path)
return -1;
}
int LAMPTOOLAPI BP2DProcessClass::saveTiFF(Eigen::MatrixXcd m)
int BP2DProcessClass::saveTiFF(Eigen::MatrixXcd m)
{
return saveMatrixXcd2TiFF(m, this->out_path);
}
@ -510,7 +510,7 @@ int LAMPTOOLAPI BP2DProcessClass::saveTiFF(Eigen::MatrixXcd m)
/// 成像工作流,注意存在大量的内存浪费,后期可以根据情况进行优化
/// </summary>
/// <returns></returns>
int LAMPTOOLAPI BP2DProcessClass::start()
int BP2DProcessClass::start()
{
// step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码
QString parantPath = getParantFolderNameFromPath(this->out_path);
@ -573,7 +573,7 @@ int LAMPTOOLAPI BP2DProcessClass::start()
return -1;
}
int LAMPTOOLAPI BP2DProcessClass::logFUN(int percent, QString logtext) {
int BP2DProcessClass::logFUN(int percent, QString logtext) {
qDebug() << "\rBPProcess [" << percent << "%]\t" << logtext;
if (percent < 100) {
qDebug()<<"\n";

View File

@ -6,7 +6,7 @@
* FEKO BP
*
**/
#include "LAMPToolAPI.h"
#include "WBFZExchangePluginAPI.h"
#include <complex>
#include <stdlib.h>
#include <stdio.h>
@ -25,12 +25,12 @@
/// </summary>
/// <param name="CartesianPoint">[X,Y,Z;X1,Y1,Z1]</param>
/// <returns></returns>
Eigen::MatrixXd LAMPTOOLAPI Cartesian2Spherical(Eigen::MatrixXd CartesianPoint);
Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint);
/// <summary>
/// 时域BP
/// </summary>
class LAMPTOOLAPI BP2DProcessClass {
class BP2DProcessClass {
public:
size_t height;
size_t width;
@ -60,15 +60,15 @@ public:
};
int LAMPTOOLAPI BP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ,int ImageHeight,int ImageWidth);
int BP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ,int ImageHeight,int ImageWidth);
// BP 成像时逐像素点计算计算速度慢回波PRFNUM,freqNUM)
template<typename T>
Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPixel(Eigen::MatrixXcd timeEcho,Eigen::MatrixXd AntPosition,double minX,double maxX,double minY,double maxY,double PlaneZ ,double Rref,size_t ImageWidth,size_t ImageHeight,double startfreq,size_t timefreqnum,double timeFreqBandWidth, T* logclss=nullptr);
Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho,Eigen::MatrixXd AntPosition,double minX,double maxX,double minY,double maxY,double PlaneZ ,double Rref,size_t ImageWidth,size_t ImageHeight,double startfreq,size_t timefreqnum,double timeFreqBandWidth, T* logclss=nullptr);
/// <summary>
/// 时域BP --- FBP
/// </summary>
class LAMPTOOLAPI FBP2DProcessClass:public BP2DProcessClass {
class FBP2DProcessClass:public BP2DProcessClass {
public:
size_t height;
size_t width;
@ -99,23 +99,23 @@ public:
// BP 成像时逐脉冲计算回波PRFNUM,freqNUM)
template<typename T>
Eigen::MatrixXcd LAMPTOOLAPI BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss = nullptr);
Eigen::MatrixXcd BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd AntPosition, double minX, double maxX, double minY, double maxY, double PlaneZ, double Rref, size_t ImageWidth, size_t ImageHeight, double startfreq, size_t timefreqnum, double timeFreqBandWidth, T* logclss = nullptr);
int LAMPTOOLAPI FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
int FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth);
// 生成成像的数据文件
int LAMPTOOLAPI build2Bin(QString path,int width,int height,std::vector<double> &freqs,Eigen::MatrixXd AntPositions,Eigen::MatrixXcd echo);
int build2Bin(QString path,int width,int height,std::vector<double> &freqs,Eigen::MatrixXd AntPositions,Eigen::MatrixXcd echo);
// 定义插值函数,以处理复数值
std::complex<double> LAMPTOOLAPI InterpolateComplex(Eigen::MatrixXd& xi, Eigen::MatrixXd& yi, Eigen::MatrixXcd& data, double x, double y);
std::complex<double> InterpolateComplex(Eigen::MatrixXd& xi, Eigen::MatrixXd& yi, Eigen::MatrixXcd& data, double x, double y);
/// <summary>
/// 远场成像
/// </summary>
class LAMPTOOLAPI FEKOFarFieldProcessClass :public BP2DProcessClass {
class FEKOFarFieldProcessClass :public BP2DProcessClass {
public:
size_t height;
size_t width;

View File

@ -434,7 +434,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
bool LAMPTOOLAPI FEKOBase::FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod, ImageAlgWindowFun winfun)
bool FEKOBase::FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod, ImageAlgWindowFun winfun)
{
Eigen::MatrixXcd echoData = echodata.getEchoData();
Eigen::MatrixXd antpos = echodata.getAntPos();
@ -1105,13 +1105,13 @@ FEKOBase::FEKOSimulationDataparamsHandler::~FEKOSimulationDataparamsHandler()
{
}
void FEKOBase::FEKOSimulationDataparamsHandler::setFEKOSimulationDataparams(std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams)
void FEKOBase::FEKOSimulationDataparamsHandler::setFEKOSimulationDataparams(FEKOBase::FEKOSimulationDataparams* simulationparams)
{
this->simulationparams = simulationparams;
this->bandingsetFEKOSimulationDataparams();
}
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> FEKOBase::FEKOSimulationDataparamsHandler::getFEKOSimulationDataparams()
FEKOBase::FEKOSimulationDataparams* FEKOBase::FEKOSimulationDataparamsHandler::getFEKOSimulationDataparams()
{
return this->simulationparams;
}

View File

@ -6,23 +6,23 @@
*/
#ifndef _FEKO_SIMULATION_SAR_CLASS_H
#define _FEKO_SIMULATION_SAR_CLASS_H
#include "WBFZExchangePluginAPI.h"
#include <QObject>
#include "referenceHeader.h"
#include "OCCTBase.h"
#include "GeoOperator.h"
#include "FEKOBaseToolClass.h"
#include "SARImageBase.h"
#include <QObject>
namespace FEKOBase {
//==========================================================
// FEKO成像仿真参数类
//==========================================================
class LAMPTOOLAPI FEKOSimulationDataparams : public QObject { // 仿真参数类
class FEKOSimulationDataparams : public QObject { // 仿真参数类
Q_OBJECT
public:
FEKOSimulationDataparams(QObject* parent = nullptr);
~FEKOSimulationDataparams();
@ -169,16 +169,21 @@ namespace FEKOBase {
void setFarsourcePhiPoints(long phiPoints);
};
class LAMPTOOLAPI FEKOSimulationDataparamsHandler {
//
class FEKOSimulationDataparamsHandler {
public:
FEKOSimulationDataparamsHandler();
~FEKOSimulationDataparamsHandler();
public:
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams;
FEKOBase::FEKOSimulationDataparams* simulationparams;
FEKOBase::FEKOSimulationDataparams* getFEKOSimulationDataparams();
void setFEKOSimulationDataparams(
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> simulationparams);
std::shared_ptr<FEKOBase::FEKOSimulationDataparams> getFEKOSimulationDataparams();
FEKOBase::FEKOSimulationDataparams* simulationparams);
public:
virtual void bandingsetFEKOSimulationDataparams();
@ -188,14 +193,14 @@ namespace FEKOBase {
// FEKO仿真成像参数类
// 解析成像参数xml
//==========================================================
class LAMPTOOLAPI FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler {
class FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler {
public:
FEKOSimulationSARClass();
~FEKOSimulationSARClass();
public:
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist; // FEKO的天线参数设置
void setFEKOAntPoselist(
void setFEKOAntPoselist(
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist); // FEKO的天线参数设置
std::vector<FEKOBase::FEKOSatelliteParams> getFEKOAntPoselist();
@ -223,12 +228,12 @@ namespace FEKOBase {
// FEKO成像
//==========================================================
bool LAMPTOOLAPI FEKOImageProcess(EchoDataClass& echodata,
bool FEKOImageProcess(EchoDataClass& echodata,
FEKOImageSettingParams& imageSettingParams, QString& outPath,
FEKOImageAlgorithm algmethod = FEKOImageAlgorithm::TBP_FREQ,
ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
class LAMPTOOLAPI FEKOImageProcessAbstractClass {
class FEKOImageProcessAbstractClass {
public:
FEKOImageProcessAbstractClass();
~FEKOImageProcessAbstractClass();

View File

@ -10,7 +10,7 @@
#include <fstream>
#include <QDebug>
std::vector<QString> LAMPTOOLAPI getFilelist(const QString& folderpath, const QString& filenameExtension, int (*logfun)(QString logtext, int value))
std::vector<QString> getFilelist(const QString& folderpath, const QString& filenameExtension, int (*logfun)(QString logtext, int value))
{
QString filenameExtensionStr = filenameExtension;
filenameExtensionStr = filenameExtensionStr.remove(0, 1);
@ -40,7 +40,7 @@ std::vector<QString> LAMPTOOLAPI getFilelist(const QString& folderpath, const Q
}
QString LAMPTOOLAPI getParantFolderNameFromPath(const QString& path)
QString getParantFolderNameFromPath(const QString& path)
{
QDir directory(path);
directory.cdUp();
@ -48,7 +48,7 @@ QString LAMPTOOLAPI getParantFolderNameFromPath(const QString& path)
return directory.dirName();
}
QString LAMPTOOLAPI getParantFromPath(const QString& path)
QString getParantFromPath(const QString& path)
{
//qDebug() << path;
QDir directory(path);
@ -58,31 +58,31 @@ QString LAMPTOOLAPI getParantFromPath(const QString& path)
return parentPath;
}
QString LAMPTOOLAPI getFileNameFromPath(const QString& path)
QString getFileNameFromPath(const QString& path)
{
QFileInfo fileInfo(path);
return fileInfo.fileName();
}
bool LAMPTOOLAPI isDirectory(const QString& path)
bool isDirectory(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.isDir();
}
bool LAMPTOOLAPI isExists(const QString& path)
bool isExists(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.exists();
}
bool LAMPTOOLAPI isFile(const QString& path)
bool isFile(const QString& path)
{
QFileInfo fileinfo(path);
return fileinfo.isFile();
}
int LAMPTOOLAPI write_binfile(char* filepath, char* data, size_t data_len)
int write_binfile(char* filepath, char* data, size_t data_len)
{
FILE* pd = fopen(filepath, "w");
if (NULL == pd) {
@ -94,7 +94,7 @@ int LAMPTOOLAPI write_binfile(char* filepath, char* data, size_t data_len)
return -1;
}
LAMPTOOLAPI char* read_textfile(char* text_path, int* length)
char* read_textfile(char* text_path, int* length)
{
char* data = NULL;
FILE* fp1 = fopen(text_path, "r");
@ -120,12 +120,12 @@ LAMPTOOLAPI char* read_textfile(char* text_path, int* length)
return data;
}
bool LAMPTOOLAPI exists_test(const QString& name)
bool exists_test(const QString& name)
{
return isExists(name);
}
size_t LAMPTOOLAPI fsize(FILE* fp)
size_t fsize(FILE* fp)
{
size_t n;
fpos_t fpos; // 当前位置
@ -137,7 +137,7 @@ size_t LAMPTOOLAPI fsize(FILE* fp)
}
void LAMPTOOLAPI removeFile(const QString& filePath)
void removeFile(const QString& filePath)
{
QFile file(filePath);
@ -154,7 +154,7 @@ void LAMPTOOLAPI removeFile(const QString& filePath)
}
}
unsigned long LAMPTOOLAPI convertToULong(const QString& input) {
unsigned long convertToULong(const QString& input) {
bool ok; // Used to check if the conversion was successful
unsigned long result = input.toULong(&ok);
@ -167,7 +167,7 @@ unsigned long LAMPTOOLAPI convertToULong(const QString& input) {
void LAMPTOOLAPI copyFile(const QString& sourcePath, const QString& destinationPath) {
void copyFile(const QString& sourcePath, const QString& destinationPath) {
QFile sourceFile(sourcePath);
QFile destinationFile(destinationPath);

View File

@ -0,0 +1,50 @@
#pragma once
#ifndef FILEOPERATOR_H
#define FILEOPERATOR_H
#include "referenceHeader.h"
#include <string.h>
#include <memory.h>
#include <memory>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#include <QString>
#include <QDir>
#include <QFile>
#include <QDebug>
bool isDirectory(const QString& path);
bool isExists(const QString& path);
bool isFile(const QString& path);
void removeFile(const QString& filePath);
unsigned long convertToULong(const QString& input);
/// <summary>
/// 获取文件(绝对路径)
/// </summary>
/// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param>
/// <returns></returns>
std::vector<QString> getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*",int (*logfun)(QString logtext,int value)=nullptr);
QString getParantFolderNameFromPath(const QString& path);
QString getFileNameFromPath(const QString& path);
int write_binfile(char* filepath, char* data, size_t data_len);
char* read_textfile(char* text_path, int* length);
bool exists_test(const QString& name);
size_t fsize(FILE* fp);
QString getParantFromPath(const QString& path);
void copyFile(const QString& sourcePath, const QString& destinationPath);
// QT FileOperator
#endif

View File

@ -22,24 +22,24 @@ using namespace std;
using namespace Eigen;
Landpoint LAMPTOOLAPI operator +(const Landpoint& p1, const Landpoint& p2)
Landpoint operator +(const Landpoint& p1, const Landpoint& p2)
{
return Landpoint{ p1.lon + p2.lon,p1.lat + p2.lat,p1.ati + p2.ati };
}
Landpoint LAMPTOOLAPI operator -(const Landpoint& p1, const Landpoint& p2)
Landpoint operator -(const Landpoint& p1, const Landpoint& p2)
{
return Landpoint{ p1.lon - p2.lon,p1.lat - p2.lat,p1.ati - p2.ati };
}
bool LAMPTOOLAPI operator ==(const Landpoint& p1, const Landpoint& p2)
bool operator ==(const Landpoint& p1, const Landpoint& p2)
{
return p1.lat == p2.lat && p1.lon == p2.lon && p1.ati == p2.ati;
}
Landpoint LAMPTOOLAPI operator *(const Landpoint& p, double scale)
Landpoint operator *(const Landpoint& p, double scale)
{
return Landpoint{
p.lon * scale,
@ -49,7 +49,7 @@ Landpoint LAMPTOOLAPI operator *(const Landpoint& p, double scale)
}
Landpoint LAMPTOOLAPI LLA2XYZ(const Landpoint& LLA) {
Landpoint LLA2XYZ(const Landpoint& LLA) {
double L = LLA.lon * d2r;
double B = LLA.lat * d2r;
double H = LLA.ati;
@ -68,7 +68,7 @@ Landpoint LAMPTOOLAPI LLA2XYZ(const Landpoint& LLA) {
}
Eigen::MatrixXd LAMPTOOLAPI LLA2XYZ(Eigen::MatrixXd landpoint)
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint)
{
landpoint.col(0) = landpoint.col(0).array() * d2r; // lon
landpoint.col(1) = landpoint.col(1).array() * d2r; // lat
@ -88,7 +88,7 @@ Eigen::MatrixXd LAMPTOOLAPI LLA2XYZ(Eigen::MatrixXd landpoint)
}
Landpoint LAMPTOOLAPI XYZ2LLA(const Landpoint& XYZ) {
Landpoint XYZ2LLA(const Landpoint& XYZ) {
double tmpX = XYZ.lon;//
double temY = XYZ.lat;//
double temZ = XYZ.ati;
@ -118,7 +118,7 @@ Landpoint LAMPTOOLAPI XYZ2LLA(const Landpoint& XYZ) {
double LAMPTOOLAPI getAngle(const Landpoint& a, const Landpoint& b)
double getAngle(const Landpoint& a, const Landpoint& b)
{
double c = dot(a, b) / (getlength(a) * getlength(b));
if (a.lon * b.lat - a.lat * b.lon >= 0) {
@ -129,17 +129,17 @@ double LAMPTOOLAPI getAngle(const Landpoint& a, const Landpoint& b)
}
}
double LAMPTOOLAPI dot(const Landpoint& p1, const Landpoint& p2)
double dot(const Landpoint& p1, const Landpoint& p2)
{
return p1.lat * p2.lat + p1.lon * p2.lon + p1.ati * p2.ati;
}
double LAMPTOOLAPI getlength(const Landpoint& p1) {
double getlength(const Landpoint& p1) {
return sqrt(dot(p1, p1));
}
Landpoint LAMPTOOLAPI crossProduct(const Landpoint& a, const Landpoint& b) {
Landpoint crossProduct(const Landpoint& a, const Landpoint& b) {
return Landpoint{
a.lat * b.ati - a.ati * b.lat,//x
a.ati * b.lon - a.lon * b.ati,//y
@ -147,28 +147,28 @@ Landpoint LAMPTOOLAPI crossProduct(const Landpoint& a, const Landpoint& b) {
};
}
float LAMPTOOLAPI cross2d(Point_3d a, Point_3d b)
float cross2d(Point_3d a, Point_3d b)
{
return a.x * b.y - a.y * b.x;
}
Point_3d LAMPTOOLAPI operator -(Point_3d a, Point_3d b)
Point_3d operator -(Point_3d a, Point_3d b)
{
return Point_3d{ a.x - b.x, a.y - b.y, a.z - b.z };
}
Point_3d LAMPTOOLAPI operator +(Point_3d a, Point_3d b)
Point_3d operator +(Point_3d a, Point_3d b)
{
return Point_3d{ a.x + b.x, a.y + b.y, a.z + b.z };
}
double LAMPTOOLAPI operator /(Point_3d a, Point_3d b)
double operator /(Point_3d a, Point_3d b)
{
return sqrt(pow(a.x, 2) + pow(a.y, 2)) / sqrt(pow(b.x, 2) + pow(b.y, 2));
}
Landpoint LAMPTOOLAPI getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4) {
Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4) {
Landpoint n0 = LLA2XYZ(p0),
n1 = LLA2XYZ(p1),
@ -226,7 +226,7 @@ Landpoint LAMPTOOLAPI getSlopeVector(const Landpoint& p0, const Landpoint& p1,
double LAMPTOOLAPI distance(const Vector3D& p1, const Vector3D& p2)
double distance(const Vector3D& p1, const Vector3D& p2)
{
double dx = p1.x - p2.x;
double dy = p1.y - p2.y;
@ -234,7 +234,7 @@ double LAMPTOOLAPI distance(const Vector3D& p1, const Vector3D& p2)
return std::sqrt(dx * dx + dy * dy + dz * dz);
}
double LAMPTOOLAPI pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection)
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection)
{
Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z };
@ -249,7 +249,7 @@ double LAMPTOOLAPI pointToLineDistance(const Vector3D& point, const Vector3D& li
return distance(point, projection);
}
SphericalCoordinates LAMPTOOLAPI cartesianToSpherical(const CartesianCoordinates& cartesian)
SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian)
{
SphericalCoordinates spherical;
@ -260,7 +260,7 @@ SphericalCoordinates LAMPTOOLAPI cartesianToSpherical(const CartesianCoordinates
return spherical;
}
CartesianCoordinates LAMPTOOLAPI sphericalToCartesian(const SphericalCoordinates& spherical)
CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical)
{
CartesianCoordinates cartesian;

View File

@ -0,0 +1,111 @@
#pragma once
#ifndef _GEOOPERATOR_H
#define _GEOOPERATOR_H
#include "WBFZExchangePluginAPI.h"
#include "BaseConstVariable.h"
#include <Eigen/Core>
#include <Eigen/Dense>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <iostream>
/// <summary>
/// 三维向量,坐标表达
/// </summary>
struct Landpoint // 点 SAR影像的像素坐标
{
/// <summary>
/// 经度x
/// </summary>
double lon; // 经度x lon pixel_col
/// <summary>
/// 纬度y
/// </summary>
double lat; // 纬度y lat pixel_row
/// <summary>
/// 高度z
/// </summary>
double ati; // 高程z ati pixel_time
};
struct Point_3d {
double x;
double y;
double z;
};
/// <summary>
/// 将经纬度转换为地固参心坐标系
/// </summary>
/// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns>
Landpoint LLA2XYZ(const Landpoint& LLA);
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary>
/// 将地固参心坐标系转换为经纬度
/// </summary>
/// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns>
Landpoint XYZ2LLA(const Landpoint& XYZ);
Landpoint operator +(const Landpoint& p1, const Landpoint& p2);
Landpoint operator -(const Landpoint& p1, const Landpoint& p2);
bool operator ==(const Landpoint& p1, const Landpoint& p2);
Landpoint operator *(const Landpoint& p, double scale);
double getAngle(const Landpoint& a, const Landpoint& b);
double dot(const Landpoint& p1, const Landpoint& p2);
double getlength(const Landpoint& p1);
Landpoint crossProduct(const Landpoint& a, const Landpoint& b);
Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4);
float cross2d(Point_3d a, Point_3d b);
Point_3d operator -(Point_3d a, Point_3d b);
Point_3d operator +(Point_3d a, Point_3d b);
double operator /(Point_3d a, Point_3d b);
// 矢量计算
struct Vector3D {
double x, y, z;
};
// 计算两点之间的距离
double distance(const Vector3D& p1, const Vector3D& p2);
// 计算点到直线的最短距离
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection);
struct CartesianCoordinates {
double x, y, z;
};
struct SphericalCoordinates {
double r, theta, phi;
};
SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian);
CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical);
#endif

View File

@ -29,7 +29,7 @@ using namespace Eigen;
std::shared_ptr<GDALDataset> LAMPTOOLAPI OpenDataset(const QString& in_path,GDALAccess rwmode)
std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path,GDALAccess rwmode)
{
GDALAllRegister();
GDALDataset* dataset_ptr = (GDALDataset*)(GDALOpen(in_path.toUtf8().constData(), rwmode));
@ -37,13 +37,13 @@ std::shared_ptr<GDALDataset> LAMPTOOLAPI OpenDataset(const QString& in_path,GDA
return rasterDataset;
}
void LAMPTOOLAPI CloseDataset(GDALDataset* ptr)
void CloseDataset(GDALDataset* ptr)
{
GDALClose(ptr);
ptr = NULL;
}
int LAMPTOOLAPI TIFF2ENVI(QString in_tiff_path, QString out_envi_path)
int TIFF2ENVI(QString in_tiff_path, QString out_envi_path)
{
std::shared_ptr<GDALDataset> ds = OpenDataset(in_tiff_path);
const char* args[] = { "-of", "ENVI", NULL };
@ -53,7 +53,7 @@ int LAMPTOOLAPI TIFF2ENVI(QString in_tiff_path, QString out_envi_path)
return 0;
}
int LAMPTOOLAPI ENVI2TIFF(QString in_envi_path, QString out_tiff_path)
int ENVI2TIFF(QString in_envi_path, QString out_tiff_path)
{
std::shared_ptr<GDALDataset> ds = OpenDataset(in_envi_path);
const char* args[] = { "-of", "Gtiff", NULL };
@ -63,7 +63,7 @@ int LAMPTOOLAPI ENVI2TIFF(QString in_envi_path, QString out_tiff_path)
return 0;
}
int LAMPTOOLAPI CreateDataset(QString new_file_path,int height, int width, int band_num,double* gt, QString projection, GDALDataType gdal_dtype ,bool need_gt)
int CreateDataset(QString new_file_path,int height, int width, int band_num,double* gt, QString projection, GDALDataType gdal_dtype ,bool need_gt)
{
GDALAllRegister();
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
@ -78,7 +78,7 @@ int LAMPTOOLAPI CreateDataset(QString new_file_path,int height, int width, int
return 0;
}
int LAMPTOOLAPI saveDataset(QString new_file_path, int start_line,int start_cols ,int band_ids, int datacols,int datarows,void* databuffer)
int saveDataset(QString new_file_path, int start_line,int start_cols ,int band_ids, int datacols,int datarows,void* databuffer)
{
GDALAllRegister();
std::shared_ptr<GDALDataset> poDstDS = OpenDataset(new_file_path,GA_Update);
@ -88,7 +88,7 @@ int LAMPTOOLAPI saveDataset(QString new_file_path, int start_line,int start_col
return 0;
}
int LAMPTOOLAPI block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype,double memey_size)
int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype,double memey_size)
{
// 计算大小
int size_meta = 0;
@ -134,7 +134,7 @@ int LAMPTOOLAPI block_num_pre_memory(int block_width, int height, GDALDataType
return block_num;
}
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOLAPI ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype)
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadComplexMatrixData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype)
{
int band_num = rasterDataset->GetRasterCount();
@ -276,7 +276,7 @@ Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOL
}
}
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOLAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype, int band_idx)
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype, int band_idx)
{
// 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false;
@ -341,7 +341,7 @@ Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOL
return data_mat;
}
Eigen::MatrixXd LAMPTOOLAPI getGeoTranslationArray(QString in_path)
Eigen::MatrixXd getGeoTranslationArray(QString in_path)
{
@ -349,7 +349,7 @@ Eigen::MatrixXd LAMPTOOLAPI getGeoTranslationArray(QString in_path)
return Eigen::MatrixXd();
}
ImageGEOINFO LAMPTOOLAPI getImageINFO(QString in_path)
ImageGEOINFO getImageINFO(QString in_path)
{
std::shared_ptr<GDALDataset> df = OpenDataset(in_path);
int width = df->GetRasterXSize();
@ -363,7 +363,7 @@ ImageGEOINFO LAMPTOOLAPI getImageINFO(QString in_path)
return result;
}
GDALDataType LAMPTOOLAPI getGDALDataType(QString fileptah)
GDALDataType getGDALDataType(QString fileptah)
{
omp_lock_t lock;
omp_init_lock(&lock);
@ -833,7 +833,7 @@ Eigen::MatrixXd gdalImage::getHist(int bandids)
}
gdalImage LAMPTOOLAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt,bool overwrite) {
gdalImage CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt,bool overwrite) {
if (exists_test(img_path.toUtf8().constData())) {
if (overwrite) {
@ -870,7 +870,7 @@ gdalImage LAMPTOOLAPI CreategdalImage(const QString& img_path, int height, int
return result_img;
}
gdalImageComplex LAMPTOOLAPI CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt, bool overwrite)
gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt, bool overwrite)
{
if (exists_test(img_path.toUtf8().constData())) {
if (overwrite) {
@ -908,7 +908,7 @@ gdalImageComplex LAMPTOOLAPI CreategdalImageComplex(const QString& img_path, in
}
int LAMPTOOLAPI ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample)
int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample)
{
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
@ -1014,7 +1014,7 @@ int LAMPTOOLAPI ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, do
return 0;
}
int LAMPTOOLAPI ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample)
int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample)
{
GDALAllRegister();
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
@ -1072,7 +1072,7 @@ int LAMPTOOLAPI ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResa
return 0;
}
int LAMPTOOLAPI saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path)
int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path)
{
int rows = data.rows();
int cols = data.cols();

View File

@ -39,31 +39,31 @@ struct ImageGEOINFO {
// 判断是否需要输出为DLL
#define DLLOUT
// 文件打开
std::shared_ptr<GDALDataset> LAMPTOOLAPI OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly); // 当指令销毁时调用GDALClose 销毁类型
void LAMPTOOLAPI CloseDataset(GDALDataset* ptr);
std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly); // 当指令销毁时调用GDALClose 销毁类型
void CloseDataset(GDALDataset* ptr);
// 数据格式转换
int LAMPTOOLAPI TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int LAMPTOOLAPI ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
int TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
// 保存影像数据 --直接保存 ENVI 文件
int LAMPTOOLAPI CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, QString projection, GDALDataType gdal_dtype, bool need_gt); // 创建文件
int CreateDataset(QString new_file_path, int height, int width, int band_num, double* gt, QString projection, GDALDataType gdal_dtype, bool need_gt); // 创建文件
int LAMPTOOLAPI saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
int saveDataset(QString new_file_path, int start_line, int start_cols, int band_ids, int datacols, int datarows, void* databuffer);
// 根据限制条件估算分块大小
int LAMPTOOLAPI block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
int block_num_pre_memory(int width, int height, GDALDataType gdal_dtype,double memey_size);
// 将结果转换为复数 或者 实数
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOLAPI ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadComplexMatrixData(int start_line,int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> LAMPTOOLAPI ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadMatrixDoubleData(int start_line, int width, int line_num, std::shared_ptr<GDALDataset> rasterDataset, GDALDataType gdal_datatype,int band_idx);
Eigen::MatrixXd LAMPTOOLAPI getGeoTranslationArray(QString in_path);
ImageGEOINFO LAMPTOOLAPI getImageINFO(QString in_path);
Eigen::MatrixXd getGeoTranslationArray(QString in_path);
ImageGEOINFO getImageINFO(QString in_path);
GDALDataType LAMPTOOLAPI getGDALDataType(QString fileptah);
GDALDataType getGDALDataType(QString fileptah);
struct DemBox {
@ -77,7 +77,7 @@ struct DemBox {
/// <summary>
/// gdalImage图像操作类
/// </summary>
class LAMPTOOLAPI gdalImage
class gdalImage
{
public: // 方法
@ -127,7 +127,7 @@ public:
/// <summary>
/// gdalImage图像操作类
/// </summary>
class LAMPTOOLAPI gdalImageComplex:public gdalImage
class gdalImageComplex:public gdalImage
{
public: // 方法
@ -155,20 +155,20 @@ public:
gdalImage LAMPTOOLAPI CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
gdalImageComplex LAMPTOOLAPI CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
gdalImage CreategdalImage(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int width, int band_num, Eigen::MatrixXd gt, QString projection, bool need_gt = true, bool overwrite = false);
int LAMPTOOLAPI ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample);
int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int new_width, int new_height, GDALResampleAlg eResample);
int LAMPTOOLAPI ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
//--------------------- 保存文博 -------------------------------
int LAMPTOOLAPI saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);
int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);
//----------------------------------------------------

View File

@ -1,19 +1,19 @@
#include "ImageShowDialogClass.h"
#include "ui_ImageShowDialogClass.h"
ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
ui.m_plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
connect(this->ui.m_plot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(updateCursor(QMouseEvent*)));
ui->setupUi(this);
ui->m_plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
connect(this->ui->m_plot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(updateCursor(QMouseEvent*)));
this->graphclass=LAMPDATASHOWCLASS::NOWINDOWS;
this->menubar = new QMenuBar(this);
QMenu* windowsMenu = this->menubar->addMenu(u8"数据");
QAction* action_cursor_enable = windowsMenu->addAction(u8"打开游标");
QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged()));
this->tracer=new QCPItemTracer(this->ui.m_plot);
this->m_plot = ui.m_plot;
//QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged()));
this->tracer=new QCPItemTracer(this->ui->m_plot);
this->m_plot = ui->m_plot;
this->desCursor = nullptr;
this->HlineCursor = nullptr;
@ -27,53 +27,53 @@ ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
this->statusbar->setMaximumHeight(20);
this->statusbar->setMinimumHeight(20);
ui.verticalLayout->setMenuBar(this->menubar);
ui.verticalLayout->addWidget(this->statusbar);
this->setLayout(ui.verticalLayout);
ui->verticalLayout->setMenuBar(this->menubar);
ui->verticalLayout->addWidget(this->statusbar);
this->setLayout(ui->verticalLayout);
}
ImageShowDialogClass::~ImageShowDialogClass()
{}
void ImageShowDialogClass::on_action_cursor_enable_trigged()
{
this->desCursor = new ImageShowCursorDesClass();
QObject::connect(this->desCursor, SIGNAL(windowsClose()), this, SLOT(on_action_descursor_close_trigged()));
this->desCursorflag = true;
for (size_t i = 0; i < this->getGraphCount(); i++) {
if (this->getGraphClass(i) == LAMPDATASHOWCLASS::LAMPColorMap) {
this->HlineCursorflag = true;
this->VlineCursorflag = true;
}
}
//下面的代码就是设置游标的外观
this->setMouseTracking(true);
tracer->setInterpolating(false);//禁用插值
tracer->setPen(QPen(Qt::DashLine));//虚线游标
tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
tracer->setBrush(Qt::red);//游标颜色
if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
this->HlineCursor = new ImageShowCursorLineClass();
this->VlineCursor = new ImageShowCursorLineClass();
QObject::connect(this->HlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_Hlinecursor_close_trigged()));
QObject::connect(this->VlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_VVlinecursor_close_trigged()));
QObject::connect(this->ui.m_plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
QObject::connect(this->ui.m_plot->yAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
this->HlineCursor->show();
this->VlineCursor->show();
}
this->desCursor->show();
}
//
//void ImageShowDialogClass::on_action_cursor_enable_trigged()
//{
// this->desCursor = new ImageShowCursorDesClass();
//
//
// QObject::connect(this->desCursor, SIGNAL(windowsClose()), this, SLOT(on_action_descursor_close_trigged()));
//
//
// this->desCursorflag = true;
// for (size_t i = 0; i < this->getGraphCount(); i++) {
// if (this->getGraphClass(i) == LAMPDATASHOWCLASS::LAMPColorMap) {
// this->HlineCursorflag = true;
// this->VlineCursorflag = true;
// }
// }
//
// //下面的代码就是设置游标的外观
// this->setMouseTracking(true);
// tracer->setInterpolating(false);//禁用插值
// tracer->setPen(QPen(Qt::DashLine));//虚线游标
// tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
// tracer->setBrush(Qt::red);//游标颜色
//
// if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
// this->HlineCursor = new ImageShowCursorLineClass();
// this->VlineCursor = new ImageShowCursorLineClass();
// QObject::connect(this->HlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_Hlinecursor_close_trigged()));
// QObject::connect(this->VlineCursor, SIGNAL(windowsClose()), this, SLOT(on_action_VVlinecursor_close_trigged()));
// QObject::connect(this->ui->m_plot->xAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
// QObject::connect(this->ui->m_plot->yAxis, SIGNAL(rangeChanged(QCPRange)), this->HlineCursor, SLOT(xAxisRangeChanged(QCPRange)));
// this->HlineCursor->show();
// this->VlineCursor->show();
// }
// this->desCursor->show();
//}
//
//
void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QString name)
{
@ -81,7 +81,7 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QStrin
int nx = data.rows(); // 行数
int ny = data.cols(); // 列数
// 创建 Color Map
QCPColorMap* colorMap = new QCPColorMap(ui.m_plot->xAxis, ui.m_plot->yAxis);
QCPColorMap* colorMap = new QCPColorMap(ui->m_plot->xAxis, ui->m_plot->yAxis);
colorMap->data()->setSize(nx, ny); // 设置 Color Map 的大小
colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // 设置坐标轴的范围
@ -95,8 +95,8 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QStrin
colorMap->setGradient(QCPColorGradient::gpJet);
colorMap->rescaleDataRange(true);
ui.m_plot->rescaleAxes();
ui.m_plot->replot();
ui->m_plot->rescaleAxes();
ui->m_plot->replot();
}
@ -105,9 +105,9 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd X, Eigen::Ma
int nx = data.cols(); // 行数
int ny = data.rows(); // 列数
// 创建 Color Map
ui.m_plot->xAxis->setRange(X(0, 0), X(0, nx - 1));
ui.m_plot->yAxis->setRange(Y(0, 0), Y(ny - 1, 0));
QCPColorMap* colorMap = new QCPColorMap(ui.m_plot->xAxis, ui.m_plot->yAxis);
ui->m_plot->xAxis->setRange(X(0, 0), X(0, nx - 1));
ui->m_plot->yAxis->setRange(Y(0, 0), Y(ny - 1, 0));
QCPColorMap* colorMap = new QCPColorMap(ui->m_plot->xAxis, ui->m_plot->yAxis);
colorMap->data()->setSize(ny, nx); // 设置 Color Map 的大小
colorMap->data()->setRange(QCPRange(X(0,0), X(0,nx-1)), QCPRange(Y(0,0),Y(ny-1,0))); // 设置坐标轴的范围
// 填充数据
@ -120,8 +120,8 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd X, Eigen::Ma
colorMap->setGradient(QCPColorGradient::gpJet);
colorMap->rescaleDataRange(true);
ui.m_plot->rescaleAxes();
ui.m_plot->replot();
ui->m_plot->rescaleAxes();
ui->m_plot->replot();
}
void ImageShowDialogClass::remove_Data(QString name)
@ -143,7 +143,7 @@ LAMPDATASHOWCLASS ImageShowDialogClass::getGraphClass(size_t i)
{
return LAMPDATASHOWCLASS::NOWINDOWS;
}
QCPAbstractPlottable* plottable = this->ui.m_plot->plottable(i);
QCPAbstractPlottable* plottable = this->ui->m_plot->plottable(i);
if (dynamic_cast<QCPGraph*>(plottable)) {
return LAMPDATASHOWCLASS::LAMPGraph;
}
@ -158,25 +158,25 @@ LAMPDATASHOWCLASS ImageShowDialogClass::getGraphClass(size_t i)
}
}
size_t ImageShowDialogClass::getGraphCount()
{
return this->m_plot->graphCount();
}
void ImageShowDialogClass::on_action_descursor_close_trigged()
{
this->desCursorflag = false;
}
void ImageShowDialogClass::on_action_Hlinecursor_close_trigged()
{
this->HlineCursorflag = false;
}
void ImageShowDialogClass::on_action_VVlinecursor_close_trigged()
{
this->VlineCursorflag = false;
}
//size_t ImageShowDialogClass::getGraphCount()
//{
// return this->m_plot->graphCount();
//}
//
//void ImageShowDialogClass::on_action_descursor_close_trigged()
//{
// this->desCursorflag = false;
//}
//
//void ImageShowDialogClass::on_action_Hlinecursor_close_trigged()
//{
// this->HlineCursorflag = false;
//}
//
//void ImageShowDialogClass::on_action_VVlinecursor_close_trigged()
//{
// this->VlineCursorflag = false;
//}
void ImageShowDialogClass::updateCursor(QMouseEvent *event)
{
@ -197,7 +197,7 @@ void ImageShowDialogClass::updateCursor(QMouseEvent *event)
if (this->desCursorflag) {
if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
QCPColorMap* colorMap = dynamic_cast<QCPColorMap*>(this->ui.m_plot->plottable(0));
QCPColorMap* colorMap = dynamic_cast<QCPColorMap*>(this->ui->m_plot->plottable(0));
double dataValue = colorMap->data()->data(x, y);
this->desCursor->updateCursorContent(u8"X: " + QString::number(x, 'f', 6) + " y: " + QString::number(y, 'f', 6) +u8"\n" +u8"DataValue: "+QString::number(dataValue));
}

View File

@ -1,10 +1,13 @@
#pragma once
#ifndef IMAGESHOWDIALOGCLASS_H
#define IMAGESHOWDIALOGCLASS_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include <QDialog>
#include "TaskXml/TaskTreeClass.h"
#include "ui_ImageShowDialogClass.h"
#include "TaskTreeClass.h"
//===========================
// 定义需要绘制的图像的类型
@ -16,7 +19,9 @@ enum LAMPDATASHOWCLASS {
NOWINDOWS
};
namespace Ui{
class ImageShowDialogClass;
}
@ -26,7 +31,7 @@ enum LAMPDATASHOWCLASS {
// 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息
// 2. 区域性描述游标,通过线,等用来展示某一个区域的信息
//===========================
class ImageShowCursorDesClass : public QDialog
class ImageShowCursorDesClass : public QDialog
{
Q_OBJECT
public:
@ -46,7 +51,7 @@ protected:
};
class ImageShowCursorLineClass :public QDialog {
class ImageShowCursorLineClass :public QDialog {
Q_OBJECT
public:
QMenuBar* menubar;
@ -92,7 +97,7 @@ protected:
// 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息
// 2. 区域性描述游标,通过线,等用来展示某一个区域的信息
//===========================
class ImageShowDialogClass : public QDialog
class ImageShowDialogClass : public QDialog
{
Q_OBJECT
private:
@ -124,15 +129,15 @@ public:
LAMPDATASHOWCLASS getGraphClass(size_t i = 0);
size_t getGraphCount();
private:
Ui::ImageShowDialogClass ui;
Ui::ImageShowDialogClass* ui;
public slots:
void updateCursor(QMouseEvent* event);
public slots: // cursor
void on_action_cursor_enable_trigged();
void on_action_descursor_close_trigged();
void on_action_Hlinecursor_close_trigged();
void on_action_VVlinecursor_close_trigged();
// void on_action_cursor_enable_trigged();
// void on_action_descursor_close_trigged();
// void on_action_Hlinecursor_close_trigged();
// void on_action_VVlinecursor_close_trigged();
};

View File

@ -1,16 +1,18 @@
#include "LAMPDataShowClass.h"
#include "ui_LAMPDataShowClass.h"
LAMPDataShowClass::LAMPDataShowClass(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
ui=new Ui::LAMPDataShowClassClass;
ui->setupUi(this);
// 添加菜单项
QMenu* FileOpenMenu = this->ui.menuFile->addMenu(u8"打开");
QMenu* FileOpenMenu = this->ui->menuFile->addMenu(u8"打开");
QAction* action_openfile_tiff = FileOpenMenu->addAction(u8"tiff文件"); // 添加菜单项
QObject::connect(action_openfile_tiff, SIGNAL(triggered()), this, SLOT(on_action_openfile_tiff_triggered()));
QMenu* ComplexFileOpenMenu = this->ui.menuFile->addMenu(u8"打开复数数据");
QMenu* ComplexFileOpenMenu = this->ui->menuFile->addMenu(u8"打开复数数据");
QAction* action_openfile_tiff_complex = ComplexFileOpenMenu->addAction(u8"tiff文件"); // 添加菜单项
QObject::connect(action_openfile_tiff_complex, SIGNAL(triggered()), this, SLOT(on_action_openfile_tiff_complex_triggered()));
QAction* action_openfile_envi_complex = ComplexFileOpenMenu->addAction(u8"envi文件"); // 添加菜单项
@ -18,19 +20,18 @@ LAMPDataShowClass::LAMPDataShowClass(QWidget *parent)
this->setContextMenuPolicy(Qt::CustomContextMenu);
this->ui.listWidgetContent->setContextMenuPolicy(Qt::CustomContextMenu);
this->ui->listWidgetContent->setContextMenuPolicy(Qt::CustomContextMenu);
}
LAMPDataShowClass::~LAMPDataShowClass()
{}
void LAMPDataShowClass::add_DataTree(TaskNode* node) {
QListWidgetItem* itemtemp = new QListWidgetItem(this->ui.listWidgetContent);
QListWidgetItem* itemtemp = new QListWidgetItem(this->ui->listWidgetContent);
itemtemp->setSizeHint(node->sizeHint());
this->ui.listWidgetContent->setItemWidget(itemtemp, node);
this->ui.listWidgetContent->addItem(itemtemp);
this->ui->listWidgetContent->setItemWidget(itemtemp, node);
this->ui->listWidgetContent->addItem(itemtemp);
}
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix) {
@ -95,6 +96,7 @@ void LAMPDataShowClass::on_action_openfile_envi_complex_triggered()
void LAMPDataShowClass::load_complex_data(QString path)
{
DebugInfo("LAMPDataShowClass::load_complex_data");
ComplexDataShowNode* node = new ComplexDataShowNode();
node->bangdindWindows(this);
node->TaskXmlPath = path;

View File

@ -2,16 +2,18 @@
#ifndef LAMPDATASHOWClASS_H
#define LAMPDATASHOWClASS_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include <QMainWindow>
#include "ui_LAMPDataShowClass.h"
#include "TaskXml/TaskTreeClass.h"
#include "TaskTreeClass.h"
#include "TaskNodeList.h"
#include "ImageShowDialogClass.h"
class LAMPDataShowClass : public QMainWindow
namespace Ui{
class LAMPDataShowClassClass;
}
class LAMPDataShowClass : public QMainWindow
{
Q_OBJECT
@ -34,14 +36,14 @@ public slots: // 菜单action 槽函数
public:
void load_complex_data(QString path);
private:
Ui::LAMPDataShowClassClass ui;
Ui::LAMPDataShowClassClass* ui;
};
///////////////////////////////////////////////////////
// 基础函数
///////////////////////////////////////////////////////
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix);
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix);

View File

@ -0,0 +1,197 @@
#include "LAMPImageCreateClass.h"
#include "ui_LAMPImageCreateClass.h"
LAMPImageCreateClass::LAMPImageCreateClass(QWidget *parent)
: QDialog(parent)
{
ui=new Ui::LAMPImageCreateClassClass;
ui->setupUi(this);
this->simulationparams =new FEKOBase::FEKOSimulationDataparams;// std::make_shared<FEKOBase::FEKOSimulationDataparams>();
this->ui->comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::Strip));
this->ui->comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::Scane));
this->ui->comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::ISAR));
this->ui->comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::CircleSAR));
// 限制lineedit输入为数值
QDoubleValidator* doubleValidator = new QDoubleValidator();
this->ui->lineEdit_minX->setValidator(doubleValidator);
this->ui->lineEdit__maxX->setValidator(doubleValidator);
this->ui->lineEdit__minY->setValidator(doubleValidator);
this->ui->lineEdit__maxY->setValidator(doubleValidator);
this->ui->lineEdit_planeZ->setValidator(doubleValidator);
QIntValidator* intValidator = new QIntValidator(1,100000000000000);
this->ui->lineEdit_height->setValidator(intValidator);
this->ui->lineEdit_width->setValidator(intValidator);
this->ui->lineEdit_minX->setText("-1.0");
this->ui->lineEdit__maxX->setText("1.0");
this->ui->lineEdit__minY->setText("-1.0");
this->ui->lineEdit__maxY->setText("1.0");
this->ui->lineEdit_planeZ->setText("0");
this->ui->lineEdit_height->setText("101");
this->ui->lineEdit_width->setText("101");
this->ui->checkBoxTheta->setChecked(true);
this->ui->checkBox_phi->setChecked(true);
}
LAMPImageCreateClass::~LAMPImageCreateClass()
{}
Q_INVOKABLE FEKOBase::FEKOImageSettingParams LAMPImageCreateClass::getFEKOImageSettingParams()
{
FEKOBase::FEKOImageSettingParams result;
result.min_x = this->ui->lineEdit_minX->text().toDouble();
result.max_x = this->ui->lineEdit__maxX->text().toDouble();
result.min_y = this->ui->lineEdit__minY->text().toDouble();
result.max_y = this->ui->lineEdit__maxY->text().toDouble();
result.plane_z = this->ui->lineEdit_planeZ->text().toDouble();
result.ImageHeight = this->ui->lineEdit_height->text().toDouble();
result.ImageWidth = this->ui->lineEdit_width->text().toDouble();
return Q_INVOKABLE result;
}
void LAMPImageCreateClass::on_pushButton_theta_clicked()
{
QString thetaechopath = getOpenFilePath(this, u8"打开theta回波文件", u8"theta Files (*.theta)");
this->ui->lineEdit_thetaechopath->setText(thetaechopath);
}
void LAMPImageCreateClass::on_pushButton_phi_clicked()
{
QString phiechopath = getOpenFilePath(this, u8"打开phi回波文件", u8"theta Files (*.phi)");
this->ui->lineEdit_phiechopath->setText(phiechopath);
}
void LAMPImageCreateClass::on_pushButton_thetaimage_clicked()
{
QString thetaimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)");
this->ui->lineEdit_thetaimagepath->setText(thetaimagePath);
}
void LAMPImageCreateClass::on_pushButton_phiImage_clicked()
{
QString phiimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)");
this->ui->lineEdit_phiimagepath->setText(phiimagePath);
}
void LAMPImageCreateClass::on_checkBoxTheta_toggled(bool flag)
{
this->ui->pushButton_theta->setEnabled(this->ui->checkBoxTheta->isChecked());
this->ui->pushButton_thetaimage->setEnabled(this->ui->checkBoxTheta->isChecked());
this->ui->lineEdit_thetaechopath->setEnabled(this->ui->checkBoxTheta->isChecked());
this->ui->lineEdit_thetaimagepath->setEnabled(this->ui->checkBoxTheta->isChecked());
}
void LAMPImageCreateClass::on_checkBox_phi_toggled(bool flag)
{
this->ui->pushButton_phi->setEnabled(this->ui->checkBox_phi->isChecked());
this->ui->pushButton_phiImage->setEnabled(this->ui->checkBox_phi->isChecked());
this->ui->lineEdit_phiechopath->setEnabled(this->ui->checkBox_phi->isChecked());
this->ui->lineEdit_phiimagepath->setEnabled(this->ui->checkBox_phi->isChecked());
}
void LAMPImageCreateClass::on_pushButton_OK_clicked()
{
FEKOBase::FEKOImageSettingParams imageparams = this->getFEKOImageSettingParams();
// 计算回波
if (this->ui->checkBoxTheta->isChecked()) { // theta
QString thetafileptah= this->ui->lineEdit_thetaechopath->text().trimmed();
QString theta_tiff_filepath=this->ui->lineEdit_thetaimagepath->text().trimmed();
FEKOBase::EchoDataClass data;
data.loadEchoData(thetafileptah);
if (this->simulationparams&&(this->simulationparams->imagemode==FEKOBase::FEKOImageMode::Strip|| this->simulationparams->imagemode == FEKOBase::FEKOImageMode::Scane)) {
FEKOBase::FEKOImageProcess(data, imageparams, theta_tiff_filepath,FEKOBase::FEKOImageAlgorithm::TBP_FREQ,FEKOBase::ImageAlgWindowFun::HANMMING);
}
else {
FEKOBase::FEKOImageProcess(data, imageparams, theta_tiff_filepath);
}
}
else {
}
if (this->ui->checkBox_phi->isChecked()) { // phi
QString phifileptah = this->ui->lineEdit_phiechopath->text().trimmed();
QString phi_tiff_filepath = this->ui->lineEdit_phiimagepath->text().trimmed();
FEKOBase::EchoDataClass data;
data.loadEchoData(phifileptah);
//FEKOBase::FEKOImageProcess(data, imageparams, phi_tiff_filepath);
if (this->simulationparams && (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::Strip || this->simulationparams->imagemode == FEKOBase::FEKOImageMode::Scane)) {
FEKOBase::FEKOImageProcess(data, imageparams, phi_tiff_filepath, FEKOBase::FEKOImageAlgorithm::TBP_FREQ, FEKOBase::ImageAlgWindowFun::HANMMING);
}
else {
FEKOBase::FEKOImageProcess(data, imageparams, phi_tiff_filepath);
}
}
else {
}
QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否查看图像", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) {
LAMPDataShowClass* datashow=new LAMPDataShowClass();
datashow->show();
if (this->ui->checkBoxTheta->isChecked()) { // theta
QString theta_tiff_filepath = this->ui->lineEdit_thetaimagepath->text().trimmed();
datashow->load_complex_data(theta_tiff_filepath);
}
if (this->ui->checkBox_phi->isChecked()) { // phi
QString phi_tiff_filepath = this->ui->lineEdit_phiimagepath->text().trimmed();
datashow->load_complex_data(phi_tiff_filepath);
}
}
else {
return;
}
}
void LAMPImageCreateClass::on_pushButton_cancel_clicked()
{
this->close();
}
void LAMPImageCreateClass::on_pushButton_loadfekosimulationxml_clicked()
{
QString xmlpath = getOpenFilePath(this, u8"仿真任务xml", u8"xml文件 (*.xml)");
if (isExists(xmlpath)) {
this->OpenFEKOSimulationImageSettingXml(xmlpath);
}
else {
}
}
void LAMPImageCreateClass::OpenFEKOSimulationImageSettingXml(QString& xmlpath)
{
this->simulationparams->loadXml(xmlpath);
this->ui->lineEdit_TaskName->setText(this->simulationparams->taskName);
this->ui->comboBox_ImageMode->setCurrentText(FEKOBase::FEKOImageModeenumToString(this->simulationparams->imagemode));
this->ui->lineEdit_minX->setText(QString::number(this->simulationparams->x_min));
this->ui->lineEdit__maxX->setText(QString::number(this->simulationparams->x_max));
this->ui->lineEdit__minY->setText(QString::number(this->simulationparams->y_min));
this->ui->lineEdit__maxY->setText(QString::number(this->simulationparams->y_max));
this->ui->lineEdit_planeZ->setText(QString::number(this->simulationparams->z_plane));
this->ui->lineEdit_height->setText(QString::number(this->simulationparams->imageheight));
this->ui->lineEdit_width->setText(QString::number(this->simulationparams->imagewidth));
}
void LAMPImageCreateClass::bandingsetFEKOSimulationDataparams()
{
}

View File

@ -1,12 +1,17 @@
#pragma once
#ifndef LAMPIMAGECREATECLASS_H
#define LAMPIMAGECREATECLASS_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include <QDialog>
#include "ui_LAMPImageCreateClass.h"
#include "LAMPDataShowClass.h"
class LAMPImageCreateClass : public QDialog,public FEKOBase::FEKOSimulationDataparamsHandler
namespace Ui{
class LAMPImageCreateClassClass;
}
class LAMPImageCreateClass : public QDialog,public FEKOBase::FEKOSimulationDataparamsHandler
{
Q_OBJECT
@ -15,7 +20,7 @@ public:
~LAMPImageCreateClass();
private:
Ui::LAMPImageCreateClassClass ui;
Ui::LAMPImageCreateClassClass* ui;
public:
Q_INVOKABLE FEKOBase::FEKOImageSettingParams getFEKOImageSettingParams();

View File

@ -14,11 +14,11 @@
#include <fileapi.h>
#include <tchar.h>
#include <stdio.h>
#include "ui_LAMPTool.h"
LAMPTool::LAMPTool(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
ui->setupUi(this);
}
LAMPTool::~LAMPTool()

View File

@ -5,17 +5,22 @@
#define LAMPTOOL_H
#include <QtWidgets/QMainWindow>
#include "ui_LAMPTool.h"
#include "LAMPToolAPI.h"
class LAMPTOOLAPI LAMPTool : public QMainWindow
#include "WBFZExchangePluginAPI.h"
namespace Ui{
class LAMPToolClass;
}
class LAMPTool : public QMainWindow
{
Q_OBJECT
// Q_OBJECT
public:
LAMPTool(QWidget *parent = nullptr);
~LAMPTool();
private:
Ui::LAMPToolClass ui;
Ui::LAMPToolClass* ui;
};
#endif

View File

@ -1,53 +1,106 @@
#include "AllHead.h"
#include "LAMP_ScatterSettingClass.h"
#include "ui_LAMP_ScatterSettingClass.h"
LAMP_ScatterSettingClass::LAMP_ScatterSettingClass(QWidget* parent)
: QDialog(parent)
{
ui.setupUi(this);
this->_mainWindows=nullptr;
_geoData=nullptr;
_geoData = Geometry::GeometryData::getInstance();
DebugInfo(" Geometry::GeometryData::getInstance() \n");
ui=new Ui::LAMP_ScatterSettingClassClass;
ui->setupUi(this);
this->setWindowTitle(u8"散射仪器仿真设置界面");
this->settingobj = new LAMP_ScatterSettingXmlClass;
this->myContext = nullptr;
DebugInfo(" Geometry::GeometryData::getInstance() \n");
//this->myContext = nullptr;
QDoubleValidator* doubleValidator = new QDoubleValidator;
this->ui.lineEdit_A1_incAngle->setValidator(doubleValidator);
this->ui.lineEdit_A2_incAngle->setValidator(doubleValidator);
this->ui.checkBox_A1->setChecked(true);
this->ui.checkBox_A2->setChecked(true);
this->ui->lineEdit_A1_incAngle->setValidator(doubleValidator);
this->ui->lineEdit_A2_incAngle->setValidator(doubleValidator);
this->ui->lineEdit_startFreq->setValidator(doubleValidator);
this->ui->lineEdit_endfreq->setValidator(doubleValidator);
this->ui->lineEdit_freqPoints->setValidator(new QIntValidator);
this->ui.radioButton_nearfield->setVisible(false);
this->ui.radioButton_nearfield->setChecked(false);
this->ui.radioButton_nearfield->setEnabled(false);
this->ui->checkBox_A1->setChecked(true);
this->ui->checkBox_A2->setChecked(true);
this->ui.radioButton_farfield->setCheckable(true);
this->ui->radioButton_nearfield->setVisible(false);
this->ui->radioButton_nearfield->setChecked(false);
this->ui->radioButton_nearfield->setEnabled(false);
this->ui.radioButton_S1 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S3 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S5 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S8 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S10 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S12 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F1 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F2 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F3 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F4 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F5 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F6 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F7 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F8 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F9 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F10 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F11 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F12 ->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui->radioButton_farfield->setCheckable(true);
this->ui->radioButton_S1 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S3 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S5 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S8 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S10 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S12 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F1 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F2 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F3 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F4 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F5 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F6 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F7 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F8 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F9 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F10 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F11 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F12 ->setEnabled(this->ui->checkBox_AllScatter->isChecked());
connect(this->ui->radioButton_S1, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S1_toggled(bool)));
connect(this->ui->radioButton_S3, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S3_toggled(bool)));
connect(this->ui->radioButton_S5, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S5_toggled(bool)));
connect(this->ui->radioButton_S8, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S8_toggled(bool)));
connect(this->ui->radioButton_S10, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S10_toggled(bool)));
connect(this->ui->radioButton_S12, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_S12_toggled(bool)));
connect(this->ui->radioButton_F1, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F1_toggled(bool)));
connect(this->ui->radioButton_F2, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F2_toggled(bool)));
connect(this->ui->radioButton_F3, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F3_toggled(bool)));
connect(this->ui->radioButton_F4, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F4_toggled(bool)));
connect(this->ui->radioButton_F5, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F5_toggled(bool)));
connect(this->ui->radioButton_F6, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F6_toggled(bool)));
connect(this->ui->radioButton_F7, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F7_toggled(bool)));
connect(this->ui->radioButton_F8, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F8_toggled(bool)));
connect(this->ui->radioButton_F9, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F9_toggled(bool)));
connect(this->ui->radioButton_F10, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F10_toggled(bool)));
connect(this->ui->radioButton_F11, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F11_toggled(bool)));
connect(this->ui->radioButton_F12, SIGNAL(toggled(bool)), this,
SLOT(on_radioButton_F12_toggled(bool)));
DebugInfo(" Geometry::GeometryData::getInstance() \n");
}
LAMP_ScatterSettingClass::~LAMP_ScatterSettingClass()
{}
{
delete this->ui;
this->ui=nullptr;
}
void LAMP_ScatterSettingClass::loadxml(QString xmlpath)
{
this->ui.lineEdit_xmlpath->setText(xmlpath);
this->ui->lineEdit_xmlpath->setText(xmlpath);
this->xmlpath = xmlpath;
this->workpsace = getParantFromPath(xmlpath);
this->settingobj->loadxml(xmlpath);
@ -74,59 +127,59 @@ void LAMP_ScatterSettingClass::savexml()
void LAMP_ScatterSettingClass::renderSettingObj()
{
this->ui.checkBox_A1->setChecked(this->settingobj->A1);
this->ui.checkBox_A2->setChecked(this->settingobj->A2);
this->ui.lineEdit_A1_incAngle->setText(QString::number(this->settingobj->incidence_A1));
this->ui.lineEdit_A2_incAngle->setText(QString::number(this->settingobj->incidence_A2));
this->ui->checkBox_A1->setChecked(this->settingobj->A1);
this->ui->checkBox_A2->setChecked(this->settingobj->A2);
this->ui->lineEdit_A1_incAngle->setText(QString::number(this->settingobj->incidence_A1));
this->ui->lineEdit_A2_incAngle->setText(QString::number(this->settingobj->incidence_A2));
this->ui.checkBox_AllScatter->setChecked(this->settingobj->enableScatter);
this->ui.radioButton_S1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F2->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F4->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F6->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F7->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F9->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F11->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui->checkBox_AllScatter->setChecked(this->settingobj->enableScatter);
this->ui->radioButton_S1->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S3->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S5->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S8->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S10->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S12->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F1->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F2->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F3->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F4->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F5->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F6->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F7->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F8->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F9->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F10->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F11->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F12->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui.radioButton_S1->setChecked(this->settingobj->S1);
this->ui.radioButton_S3->setChecked(this->settingobj->S3);
this->ui.radioButton_S5->setChecked(this->settingobj->S5);
this->ui.radioButton_S8->setChecked(this->settingobj->S8);
this->ui.radioButton_S10->setChecked(this->settingobj->S10);
this->ui.radioButton_S12->setChecked(this->settingobj->S12);
this->ui.radioButton_F1->setChecked(this->settingobj->F1);
this->ui.radioButton_F2->setChecked(this->settingobj->F2);
this->ui.radioButton_F3->setChecked(this->settingobj->F3);
this->ui.radioButton_F4->setChecked(this->settingobj->F4);
this->ui.radioButton_F5->setChecked(this->settingobj->F5);
this->ui.radioButton_F6->setChecked(this->settingobj->F6);
this->ui.radioButton_F7->setChecked(this->settingobj->F7);
this->ui.radioButton_F8->setChecked(this->settingobj->F8);
this->ui.radioButton_F9->setChecked(this->settingobj->F9);
this->ui.radioButton_F10->setChecked(this->settingobj->F10);
this->ui.radioButton_F11->setChecked(this->settingobj->F11);
this->ui.radioButton_F12->setChecked(this->settingobj->F12);
this->ui->radioButton_S1->setChecked(this->settingobj->S1);
this->ui->radioButton_S3->setChecked(this->settingobj->S3);
this->ui->radioButton_S5->setChecked(this->settingobj->S5);
this->ui->radioButton_S8->setChecked(this->settingobj->S8);
this->ui->radioButton_S10->setChecked(this->settingobj->S10);
this->ui->radioButton_S12->setChecked(this->settingobj->S12);
this->ui->radioButton_F1->setChecked(this->settingobj->F1);
this->ui->radioButton_F2->setChecked(this->settingobj->F2);
this->ui->radioButton_F3->setChecked(this->settingobj->F3);
this->ui->radioButton_F4->setChecked(this->settingobj->F4);
this->ui->radioButton_F5->setChecked(this->settingobj->F5);
this->ui->radioButton_F6->setChecked(this->settingobj->F6);
this->ui->radioButton_F7->setChecked(this->settingobj->F7);
this->ui->radioButton_F8->setChecked(this->settingobj->F8);
this->ui->radioButton_F9->setChecked(this->settingobj->F9);
this->ui->radioButton_F10->setChecked(this->settingobj->F10);
this->ui->radioButton_F11->setChecked(this->settingobj->F11);
this->ui->radioButton_F12->setChecked(this->settingobj->F12);
this->ui.lineEdit_startFreq->setText(QString::number(this->settingobj->startfre));
this->ui.lineEdit_endfreq->setText(QString::number(this->settingobj->endfre));
this->ui.lineEdit_freqPoints->setText(QString::number(this->settingobj->freponts));
this->ui.radioButton_farfield->setChecked(this->settingobj->farfield);
this->ui.radioButton_nearfield->setChecked(this->settingobj->nearfield);
this->ui.lineEdit_TaskName->setText(this->settingobj->taskName);
this->ui.lineEdit_xmlpath->setText(this->xmlpath);
this->ui->lineEdit_startFreq->setText(QString::number(this->settingobj->startfre));
this->ui->lineEdit_endfreq->setText(QString::number(this->settingobj->endfre));
this->ui->lineEdit_freqPoints->setText(QString::number(this->settingobj->freponts));
this->ui->radioButton_farfield->setChecked(this->settingobj->farfield);
this->ui->radioButton_nearfield->setChecked(this->settingobj->nearfield);
this->ui->lineEdit_TaskName->setText(this->settingobj->taskName);
this->ui->lineEdit_xmlpath->setText(this->xmlpath);
}
@ -134,38 +187,38 @@ void LAMP_ScatterSettingClass::renderSettingObj()
void LAMP_ScatterSettingClass::sycnSettingObj()
{
//renderSettingObj 函数的关系,使用界面控件值,更新 settingobj 的值
this->settingobj->A1 = this->ui.checkBox_A1->isChecked();
this->settingobj->A2 = this->ui.checkBox_A2->isChecked();
this->settingobj->incidence_A1 = this->ui.lineEdit_A1_incAngle->text().toDouble();
this->settingobj->incidence_A2 = this->ui.lineEdit_A2_incAngle->text().toDouble();
this->settingobj->A1 = this->ui->checkBox_A1->isChecked();
this->settingobj->A2 = this->ui->checkBox_A2->isChecked();
this->settingobj->incidence_A1 = this->ui->lineEdit_A1_incAngle->text().toDouble();
this->settingobj->incidence_A2 = this->ui->lineEdit_A2_incAngle->text().toDouble();
this->settingobj->enableScatter = this->ui.checkBox_AllScatter->isChecked();
this->settingobj->S1 = this->ui.radioButton_S1->isChecked();
this->settingobj->S3 = this->ui.radioButton_S3->isChecked();
this->settingobj->S5 = this->ui.radioButton_S5->isChecked();
this->settingobj->S8 = this->ui.radioButton_S8->isChecked();
this->settingobj->S10 = this->ui.radioButton_S10->isChecked();
this->settingobj->S12 = this->ui.radioButton_S12->isChecked();
this->settingobj->F1 = this->ui.radioButton_F1->isChecked();
this->settingobj->F2 = this->ui.radioButton_F2->isChecked();
this->settingobj->F3 = this->ui.radioButton_F3->isChecked();
this->settingobj->F4 = this->ui.radioButton_F4->isChecked();
this->settingobj->F5 = this->ui.radioButton_F5->isChecked();
this->settingobj->F6 = this->ui.radioButton_F6->isChecked();
this->settingobj->F7 = this->ui.radioButton_F7->isChecked();
this->settingobj->F8 = this->ui.radioButton_F8->isChecked();
this->settingobj->F9 = this->ui.radioButton_F9->isChecked();
this->settingobj->F10 = this->ui.radioButton_F10->isChecked();
this->settingobj->F11 = this->ui.radioButton_F11->isChecked();
this->settingobj->F12 = this->ui.radioButton_F12->isChecked();
this->settingobj->enableScatter = this->ui->checkBox_AllScatter->isChecked();
this->settingobj->S1 = this->ui->radioButton_S1->isChecked();
this->settingobj->S3 = this->ui->radioButton_S3->isChecked();
this->settingobj->S5 = this->ui->radioButton_S5->isChecked();
this->settingobj->S8 = this->ui->radioButton_S8->isChecked();
this->settingobj->S10 = this->ui->radioButton_S10->isChecked();
this->settingobj->S12 = this->ui->radioButton_S12->isChecked();
this->settingobj->F1 = this->ui->radioButton_F1->isChecked();
this->settingobj->F2 = this->ui->radioButton_F2->isChecked();
this->settingobj->F3 = this->ui->radioButton_F3->isChecked();
this->settingobj->F4 = this->ui->radioButton_F4->isChecked();
this->settingobj->F5 = this->ui->radioButton_F5->isChecked();
this->settingobj->F6 = this->ui->radioButton_F6->isChecked();
this->settingobj->F7 = this->ui->radioButton_F7->isChecked();
this->settingobj->F8 = this->ui->radioButton_F8->isChecked();
this->settingobj->F9 = this->ui->radioButton_F9->isChecked();
this->settingobj->F10 = this->ui->radioButton_F10->isChecked();
this->settingobj->F11 = this->ui->radioButton_F11->isChecked();
this->settingobj->F12 = this->ui->radioButton_F12->isChecked();
this->settingobj->startfre = this->ui.lineEdit_startFreq->text().toDouble();
this->settingobj->endfre = this->ui.lineEdit_endfreq->text().toDouble();
this->settingobj->freponts = this->ui.lineEdit_freqPoints->text().toDouble();
this->settingobj->farfield = this->ui.radioButton_farfield->isChecked();
this->settingobj->nearfield = this->ui.radioButton_nearfield->isChecked();
this->settingobj->startfre = this->ui->lineEdit_startFreq->text().toDouble();
this->settingobj->endfre = this->ui->lineEdit_endfreq->text().toDouble();
this->settingobj->freponts = this->ui->lineEdit_freqPoints->text().toInt();
this->settingobj->farfield = this->ui->radioButton_farfield->isChecked();
this->settingobj->nearfield = this->ui->radioButton_nearfield->isChecked();
this->settingobj->taskName = this->ui.lineEdit_TaskName->text();
this->settingobj->taskName = this->ui->lineEdit_TaskName->text();
@ -182,10 +235,14 @@ void LAMP_ScatterSettingClass::createAntModel()
sp.theta = sp.theta * M_PI / 180;
CartesianCoordinates cp = sphericalToCartesian(sp);
TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
TopoDS_Shape *shape = new TopoDS_Shape;
*shape= Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
//Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
Geometry::GeometrySet *set = new Geometry::GeometrySet(Geometry::STEP);
set->setName(QString::fromStdString(k));
set->setShape(shape);
DataAISMap[k] = shape_ais;
DataAISMap[k] = set;
}
}
@ -297,21 +354,21 @@ void LAMP_ScatterSettingClass::initAntModelSettingParams()
void LAMP_ScatterSettingClass::closeWindows()
{
for (map<std::string, Handle(AIS_InteractiveObject)>::iterator iter = DataAISMap.begin(); iter != DataAISMap.end(); ++iter) {
this->myContext->Erase(iter->second, Standard_True);
this->myContext->Remove(iter->second, Standard_True);
for (map<std::string, Geometry::GeometrySet* >::iterator iter = DataAISMap.begin(); iter != DataAISMap.end(); ++iter) {
AddOrRemoveScatterAntModel(_mainWindows,_geoData,iter->second,false);
// this->myContext->Erase(iter->second);
// this->myContext->Remove(iter->second);
}
this->close();
}
void LAMP_ScatterSettingClass::setDocument3d(Handle(AIS_InteractiveContext) myContext)
void LAMP_ScatterSettingClass::setDocument3d(GUI::MainWindow* myContext)
{
this->myContext = myContext;
this->_mainWindows = myContext;
this->initAntModelSettingParams();
this->createAntModel();
this->myContext->Display(DataAISMap["A1"],Standard_True);
this->myContext->Display(DataAISMap["A2"], Standard_True);
_geoData->appendGeometrySet(DataAISMap["A1"]);
_geoData->appendGeometrySet(DataAISMap["A2"]);
}
@ -1572,7 +1629,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
void LAMP_ScatterSettingClass::setTaskName(QString name)
{
this->ui.lineEdit_TaskName->setText(name);
this->ui->lineEdit_TaskName->setText(name);
this->settingobj->taskName = name;
}
@ -1580,203 +1637,236 @@ void LAMP_ScatterSettingClass::setWorkSpacePath(QString path)
{
this->workpsace = getParantFromPath(path);
this->xmlpath = path;
this->ui.lineEdit_xmlpath->setText(this->xmlpath);
this->ui->lineEdit_xmlpath->setText(this->xmlpath);
}
void LAMP_ScatterSettingClass::on_radioButton_S1_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S1", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_S3_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S3", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_S5_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S5", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_S8_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S8", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_S10_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S10", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_S12_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("S12", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F1_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F1", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F2_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F2", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F3_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F3", flag); this->switchAntShowAndHide("F1", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F4_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F4", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F5_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F5", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F6_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F6", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F7_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F7", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F8_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F8", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F9_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F9", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F10_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F10", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F11_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F11", flag);
}
void LAMP_ScatterSettingClass::on_radioButton_F12_toggled(bool flag)
{
if (this->myContext.IsNull()) {}
else { return; }
if (this->_geoData==nullptr) {return; }
else { }
this->switchAntShowAndHide("F12", flag);
}
void LAMP_ScatterSettingClass::on_checkBox_A1_toggled(bool flag)
{
this->ui.lineEdit_A1_incAngle->setEnabled(this->ui.checkBox_A1->isChecked());
this->switchAntShowAndHide("A1", this->ui.checkBox_A1->isChecked());
if (this->myContext.IsNull()) {}
else { return; }
this->ui->lineEdit_A1_incAngle->setEnabled(this->ui->checkBox_A1->isChecked());
this->switchAntShowAndHide("A1", this->ui->checkBox_A1->isChecked());
if (this->_geoData==nullptr) {return; }
else { }
}
void LAMP_ScatterSettingClass::on_checkBox_A2_toggled(bool flag)
{
this->ui.lineEdit_A2_incAngle->setEnabled(this->ui.checkBox_A2->isChecked());
this->switchAntShowAndHide("A2", this->ui.checkBox_A2->isChecked());
if (this->myContext.IsNull()) {}
else { return; }
this->ui->lineEdit_A2_incAngle->setEnabled(this->ui->checkBox_A2->isChecked());
this->switchAntShowAndHide("A2", this->ui->checkBox_A2->isChecked());
if (this->_geoData==nullptr) {return; }
else { }
}
void LAMP_ScatterSettingClass::on_checkBox_AllScatter_toggled(bool flag)
{
this->ui.radioButton_S1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_S12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F1->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F2->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F3->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F4->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F5->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F6->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F7->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F8->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F9->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F10->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F11->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui.radioButton_F12->setEnabled(this->ui.checkBox_AllScatter->isChecked());
this->ui->radioButton_S1->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S3->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S5->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S8->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S10->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_S12->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F1->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F2->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F3->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F4->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F5->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F6->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F7->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F8->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F9->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F10->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F11->setEnabled(this->ui->checkBox_AllScatter->isChecked());
this->ui->radioButton_F12->setEnabled(this->ui->checkBox_AllScatter->isChecked());
}
void LAMP_ScatterSettingClass::on_lineEdit_A1_incAngle_editingFinished()
{
DebugInfo("_mainWindows %d ; DataAISMap[\"A1\"] %d \n",_mainWindows== nullptr,DataAISMap["A1"] ==nullptr);
if(_mainWindows== nullptr){return;}
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap["A1"],false);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
//emit _mainWindows->getSubWindowManager()->getPreWindow()->removeGemoActors(DataAISMap["A1"]);
// 根据坐标计算
this->myContext->Erase(DataAISMap["A1"], Standard_True);
AntSettingdict["A1"].theta = this->ui.lineEdit_A1_incAngle->text().toDouble();
// this->myContext->Erase(DataAISMap["A1"]);
AntSettingdict["A1"].theta = this->ui->lineEdit_A1_incAngle->text().toDouble();
SphericalCoordinates sp = AntSettingdict["A1"];
sp.phi = sp.phi * M_PI / 180;
sp.theta = sp.theta * M_PI / 180;
CartesianCoordinates cp = sphericalToCartesian(sp);
TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
DataAISMap["A1"] = shape_ais;
this->myContext->Display(DataAISMap["A1"],Standard_True);
TopoDS_Shape* shape=new TopoDS_Shape;
*shape=shape_ant;
Geometry::GeometrySet *set = new Geometry::GeometrySet(Geometry::STEP);
set->setName("A1");
set->setShape(shape);
DataAISMap["A1"] = set;
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap["A1"],true);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
//emit _mainWindows->getSubWindowManager()->getPreWindow()->showGeoSet(DataAISMap["A1"], true);
DebugInfo("_mainWindows %d ; DataAISMap[\"A1\"] %d \n",_mainWindows== nullptr,DataAISMap["A1"] ==nullptr);
}
void LAMP_ScatterSettingClass::on_lineEdit_A2_incAngle_editingFinished()
{
DebugInfo("_mainWindows %d ; DataAISMap[\"A2\"] %d \n",_mainWindows== nullptr,DataAISMap["A2"] ==nullptr);
if(_mainWindows== nullptr){return;}
// 根据坐标计算
this->myContext->Erase(DataAISMap["A2"], Standard_True);
AntSettingdict["A2"].theta = this->ui.lineEdit_A2_incAngle->text().toDouble();
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap["A2"],false);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
//emit _mainWindows->getSubWindowManager()->getPreWindow()->removeGemoActors(DataAISMap["A2"]);
AntSettingdict["A2"].theta = this->ui->lineEdit_A2_incAngle->text().toDouble();
SphericalCoordinates sp = AntSettingdict["A2"];
sp.phi = sp.phi * M_PI / 180;
sp.theta = sp.theta * M_PI / 180;
CartesianCoordinates cp = sphericalToCartesian(sp);
TopoDS_Shape shape_ax = CreateCartesianCoordinatesAxis(0.2, 0.4, 0.8);
TopoDS_Shape shape_ant = Process_RotationThetaPhi_MoveXYZ(shape_ax, M_PI - sp.theta, sp.phi + M_PI, cp.x, cp.y, cp.z);
Handle(AIS_InteractiveObject) shape_ais = new AIS_Shape(shape_ant);
DataAISMap["A2"] = shape_ais;
this->myContext->Display(DataAISMap["A2"], Standard_True);
TopoDS_Shape* shape=new TopoDS_Shape;
*shape=shape_ant;
Geometry::GeometrySet *set = new Geometry::GeometrySet(Geometry::STEP);
set->setName("A2");
set->setShape(shape);
DataAISMap["A2"] = set;
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap["A2"],true);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
//emit _mainWindows->getSubWindowManager()->getPreWindow()->showGeoSet(DataAISMap["A2"], true);
DebugInfo("_mainWindows %d ; DataAISMap[\"A2\"] %d \n",_mainWindows== nullptr,DataAISMap["A2"] ==nullptr);
}
void LAMP_ScatterSettingClass::on_pushButton_load_clicked()
{
@ -1815,12 +1905,23 @@ void LAMP_ScatterSettingClass::on_cancelButton_clicked()
}
void LAMP_ScatterSettingClass::switchAntShowAndHide(std::string antName, bool flag) {
DebugInfo("emit antName %s %d;",antName.c_str(),flag);
if(_mainWindows==nullptr){
return;
}
if (flag) {
this->myContext->Display(DataAISMap[antName], Standard_True);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap[antName],flag);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
//emit _mainWindows->getSubWindowManager()->getPreWindow()->showGeoSet(DataAISMap[antName], true);
}
else {
this->myContext->Erase(DataAISMap[antName], Standard_True);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
AddOrRemoveScatterAntModel(_mainWindows,_geoData,DataAISMap[antName],flag);
DebugInfo("emit _mainWindows->updateGeometryTreeSig();");
}
DebugInfo("emit antName %s %d;",antName.c_str(),flag);
}
SphericalCoordinates LAMP_ScatterSettingClass::antsettingstring2Spherical(QString sphericalStr)
@ -1834,6 +1935,48 @@ SphericalCoordinates LAMP_ScatterSettingClass::antsettingstring2Spherical(QStrin
return p;
}
void LAMP_ScatterSettingClass::on_lineEdit_freqPoints_editingFinished() {
double startfreq=this->ui->lineEdit_startFreq->text().toDouble();
double endfreq=this->ui->lineEdit_endfreq->text().toDouble();
double pointcount=this->ui->lineEdit_freqPoints->text().toInt();
if(pointcount<=0){
return;
}else if(pointcount==1){
this->ui->lineEdit_freqdelta->setText(0);
}else{
double delta=(endfreq-startfreq)/(pointcount-1);
this->ui->lineEdit_freqdelta->setText(QString::number(delta*1000));
}
}
void LAMP_ScatterSettingClass::on_lineEdit_startFreq_editingFinished() {
double startfreq=this->ui->lineEdit_startFreq->text().toDouble();
double endfreq=this->ui->lineEdit_endfreq->text().toDouble();
double pointcount=this->ui->lineEdit_freqPoints->text().toInt();
if(pointcount<=0){
return;
}else if(pointcount==1){
this->ui->lineEdit_freqdelta->setText(0);
}else{
double delta=(endfreq-startfreq)/(pointcount-1);
this->ui->lineEdit_freqdelta->setText(QString::number(delta*1000));
}
}
void LAMP_ScatterSettingClass::on_lineEdit_endfreq_editingFinished() {
double startfreq=this->ui->lineEdit_startFreq->text().toDouble();
double endfreq=this->ui->lineEdit_endfreq->text().toDouble();
double pointcount=this->ui->lineEdit_freqPoints->text().toInt();
if(pointcount<=0){
return;
}else if(pointcount==1){
this->ui->lineEdit_freqdelta->setText(0);
}else{
double delta=(endfreq-startfreq)/(pointcount-1);
this->ui->lineEdit_freqdelta->setText(QString::number(delta*1000));
}
}
LAMP_ScatterSettingXmlClass::LAMP_ScatterSettingXmlClass()
{
// 对成员变量进行初始化

View File

@ -2,10 +2,21 @@
#ifndef LAMP_SCATTERSETTINGCLASS_H
#define LAMP_SCATTERSETTINGCLASS_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include <QDialog>
#include "ui_LAMP_ScatterSettingClass.h"
#include "MainWindow/MainWindow.h"
namespace Ui{
class LAMP_ScatterSettingClassClass;
}
class LAMP_ScatterSettingXmlClass {
public:
@ -47,7 +58,13 @@ public:
};
class LAMP_ScatterSettingClass : public QDialog
class LAMP_ScatterSettingClass : public QDialog
{
Q_OBJECT
@ -56,12 +73,14 @@ public:
~LAMP_ScatterSettingClass();
public:
Handle(AIS_InteractiveContext) myContext; // 窗口交互 // 模型管理
GUI::MainWindow* _mainWindows;
Geometry::GeometryData * _geoData;
//Handle(AIS_InteractiveContext) myContext; // 窗口交互 // 模型管理
QString xmlpath;
QString workpsace;
LAMP_ScatterSettingXmlClass* settingobj;
//QMap<QString, Handle(AIS_InteractiveObject)> DataAISMap;
std::map<std::string, Handle(AIS_InteractiveObject)> DataAISMap; // 构建雷达照射模型
std::map<std::string, Geometry::GeometrySet *> DataAISMap; // 构建雷达照射模型
std::map<std::string, SphericalCoordinates> AntSettingdict; // 构建雷达照射模型
std::map<std::string, QString> AntffePathDict;
public:
@ -72,7 +91,7 @@ public:
void createAntModel();
void initAntModelSettingParams(); // 模型设置参数
void closeWindows();
void setDocument3d(Handle(AIS_InteractiveContext) myContext);
void setDocument3d(GUI::MainWindow* m );
void createFEKOLua();
void setTaskName(QString name);
void setWorkSpacePath(QString path);
@ -108,6 +127,10 @@ public slots:
void on_okButton_clicked();
void on_cancelButton_clicked();
void on_lineEdit_freqPoints_editingFinished();
void on_lineEdit_startFreq_editingFinished();
void on_lineEdit_endfreq_editingFinished();
void switchAntShowAndHide(std::string antName,bool isShow);
@ -115,7 +138,7 @@ private:
SphericalCoordinates antsettingstring2Spherical(QString sphericalStr);
private:
Ui::LAMP_ScatterSettingClassClass ui;
Ui::LAMP_ScatterSettingClassClass* ui;
};

View File

@ -8,7 +8,7 @@
// ===================================================================
OCCTShapeType LAMPTOOLAPI str2OCCTShapeType(QString str)
OCCTShapeType str2OCCTShapeType(QString str)
{
if (str.isEmpty()) {
return OCCTShapeType::NoneType;
@ -28,7 +28,7 @@ OCCTShapeType LAMPTOOLAPI str2OCCTShapeType(QString str)
return OCCTShapeType();
}
QStringList LAMPTOOLAPI getOCCTShapeTypeEmnu()
QStringList getOCCTShapeTypeEmnu()
{
QStringList list;
list.push_back(QString(u8"STL"));
@ -38,27 +38,27 @@ QStringList LAMPTOOLAPI getOCCTShapeTypeEmnu()
return list;
}
QString LAMPTOOLAPI getOCCTShapeTypeFilterString()
QString getOCCTShapeTypeFilterString()
{
return QString(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)");
}
QString LAMPTOOLAPI get_STL_FilterString()
QString get_STL_FilterString()
{
return QString(u8"STL Files (*.stl);;STL Files (*.stla)");
}
QString LAMPTOOLAPI get_STEP_FilterString()
QString get_STEP_FilterString()
{
return QString(u8"step Files (*.stp);;step Files (*.step)");
}
QString LAMPTOOLAPI get_IGES_FilterString()
QString get_IGES_FilterString()
{
return QString(u8"IGES Files (*.iges);;IGES Files (*.igs)");
}
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
QString getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
{
switch (switch_on)
{
@ -71,26 +71,26 @@ QString LAMPTOOLAPI getOCCTShapeTypeFilterString(OCCTShapeType switch_on)
}
}
QString LAMPTOOLAPI getOCCTShapeTypeFilterString(QString str)
QString getOCCTShapeTypeFilterString(QString str)
{
return getOCCTShapeTypeFilterString(str2OCCTShapeType(str));
}
bool LAMPTOOLAPI SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) {
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) {
// 将形状保存为 STL 文件
qDebug() << u8"SaveTopoDs_Stl " << FilePath;
StlAPI_Writer writer;
writer.Write(shape, FilePath.toStdString().c_str()); // 保存为stl模型
return true;
}
bool LAMPTOOLAPI SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) {
bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) {
qDebug() << u8"SaveTopoDs_Step " << FilePath;
STEPControl_Writer writer;
writer.Transfer(shape, STEPControl_AsIs);
writer.Write(FilePath.toStdString().c_str());
return true;
}
bool LAMPTOOLAPI SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
bool SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
qDebug() << u8"SaveTopoDs_IGES " << FilePath;
IGESControl_Writer writer;
writer.AddShape(shape);
@ -98,7 +98,7 @@ bool LAMPTOOLAPI SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape) {
return true;
}
bool LAMPTOOLAPI SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType shapetype)
bool SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType shapetype)
{
switch (shapetype)
{
@ -125,20 +125,20 @@ bool LAMPTOOLAPI SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OC
return true;
}
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_IGES(QString Filepath) {
TopoDS_Shape ReadTopoDs_IGES(QString Filepath) {
IGESControl_Reader reader;
reader.ReadFile(Filepath.toStdString().c_str());
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
return shape;
}
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Stl(QString Filepath) {
TopoDS_Shape ReadTopoDs_Stl(QString Filepath) {
TopoDS_Shape shape_TopoDs;
StlAPI_Reader aReader_Stl;
aReader_Stl.Read(shape_TopoDs, Filepath.toStdString().c_str());
return shape_TopoDs;
}
TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Step(QString Filepath) {
TopoDS_Shape ReadTopoDs_Step(QString Filepath) {
TopoDS_Shape shape;
STEPControl_Reader reader;
IFSelect_ReturnStatus status = reader.ReadFile(Filepath.toStdString().c_str());
@ -152,7 +152,7 @@ TopoDS_Shape LAMPTOOLAPI ReadTopoDs_Step(QString Filepath) {
}
}
OCCTShapeType LAMPTOOLAPI ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
OCCTShapeType ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
{
QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName();
@ -182,7 +182,7 @@ OCCTShapeType LAMPTOOLAPI ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shap
}
}
TopoDS_Shape LAMPTOOLAPI MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
{
// 创建一个复合体
TopoDS_Compound compound;
@ -199,7 +199,7 @@ TopoDS_Shape LAMPTOOLAPI MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shape
}
void LAMPTOOLAPI ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
{
// 将颜色应用到模型
@ -208,7 +208,7 @@ void LAMPTOOLAPI ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color&
TopoDS_Shape LAMPTOOLAPI CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius) {
TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius) {
// 创建一个圆柱作为箭头的主体
gp_Pnt origin(0, 0, 0);
gp_Ax2 axis(origin, direction);
@ -230,7 +230,7 @@ TopoDS_Shape LAMPTOOLAPI CreateArrow(const gp_Dir& direction, Standard_Real len
}
gp_Trsf LAMPTOOLAPI GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec& vectorB)
gp_Trsf GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec& vectorB)
{
// 计算旋转轴和旋转角度
gp_Vec rotationAxis = vectorA.Crossed(vectorB);
@ -250,7 +250,7 @@ gp_Trsf LAMPTOOLAPI GetTransFormFromVector(const gp_Vec& vectorA, const gp_Vec&
}
TopoDS_Shape LAMPTOOLAPI Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi, double X, double Y, double Z)
TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi, double X, double Y, double Z)
{
gp_Vec Position(gp_Pnt(0, 0, 0), gp_Pnt(X, Y, Z));
gp_Trsf rotationTransform_theta;
@ -270,7 +270,7 @@ TopoDS_Shape LAMPTOOLAPI Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, d
return result;
}
TopoDS_Shape LAMPTOOLAPI CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength)
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength)
{
// 创建三个方向的箭头
@ -296,21 +296,21 @@ TopoDS_Shape LAMPTOOLAPI CreateCartesianCoordinatesAxis(double xlength, double
return compound;
}
TopoDS_Shape LAMPTOOLAPI CreateBox(double x, double y, double z)
TopoDS_Shape CreateBox(double x, double y, double z)
{
// 创建一个长方体
BRepPrimAPI_MakeBox box(gp_Pnt(-x / 2, -y / 2, -z / 2), gp_Pnt(x / 2, y / 2, z / 2));
return box.Shape();
}
TopoDS_Shape LAMPTOOLAPI CreateCylinder(double radius, double height)
TopoDS_Shape CreateCylinder(double radius, double height)
{
BRepPrimAPI_MakeCylinder makeCylinder(radius, height);
TopoDS_Shape cylinderShape = makeCylinder.Shape();
return cylinderShape;
}
TopoDS_Shape LAMPTOOLAPI CreateCone(double radius1, double radius2, double height)
TopoDS_Shape CreateCone(double radius1, double radius2, double height)
{
BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(radius1, radius2, height);
TopoDS_Shape coneShape = mkCone.Shape();
@ -318,29 +318,29 @@ TopoDS_Shape LAMPTOOLAPI CreateCone(double radius1, double radius2, double heig
return coneShape;
}
TopoDS_Shape LAMPTOOLAPI CreateSphere(double radius)
TopoDS_Shape CreateSphere(double radius)
{
return TopoDS_Shape();
}
TopoDS_Shape LAMPTOOLAPI CreateTorus(double majorRadius, double minorRadius)
TopoDS_Shape CreateTorus(double majorRadius, double minorRadius)
{
return TopoDS_Shape();
}
TopoDS_Shape LAMPTOOLAPI Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
{
return TopoDS_Shape();
}
TopoDS_Shape LAMPTOOLAPI Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
TopoDS_Shape Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
{
return TopoDS_Shape();
}
TopoDS_Shape LAMPTOOLAPI Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
TopoDS_Shape Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
{
// 进行旋转
angle= angle * M_PI / 180;
@ -350,7 +350,7 @@ TopoDS_Shape LAMPTOOLAPI Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle)
return rotateTransform_X.Shape();
}
TopoDS_Shape LAMPTOOLAPI Translate(TopoDS_Shape& shape, gp_Vec move_vec)
TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec)
{
gp_Trsf translation;
translation.SetTranslation(move_vec);
@ -358,7 +358,7 @@ TopoDS_Shape LAMPTOOLAPI Translate(TopoDS_Shape& shape, gp_Vec move_vec)
return translateTransform.Shape();
}
TopoDS_Shape LAMPTOOLAPI Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale)
TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale)
{
gp_Trsf scaleTransform;
scaleTransform.SetScale(refrenceCenter, scale);
@ -366,7 +366,7 @@ TopoDS_Shape LAMPTOOLAPI Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, doub
return scaleTransformBuilder.Shape();
}
TopoDS_Shape LAMPTOOLAPI createConicalHorn(double bottomRadius, double bottomHeight, double topRadius, double topHeight)
TopoDS_Shape createConicalHorn(double bottomRadius, double bottomHeight, double topRadius, double topHeight)
{
BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(bottomRadius,topRadius,topHeight);
@ -394,7 +394,7 @@ TopoDS_Shape LAMPTOOLAPI createConicalHorn(double bottomRadius, double bottomHe
return compound;
}
TopoDS_Shape LAMPTOOLAPI createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl)
TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl)
{
@ -402,7 +402,7 @@ TopoDS_Shape LAMPTOOLAPI createPyramidalHorn(double bottomWidth, double bottomH
return TopoDS_Shape();
}
TopoDS_Shape LAMPTOOLAPI CreateWedge(double x, double y, double z)
TopoDS_Shape CreateWedge(double x, double y, double z)
{

View File

@ -0,0 +1,97 @@
#pragma once
#ifndef OCCTBASELAMP_H
#define OCCTBASELAMP_H
#include "WBFZExchangePluginAPI.h"
#include "referenceHeader.h"
//====================
// 系统支持的模型导出类型
//=====================
enum OCCTShapeType
{
STL,
STEP,
IGES,
NoneType,
};
OCCTShapeType str2OCCTShapeType(QString str);
QStringList getOCCTShapeTypeEmnu();
QString getOCCTShapeTypeFilterString();
QString get_STL_FilterString();
QString get_STEP_FilterString();
QString get_IGES_FilterString();
QString getOCCTShapeTypeFilterString(OCCTShapeType t);
QString getOCCTShapeTypeFilterString(QString str);
// 常用静态函数
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape);
bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape);
bool SaveTopoDs_IGES(QString FilePath,const TopoDS_Shape& shape);
bool SaveTopoDs(QString FilePath,const TopoDS_Shape& shape, OCCTShapeType type);
TopoDS_Shape ReadTopoDs_IGES(QString Filepath);
TopoDS_Shape ReadTopoDs_Stl(QString Filepath);
TopoDS_Shape ReadTopoDs_Step(QString Filepath);
OCCTShapeType ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs);
// 模型合并
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist);
// 修改模型显示
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor);
//// 创建箭头
TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius);
//
// OCCT 根据向量A和B,计算变换矩阵
gp_Trsf GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B);
TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta, double phi,double X,double Y,double Z);
//TopoDS_Shape Createpyramid(double width=10.0,double depth=5.0, double mouthWidth=1.0, double mouthHeight=0.5, double height = 15.0);
// 创建一个笛卡尔坐标系
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength);
// 常见模型创建
TopoDS_Shape CreateBox(double x, double y, double z);
TopoDS_Shape CreateCylinder(double radius, double height);
TopoDS_Shape CreateCone(double radius_bottom, double radius_top, double height);
TopoDS_Shape CreateSphere(double radius);
TopoDS_Shape CreateTorus(double majorRadius, double minorRadius);
// 常见模型操作
TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
// 常见操作 -- 模型旋转、平移、缩放
TopoDS_Shape Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle);
TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec);
TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale);
// 创建散射体雷达
// 创建一个坐标原点为圆心的
TopoDS_Shape createConicalHorn(double bottomRadius,double bottomHeight,double topRadius,double topHeight);
TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl);
#endif // OCCTBASELAMP_H

View File

@ -2,69 +2,69 @@
#include <BRepBuilderAPI_Transform.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include "ui_OCCTModelOperator.h"
OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext)
: QDialog(parent)
{
ui.setupUi(this);
ui->setupUi(this);
setWindowFlags(Qt::Window);
setWindowTitle(TopoName);
// 参数初设
this->ui.radioButton_NoCopy->setChecked(true);
this->ui.radioButton_Time->setChecked(true);
this->ui->radioButton_NoCopy->setChecked(true);
this->ui->radioButton_Time->setChecked(true);
this->myContext = myContext;
this->ModelName = TopoName;
// 处理平移
QDoubleValidator* validator = new QDoubleValidator(); // 限制参数
ui.lineEdit_Move_From_X->setValidator(validator);
ui.lineEdit_Move_From_Z->setValidator(validator);
ui.lineEdit_Move_From_Y->setValidator(validator);
ui.lineEdit_Move_To_X->setValidator(validator);
ui.lineEdit_Move_To_Y->setValidator(validator);
ui.lineEdit_Move_To_Z->setValidator(validator);
ui.lineEdit_Rotation_Center_X->setValidator(validator);
ui.lineEdit_Rotation_Center_Y->setValidator(validator);
ui.lineEdit_Rotation_Center_Z->setValidator(validator);
ui.lineEdit_Rotation_Axis_X->setValidator(validator);
ui.lineEdit_Rotation_Axis_Y->setValidator(validator);
ui.lineEdit_Rotation_Axis_Z->setValidator(validator);
ui->lineEdit_Move_From_X->setValidator(validator);
ui->lineEdit_Move_From_Z->setValidator(validator);
ui->lineEdit_Move_From_Y->setValidator(validator);
ui->lineEdit_Move_To_X->setValidator(validator);
ui->lineEdit_Move_To_Y->setValidator(validator);
ui->lineEdit_Move_To_Z->setValidator(validator);
ui->lineEdit_Rotation_Center_X->setValidator(validator);
ui->lineEdit_Rotation_Center_Y->setValidator(validator);
ui->lineEdit_Rotation_Center_Z->setValidator(validator);
ui->lineEdit_Rotation_Axis_X->setValidator(validator);
ui->lineEdit_Rotation_Axis_Y->setValidator(validator);
ui->lineEdit_Rotation_Axis_Z->setValidator(validator);
ui.lineEdit_Scale_refrence_point_X->setValidator(validator);
ui.lineEdit_Scale_refrence_point_Y->setValidator(validator);
ui.lineEdit_Scale_refrence_point_Z->setValidator(validator);
ui->lineEdit_Scale_refrence_point_X->setValidator(validator);
ui->lineEdit_Scale_refrence_point_Y->setValidator(validator);
ui->lineEdit_Scale_refrence_point_Z->setValidator(validator);
QDoubleValidator* validatorScale = new QDoubleValidator();
validatorScale->setBottom(0.0);
ui.lineEdit_ScaleValue->setValidator(validatorScale);
ui->lineEdit_ScaleValue->setValidator(validatorScale);
// 初始化
ui.lineEdit_Move_From_X->setText(u8"0.0");
ui.lineEdit_Move_From_Z->setText(u8"0.0");
ui.lineEdit_Move_From_Y->setText(u8"0.0");
ui.lineEdit_Move_To_X->setText(u8"0.0");
ui.lineEdit_Move_To_Y->setText(u8"0.0");
ui.lineEdit_Move_To_Z->setText(u8"0.0");
ui.lineEdit_Rotation_Center_X->setText(u8"0.0");
ui.lineEdit_Rotation_Center_Y->setText(u8"0.0");
ui.lineEdit_Rotation_Center_Z->setText(u8"0.0");
ui.lineEdit_Rotation_Axis_X->setText(u8"0.0");
ui.lineEdit_Rotation_Axis_Y->setText(u8"0.0");
ui.lineEdit_Rotation_Axis_Z->setText(u8"0.0");
ui.lineEdit_ScaleValue->setText(u8"1.0");
ui.lineEdit_Scale_refrence_point_X->setText(u8"0.0");
ui.lineEdit_Scale_refrence_point_Y->setText(u8"0.0");
ui.lineEdit_Scale_refrence_point_Z->setText(u8"0.0");
ui->lineEdit_Move_From_X->setText(u8"0.0");
ui->lineEdit_Move_From_Z->setText(u8"0.0");
ui->lineEdit_Move_From_Y->setText(u8"0.0");
ui->lineEdit_Move_To_X->setText(u8"0.0");
ui->lineEdit_Move_To_Y->setText(u8"0.0");
ui->lineEdit_Move_To_Z->setText(u8"0.0");
ui->lineEdit_Rotation_Center_X->setText(u8"0.0");
ui->lineEdit_Rotation_Center_Y->setText(u8"0.0");
ui->lineEdit_Rotation_Center_Z->setText(u8"0.0");
ui->lineEdit_Rotation_Axis_X->setText(u8"0.0");
ui->lineEdit_Rotation_Axis_Y->setText(u8"0.0");
ui->lineEdit_Rotation_Axis_Z->setText(u8"0.0");
ui->lineEdit_ScaleValue->setText(u8"1.0");
ui->lineEdit_Scale_refrence_point_X->setText(u8"0.0");
ui->lineEdit_Scale_refrence_point_Y->setText(u8"0.0");
ui->lineEdit_Scale_refrence_point_Z->setText(u8"0.0");
// 缩放中心参数化
ui.radioButton_Auto->setChecked(true);
ui->radioButton_Auto->setChecked(true);
// 参数初始化
this->UpdataVariable();
// 事件绑定
if (TopoName.isEmpty()) {
this->ui.radioButton_Copy->setChecked(true);
this->ui.radioButton_NoCopy->setEnabled(false);
this->ui->radioButton_Copy->setChecked(true);
this->ui->radioButton_NoCopy->setEnabled(false);
}
}
@ -135,7 +135,7 @@ Handle(AIS_InteractiveObject) OCCTModelOperator::getAISBAK()
void OCCTModelOperator::ExcuteOperator()
{
this->ProcesssModel();
if (this->ui.radioButton_Copy->isChecked()) { // 复制模型
if (this->ui->radioButton_Copy->isChecked()) { // 复制模型
emit this->ResultExportCopyAndCreateNew(this);
}
else {
@ -147,27 +147,27 @@ void OCCTModelOperator::ExcuteOperator()
void OCCTModelOperator::UpdataVariable()
{
this->Move_From_X = this->ui.lineEdit_Move_From_X->text().toDouble();
this->Move_From_Z = this->ui.lineEdit_Move_From_Z->text().toDouble();
this->Move_From_Y = this->ui.lineEdit_Move_From_Y->text().toDouble();
this->Move_To_X = this->ui.lineEdit_Move_To_X->text().toDouble();
this->Move_To_Y = this->ui.lineEdit_Move_To_Y->text().toDouble();
this->Move_To_Z = this->ui.lineEdit_Move_To_Z->text().toDouble();
this->Rotation_Center_X = this->ui.lineEdit_Rotation_Center_X->text().toDouble();
this->Rotation_Center_Y = this->ui.lineEdit_Rotation_Center_Y->text().toDouble();
this->Rotation_Center_Z = this->ui.lineEdit_Rotation_Center_Z->text().toDouble();
this->Rotation_angle_X = this->ui.lineEdit_Rotation_Axis_X->text().toDouble();
this->Rotation_angle_Y = this->ui.lineEdit_Rotation_Axis_Y->text().toDouble();
this->ScaleDouble = this->ui.lineEdit_ScaleValue->text().toDouble();
this->Move_From_X = this->ui->lineEdit_Move_From_X->text().toDouble();
this->Move_From_Z = this->ui->lineEdit_Move_From_Z->text().toDouble();
this->Move_From_Y = this->ui->lineEdit_Move_From_Y->text().toDouble();
this->Move_To_X = this->ui->lineEdit_Move_To_X->text().toDouble();
this->Move_To_Y = this->ui->lineEdit_Move_To_Y->text().toDouble();
this->Move_To_Z = this->ui->lineEdit_Move_To_Z->text().toDouble();
this->Rotation_Center_X = this->ui->lineEdit_Rotation_Center_X->text().toDouble();
this->Rotation_Center_Y = this->ui->lineEdit_Rotation_Center_Y->text().toDouble();
this->Rotation_Center_Z = this->ui->lineEdit_Rotation_Center_Z->text().toDouble();
this->Rotation_angle_X = this->ui->lineEdit_Rotation_Axis_X->text().toDouble();
this->Rotation_angle_Y = this->ui->lineEdit_Rotation_Axis_Y->text().toDouble();
this->ScaleDouble = this->ui->lineEdit_ScaleValue->text().toDouble();
this->ScaleRefrencePoint_X=this->ui.lineEdit_Scale_refrence_point_X->text().toDouble();
this->ScaleRefrencePoint_Y=this->ui.lineEdit_Scale_refrence_point_Y->text().toDouble();
this->ScaleRefrencePoint_Z=this->ui.lineEdit_Scale_refrence_point_Z->text().toDouble();
this->ScaleRefrencePoint_X=this->ui->lineEdit_Scale_refrence_point_X->text().toDouble();
this->ScaleRefrencePoint_Y=this->ui->lineEdit_Scale_refrence_point_Y->text().toDouble();
this->ScaleRefrencePoint_Z=this->ui->lineEdit_Scale_refrence_point_Z->text().toDouble();
}
void OCCTModelOperator::UpdateScaleRefrencepoint()
{
if (this->ui.radioButton_Auto->isChecked()) {
if (this->ui->radioButton_Auto->isChecked()) {
// 假设你有一个 TopoDS_Shape 对象,例如一个立方体
TopoDS_Shape myShape = this->DataShapeBAK; // 你需要将其替换为实际的形状对象
GProp_GProps volumeProperties;
@ -178,9 +178,9 @@ void OCCTModelOperator::UpdateScaleRefrencepoint()
//// 获取质心
gp_Pnt centerOfMass = volumeProperties.CentreOfMass();
this->ui.lineEdit_Scale_refrence_point_X->setText(QString("%1").arg(centerOfMass.X(), 0, 'e', 8));
this->ui.lineEdit_Scale_refrence_point_Y->setText(QString("%1").arg(centerOfMass.Y(), 0, 'e', 8));
this->ui.lineEdit_Scale_refrence_point_Z->setText(QString("%1").arg(centerOfMass.Z(), 0, 'e', 8));
this->ui->lineEdit_Scale_refrence_point_X->setText(QString("%1").arg(centerOfMass.X(), 0, 'e', 8));
this->ui->lineEdit_Scale_refrence_point_Y->setText(QString("%1").arg(centerOfMass.Y(), 0, 'e', 8));
this->ui->lineEdit_Scale_refrence_point_Z->setText(QString("%1").arg(centerOfMass.Z(), 0, 'e', 8));
}
}
@ -189,7 +189,7 @@ void OCCTModelOperator::PreViewOperator()
this->UpdataVariable();
this->toString();
if (this->ui.radioButton_Time->isChecked()) {
if (this->ui->radioButton_Time->isChecked()) {
this->ProcesssModel();
}
}
@ -389,9 +389,9 @@ void OCCTModelOperator::on_lineEdit_ScaleValue_returnPressed()
void OCCTModelOperator::on_radioButton_Auto_toggled(bool flag)
{
if (flag) {
this->ui.lineEdit_Scale_refrence_point_X->setEnabled(false);
this->ui.lineEdit_Scale_refrence_point_Y->setEnabled(false);
this->ui.lineEdit_Scale_refrence_point_Z->setEnabled(false);
this->ui->lineEdit_Scale_refrence_point_X->setEnabled(false);
this->ui->lineEdit_Scale_refrence_point_Y->setEnabled(false);
this->ui->lineEdit_Scale_refrence_point_Z->setEnabled(false);
this->UpdateScaleRefrencepoint();
}
}
@ -399,9 +399,9 @@ void OCCTModelOperator::on_radioButton_Auto_toggled(bool flag)
void OCCTModelOperator::on_radioButton_NoAuto_toggled(bool flag)
{
if (flag) {
this->ui.lineEdit_Scale_refrence_point_X->setEnabled(true);
this->ui.lineEdit_Scale_refrence_point_Y->setEnabled(true);
this->ui.lineEdit_Scale_refrence_point_Z->setEnabled(true);
this->ui->lineEdit_Scale_refrence_point_X->setEnabled(true);
this->ui->lineEdit_Scale_refrence_point_Y->setEnabled(true);
this->ui->lineEdit_Scale_refrence_point_Z->setEnabled(true);
this->UpdateScaleRefrencepoint();
}
}
@ -424,7 +424,7 @@ void OCCTModelOperator::on_pushButton_ok_clicked()
copyBuilder.Perform(this->Datashape);
this->DataShapeBAK = copyBuilder.Shape();
if (this->ui.radioButton_Copy->isChecked()) {
if (this->ui->radioButton_Copy->isChecked()) {
emit this->ResultExportCopyAndCreateNew(this);
}
else {
@ -451,7 +451,7 @@ void OCCTModelOperator::on_pushButton_apply_clicked()
copyBuilder.Perform(this->Datashape);
this->DataShapeBAK = copyBuilder.Shape();
if (this->ui.radioButton_Copy->isChecked()) {
if (this->ui->radioButton_Copy->isChecked()) {
emit this->ResultExportCopyAndCreateNew(this);
}
else {

View File

@ -11,10 +11,16 @@
#ifndef OCCT_MODEL_OPERATOR_H
#define OCCT_MODEL_OPERATOR_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include "ui_OCCTModelOperator.h"
#include "OCCTBaseOperaorClass.h"
class OCCTModelOperator : public QDialog
namespace Ui{
class OCCTModelOperatorClass;
}
class OCCTModelOperator : public QDialog
{
Q_OBJECT
@ -31,7 +37,7 @@ public:
Handle(AIS_InteractiveObject) getAISBAK();
private:
Ui::OCCTModelOperatorClass ui;
Ui::OCCTModelOperatorClass* ui;
public:
TopoDS_Shape Datashape; // 处理控制的模型

View File

@ -1,9 +1,9 @@
#ifndef OCCTOPOSHAPETREEVIEWER_H
#define OCCTOPOSHAPETREEVIEWER_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
class OCCTopoShapeTreeViewer : public QTreeWidget
class OCCTopoShapeTreeViewer : public QTreeWidget
{
Q_OBJECT

View File

@ -22,11 +22,11 @@
#ifndef DOCUMENT_COMMON_OVERVIEW_H
#define DOCUMENT_COMMON_OVERVIEW_H
#include "WBFZExchangePluginAPI.h"
#include "AllHead.h"
#include <qDebug>
#include "TaskXml/TaskTreeClass.h"
#include "TaskTreeClass.h"
#include "TaskNodeList.h"
@ -38,7 +38,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! Implements visualization of samples content
class DocumentCommon : public QTreeWidget
class DocumentCommon : public QTreeWidget
{
Q_OBJECT
public:

View File

@ -21,7 +21,7 @@
#ifndef GEOMWIDGET_H
#define GEOMWIDGET_H
#include "WBFZExchangePluginAPI.h"
#include "OCCViewer\View.h"
#include "OCCViewer\DocumentCommon.h"
@ -39,7 +39,7 @@
#include <QWidget>
#include <QObject>
//! Qt widget for organize 3D & 2D documents
class GeomWidget : public QWidget
class GeomWidget : public QWidget
{
Q_OBJECT
public:

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