更换编译器为vs2022

master
剑古敛锋 2024-03-18 09:05:42 +08:00
parent f0eb787bd8
commit fd6e20f752
325 changed files with 128760 additions and 6598 deletions

View File

@ -11,6 +11,9 @@ project(FastCAE
HOMEPAGE_URL "http://124.16.188.131:9699/web/server3/build/#/Guide/" HOMEPAGE_URL "http://124.16.188.131:9699/web/server3/build/#/Guide/"
) )
# vcpkg
set(CMAKE_TOOLCHAIN_FILE D:/vcpkg/scripts/buildsystems/vcpkg.cmake)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -133,6 +136,12 @@ list(APPEND QtNeededModules
OpenGL # Qwt OpenGL # Qwt
PrintSupport # QwtPolar PrintSupport # QwtPolar
DBus DBus
Qml
Sql
PrintSupport
QuickWidgets
DataVisualization
Charts
) )
if(FASTCAE_LINUX) if(FASTCAE_LINUX)
list(APPEND QtNeededModules XcbQpa) list(APPEND QtNeededModules XcbQpa)
@ -178,8 +187,14 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# boost
set(BOOST_ROOT "D:/vcpkg/installed/x64-windows")
set(BOOST_INCLUDE_DIRS "${BOOST_ROOT}/include")
set(BOOST_LIBRARY_DIRS "${BOOST_ROOT}/lib")
find_package(Boost REQUIRED)
# VTK # VTK
find_package(VTK REQUIRED) find_package(VTK 9.3 REQUIRED )
# OpenCASCADE # OpenCASCADE
find_package(OpenCASCADE REQUIRED) find_package(OpenCASCADE REQUIRED)
@ -205,6 +220,10 @@ find_package(Gmsh REQUIRED)
# Python # Python
find_package(Python REQUIRED) find_package(Python REQUIRED)
# PCL
find_package(PCL REQUIRED)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# pythoncmake # pythoncmake
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -216,6 +235,7 @@ find_package(Python REQUIRED)
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# cmaketarget # cmaketarget
#set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Predefined") #set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Predefined")

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 12.0.2, 2024-03-12T16:41:22. --> <!-- Written by QtCreator 12.0.2, 2024-03-15T20:26:48. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@ -108,7 +108,6 @@
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value> -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\WBFZCPP\source\build-FastCAE-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\WBFZCPP\source\build-FastCAE-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">

View File

@ -35,11 +35,11 @@ if(FASTCAE_VTK_ALREADY_INCLUDED)
endif() endif()
set(FASTCAE_VTK_ALREADY_INCLUDED 1) set(FASTCAE_VTK_ALREADY_INCLUDED 1)
set(VTK_DIRS "${CMAKE_SOURCE_DIR}/extlib/VTK") set(VTK_DIRS "C:/PCL/3rdParty/VTK")
set(VTK_VERSION_MAJOR 9) set(VTK_VERSION_MAJOR 9)
set(VTK_VERSION_MINOR 0) set(VTK_VERSION_MINOR 3)
set(VTK_VERSION_PATCH 1) set(VTK_VERSION_PATCH 0)
set(VTK_INCLUDE_DIRS "${VTK_DIRS}/include/vtk-${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}") set(VTK_INCLUDE_DIRS "${VTK_DIRS}/include/vtk-${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}")
set(VTK_LIBRARY_DIRS "${VTK_DIRS}/lib") set(VTK_LIBRARY_DIRS "${VTK_DIRS}/lib")

View File

@ -18,21 +18,30 @@ list(APPEND _libraries MainWindow ${PROJECT_NAME})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
file(RELATIVE_PATH _rel ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR} ${CMAKE_INSTALL_PREFIX}) file(RELATIVE_PATH _rel ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR} ${CMAKE_INSTALL_PREFIX})
if(_APPLE_) if(_APPLE_)
set(_rpath "@loader_path/${_rel}") #set(_rpath "@loader_path/${_rel}")
set(_rpath "@loader_path/")
else() else()
set(_rpath "\$ORIGIN:\$ORIGIN/${_rel}") #set(_rpath "\$ORIGIN:\$ORIGIN/${_rel}")
set(_rpath "\$ORIGIN:\$ORIGIN/")
endif() endif()
file(TO_NATIVE_PATH "${_rpath}/${INSTALL_LIBDIR}" _lib_rpath) file(TO_NATIVE_PATH "${_rpath}/${INSTALL_LIBDIR}" _lib_rpath)
# #
list(APPEND FastCAE_Runtimes_Libraries VTK::loguru VTK::gl2ps Qt5::DBus) list(APPEND FastCAE_Runtimes_Libraries
VTK::loguru VTK::gl2ps Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport
)
foreach(_library ${_libraries}) foreach(_library ${_libraries})
add_subdirectory(${_library}) add_subdirectory(${_library})
set_target_properties(${_library} set_target_properties(${_library}
PROPERTIES PROPERTIES
MACOSX_RPATH ON MACOSX_RPATH ON
@ -45,6 +54,7 @@ foreach(_library ${_libraries})
#DEBUG_POSTFIX "_d" #DEBUG_POSTFIX "_d"
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}
FOLDER Modules FOLDER Modules
VS_GLOBAL_VcpkgEnabled ON
) )
list(APPEND FastCAE_Runtimes_Libraries ${FastCAE_${_library}_Runtimes_Libraries}) list(APPEND FastCAE_Runtimes_Libraries ${FastCAE_${_library}_Runtimes_Libraries})
@ -88,4 +98,6 @@ install(IMPORTED_RUNTIME_ARTIFACTS
${FastCAE_Runtimes_Libraries} ${FastCAE_Runtimes_Libraries}
DESTINATION ${INSTALL_LIBDIR} DESTINATION ${INSTALL_LIBDIR}
COMPONENT lib COMPONENT lib
) )
message("================================")
message("${TARGET_FILE_DIR}:${PROJECT_NAME}>/plugins")

View File

@ -36,4 +36,4 @@ target_link_libraries(Common PRIVATE
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(FastCAE_Common_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) set(FastCAE_Common_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef BASECONSTVARIABLE_H #ifndef BASECONSTVARIABLE_H
#define BASECONSTVARIABLE_H #define BASECONSTVARIABLE_H
@ -23,10 +23,10 @@ const double pi = 3.14159265358979323846;
const double d2r = pi / 180; const double d2r = pi / 180;
const double r2d = 180 / pi; const double r2d = 180 / pi;
const double a = 6378137.0; //椭球长半轴 const double a = 6378137.0; //椭球长半轴
const double ae = 6378137.0; //椭球长半轴 const double ae = 6378137.0; //椭球长半轴
const double ee = 0.0818191910428;// 第一偏心率 const double ee = 0.0818191910428;// 第一偏心率
const double f_inverse = 298.257223563; //扁率倒数 const double f_inverse = 298.257223563; //扁率倒数
const double b = a - a / f_inverse; const double b = a - a / f_inverse;
const double eSquare = (a * a - b * b) / (a * a); const double eSquare = (a * a - b * b) / (a * a);
const double e = sqrt(eSquare); const double e = sqrt(eSquare);

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "BaseTool.h" #include "BaseTool.h"
/// ///
/// ///
@ -68,8 +68,8 @@ complex<double> Cubic_Convolution_interpolation(double u, double v, Eigen::Matri
if (img.rows() != 4 || img.cols() != 4) { if (img.rows() != 4 || img.cols() != 4) {
throw exception("the size of img's block is not right"); throw exception("the size of img's block is not right");
} }
// 斤拷锟斤拷模锟斤拷 // 斤拷锟斤拷模锟斤拷
Eigen::MatrixX<complex<double>> wrc(1, 4);// 使锟斤拷 complex<double> 斤拷锟斤拷要原斤拷为锟剿伙拷取值 Eigen::MatrixX<complex<double>> wrc(1, 4);// 使锟斤拷 complex<double> 斤拷锟斤拷要原斤拷为锟剿伙拷取值
Eigen::MatrixX<complex<double>> wcr(4, 1);// Eigen::MatrixX<complex<double>> wcr(4, 1);//
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
wrc(0, i) = Cubic_kernel_weight(u + 1 - i); // u+1,u,u-1,u-2 wrc(0, i) = Cubic_kernel_weight(u + 1 - i); // u+1,u,u-1,u-2
@ -124,8 +124,8 @@ double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpo
bool 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) //叉乘 if ((Q.x - Pi.x) * (Pj.y - Pi.y) == (Pj.x - Pi.x) * (Q.y - Pi.y) //叉乘
//保证Q点坐标在pi,pj之间 //保证Q点坐标在pi,pj之间
&& min(Pi.x, Pj.x) <= Q.x && Q.x <= max(Pi.x, Pj.x) && min(Pi.x, Pj.x) <= Q.x && Q.x <= max(Pi.x, Pj.x)
&& min(Pi.y, Pj.y) <= Q.y && Q.y <= max(Pi.y, Pj.y)) && min(Pi.y, Pj.y) <= Q.y && Q.y <= max(Pi.y, Pj.y))
return true; return true;
@ -159,7 +159,7 @@ Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d)
{ {
float w = k1 * k1 - 4.0 * k0 * k2; float w = k1 * k1 - 4.0 * k0 * k2;
if (w < 0.0) { if (w < 0.0) {
// 可能在边界上 // 可能在边界上
if (onSegment(a, b, p)) { if (onSegment(a, b, p)) {
Point_3d tt = b - a; Point_3d tt = b - a;
Point_3d ttpa = p - a; Point_3d ttpa = p - a;

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#pragma once #pragma once
#ifndef BASETOOL_H #ifndef BASETOOL_H
#define BASETOOL_H #define BASETOOL_H
/// ///
/// 基本类、基本函数 /// 基本类、基本函数
/// ///
//#define EIGEN_USE_MKL_ALL //#define EIGEN_USE_MKL_ALL
//#define EIGEN_VECTORIZE_SSE4_2 //#define EIGEN_VECTORIZE_SSE4_2
@ -18,7 +18,7 @@
#include <time.h> #include <time.h>
#include <string> #include <string>
#include <omp.h> #include <omp.h>
#include "referenceHeader.h" #include "../LAMPTool/referenceHeader.h"
#include <gdal.h> #include <gdal.h>
#include <gdal_priv.h> #include <gdal_priv.h>
#include <gdalwarper.h> #include <gdalwarper.h>
@ -32,7 +32,7 @@ using namespace std;
using namespace Eigen; using namespace Eigen;
///////////////////////////////////// 运行时间打印 ////////////////////////////////////////////////////////// ///////////////////////////////////// 运行时间打印 //////////////////////////////////////////////////////////
QString getCurrentTimeString(); QString getCurrentTimeString();
@ -42,18 +42,18 @@ std::vector<QString> splitString(const QString& str, char delimiter);
/////////////////////////////// 基本图像类 结束 ////////////////////////////////////////////////////////// /////////////////////////////// 基本图像类 结束 //////////////////////////////////////////////////////////
string Convert(float Num); string Convert(float Num);
QString JoinPath(const QString& path, const QString& filename); QString JoinPath(const QString& path, const QString& filename);
////////////////////////////// 坐标部分基本方法 ////////////////////////////////////////// ////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 坐标部分基本方法 ////////////////////////////////////////// ////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
////////////////////////////// 插值 //////////////////////////////////////////// ////////////////////////////// 插值 ////////////////////////////////////////////
complex<double> 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);
@ -68,21 +68,21 @@ Point_3d invBilinear(Point_3d p, Point_3d a, Point_3d b, Point_3d c, Point_3d d)
// //
// WGS84 到J2000 坐标系的变换 // WGS84 到J2000 坐标系的变换
// 参考网址https://blog.csdn.net/hit5067/article/details/116894616 // 参考网址https://blog.csdn.net/hit5067/article/details/116894616
// 资料网址http://celestrak.org/spacedata/ // 资料网址http://celestrak.org/spacedata/
// 参数文件: // 参数文件:
// a. Earth Orientation Parameter 文件: http://celestrak.org/spacedata/EOP-Last5Years.csv // a. Earth Orientation Parameter 文件: http://celestrak.org/spacedata/EOP-Last5Years.csv
// b. Space Weather Data 文件: http://celestrak.org/spacedata/SW-Last5Years.csv // b. Space Weather Data 文件: http://celestrak.org/spacedata/SW-Last5Years.csv
// 备注上述文件是自2017年-五年内 // 备注上述文件是自2017年-五年内
/** /**
wgs84 J2000 WGS t ,BLH wgs84 J2000 WGS t ,BLH
step 1: WGS 84 step 1: WGS 84
step 2: step 2:
step 3: step 3:
step 4: step 4:
step 5: J2000 step 5: J2000
**/ **/

View File

@ -1,4 +1,4 @@
#include "FileOperator.h" #include "FileOperator.h"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <string> #include <string>
#include <memory.h> #include <memory.h>
@ -88,7 +88,7 @@ int write_binfile(char* filepath, char* data, size_t data_len)
if (NULL == pd) { if (NULL == pd) {
return 2; return 2;
} }
//数据块首地址: "&a",元素大小: "sizeof(unsigned __int8)" 元素个数: "10" 文件指针:"pd" //数据块首地址: "&a",元素大小: "sizeof(unsigned __int8)" 元素个数: "10" 文件指针:"pd"
fwrite(data, sizeof(char), data_len, pd); fwrite(data, sizeof(char), data_len, pd);
fclose(pd); fclose(pd);
return -1; return -1;
@ -102,13 +102,13 @@ char* read_textfile(char* text_path, int* length)
return NULL; return NULL;
} }
else {} else {}
// 读取文件 // 读取文件
fseek(fp1, 0, SEEK_END); fseek(fp1, 0, SEEK_END);
int data_length = ftell(fp1); int data_length = ftell(fp1);
data = (char*)malloc((data_length + 1) * sizeof(char)); data = (char*)malloc((data_length + 1) * sizeof(char));
rewind(fp1); rewind(fp1);
if (data_length == fread(data, sizeof(char), data_length, fp1)) { if (data_length == fread(data, sizeof(char), data_length, fp1)) {
data[data_length] = '\0'; // 文件尾 data[data_length] = '\0'; // 文件尾
} }
else { else {
free(data); free(data);
@ -128,11 +128,11 @@ bool exists_test(const QString& name)
size_t fsize(FILE* fp) size_t fsize(FILE* fp)
{ {
size_t n; size_t n;
fpos_t fpos; // 当前位置 fpos_t fpos; // 当前位置
fgetpos(fp, &fpos); // 获取当前位置 fgetpos(fp, &fpos); // 获取当前位置
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
n = ftell(fp); n = ftell(fp);
fsetpos(fp, &fpos); // 恢复之前的位置 fsetpos(fp, &fpos); // 恢复之前的位置
return n; return n;
} }
@ -173,16 +173,16 @@ void copyFile(const QString& sourcePath, const QString& destinationPath) {
if (sourceFile.exists()) { if (sourceFile.exists()) {
if (sourceFile.copy(destinationPath)) { if (sourceFile.copy(destinationPath)) {
// 复制成功 // 复制成功
//QMessageBox::information(nullptr, u8"成功", u8"文件复制成功"); //QMessageBox::information(nullptr, u8"成功", u8"文件复制成功");
} }
else { else {
// 复制失败 // 复制失败
QMessageBox::critical(nullptr, u8"错误", u8"文件复制失败"); QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("file copy error"));
} }
} }
else { else {
// 源文件不存在 // 源文件不存在
QMessageBox::warning(nullptr, u8"警告", u8"源文件不存在"); QMessageBox::warning(nullptr, QObject::tr("warning"), QObject::tr("Source file not found"));
} }
} }

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#ifndef FILEOPERATOR_H #ifndef FILEOPERATOR_H
#define FILEOPERATOR_H #define FILEOPERATOR_H
#include "referenceHeader.h" #include "../LAMPTool/referenceHeader.h"
#include <string.h> #include <string.h>
#include <memory.h> #include <memory.h>
#include <memory> #include <memory>
@ -25,7 +25,7 @@ bool isFile(const QString& path);
void removeFile(const QString& filePath); void removeFile(const QString& filePath);
unsigned long convertToULong(const QString& input); unsigned long convertToULong(const QString& input);
/// <summary> /// <summary>
/// 获取文件(绝对路径) /// 获取文件(绝对路径)
/// </summary> /// </summary>
/// <param name="folderpath"></param> /// <param name="folderpath"></param>
/// <param name="FilenameExtension"></param> /// <param name="FilenameExtension"></param>

View File

@ -1,4 +1,4 @@
#include "GeoOperator.h" #include "GeoOperator.h"
#include <iostream> #include <iostream>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
@ -175,11 +175,11 @@ Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landp
n3 = LLA2XYZ(p3), n3 = LLA2XYZ(p3),
n4 = LLA2XYZ(p4); n4 = LLA2XYZ(p4);
Landpoint n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0; Landpoint n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0;
// <EFBFBD><EFBFBD>n01Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 锟斤拷n01为锟斤拷锟斤拷锟斤拷锟斤拷
Landpoint np01 = p1 - p0, np02 = p2 - p0, np03 = p3 - p0, np04 = p4 - p0; Landpoint np01 = p1 - p0, np02 = p2 - p0, np03 = p3 - p0, np04 = p4 - p0;
double a2 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np02.lon,np02.lat,0 });// 01->02 <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> double a2 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np02.lon,np02.lat,0 });// 01->02 锟斤拷时锟斤拷
double a3 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np03.lon,np03.lat,0 });// 01->03 <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> double a3 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np03.lon,np03.lat,0 });// 01->03 锟斤拷时锟斤拷
double a4 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np04.lon,np04.lat,0 });// 01->04 <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> double a4 = getAngle(Landpoint{ np01.lon,np01.lat,0 }, Landpoint{ np04.lon,np04.lat,0 });// 01->04 锟斤拷时锟斤拷
//qDebug() << a2 << "\t" << a3 << "\t" << a4 << endl; //qDebug() << a2 << "\t" << a3 << "\t" << a4 << endl;
a2 = 360 - a2; a2 = 360 - a2;
a3 = 360 - a3; a3 = 360 - a3;
@ -237,14 +237,14 @@ double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, con
{ {
Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z }; Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z };
// 计算点到直线的投影点的位置 // 畻鐐瑰埌鐩寸嚎鐨勬姇褰辩偣鐨勪綅缃<EFBFBD>
double t = (pointToLine.x * lineDirection.x + pointToLine.y * lineDirection.y + pointToLine.z * lineDirection.z) / double t = (pointToLine.x * lineDirection.x + pointToLine.y * lineDirection.y + pointToLine.z * lineDirection.z) /
(lineDirection.x * lineDirection.x + lineDirection.y * lineDirection.y + lineDirection.z * lineDirection.z); (lineDirection.x * lineDirection.x + lineDirection.y * lineDirection.y + lineDirection.z * lineDirection.z);
// 计算投影点 // 畻鎶曞奖鐐<EFBFBD>
Vector3D projection = { linePoint.x + t * lineDirection.x, linePoint.y + t * lineDirection.y, linePoint.z + t * lineDirection.z }; Vector3D projection = { linePoint.x + t * lineDirection.x, linePoint.y + t * lineDirection.y, linePoint.z + t * lineDirection.z };
// 计算点到直线的距离 // 畻鐐瑰埌鐩寸嚎鐨勮窛绂<EFBFBD>
return distance(point, projection); return distance(point, projection);
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef GEOOPERATOR_H #ifndef GEOOPERATOR_H
@ -14,22 +14,22 @@
#include <iostream> #include <iostream>
/// <summary> /// <summary>
/// 三维向量,坐标表达 /// 三维向量,坐标表达
/// </summary> /// </summary>
struct Landpoint // 点 SAR影像的像素坐标 struct Landpoint // 点 SAR影像的像素坐标
{ {
/// <summary> /// <summary>
/// 经度x /// 经度x
/// </summary> /// </summary>
double lon; // 经度x lon pixel_col double lon; // 经度x lon pixel_col
/// <summary> /// <summary>
/// 纬度y /// 纬度y
/// </summary> /// </summary>
double lat; // 纬度y lat pixel_row double lat; // 纬度y lat pixel_row
/// <summary> /// <summary>
/// 高度z /// 高度z
/// </summary> /// </summary>
double ati; // 高程z ati pixel_time double ati; // 高程z ati pixel_time
}; };
struct Point_3d { struct Point_3d {
double x; double x;
@ -38,18 +38,18 @@ struct Point_3d {
}; };
/// <summary> /// <summary>
/// 将经纬度转换为地固参心坐标系 /// 将经纬度转换为地固参心坐标系
/// </summary> /// </summary>
/// <param name="XYZP">经纬度点--degree</param> /// <param name="XYZP">经纬度点--degree</param>
/// <returns>投影坐标系点</returns> /// <returns>投影坐标系点</returns>
Landpoint LLA2XYZ(const Landpoint& LLA); Landpoint LLA2XYZ(const Landpoint& LLA);
Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint); Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint);
/// <summary> /// <summary>
/// 将地固参心坐标系转换为经纬度 /// 将地固参心坐标系转换为经纬度
/// </summary> /// </summary>
/// <param name="XYZ">固参心坐标系</param> /// <param name="XYZ">固参心坐标系</param>
/// <returns>经纬度--degree</returns> /// <returns>经纬度--degree</returns>
Landpoint XYZ2LLA(const Landpoint& XYZ); Landpoint XYZ2LLA(const Landpoint& XYZ);
@ -84,14 +84,14 @@ double operator /(Point_3d a, Point_3d b);
// 矢量计算 // 矢量计算
struct Vector3D { struct Vector3D {
double x, y, z; double x, y, z;
}; };
// 计算两点之间的距离 // 计算两点之间的距离
double distance(const Vector3D& p1, const Vector3D& p2); double distance(const Vector3D& p1, const Vector3D& p2);
// 计算点到直线的最短距离 // 计算点到直线的最短距离
double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection); double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection);

View File

@ -1,4 +1,4 @@
#include "ImageOperatorBase.h" #include "ImageOperatorBase.h"
#include "GeoOperator.h" #include "GeoOperator.h"
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
@ -21,7 +21,7 @@ using namespace std;
using namespace Eigen; using namespace Eigen;
/** /**
* ENVI * ENVI
*/ */
@ -90,14 +90,14 @@ int saveDataset(QString new_file_path, int start_line,int start_cols ,int band_i
int 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; int size_meta = 0;
if (gdal_datatype == GDT_Byte) { if (gdal_datatype == GDT_Byte) {
size_meta = 1; size_meta = 1;
} }
else if (gdal_datatype == GDT_UInt16) { else if (gdal_datatype == GDT_UInt16) {
size_meta = 2; // 只有双通道才能构建 复数矩阵 size_meta = 2; // 只有双通道才能构建 复数矩阵
} }
else if (gdal_datatype == GDT_UInt16) { else if (gdal_datatype == GDT_UInt16) {
size_meta = 2; size_meta = 2;
@ -129,7 +129,7 @@ int block_num_pre_memory(int block_width, int height, GDALDataType gdal_datatype
else if (gdal_datatype == GDT_CFloat64) { size_meta = 8; } else if (gdal_datatype == GDT_CFloat64) { size_meta = 8; }
else {} else {}
int block_num = int(memey_size / (size_meta * block_width)); int block_num = int(memey_size / (size_meta * block_width));
block_num = block_num > height ? height : block_num; // 行数 block_num = block_num > height ? height : block_num; // 行数
block_num = block_num < 1 ? 1 : block_num; block_num = block_num < 1 ? 1 : block_num;
return block_num; return block_num;
} }
@ -154,7 +154,7 @@ Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadCompl
} }
else {} else {}
bool _flag = false; bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先
if (gdal_datatype == GDT_Byte) { if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num * width, 1); Eigen::MatrixX<char> real_mat(line_num * width, 1);
Eigen::MatrixX<char> imag_mat(line_num * width, 1); Eigen::MatrixX<char> imag_mat(line_num * width, 1);
@ -265,22 +265,22 @@ Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> ReadCompl
_flag = true; _flag = true;
} }
else {} else {}
// 保存数据 // 保存数据
if (_flag) { if (_flag) {
return data_mat; return data_mat;
} }
else { else {
return Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>(0, 0);// 必须强制行优先; return Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>(0, 0);// 必须强制行优先;
} }
} }
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::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 进行矩阵计算,加速计算 // 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false; bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 1);// 必须强制行优先 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 1);// 必须强制行优先
if (gdal_datatype == GDT_Byte) { if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num * width, 1); Eigen::MatrixX<char> real_mat(line_num * width, 1);
rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real rasterDataset->GetRasterBand(band_idx)->RasterIO(GF_Read, 0, start_line, width, line_num, real_mat.data(), width, line_num, gdal_datatype, 0, 0); // real
@ -370,13 +370,13 @@ GDALDataType getGDALDataType(QString fileptah)
omp_set_lock(&lock); omp_set_lock(&lock);
GDALAllRegister(); GDALAllRegister();
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(fileptah.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(fileptah.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
GDALClose((GDALDatasetH)rasterDataset); GDALClose((GDALDatasetH)rasterDataset);
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
return gdal_datatype; return gdal_datatype;
} }
@ -392,42 +392,42 @@ gdalImage::gdalImage()
} }
/// <summary> /// <summary>
/// 斤拷图饺∮帮拷锟?1锟?7 /// 斤拷图饺∮帮拷锟?1锟?7
/// </summary> /// </summary>
/// <param name="dem_path"></param> /// <param name="dem_path"></param>
gdalImage::gdalImage(const QString& raster_path) gdalImage::gdalImage(const QString& raster_path)
{ {
omp_lock_t lock; omp_lock_t lock;
omp_init_lock(&lock); // 锟斤拷始斤拷斤拷 omp_init_lock(&lock); // 锟斤拷始斤拷斤拷
omp_set_lock(&lock); //锟斤拷没斤拷锟?1锟?7 omp_set_lock(&lock); //锟斤拷没斤拷锟?1锟?7
this->img_path = raster_path; this->img_path = raster_path;
GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7 GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7
// 锟斤拷DEM影锟斤拷 // 锟斤拷DEM影锟斤拷
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(raster_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(raster_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
this->width = rasterDataset->GetRasterXSize(); this->width = rasterDataset->GetRasterXSize();
this->height = rasterDataset->GetRasterYSize(); this->height = rasterDataset->GetRasterYSize();
this->band_num = rasterDataset->GetRasterCount(); this->band_num = rasterDataset->GetRasterCount();
double* gt = new double[6]; double* gt = new double[6];
// 锟斤拷梅斤拷锟斤拷 // 锟斤拷梅斤拷锟斤拷
rasterDataset->GetGeoTransform(gt); rasterDataset->GetGeoTransform(gt);
this->gt = Eigen::MatrixXd(2, 3); this->gt = Eigen::MatrixXd(2, 3);
this->gt << gt[0], gt[1], gt[2], gt[3], gt[4], gt[5]; this->gt << gt[0], gt[1], gt[2], gt[3], gt[4], gt[5];
this->projection = rasterDataset->GetProjectionRef(); this->projection = rasterDataset->GetProjectionRef();
// 斤拷斤拷 // 斤拷斤拷
//double* inv_gt = new double[6];; //double* inv_gt = new double[6];;
//GDALInvGeoTransform(gt, inv_gt); // 斤拷斤拷 //GDALInvGeoTransform(gt, inv_gt); // 斤拷斤拷
// 斤拷投影 // 斤拷投影
GDALFlushCache((GDALDatasetH)rasterDataset); GDALFlushCache((GDALDatasetH)rasterDataset);
GDALClose((GDALDatasetH)rasterDataset); GDALClose((GDALDatasetH)rasterDataset);
rasterDataset = NULL;// 指矫匡拷 rasterDataset = NULL;// 指矫匡拷
this->InitInv_gt(); this->InitInv_gt();
delete[] gt; delete[] gt;
////GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH ////GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
} }
gdalImage::~gdalImage() gdalImage::~gdalImage()
@ -464,7 +464,7 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
omp_set_lock(&lock); omp_set_lock(&lock);
GDALAllRegister(); GDALAllRegister();
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids); GDALRasterBand* demBand = rasterDataset->GetRasterBand(band_ids);
@ -569,8 +569,8 @@ Eigen::MatrixXd gdalImage::getData(int start_row, int start_col, int rows_count,
} }
else {} else {}
GDALClose((GDALDatasetH)rasterDataset); GDALClose((GDALDatasetH)rasterDataset);
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
//GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH //GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
return datamatrix; return datamatrix;
@ -589,7 +589,7 @@ GDALDataType gdalImage::getDataType()
} }
/// <summary> /// <summary>
/// 写锟斤拷遥锟斤拷影锟斤拷 /// 写锟斤拷遥锟斤拷影锟斤拷
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="start_row"></param> /// <param name="start_row"></param>
@ -612,7 +612,7 @@ void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
} }
else { else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, this->band_num, GDT_Float32, NULL); // 斤拷锟斤拷 poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, this->band_num, GDT_Float32, NULL); // 斤拷锟斤拷
poDstDS->SetProjection(this->projection.toUtf8().constData()); poDstDS->SetProjection(this->projection.toUtf8().constData());
@ -644,8 +644,8 @@ void gdalImage::saveImage(Eigen::MatrixXd data, int start_row = 0, int start_col
GDALClose((GDALDatasetH)poDstDS); GDALClose((GDALDatasetH)poDstDS);
//GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH //GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
delete[] databuffer; delete[] databuffer;
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
} }
void gdalImage::saveImage() void gdalImage::saveImage()
@ -655,7 +655,7 @@ void gdalImage::saveImage()
void gdalImage::setNoDataValue(double nodatavalue = -9999, int band_ids = 1) void gdalImage::setNoDataValue(double nodatavalue = -9999, int band_ids = 1)
{ {
GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7 GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7
//GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); //GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update)); GDALDataset* poDstDS = (GDALDataset*)(GDALOpen(img_path.toUtf8().constData(), GA_Update));
poDstDS->GetRasterBand(band_ids)->SetNoDataValue(nodatavalue); poDstDS->GetRasterBand(band_ids)->SetNoDataValue(nodatavalue);
@ -772,13 +772,13 @@ GDALRPCInfo gdalImage::getRPC()
{ {
CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");
CPLSetConfigOption("GDAL_DATA", "./data"); CPLSetConfigOption("GDAL_DATA", "./data");
GDALAllRegister();//注斤拷锟斤拷 GDALAllRegister();//注斤拷锟斤拷
//斤拷锟斤拷 //斤拷锟斤拷
GDALDataset* pDS = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly); GDALDataset* pDS = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly);
//锟斤拷元斤拷锟叫伙拷取RPC锟斤拷息 //锟斤拷元斤拷锟叫伙拷取RPC锟斤拷息
char** papszRPC = pDS->GetMetadata("RPC"); char** papszRPC = pDS->GetMetadata("RPC");
//斤拷取锟斤拷RPC锟斤拷息斤拷山峁癸拷锟?1锟?7 //斤拷取锟斤拷RPC锟斤拷息斤拷山峁癸拷锟?1锟?7
GDALRPCInfo oInfo; GDALRPCInfo oInfo;
GDALExtractRPCInfo(papszRPC, &oInfo); GDALExtractRPCInfo(papszRPC, &oInfo);
@ -794,9 +794,9 @@ Eigen::MatrixXd gdalImage::getLandPoint(Eigen::MatrixXd points)
} }
Eigen::MatrixXd result(points.rows(), 3); Eigen::MatrixXd result(points.rows(), 3);
result.col(2) = points.col(2);// 锟竭筹拷 result.col(2) = points.col(2);// 锟竭筹拷
points.col(2) = points.col(2).array() * 0 + 1; points.col(2) = points.col(2).array() * 0 + 1;
points.col(0).swap(points.col(2));// 斤拷 points.col(0).swap(points.col(2));// 斤拷
Eigen::MatrixXd gts(3, 2); Eigen::MatrixXd gts(3, 2);
gts.col(0) = this->gt.row(0); gts.col(0) = this->gt.row(0);
gts.col(1) = this->gt.row(1); gts.col(1) = this->gt.row(1);
@ -807,9 +807,9 @@ Eigen::MatrixXd gdalImage::getLandPoint(Eigen::MatrixXd points)
Eigen::MatrixXd gdalImage::getHist(int bandids) Eigen::MatrixXd gdalImage::getHist(int bandids)
{ {
GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7 GDALAllRegister();// 注绞斤拷斤拷锟?1锟?7
// 锟斤拷DEM影锟斤拷 // 锟斤拷DEM影锟斤拷
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType(); GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
GDALRasterBand* xBand = rasterDataset->GetRasterBand(bandids); GDALRasterBand* xBand = rasterDataset->GetRasterBand(bandids);
@ -845,13 +845,13 @@ gdalImage CreategdalImage(const QString& img_path, int height, int width, int ba
exit(1); exit(1);
} }
} }
GDALAllRegister();// 注锟斤拷锟绞斤拷锟斤拷锟斤拷锟?1锟?7 GDALAllRegister();// 注锟斤拷锟绞斤拷锟斤拷锟斤拷锟?1锟?7
GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff"); GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTiff");
GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_Float32, NULL); // 锟斤拷锟斤拷锟斤拷 GDALDataset* poDstDS = poDriver->Create(img_path.toUtf8().constData(), width, height, band_num, GDT_Float32, NULL); // 锟斤拷锟斤拷锟斤拷
if (need_gt) { if (need_gt) {
poDstDS->SetProjection(projection.toUtf8().constData()); poDstDS->SetProjection(projection.toUtf8().constData());
// 锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷 // 锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷
double gt_ptr[6] = { 0 }; double gt_ptr[6] = { 0 };
for (int i = 0; i < gt.rows(); i++) { for (int i = 0; i < gt.rows(); i++) {
for (int j = 0; j < gt.cols(); j++) { for (int j = 0; j < gt.cols(); j++) {
@ -888,7 +888,7 @@ gdalImageComplex CreategdalImageComplex(const QString& img_path, int height, int
if (need_gt) { if (need_gt) {
poDstDS->SetProjection(projection.toUtf8().constData()); poDstDS->SetProjection(projection.toUtf8().constData());
// 锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷 // 锟斤拷锟斤拷转锟斤拷锟斤拷锟斤拷
double gt_ptr[6] = { 0 }; double gt_ptr[6] = { 0 };
for (int i = 0; i < gt.rows(); i++) { for (int i = 0; i < gt.rows(); i++) {
for (int j = 0; j < gt.cols(); j++) { for (int j = 0; j < gt.cols(); j++) {
@ -932,12 +932,12 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
char* pszSrcWKT = NULL; char* pszSrcWKT = NULL;
pszSrcWKT = const_cast<char*>(pDSrc->GetProjectionRef()); pszSrcWKT = const_cast<char*>(pDSrc->GetProjectionRef());
//锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7 //锟斤拷锟矫伙拷锟酵队帮拷锟斤拷锟轿?拷锟斤拷锟揭伙拷锟?1锟?7
if (strlen(pszSrcWKT) <= 0) if (strlen(pszSrcWKT) <= 0)
{ {
OGRSpatialReference oSRS; OGRSpatialReference oSRS;
oSRS.importFromEPSG(4326); oSRS.importFromEPSG(4326);
//oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷 //oSRS.SetUTM(50, true); //锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷120锟斤拷
//oSRS.SetWellKnownGeogCS("WGS84"); //oSRS.SetWellKnownGeogCS("WGS84");
oSRS.exportToWkt(&pszSrcWKT); oSRS.exportToWkt(&pszSrcWKT);
} }
@ -945,7 +945,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
void* hTransformArg; void* hTransformArg;
hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1); hTransformArg = GDALCreateGenImgProjTransformer((GDALDatasetH)pDSrc, pszSrcWKT, NULL, pszSrcWKT, FALSE, 0.0, 1);
qDebug() << "no proj " << endl; qDebug() << "no proj " << endl;
//(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7) //(没锟斤拷投影锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷卟锟酵?拷锟?1锟?7)
if (hTransformArg == NULL) if (hTransformArg == NULL)
{ {
GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc); GDALClose((GDALDatasetH)(GDALDatasetH)pDSrc);
@ -1079,8 +1079,8 @@ int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path)
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff = CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true);// 注意这里保留仿真结果 gdalImage image_tiff = CreategdalImage(out_tiff_path, rows, cols, 2, gt, "", false, true);// 注意这里保留仿真结果
// 保存二进制文件 // 保存二进制文件
Eigen::MatrixXd real_img = data.array().real(); Eigen::MatrixXd real_img = data.array().real();
Eigen::MatrixXd imag_img = data.array().imag(); Eigen::MatrixXd imag_img = data.array().imag();
image_tiff.saveImage(real_img, 0, 0, 1); image_tiff.saveImage(real_img, 0, 0, 1);
@ -1097,7 +1097,7 @@ gdalImageComplex::gdalImageComplex(const QString& raster_path)
this->img_path = raster_path; this->img_path = raster_path;
GDALAllRegister(); GDALAllRegister();
GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(raster_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷 GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(raster_path.toUtf8().constData(), GA_ReadOnly));//锟斤拷只斤拷式锟斤拷取斤拷影锟斤拷
this->width = rasterDataset->GetRasterXSize(); this->width = rasterDataset->GetRasterXSize();
this->height = rasterDataset->GetRasterYSize(); this->height = rasterDataset->GetRasterYSize();
this->band_num = rasterDataset->GetRasterCount(); this->band_num = rasterDataset->GetRasterCount();
@ -1117,15 +1117,15 @@ gdalImageComplex::gdalImageComplex(const QString& raster_path)
this->projection = rasterDataset->GetProjectionRef(); this->projection = rasterDataset->GetProjectionRef();
// 斤拷投影 // 斤拷投影
GDALFlushCache((GDALDatasetH)rasterDataset); GDALFlushCache((GDALDatasetH)rasterDataset);
GDALClose((GDALDatasetH)rasterDataset); GDALClose((GDALDatasetH)rasterDataset);
rasterDataset = NULL;// 指矫匡拷 rasterDataset = NULL;// 指矫匡拷
this->InitInv_gt(); this->InitInv_gt();
delete[] gt; delete[] gt;
////GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH ////GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
} }
@ -1156,7 +1156,7 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start
poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update)); poDstDS = (GDALDataset*)(GDALOpen(this->img_path.toUtf8().constData(), GA_Update));
} }
else { else {
poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, this->band_num, GDT_CFloat64, NULL); // 斤拷锟斤拷 poDstDS = poDriver->Create(this->img_path.toUtf8().constData(), this->width, this->height, this->band_num, GDT_CFloat64, NULL); // 斤拷锟斤拷
poDstDS->SetProjection(this->projection.toUtf8().constData()); poDstDS->SetProjection(this->projection.toUtf8().constData());
@ -1187,8 +1187,8 @@ void gdalImageComplex::saveImage(Eigen::MatrixXcd data, int start_row, int start
delete databuffer; delete databuffer;
GDALClose((GDALDatasetH)poDstDS); GDALClose((GDALDatasetH)poDstDS);
//GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH //GDALDestroy(); // or, DllMain at DLL_PROCESS_DETACH
omp_unset_lock(&lock); //锟酵放伙拷斤拷 omp_unset_lock(&lock); //锟酵放伙拷斤拷
omp_destroy_lock(&lock); //劫伙拷斤拷 omp_destroy_lock(&lock); //劫伙拷斤拷
} }
@ -1199,18 +1199,18 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col,
GDALDataset* poDataset; GDALDataset* poDataset;
GDALAllRegister(); GDALAllRegister();
// 打开TIFF文件 // 打开TIFF文件
poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly); poDataset = (GDALDataset*)GDALOpen(this->img_path.toUtf8().constData(), GA_ReadOnly);
if (poDataset == nullptr) { if (poDataset == nullptr) {
QMessageBox::warning(nullptr, u8"错误", u8"无法打开文件:" + this->img_path); QMessageBox::warning(nullptr, u8"错误", u8"无法打开文件:" + this->img_path);
qDebug() << u8"无法打开文件:" + this->img_path; qDebug() << u8"无法打开文件:" + this->img_path;
} }
// 获取数据集的第一个波段 // 获取数据集的第一个波段
GDALRasterBand* poBand; GDALRasterBand* poBand;
poBand = poDataset->GetRasterBand(1); poBand = poDataset->GetRasterBand(1);
// 读取波段信息,假设是复数类型 // 读取波段信息,假设是复数类型
int nXSize = poBand->GetXSize(); int nXSize = poBand->GetXSize();
int nYSize = poBand->GetYSize(); int nYSize = poBand->GetYSize();
@ -1218,7 +1218,7 @@ Eigen::MatrixXcd gdalImageComplex::getDataComplex(int start_row, int start_col,
double* databuffer = new double[nXSize * nYSize * 2]; double* databuffer = new double[nXSize * nYSize * 2];
poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0); poBand->RasterIO(GF_Read, start_col, start_row, cols_count, rows_count, databuffer, cols_count, rows_count, GDT_CFloat64, 0, 0);
GDALClose((GDALDatasetH)poDataset); GDALClose((GDALDatasetH)poDataset);
Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd Eigen::MatrixXcd rasterData(nYSize, nXSize); // 使用Eigen的MatrixXcd
for (size_t i = 0; i < nYSize; i++) for (size_t i = 0; i < nYSize; i++)
{ {
for (size_t j = 0; j < nXSize; j++) { for (size_t j = 0; j < nXSize; j++) {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
/** /**
* *
* ENVI * ENVI
* GDAL * GDAL
* **/ * **/
@ -10,8 +10,8 @@
#ifndef IMAGEOPERATORBASE_H #ifndef IMAGEOPERATORBASE_H
#define IMAGEOPERATORBASE_H #define IMAGEOPERATORBASE_H
#include "BaseToollib/BaseConstVariable.h" #include "../LAMPTool/BaseToollib/BaseConstVariable.h"
#include "BaseToollib/GeoOperator.h" #include "../LAMPTool/BaseToollib/GeoOperator.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -25,7 +25,7 @@
#include <memory> #include <memory>
#include <QString> #include <QString>
#include <cpl_conv.h> // for CPLMalloc() #include <cpl_conv.h> // for CPLMalloc()
#include "referenceHeader.h" #include "../LAMPTool/referenceHeader.h"
using namespace std; using namespace std;
using namespace Eigen; using namespace Eigen;
@ -36,26 +36,26 @@ struct ImageGEOINFO {
}; };
// 判断是否需要输出为DLL // 判断是否需要输出为DLL
#define DLLOUT #define DLLOUT
// 文件打开 // 文件打开
std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly); // 当指令销毁时调用GDALClose 销毁类型 std::shared_ptr<GDALDataset> OpenDataset(const QString& in_path, GDALAccess rwmode= GA_ReadOnly); // 当指令销毁时调用GDALClose 销毁类型
void CloseDataset(GDALDataset* ptr); void CloseDataset(GDALDataset* ptr);
// 数据格式转换 // 数据格式转换
int TIFF2ENVI(QString in_tiff_path,QString out_envi_path); int TIFF2ENVI(QString in_tiff_path,QString out_envi_path);
int ENVI2TIFF(QString in_envi_path,QString out_tiff_path); int ENVI2TIFF(QString in_envi_path,QString out_tiff_path);
// 保存影像数据 --直接保存 ENVI 文件 // 保存影像数据 --直接保存 ENVI 文件
int 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 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 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> 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> 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);
@ -67,20 +67,20 @@ GDALDataType getGDALDataType(QString fileptah);
struct DemBox { struct DemBox {
double min_lat; //纬度 double min_lat; //纬度
double min_lon;//经度 double min_lon;//经度
double max_lat;//纬度 double max_lat;//纬度
double max_lon;//经度 double max_lon;//经度
}; };
/// <summary> /// <summary>
/// gdalImage图像操作类 /// gdalImage图像操作类
/// </summary> /// </summary>
class gdalImage class gdalImage
{ {
public: // 方法 public: // 方法
gdalImage(); gdalImage();
gdalImage(const QString& raster_path); gdalImage(const QString& raster_path);
~gdalImage(); ~gdalImage();
@ -105,15 +105,15 @@ public: //
virtual Eigen::MatrixXd getHist(int bandids); virtual Eigen::MatrixXd getHist(int bandids);
public: public:
QString img_path; // 图像文件 QString img_path; // 图像文件
int height; // 高 int height; // 高
int width; // 宽 int width; // 宽
int band_num;// 波段数 int band_num;// 波段数
int start_row;// int start_row;//
int start_col;// int start_col;//
int data_band_ids; int data_band_ids;
Eigen::MatrixXd gt; // 变换矩阵 Eigen::MatrixXd gt; // 变换矩阵
Eigen::MatrixXd inv_gt; // 逆变换矩阵 Eigen::MatrixXd inv_gt; // 逆变换矩阵
Eigen::MatrixXd data; Eigen::MatrixXd data;
QString projection; QString projection;
}; };
@ -125,12 +125,12 @@ public:
/// <summary> /// <summary>
/// gdalImage图像操作类 /// gdalImage图像操作类
/// </summary> /// </summary>
class gdalImageComplex:public gdalImage class gdalImageComplex:public gdalImage
{ {
public: // 方法 public: // 方法
gdalImageComplex(const QString& raster_path); gdalImageComplex(const QString& raster_path);
~gdalImageComplex(); ~gdalImageComplex();
void setData(Eigen::MatrixXcd); void setData(Eigen::MatrixXcd);
@ -166,7 +166,7 @@ int ResampleGDAL(const char* pszSrcFile, const char* pszOutFile, double* gt, int
int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear); int ResampleGDALs(const char* pszSrcFile, int band_ids, GDALRIOResampleAlg eResample = GRIORA_Bilinear);
//--------------------- 保存文博 ------------------------------- //--------------------- 保存文博 -------------------------------
int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path); int saveMatrixXcd2TiFF(Eigen::MatrixXcd data, QString out_tiff_path);

View File

@ -1,4 +1,4 @@
#include "BaseToolLib/interpolation.h" #include "BaseToolLib/interpolation.h"
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
#include <stdio.h> #include <stdio.h>

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef INTERPOLATION_H #ifndef INTERPOLATION_H
#define INTERPOLATION_H #define INTERPOLATION_H
@ -21,12 +21,12 @@ namespace LampInterpolation {
/// <summary> /// <summary>
/// 矩阵为 1xn /// 矩阵为 1xn
/// </summary> /// </summary>
template<typename T> template<typename T>
std::complex<T> interpolation(Eigen::MatrixX<std::complex<T>>& echo, double& index, interpolationtype methodtype) std::complex<T> interpolation(Eigen::MatrixX<std::complex<T>>& echo, double& index, interpolationtype methodtype)
{ {
assert(echo.rows() != 1 || echo.cols() >= index || index < 0); // 断言 assert(echo.rows() != 1 || echo.cols() >= index || index < 0); // 断言
if (methodtype == interpolationtype::linear) { if (methodtype == interpolationtype::linear) {
return interpolationLinear(echo, index); return interpolationLinear(echo, index);
} }
@ -49,7 +49,7 @@ namespace LampInterpolation {
std::complex<T> last_value = echo(1, last_ids); std::complex<T> last_value = echo(1, last_ids);
std::complex<T> next_value = echo(1, next_ids); std::complex<T> next_value = echo(1, next_ids);
// 实部,虚部同时插值 // 实部,虚部同时插值
double real = last_value.real() + ((next_value.real() - last_value.real()) / (next_ids - last_ids)) * (index - last_ids); double real = last_value.real() + ((next_value.real() - last_value.real()) / (next_ids - last_ids)) * (index - last_ids);
double imag = last_value.imag() + ((next_value.imag() - last_value.imag()) / (next_ids - last_ids)) * (index - last_ids); double imag = last_value.imag() + ((next_value.imag() - last_value.imag()) / (next_ids - last_ids)) * (index - last_ids);

View File

@ -18,9 +18,9 @@ qt5_add_resources(_resource ${_qrc} ${_lang})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
file(GLOB _ui "*.ui") file(GLOB_RECURSE _ui "*.ui")
file(GLOB _header "*.h*") file(GLOB_RECURSE _header "*.h*")
file(GLOB _source "*.cpp") file(GLOB_RECURSE _source "*.cpp")
qt5_wrap_ui(_interface ${_ui}) qt5_wrap_ui(_interface ${_ui})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -36,7 +36,7 @@ add_library(LAMPTool
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
target_compile_definitions(LAMPTool PRIVATE "LAMPTool_API") target_compile_definitions(LAMPTool PUBLIC "LAMPTool_API")
@ -65,4 +65,4 @@ add_dependencies(LAMPTool ${_depend_library})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(FastCAE_LAMPTool_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) set(FastCAE_LAMPTool_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -1,4 +1,4 @@
#include "FEKOFarFieldFileClass.h" #include "FEKOFarFieldFileClass.h"
FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass() FEKOBase::FEKOFarFieldFileClass::FEKOFarFieldFileClass()
{ {
@ -13,7 +13,7 @@ FEKOBase::FEKOFarFieldFileClass::~FEKOFarFieldFileClass()
void FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName) void FEKOBase::FEKOFarFieldFileClass::parseFarFieldFile(const QString& fileName)
{ {
QFile file(fileName); QFile file(fileName);
// 加载文本文件中的所有数据到一个 QString 中 // 加载文本文件中的所有数据到一个 QString 中
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
qDebug() << "Failed to open file for reading"; qDebug() << "Failed to open file for reading";
@ -143,7 +143,7 @@ FEKOBase::FEKOFARFIELDFEKODATABLOCK::~FEKOFARFIELDFEKODATABLOCK()
int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr) int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlock(const QString& blockstr)
{ {
// 按行进行解析 // 按行进行解析
QList<QString> lines= blockstr.split("\n"); QList<QString> lines= blockstr.split("\n");
return this->paraseFEKOFarFieldDataBlockFromList(lines); return this->paraseFEKOFarFieldDataBlockFromList(lines);
return 1; return 1;
@ -154,16 +154,16 @@ int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QLi
{ {
bool in_readHeaderState = false; bool in_readHeaderState = false;
size_t headerlineCount = 0; size_t headerlineCount = 0;
std::vector<QString> headerLines;// 解析行列时保证结果 std::vector<QString> headerLines;// 解析行列时保证结果
for (size_t i = 0; i < lines.size(); i++) { for (size_t i = 0; i < lines.size(); i++) {
if (lines[i].startsWith("#")) { // 参数项是以# 开头作为配置项 if (lines[i].startsWith("#")) { // 参数项是以# 开头作为配置项
// 针对不同参数项提取参数 // 针对不同参数项提取参数
QString configName = normalizationHeaderString(lines[i]); // 获取参数的归一化名称 QString configName = normalizationHeaderString(lines[i]); // 获取参数的归一化名称
if (configName == u8"") { // 未知参数项 if (configName == u8"") { // 未知参数项
// 进入字段解析状态 // 进入字段解析状态
if (in_readHeaderState) { // 解析字段 if (in_readHeaderState) { // 解析字段
QList<QString> temp_headerLines=lines[i].split(FEKOFARFIELDSPLITCHAT); QList<QString> temp_headerLines=lines[i].split(FEKOFARFIELDSPLITCHAT);
for (size_t ii = 0; ii < temp_headerLines.size();ii++) { for (size_t ii = 0; ii < temp_headerLines.size();ii++) {
if (temp_headerLines[ii].length() > 2) { if (temp_headerLines[ii].length() > 2) {
@ -223,7 +223,7 @@ int FEKOBase::FEKOFARFIELDFEKODATABLOCK::paraseFEKOFarFieldDataBlockFromList(QLi
continue; continue;
} }
} }
else if (lines[i].size() > 10) { // 解析数据块 else if (lines[i].size() > 10) { // 解析数据块
QList<QString> dataline = lines[i].split(FEKOFARFIELDSPLITCHAT); QList<QString> dataline = lines[i].split(FEKOFARFIELDSPLITCHAT);
FEKOBase::FEKOFarFieldFEKOFarFieldData temp_data; FEKOBase::FEKOFarFieldFEKOFarFieldData temp_data;
long field_idx =-1; long field_idx =-1;

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef FARFIELDFILECLASS_H #ifndef FARFIELDFILECLASS_H
#define FARFIELDFILECLASS_H #define FARFIELDFILECLASS_H
@ -8,17 +8,17 @@
namespace FEKOBase { namespace FEKOBase {
// //
// 参数 altair feko user guide 2018.1 // 参数 altair feko user guide 2018.1
// 章节 A-10 summary of feko file formats // 章节 A-10 summary of feko file formats
// //
const QString FEKOFARFIELDSPLITCHAT = u8" "; const QString FEKOFARFIELDSPLITCHAT = u8" ";
enum FEKOFARFIELDRESULTTYPE { enum FEKOFARFIELDRESULTTYPE {
GAIN, // 增益 GAIN, // 增益
DIRECTIVITY,// 电场 DIRECTIVITY,// 电场
RCS,// 后向散射系数 RCS,// 后向散射系数
FARFIELDVALUES,// 远场值 FARFIELDVALUES,// 远场值
FEKOFARFIELDRESULTTYPEUNKOWN FEKOFARFIELDRESULTTYPEUNKOWN
}; };
FEKOBase::FEKOFARFIELDRESULTTYPE FEKOFARFIELDRESULTTYPEString2Enum(QString str); FEKOBase::FEKOFARFIELDRESULTTYPE FEKOFARFIELDRESULTTYPEString2Enum(QString str);
@ -27,10 +27,10 @@ namespace FEKOBase {
//========================================================== //==========================================================
// FEKO 仿真结果文件 farfield 文件 ffe // FEKO 仿真结果文件 farfield 文件 ffe
// 解析ffe 文件 // 解析ffe 文件
//========================================================== //==========================================================
struct FEKOFarFieldFEKOFarFieldData // 仿真结果的数据项 ,行 struct FEKOFarFieldFEKOFarFieldData // 仿真结果的数据项 ,行
{ {
double X=0;// cartesian coordinate system double X=0;// cartesian coordinate system
double Y=0; double Y=0;
@ -63,11 +63,11 @@ namespace FEKOBase {
double RCS_total = 0; double RCS_total = 0;
}; };
class FEKOFARFIELDFEKODATABLOCK { // 数据块 class FEKOFARFIELDFEKODATABLOCK { // 数据块
public: public:
FEKOFARFIELDFEKODATABLOCK(); FEKOFARFIELDFEKODATABLOCK();
~FEKOFARFIELDFEKODATABLOCK(); ~FEKOFARFIELDFEKODATABLOCK();
public: // 变量 public: // 变量
QString configurationName; QString configurationName;
QString requestName; QString requestName;
double frequency; double frequency;
@ -77,18 +77,18 @@ namespace FEKOBase {
long phiSamples; long phiSamples;
long USamples; long USamples;
long VSamples; long VSamples;
CartesianCoordinates Origin; // 坐标系原点 CartesianCoordinates Origin; // 坐标系原点
long headerLines; long headerLines;
QList<FEKOBase::FEKOFarFieldFEKOFarFieldData> dataList; QList<FEKOBase::FEKOFarFieldFEKOFarFieldData> dataList;
public: // 相关函数 public: // 相关函数
// 解析文件 // 解析文件
int paraseFEKOFarFieldDataBlock(const QString& blockstr); // 解析数据块 int paraseFEKOFarFieldDataBlock(const QString& blockstr); // 解析数据块
int paraseFEKOFarFieldDataBlockFromList(QList<QString>& blockstr); // 解析数据块 int paraseFEKOFarFieldDataBlockFromList(QList<QString>& blockstr); // 解析数据块
QString normalizationHeaderString(QString headerstr);// 对数据块头名称进行标准化 QString normalizationHeaderString(QString headerstr);// 对数据块头名称进行标准化
// 保存文件 // 保存文件
QString saveFEKOFarFieldDataBlock(); // 生成数据块字符串 QString saveFEKOFarFieldDataBlock(); // 生成数据块字符串
QString saveFEKOFarFieldDataBlock_Gain(); // 根据类型生成数据块字符串 QString saveFEKOFarFieldDataBlock_Gain(); // 根据类型生成数据块字符串
QString saveFEKOFarFieldDataBlock_Directivity(); QString saveFEKOFarFieldDataBlock_Directivity();
QString saveFEKOFarFieldDataBlock_RCS(); QString saveFEKOFarFieldDataBlock_RCS();
QString saveFEKOFarFieldDataBlock_FarFieldValues(); QString saveFEKOFarFieldDataBlock_FarFieldValues();
@ -124,8 +124,8 @@ public:
//========================================================== //==========================================================
// FEKO 仿真结果文件 nearfield 文件 efe // FEKO 仿真结果文件 nearfield 文件 efe
// 解析efe 文件, // 解析efe 文件,
//========================================================== //==========================================================

View File

@ -1,4 +1,4 @@
// 下面的代码是属性的设置与获取,请补充完整 // 下面的代码是属性的设置与获取,请补充完整
#include "FEKOSimulationSARClass.h" #include "FEKOSimulationSARClass.h"
#include "BaseToolLib/BaseConstVariable.h" #include "BaseToolLib/BaseConstVariable.h"
#include <QMessageBox> #include <QMessageBox>
@ -24,7 +24,7 @@ FEKOBase::FEKOSimulationSARClass::~FEKOSimulationSARClass()
void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams() void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams()
{ {
qDebug() << u8"计算 Strip..."; qDebug() << u8"计算 Strip...";
double incAngle = this->simulationparams->incangle; double incAngle = this->simulationparams->incangle;
double refRange = this->simulationparams->refRange; double refRange = this->simulationparams->refRange;
double start_x = this->simulationparams->start_x; double start_x = this->simulationparams->start_x;
@ -38,19 +38,19 @@ void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams()
double AzAngle = 0; double AzAngle = 0;
this->FEKOAntPoselist.clear(); this->FEKOAntPoselist.clear();
gp_Pnt apex(0, 0, 5); // 顶点在三维空间中的坐标 gp_Pnt apex(0, 0, 5); // 顶点在三维空间中的坐标
gp_Pnt p1(-2, 0, 0); gp_Pnt p1(-2, 0, 0);
gp_Pnt p2(0, -2, 0); gp_Pnt p2(0, -2, 0);
gp_Pnt p3(4, 0, 0); gp_Pnt p3(4, 0, 0);
gp_Pnt p4(0, 3, 0); gp_Pnt p4(0, 3, 0);
// 创建基底的边 // 创建基底的边
TopoDS_Edge edge1 = BRepBuilderAPI_MakeEdge(p1, p2); TopoDS_Edge edge1 = BRepBuilderAPI_MakeEdge(p1, p2);
TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(p2, p3); TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(p2, p3);
TopoDS_Edge edge3 = BRepBuilderAPI_MakeEdge(p3, p4); TopoDS_Edge edge3 = BRepBuilderAPI_MakeEdge(p3, p4);
TopoDS_Edge edge4 = BRepBuilderAPI_MakeEdge(p4, p1); TopoDS_Edge edge4 = BRepBuilderAPI_MakeEdge(p4, p1);
// 使用边创建一个闭合的线框 // 使用边创建一个闭合的线框
BRepBuilderAPI_MakeWire makeWire; BRepBuilderAPI_MakeWire makeWire;
makeWire.Add(edge1); makeWire.Add(edge1);
makeWire.Add(edge2); makeWire.Add(edge2);
@ -58,11 +58,11 @@ void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams()
makeWire.Add(edge4); makeWire.Add(edge4);
TopoDS_Wire baseWire = makeWire.Wire(); TopoDS_Wire baseWire = makeWire.Wire();
// 使用线框创建一个面 // 使用线框创建一个面
BRepBuilderAPI_MakeFace makeFace(baseWire); BRepBuilderAPI_MakeFace makeFace(baseWire);
TopoDS_Face baseFace = makeFace.Face(); TopoDS_Face baseFace = makeFace.Face();
// 从基底面向顶点拉伸,创建四棱锥 // 从基底面向顶点拉伸,创建四棱锥
BRepPrimAPI_MakePrism makePrism(baseFace, gp_Vec(apex.XYZ() - p1.XYZ())); BRepPrimAPI_MakePrism makePrism(baseFace, gp_Vec(apex.XYZ() - p1.XYZ()));
TopoDS_Shape in_ds = makePrism.Shape(); TopoDS_Shape in_ds = makePrism.Shape();
double Vx = end_x - start_x; double Vx = end_x - start_x;
@ -73,7 +73,7 @@ void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams()
double Py = start_y + (end_y - start_y) / (prfcount - 1) * i; double Py = start_y + (end_y - start_y) / (prfcount - 1) * i;
double Pz = start_z + (end_z - start_z) / (prfcount - 1) * i; double Pz = start_z + (end_z - start_z) / (prfcount - 1) * i;
// 创建 SatelliteState // 创建 SatelliteState
FEKOBase::SatelliteState satepos{ FEKOBase::SatelliteState satepos{
FEKOBase::SatellitePosition{Px,Py,Pz}, FEKOBase::SatellitePosition{Px,Py,Pz},
FEKOBase::SatelliteVelocity{Vx,Vy,Vz}, FEKOBase::SatelliteVelocity{Vx,Vy,Vz},
@ -90,7 +90,7 @@ void FEKOBase::FEKOSimulationSARClass::generator_STRIP_FEKOSatelliteParams()
void FEKOBase::FEKOSimulationSARClass::generator_SCAN_FEKOSatelliteParams() void FEKOBase::FEKOSimulationSARClass::generator_SCAN_FEKOSatelliteParams()
{ {
qDebug() << u8"计算 ScaneSAR..."; qDebug() << u8"计算 ScaneSAR...";
double incAngle = this->simulationparams->incangle; double incAngle = this->simulationparams->incangle;
@ -117,7 +117,7 @@ void FEKOBase::FEKOSimulationSARClass::generator_SCAN_FEKOSatelliteParams()
double Vy = end_y - start_y; double Vy = end_y - start_y;
double Vz = end_z - start_z; double Vz = end_z - start_z;
// 创建 SatelliteState // 创建 SatelliteState
FEKOBase::SatelliteState satepos{ FEKOBase::SatelliteState satepos{
FEKOBase::SatellitePosition{Px,Py,Pz}, FEKOBase::SatellitePosition{Px,Py,Pz},
FEKOBase::SatelliteVelocity{Vx,Vy,Vz}, FEKOBase::SatelliteVelocity{Vx,Vy,Vz},
@ -133,10 +133,10 @@ void FEKOBase::FEKOSimulationSARClass::generator_SCAN_FEKOSatelliteParams()
void FEKOBase::FEKOSimulationSARClass::generator_ISAR_FEKOSatelliteParams() void FEKOBase::FEKOSimulationSARClass::generator_ISAR_FEKOSatelliteParams()
{ {
qDebug() << u8"计算 ISAR..."; qDebug() << u8"计算 ISAR...";
// 计算ISAR // 计算ISAR
double iangle = this->simulationparams->incangle; // 入射角 double iangle = this->simulationparams->incangle; // 入射角
double azAngle = 0; // 扫描角变化 double azAngle = 0; // 扫描角变化
double incAngle = this->simulationparams->incangle * M_PI / 180; double incAngle = this->simulationparams->incangle * M_PI / 180;
double deltaAngle = this->simulationparams->delta_angle * M_PI / 180; double deltaAngle = this->simulationparams->delta_angle * M_PI / 180;
double startAngle = this->simulationparams->start_circle_angle * M_PI / 180; double startAngle = this->simulationparams->start_circle_angle * M_PI / 180;
@ -145,12 +145,12 @@ void FEKOBase::FEKOSimulationSARClass::generator_ISAR_FEKOSatelliteParams()
double refRange = this->simulationparams->refRange; double refRange = this->simulationparams->refRange;
// 计算ISAR // 计算ISAR
this->FEKOAntPoselist.clear(); this->FEKOAntPoselist.clear();
double mpi_delta = (deltaAngle) / abs(deltaAngle) * M_PI / 2; double mpi_delta = (deltaAngle) / abs(deltaAngle) * M_PI / 2;
//double startangle = 0; //double startangle = 0;
//double endAngle = M_PI * 2; //double endAngle = M_PI * 2;
if (mpi_delta > 0) { // 逆时针旋转 if (mpi_delta > 0) { // 逆时针旋转
this->simulationparams->setIsRight(false); this->simulationparams->setIsRight(false);
} }
else { else {
@ -161,20 +161,20 @@ void FEKOBase::FEKOSimulationSARClass::generator_ISAR_FEKOSatelliteParams()
size_t PRFidx = 0; size_t PRFidx = 0;
for (double angle = startAngle; angle <= endAngle; angle = angle + deltaAngle) { for (double angle = startAngle; angle <= endAngle; angle = angle + deltaAngle) {
double Px = refRange * sin(incAngle) * cos(angle); // 计算坐标 double Px = refRange * sin(incAngle) * cos(angle); // 计算坐标
double Py = refRange * sin(incAngle) * sin(angle); double Py = refRange * sin(incAngle) * sin(angle);
double Pz = refRange * cos(incAngle); double Pz = refRange * cos(incAngle);
// 计算速度矢量它与xyz.切线垂直 // 计算速度矢量它与xyz.切线垂直
gp_Vec fly_ori(gp_Pnt(Px, Py, Pz), gp_Pnt(0.0, 0.0, 0.0)); gp_Vec fly_ori(gp_Pnt(Px, Py, Pz), gp_Pnt(0.0, 0.0, 0.0));
gp_Vec fly_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1)); gp_Vec fly_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1));
gp_Vec fly_direct = fly_ori.Crossed(fly_Z); gp_Vec fly_direct = fly_ori.Crossed(fly_Z);
// //
double Vx = fly_direct.X(); // 计算飞行速度 double Vx = fly_direct.X(); // 计算飞行速度
double Vy = fly_direct.Y(); double Vy = fly_direct.Y();
double Vz = fly_direct.Z(); double Vz = fly_direct.Z();
double theta = ZRotation_angle; double theta = ZRotation_angle;
double phi = (this->simulationparams->isRight) ? -1 * angle + M_PI / 2 : angle + M_PI; // 根据位置计算入射角 double phi = (this->simulationparams->isRight) ? -1 * angle + M_PI / 2 : angle + M_PI; // 根据位置计算入射角
theta = theta * 180 / M_PI; theta = theta * 180 / M_PI;
phi = phi * 180 / M_PI; phi = phi * 180 / M_PI;
@ -187,18 +187,18 @@ void FEKOBase::FEKOSimulationSARClass::generator_ISAR_FEKOSatelliteParams()
void FEKOBase::FEKOSimulationSARClass::generator_CircleSAR_FEKOSatelliteParams() void FEKOBase::FEKOSimulationSARClass::generator_CircleSAR_FEKOSatelliteParams()
{ {
qDebug() << u8"计算 CircleSAR..."; // 飞行方向为 Y 轴,雷达指向为 Z 轴 qDebug() << u8"计算 CircleSAR..."; // 飞行方向为 Y 轴,雷达指向为 Z 轴
double incAngle = this->simulationparams->incangle; double incAngle = this->simulationparams->incangle;
double deltaAngle = this->simulationparams->delta_angle; double deltaAngle = this->simulationparams->delta_angle;
double refRange = this->simulationparams->refRange; double refRange = this->simulationparams->refRange;
double iangle = incAngle; // 入射角 double iangle = incAngle; // 入射角
double azAngle = 0; // 扫描角变化 double azAngle = 0; // 扫描角变化
incAngle = incAngle * M_PI / 180; incAngle = incAngle * M_PI / 180;
deltaAngle = deltaAngle * M_PI / 180; deltaAngle = deltaAngle * M_PI / 180;
// 计算ISAR // 计算ISAR
this->FEKOAntPoselist.clear(); this->FEKOAntPoselist.clear();
double mpi_delta = (deltaAngle) / abs(deltaAngle) * M_PI / 2; double mpi_delta = (deltaAngle) / abs(deltaAngle) * M_PI / 2;
double startangle = 0; double startangle = 0;
@ -206,7 +206,7 @@ void FEKOBase::FEKOSimulationSARClass::generator_CircleSAR_FEKOSatelliteParams()
if (mpi_delta > 0) { // 逆时针旋转 if (mpi_delta > 0) { // 逆时针旋转
this->simulationparams->isRight = false; this->simulationparams->isRight = false;
} }
else { else {
@ -217,20 +217,20 @@ void FEKOBase::FEKOSimulationSARClass::generator_CircleSAR_FEKOSatelliteParams()
size_t PRFidx = 0; size_t PRFidx = 0;
for (double angle = 0; angle <= endAngle; angle = angle + deltaAngle) { for (double angle = 0; angle <= endAngle; angle = angle + deltaAngle) {
double Px = refRange * sin(incAngle) * cos(angle); // 计算坐标 double Px = refRange * sin(incAngle) * cos(angle); // 计算坐标
double Py = refRange * sin(incAngle) * sin(angle); double Py = refRange * sin(incAngle) * sin(angle);
double Pz = refRange * cos(incAngle); double Pz = refRange * cos(incAngle);
// 计算速度矢量它与xyz.切线垂直 // 计算速度矢量它与xyz.切线垂直
gp_Vec fly_ori(gp_Pnt(Px, Py, Pz), gp_Pnt(0.0, 0.0, 0.0)); gp_Vec fly_ori(gp_Pnt(Px, Py, Pz), gp_Pnt(0.0, 0.0, 0.0));
gp_Vec fly_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1)); gp_Vec fly_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1));
gp_Vec fly_direct = fly_ori.Crossed(fly_Z); gp_Vec fly_direct = fly_ori.Crossed(fly_Z);
// //
double Vx = fly_direct.X(); // 计算飞行速度 double Vx = fly_direct.X(); // 计算飞行速度
double Vy = fly_direct.Y(); double Vy = fly_direct.Y();
double Vz = fly_direct.Z(); double Vz = fly_direct.Z();
double theta = ZRotation_angle; double theta = ZRotation_angle;
double phi = (this->simulationparams->isRight) ? -1 * angle + M_PI / 2 : angle + M_PI; // 根据位置计算入射角 double phi = (this->simulationparams->isRight) ? -1 * angle + M_PI / 2 : angle + M_PI; // 根据位置计算入射角
theta = theta * 180 / M_PI; theta = theta * 180 / M_PI;
phi = phi * 180 / M_PI; phi = phi * 180 / M_PI;
@ -280,7 +280,7 @@ void FEKOBase::FEKOSimulationSARClass::loadFEKOImageSettingXML(QString xmlpath)
{ {
if (!isExists(xmlpath)) { if (!isExists(xmlpath)) {
// QString newName = QInputDialog::getText(nullptr, u8"命名", u8"成像任务名称", QLineEdit::Normal); // QString newName = QInputDialog::getText(nullptr, u8"命名", u8"成像任务名称", QLineEdit::Normal);
QString newName = QInputDialog::getText(nullptr, "rename", "Image task Name", QLineEdit::Normal); QString newName = QInputDialog::getText(nullptr, "rename", "Image task Name", QLineEdit::Normal);
if (newName.isEmpty()) { if (newName.isEmpty()) {
return; return;
@ -307,7 +307,7 @@ void FEKOBase::FEKOSimulationSARClass::loadFEKOImageSettingXML(QString xmlpath)
void FEKOBase::FEKOSimulationSARClass::saveFEKOImageSettingXML() void FEKOBase::FEKOSimulationSARClass::saveFEKOImageSettingXML()
{ {
// 为下列每个节点附加一个TextNode // 为下列每个节点附加一个TextNode
if (isExists(this->xmlpath)) { if (isExists(this->xmlpath)) {
removeFile(this->xmlpath); removeFile(this->xmlpath);
} }
@ -318,7 +318,7 @@ void FEKOBase::FEKOSimulationSARClass::saveFEKOImageSettingXML()
QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfidx, size_t endprfidx) QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfidx, size_t endprfidx)
{ {
QProgressDialog progressDialog(u8"构建馈源设置脚本", u8"终止", 0, this->FEKOAntPoselist.size()); QProgressDialog progressDialog(u8"构建馈源设置脚本", u8"终止", 0, this->FEKOAntPoselist.size());
progressDialog.setWindowTitle("imaging..."); progressDialog.setWindowTitle("imaging...");
progressDialog.setModal(true); progressDialog.setModal(true);
progressDialog.setAutoClose(true); progressDialog.setAutoClose(true);
@ -357,22 +357,22 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8"--- local request_z=Rref*math.cos(in_theta*d2r) --z\n"); luascript = luascript + QString(u8"--- local request_z=Rref*math.cos(in_theta*d2r) --z\n");
luascript = luascript + QString(u8"--- local request_y=Rref*math.sin(in_theta*d2r)*math.sin(in_phi*d2r) -- y\n"); luascript = luascript + QString(u8"--- local request_y=Rref*math.sin(in_theta*d2r)*math.sin(in_phi*d2r) -- y\n");
luascript = luascript + QString(u8"--- local ant_theta= 220 --- 天线入射角方向\n"); luascript = luascript + QString(u8"--- local ant_theta= 220 --- 天线入射角方向\n");
luascript = luascript + QString(u8"--- local ant_phi=90 -- 天线照射方向 -:指向负轴 +:指向正轴\n"); luascript = luascript + QString(u8"--- local ant_phi=90 -- 天线照射方向 -:指向负轴 +:指向正轴\n");
luascript = luascript + QString(u8"--- local ant_phi_start=-1.5 -- 当前工程的起始点 天线指向扫描角\n"); luascript = luascript + QString(u8"--- local ant_phi_start=-1.5 -- 当前工程的起始点 天线指向扫描角\n");
luascript = luascript + QString(u8"--- local ant_phi_delta= 3/2800 -- 这里调整步进增量为\n"); luascript = luascript + QString(u8"--- local ant_phi_delta= 3/2800 -- 这里调整步进增量为\n");
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8"--- PRF POint Setting --- \n"); luascript = luascript + QString(u8"--- PRF POint Setting --- \n");
// ------------------------------------------ 参数设置 ------------------------ // ------------------------------------------ 参数设置 ------------------------
for (size_t i = startprfidx; i < this->FEKOAntPoselist.size() && i < endprfidx; i++) { for (size_t i = startprfidx; i < this->FEKOAntPoselist.size() && i < endprfidx; i++) {
FEKOBase::FEKOSatelliteParams temp = this->FEKOAntPoselist[i]; FEKOBase::FEKOSatelliteParams temp = this->FEKOAntPoselist[i];
QString prf_id = QString::number(QString::number(temp.PRFidx).toInt()); QString prf_id = QString::number(QString::number(temp.PRFidx).toInt());
luascript = luascript + QString(u8" ---------------------\"PRF_%1\" start -------------------------------------------------\n").arg(prf_id); luascript = luascript + QString(u8" ---------------------\"PRF_%1\" start -------------------------------------------------\n").arg(prf_id);
luascript = luascript + QString(u8" PRF_phi=%1 --- 天线照射方向\n").arg(QString::number(temp.antpos.phi)); luascript = luascript + QString(u8" PRF_phi=%1 --- 天线照射方向\n").arg(QString::number(temp.antpos.phi));
luascript = luascript + QString(u8" PRF_theta=%1 --- 入射角\n").arg(QString::number(temp.antpos.theta)); luascript = luascript + QString(u8" PRF_theta=%1 --- 入射角\n").arg(QString::number(temp.antpos.theta));
luascript = luascript + QString(u8" temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n"); luascript = luascript + QString(u8" temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n");
luascript = luascript + QString(u8" temp_standardConfiguration.Label=\"PRF_%1\" -- set standardConfiguration label PRF Count\n").arg(prf_id); luascript = luascript + QString(u8" temp_standardConfiguration.Label=\"PRF_%1\" -- set standardConfiguration label PRF Count\n").arg(prf_id);
luascript = luascript + QString(u8" --- set frequency\n"); // 设置频率 luascript = luascript + QString(u8" --- set frequency\n"); // 设置频率
luascript = luascript + QString(u8" frequencyRange=temp_standardConfiguration.Frequency\n"); luascript = luascript + QString(u8" frequencyRange=temp_standardConfiguration.Frequency\n");
luascript = luascript + QString(u8" properties = frequencyRange:GetProperties()\n"); luascript = luascript + QString(u8" properties = frequencyRange:GetProperties()\n");
luascript = luascript + QString(u8" properties.RangeType = cf.Enums.FrequencyRangeTypeEnum.LinearSpacedDiscrete\n"); luascript = luascript + QString(u8" properties.RangeType = cf.Enums.FrequencyRangeTypeEnum.LinearSpacedDiscrete\n");
@ -381,7 +381,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8" properties.NumberOfDiscreteValues=freq_num -- freq_num\n"); luascript = luascript + QString(u8" properties.NumberOfDiscreteValues=freq_num -- freq_num\n");
luascript = luascript + QString(u8" frequencyRange:SetProperties(properties)\n"); luascript = luascript + QString(u8" frequencyRange:SetProperties(properties)\n");
luascript = luascript + QString(u8" -- set Source\n"); luascript = luascript + QString(u8" -- set Source\n");
luascript = luascript + QString(u8" farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(farFieldData)\n"); // 设置发射源 luascript = luascript + QString(u8" farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(farFieldData)\n"); // 设置发射源
luascript = luascript + QString(u8" farFieldSource.Label=\"FarSource_PRF_%1\"\n").arg(prf_id); luascript = luascript + QString(u8" farFieldSource.Label=\"FarSource_PRF_%1\"\n").arg(prf_id);
luascript = luascript + QString(u8" farFieldSource.Position.U=%1\n").arg(QString::number(temp.antpos.x)); luascript = luascript + QString(u8" farFieldSource.Position.U=%1\n").arg(QString::number(temp.antpos.x));
luascript = luascript + QString(u8" farFieldSource.Position.V=%1\n").arg(QString::number(temp.antpos.y)); luascript = luascript + QString(u8" farFieldSource.Position.V=%1\n").arg(QString::number(temp.antpos.y));
@ -399,7 +399,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
.arg(QString::number(temp.antpos.phi)) .arg(QString::number(temp.antpos.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(temp.antpos.theta)) .arg(QString::number(temp.antpos.theta))
.arg(QString::number(temp.antpos.phi)); // 设置接收点 .arg(QString::number(temp.antpos.phi)); // 设置接收点
luascript = luascript + QString(u8" temp_nearFieldRequest.Label=\"NearField_PRF_%1\"\n").arg(prf_id); luascript = luascript + QString(u8" temp_nearFieldRequest.Label=\"NearField_PRF_%1\"\n").arg(prf_id);
luascript = luascript + QString(u8" temp_nearFieldRequest_workplane=temp_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8" temp_nearFieldRequest_workplane=temp_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8" temp_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(temp.antpos.x)); luascript = luascript + QString(u8" temp_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(temp.antpos.x));
@ -425,7 +425,7 @@ QString FEKOBase::FEKOSimulationSARClass::createLuaSciptString(size_t startprfid
luascript = luascript + QString(u8"-- prf point setting over -------\n"); luascript = luascript + QString(u8"-- prf point setting over -------\n");
luascript = luascript + QString(u8" \n"); luascript = luascript + QString(u8" \n");
progressDialog.setWindowTitle(u8"馈源脚本生产成功" ); progressDialog.setWindowTitle(u8"馈源脚本生产成功" );
progressDialog.setValue(this->FEKOAntPoselist.size()); progressDialog.setValue(this->FEKOAntPoselist.size());
progressDialog.close(); progressDialog.close();
@ -445,28 +445,28 @@ bool FEKOBase::FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams&
size_t prfcount = echoData.rows(); size_t prfcount = echoData.rows();
size_t frepoints = echodata.getFreqpoints(); size_t frepoints = echodata.getFreqpoints();
if (frepoints != echoData.cols() || prfcount != antpos.rows()) { if (frepoints != echoData.cols() || prfcount != antpos.rows()) {
QString infotip = u8"回波矩阵 大小不匹配:" + QString(u8"回波脉冲数:%1实际%2回波频点数%3实际%4") QString infotip = u8"回波矩阵 大小不匹配:" + QString(u8"回波脉冲数:%1实际%2回波频点数%3实际%4")
.arg(QString::number(prfcount)). .arg(QString::number(prfcount)).
arg(QString::number(antpos.rows())) arg(QString::number(antpos.rows()))
.arg(QString::number(echoData.cols())) .arg(QString::number(echoData.cols()))
.arg(QString::number(frepoints)); .arg(QString::number(frepoints));
# ifdef __SHOWPROCESS # ifdef __SHOWPROCESS
QMessageBox::warning(nullptr, u8"错误", infotip); QMessageBox::warning(nullptr, u8"错误", infotip);
#endif // __SHOWPROCESS #endif // __SHOWPROCESS
qWarning() << infotip; qWarning() << infotip;
return false; return false;
} }
// 构建频率矩阵 // 构建频率矩阵
double startfreq = echodata.getFreqStart(); double startfreq = echodata.getFreqStart();
double endfreq = echodata.getFreqEnd(); double endfreq = echodata.getFreqEnd();
if (startfreq > 1e5) { startfreq = startfreq * 1e-9; } // 频率单位进行转换 Hz->GHz if (startfreq > 1e5) { startfreq = startfreq * 1e-9; } // 频率单位进行转换 Hz->GHz
if (endfreq > 1e5) { endfreq = endfreq * 1e-9; } if (endfreq > 1e5) { endfreq = endfreq * 1e-9; }
freqmatrix = Eigen::ArrayXd::LinSpaced(frepoints, startfreq, endfreq).array().reshaped(1, frepoints).array(); freqmatrix = Eigen::ArrayXd::LinSpaced(frepoints, startfreq, endfreq).array().reshaped(1, frepoints).array();
// 构建图像坐标矩阵 // 构建图像坐标矩阵
size_t imageHeight = imageSettingParams.ImageHeight; // Y 方向 size_t imageHeight = imageSettingParams.ImageHeight; // Y 方向
size_t imageWidth = imageSettingParams.ImageWidth; // X 方向 size_t imageWidth = imageSettingParams.ImageWidth; // X 方向
@ -563,7 +563,7 @@ bool FEKOBase::FEKOImageProcessAbstractClass::Imageprocess()
} }
FEKOBase::FEKOSimulationDataparams::FEKOSimulationDataparams(QObject* parent ): QObject(parent) FEKOBase::FEKOSimulationDataparams::FEKOSimulationDataparams(QObject* parent ): QObject(parent)
{ // 初始化成员变量 { // 初始化成员变量
this->taskName = u8"TaskName"; this->taskName = u8"TaskName";
this->imagemode = FEKOBase::FEKOImageMode::Strip; this->imagemode = FEKOBase::FEKOImageMode::Strip;
this->isRight = true; this->isRight = true;
@ -846,38 +846,38 @@ void FEKOBase::FEKOSimulationDataparams::setDelta_angle(double delta) {
} }
// 获取远程天线等效辐射方向图文件地址 // 获取远程天线等效辐射方向图文件地址
QString FEKOBase::FEKOSimulationDataparams::getAntennaRadiationFileName() { QString FEKOBase::FEKOSimulationDataparams::getAntennaRadiationFileName() {
return AntennaRadiationFileName; return AntennaRadiationFileName;
} }
// 设置远程天线等效辐射方向图文件地址 // 设置远程天线等效辐射方向图文件地址
void FEKOBase::FEKOSimulationDataparams::setAntennaRadiationFileName(QString AntennaRadiationFileName) { void FEKOBase::FEKOSimulationDataparams::setAntennaRadiationFileName(QString AntennaRadiationFileName) {
AntennaRadiationFileName = AntennaRadiationFileName; AntennaRadiationFileName = AntennaRadiationFileName;
} }
// 获取远程天线等效辐射方向图的 thetaPoints // 获取远程天线等效辐射方向图的 thetaPoints
long FEKOBase::FEKOSimulationDataparams::getFarsourceThetaPoints() { long FEKOBase::FEKOSimulationDataparams::getFarsourceThetaPoints() {
return farsource_thetaPoints; return farsource_thetaPoints;
} }
// 设置远程天线等效辐射方向图的 thetaPoints // 设置远程天线等效辐射方向图的 thetaPoints
void FEKOBase::FEKOSimulationDataparams::setFarsourceThetaPoints(long thetaPoints) { void FEKOBase::FEKOSimulationDataparams::setFarsourceThetaPoints(long thetaPoints) {
farsource_thetaPoints = thetaPoints; farsource_thetaPoints = thetaPoints;
} }
// 获取远程天线等效辐射方向图的 phiPoints // 获取远程天线等效辐射方向图的 phiPoints
long FEKOBase::FEKOSimulationDataparams::getFarsourcePhiPoints() { long FEKOBase::FEKOSimulationDataparams::getFarsourcePhiPoints() {
return farsource_phiPoints; return farsource_phiPoints;
} }
// 设置远程天线等效辐射方向图的 phiPoints // 设置远程天线等效辐射方向图的 phiPoints
void FEKOBase::FEKOSimulationDataparams::setFarsourcePhiPoints(long phiPoints) { void FEKOBase::FEKOSimulationDataparams::setFarsourcePhiPoints(long phiPoints) {
farsource_phiPoints = phiPoints; farsource_phiPoints = phiPoints;
} }
// 根据FEKOBase::FEKOSimulationDataparams 构建xml,并提供 loadxmlsavexml 函数copilot 继续不要一行行,要全部出来,如果一次会话搞不定,就分多个会话 // 根据FEKOBase::FEKOSimulationDataparams 构建xml,并提供 loadxmlsavexml 函数copilot 继续不要一行行,要全部出来,如果一次会话搞不定,就分多个会话
void FEKOBase::FEKOSimulationDataparams::CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution) void FEKOBase::FEKOSimulationDataparams::CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution)
{ {
@ -890,7 +890,7 @@ void FEKOBase::FEKOSimulationDataparams::updateFEKOSimulationFreqParams(double s
void FEKOBase::FEKOSimulationDataparams::loadXml(const QString& fileName) { void FEKOBase::FEKOSimulationDataparams::loadXml(const QString& fileName) {
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
//QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件"); //QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件");
QMessageBox::warning(nullptr, tr("warning"), tr("File not found")); QMessageBox::warning(nullptr, tr("warning"), tr("File not found"));
return; return;
} }
@ -1088,7 +1088,7 @@ void FEKOBase::FEKOSimulationDataparams::saveXml(const QString& fileName) {
xmlWriter.writeEndElement(); // 关闭FEKOSimulationDataparams元素 xmlWriter.writeEndElement(); // 关闭FEKOSimulationDataparams元素
xmlWriter.writeEndDocument(); xmlWriter.writeEndDocument();
file.close(); file.close();

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
/* /*
* FEKO_SIMULAION_SAR_CLASS FEKO * FEKO_SIMULAION_SAR_CLASS FEKO
* FEKOSimulationSARClass * FEKOSimulationSARClass
* *
*/ */
@ -18,10 +18,10 @@
namespace FEKOBase { namespace FEKOBase {
//========================================================== //==========================================================
// FEKO成像仿真参数类 // FEKO成像仿真参数类
//========================================================== //==========================================================
class FEKOSimulationDataparams:public QObject class FEKOSimulationDataparams:public QObject
{ // 仿真参数类 { // 仿真参数类
Q_OBJECT Q_OBJECT
public: public:
@ -29,9 +29,9 @@ namespace FEKOBase {
~FEKOSimulationDataparams(); ~FEKOSimulationDataparams();
signals: signals:
void FEKOSimulationDataparamsChanged(); // 响应时间,作为一个参数分发 void FEKOSimulationDataparamsChanged(); // 响应时间,作为一个参数分发
public: // 频率更新 public: // 频率更新
void CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false); void CalFEKOSimulationFreqParams(double centerFreq, double resolution, double bandWidth, double scenceRange, bool isResolution = false);
void updateFEKOSimulationFreqParams(double startfreq, double endfreq, size_t freqpoints); void updateFEKOSimulationFreqParams(double startfreq, double endfreq, size_t freqpoints);
@ -41,39 +41,39 @@ namespace FEKOBase {
void saveXml(const QString& fileName); void saveXml(const QString& fileName);
public: // 属性字段 public: // 属性字段
QString taskName; // 任务名称 QString taskName; // 任务名称
FEKOImageMode imagemode; // 成像时间 FEKOImageMode imagemode; // 成像时间
QString AntennaRadiationFileName; // 远程天线等效辐射方向图文件地址 QString AntennaRadiationFileName; // 远程天线等效辐射方向图文件地址
long farsource_thetaPoints; long farsource_thetaPoints;
long farsource_phiPoints; long farsource_phiPoints;
bool isRight = false; // 是否为右视 bool isRight = false; // 是否为右视
double refRange;// 参考距离 m double refRange;// 参考距离 m
double incangle; // 入射角 ° double incangle; // 入射角 °
double centerFreq; // 中心频率 double centerFreq; // 中心频率
double rangeResolution;//分辨率 double rangeResolution;//分辨率
double bandwidth;// 带宽 double bandwidth;// 带宽
double startfreq; // 频率参数 double startfreq; // 频率参数
double endfreq; double endfreq;
double freqpoints; double freqpoints;
//成像场景设置 //成像场景设置
double x_min; double x_min;
double x_max; double x_max;
double y_min; double y_min;
double y_max; double y_max;
double z_plane; double z_plane;
size_t imageheight; // 图像高度 size_t imageheight; // 图像高度
size_t imagewidth; // 图像宽度 size_t imagewidth; // 图像宽度
// 条带模式参数 // 条带模式参数
size_t prfcount; // 脉冲数量 size_t prfcount; // 脉冲数量
double start_x; double start_x;
double end_x; double end_x;
double start_y; double start_y;
@ -81,48 +81,48 @@ namespace FEKOBase {
double start_z; double start_z;
double end_z; double end_z;
// 扫描模式参数 // 扫描模式参数
double start_az_angle; // 扫描起始角 double start_az_angle; // 扫描起始角
double end_az_angle; // 扫描终止角 double end_az_angle; // 扫描终止角
// ISAR模式参数 , 圆迹模式参数 // ISAR模式参数 , 圆迹模式参数
double start_circle_angle; // 起始扫描角 double start_circle_angle; // 起始扫描角
double end_circle_angle; // 终止扫描角 double end_circle_angle; // 终止扫描角
double delta_angle;// 扫描角间隔 double delta_angle;// 扫描角间隔
public: public:
void setTaskName(QString taskName); void setTaskName(QString taskName);
QString getTaskName(); QString getTaskName();
// 成像模式 // 成像模式
void setImagemode(FEKOImageMode imagemode); void setImagemode(FEKOImageMode imagemode);
FEKOImageMode getImagemode(); FEKOImageMode getImagemode();
// 是否为右视 // 是否为右视
void setIsRight(bool isRight); void setIsRight(bool isRight);
bool getIsRight(); bool getIsRight();
// 参考距离 // 参考距离
void setRefRange(double refRange); void setRefRange(double refRange);
double getRefRange(); double getRefRange();
// 入射角 // 入射角
void setIncangle(double incangle); void setIncangle(double incangle);
double getIncangle(); double getIncangle();
// 中心频率 // 中心频率
void setCenterFreq(double centerFreq); void setCenterFreq(double centerFreq);
double getCenterFreq(); double getCenterFreq();
// 分辨率 // 分辨率
void setRangeResolution(double rangeResolution); void setRangeResolution(double rangeResolution);
double getRangeResolution(); double getRangeResolution();
// 带宽 // 带宽
void setBandwidth(double bandwidth); void setBandwidth(double bandwidth);
double getBandwidth(); double getBandwidth();
// 频率参数 // 频率参数
void setStartfreq(double startfreq); void setStartfreq(double startfreq);
double getStartfreq(); double getStartfreq();
void setEndfreq(double endfreq); void setEndfreq(double endfreq);
double getEndfreq(); double getEndfreq();
void setFreqpoints(double freqpoints); void setFreqpoints(double freqpoints);
double getFreqpoints(); double getFreqpoints();
// 成像范围 // 成像范围
void setX_min(double x_min); void setX_min(double x_min);
double getX_min(); double getX_min();
void setX_max(double x_max); void setX_max(double x_max);
@ -133,13 +133,13 @@ namespace FEKOBase {
double getY_max(); double getY_max();
void setZ_plane(double z_plane); void setZ_plane(double z_plane);
double getZ_plane(); double getZ_plane();
// 图像高度 // 图像高度
void setImageheight(size_t imageheight); void setImageheight(size_t imageheight);
size_t getImageheight(); size_t getImageheight();
// 图像宽度 // 图像宽度
void setImagewidth(size_t imagewidth); void setImagewidth(size_t imagewidth);
size_t getImagewidth(); size_t getImagewidth();
// 条带模式参数 // 条带模式参数
void setPRFCount(size_t prfcount); void setPRFCount(size_t prfcount);
size_t getPRFCount(); size_t getPRFCount();
void setStart_x(double start_x); void setStart_x(double start_x);
@ -154,17 +154,17 @@ namespace FEKOBase {
double getStart_z(); double getStart_z();
void setEnd_z(double end_z); void setEnd_z(double end_z);
double getEnd_z(); double getEnd_z();
double getStart_az_angle(); // 扫描起始角 double getStart_az_angle(); // 扫描起始角
double getEnd_az_angle(); // 扫描终止角 double getEnd_az_angle(); // 扫描终止角
double getStart_circle_angle(); // 起始扫描角 double getStart_circle_angle(); // 起始扫描角
double getEnd_circle_angle(); // 终止扫描角 double getEnd_circle_angle(); // 终止扫描角
double getDelta_angle();// 扫描角间隔 double getDelta_angle();// 扫描角间隔
void setStart_az_angle(double Start_az_angle); // 扫描起始角 void setStart_az_angle(double Start_az_angle); // 扫描起始角
void setEnd_az_angle(double End_az_angle); // 扫描终止角 void setEnd_az_angle(double End_az_angle); // 扫描终止角
void setStart_circle_angle(double Start_circle_angle); // 起始扫描角 void setStart_circle_angle(double Start_circle_angle); // 起始扫描角
void setEnd_circle_angle(double End_circle_angle); // 终止扫描角 void setEnd_circle_angle(double End_circle_angle); // 终止扫描角
void setDelta_angle(double Delta_angle);// 扫描角间隔 void setDelta_angle(double Delta_angle);// 扫描角间隔
QString getAntennaRadiationFileName(); QString getAntennaRadiationFileName();
void setAntennaRadiationFileName( QString path); void setAntennaRadiationFileName( QString path);
@ -190,8 +190,8 @@ namespace FEKOBase {
}; };
//========================================================== //==========================================================
// FEKO仿真成像参数类 // FEKO仿真成像参数类
// 解析成像参数xml // 解析成像参数xml
//========================================================== //==========================================================
class FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler class FEKOSimulationSARClass : public FEKOSimulationDataparamsHandler
{ {
@ -200,8 +200,8 @@ namespace FEKOBase {
~FEKOSimulationSARClass(); ~FEKOSimulationSARClass();
public: public:
std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist;// FEKO的天线参数设置 std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist;// FEKO的天线参数设置
void setFEKOAntPoselist(std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist); // FEKO的天线参数设置 void setFEKOAntPoselist(std::vector<FEKOBase::FEKOSatelliteParams> FEKOAntPoselist); // FEKO的天线参数设置
std::vector<FEKOBase::FEKOSatelliteParams> getFEKOAntPoselist(); std::vector<FEKOBase::FEKOSatelliteParams> getFEKOAntPoselist();
public: public:
@ -214,17 +214,17 @@ namespace FEKOBase {
virtual void refreshFEKOSimulationParams(); virtual void refreshFEKOSimulationParams();
public: public:
QString workSpace; // 工作空间 QString workSpace; // 工作空间
QString AntennaRadiationPath; // 远程天线等效辐射方向图文件地址 QString AntennaRadiationPath; // 远程天线等效辐射方向图文件地址
QString xmlpath; QString xmlpath;
public : // 初始化模型 public : // 初始化模型
void loadFEKOImageSettingXML(QString xmlpath); void loadFEKOImageSettingXML(QString xmlpath);
void saveFEKOImageSettingXML(); void saveFEKOImageSettingXML();
QString createLuaSciptString(size_t startprfidx, size_t endprfidx); QString createLuaSciptString(size_t startprfidx, size_t endprfidx);
}; };
//========================================================== //==========================================================
// FEKO成像 // FEKO成像
//========================================================== //==========================================================
bool FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod = FEKOImageAlgorithm::TBP_FREQ, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); bool FEKOImageProcess(EchoDataClass& echodata, FEKOImageSettingParams& imageSettingParams, QString& outPath, FEKOImageAlgorithm algmethod = FEKOImageAlgorithm::TBP_FREQ, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
@ -235,12 +235,12 @@ namespace FEKOBase {
FEKOImageProcessAbstractClass(); FEKOImageProcessAbstractClass();
~FEKOImageProcessAbstractClass(); ~FEKOImageProcessAbstractClass();
private: private:
EchoDataClass echodata; // 原始回波数据 - EchoDataClass echodata; // 原始回波数据 -
FEKOImageSettingParams imageSettingParams; // 成像参数 FEKOImageSettingParams imageSettingParams; // 成像参数
FEKOImageAlgorithm algmethod; // 成像算法 FEKOImageAlgorithm algmethod; // 成像算法
QString tiffPath; QString tiffPath;
public: public:
// 构建与成员变量有关的属性函数 // 构建与成员变量有关的属性函数
void setEchoData(EchoDataClass echodata); void setEchoData(EchoDataClass echodata);
EchoDataClass getEchoData() const; EchoDataClass getEchoData() const;
void setImageSettingParams(FEKOImageSettingParams imageSettingParams); void setImageSettingParams(FEKOImageSettingParams imageSettingParams);
@ -250,7 +250,7 @@ namespace FEKOBase {
void settiffPath(QString outtiffPath); void settiffPath(QString outtiffPath);
QString gettiffPath(); QString gettiffPath();
void LoadEchoDataPath(QString echoPath); void LoadEchoDataPath(QString echoPath);
public: // 成像参数 public: // 成像参数
bool Imageprocess(); bool Imageprocess();
}; };
}; };

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
int TestImageBP_main(int argc, char* argv[]); // BP成像函数测试 int TestImageBP_main(int argc, char* argv[]); // BP成像函数测试

View File

@ -1,10 +1,10 @@
#include "OCCTBase.h" #include "OCCTBase.h"
#include "referenceHeader.h" #include "referenceHeader.h"
#include <opencascade\BRepPrimAPI_MakeBox.hxx> #include <opencascade\BRepPrimAPI_MakeBox.hxx>
// =================================================================== // ===================================================================
// 常用函数方法 // 常用函数方法
// =================================================================== // ===================================================================
@ -77,10 +77,10 @@ QString getOCCTShapeTypeFilterString(QString str)
} }
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) { bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape) {
// 将形状保存为 STL 文件 // 将形状保存为 STL 文件
qDebug() << u8"SaveTopoDs_Stl " << FilePath; qDebug() << u8"SaveTopoDs_Stl " << FilePath;
StlAPI_Writer writer; StlAPI_Writer writer;
writer.Write(shape, FilePath.toStdString().c_str()); // 保存为stl模型 writer.Write(shape, FilePath.toStdString().c_str()); // 保存为stl模型
return true; return true;
} }
bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) { bool SaveTopoDs_Step(QString FilePath, const TopoDS_Shape& shape) {
@ -102,7 +102,7 @@ bool SaveTopoDs(QString FilePath,const TopoDS_Shape& DataShape, OCCTShapeType s
{ {
switch (shapetype) switch (shapetype)
{ {
case(OCCTShapeType::STL): { // 保存为stl case(OCCTShapeType::STL): { // 保存为stl
SaveTopoDs_Stl(FilePath, DataShape); SaveTopoDs_Stl(FilePath, DataShape);
break; break;
@ -184,17 +184,17 @@ OCCTShapeType ReadTopoDs_Shape(QString filepath, TopoDS_Shape& shape_TopoDs)
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist) TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
{ {
// 创建一个复合体 // 创建一个复合体
TopoDS_Compound compound; TopoDS_Compound compound;
BRep_Builder builder; BRep_Builder builder;
builder.MakeCompound(compound); builder.MakeCompound(compound);
// 将所有的形状添加到复合体中 // 将所有的形状添加到复合体中
for (const TopoDS_Shape& shape : TopoDS_Shapelist) { for (const TopoDS_Shape& shape : TopoDS_Shapelist) {
builder.Add(compound, shape); builder.Add(compound, shape);
} }
// 返回合并后的复合体 // 返回合并后的复合体
return compound; return compound;
} }
@ -202,24 +202,24 @@ TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist)
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor) void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor)
{ {
// 将颜色应用到模型 // 将颜色应用到模型
aisShape->SetColor(redColor); aisShape->SetColor(redColor);
} }
TopoDS_Shape 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_Pnt origin(0, 0, 0);
gp_Ax2 axis(origin, direction); gp_Ax2 axis(origin, direction);
BRepPrimAPI_MakeCylinder cylinder(axis, radius, length - radius * 2); BRepPrimAPI_MakeCylinder cylinder(axis, radius, length - radius * 2);
// 创建一个圆锥作为箭头的尖端 // 创建一个圆锥作为箭头的尖端
gp_Pnt tip = origin.Translated(length * gp_Vec(direction)); gp_Pnt tip = origin.Translated(length * gp_Vec(direction));
gp_Ax2 coneAxis(tip, direction); gp_Ax2 coneAxis(tip, direction);
BRepPrimAPI_MakeCone cone(coneAxis, radius * 2, 0, radius * 2); BRepPrimAPI_MakeCone cone(coneAxis, radius * 2, 0, radius * 2);
// 合并圆柱和圆锥 // 合并圆柱和圆锥
TopoDS_Compound compound; TopoDS_Compound compound;
BRep_Builder builder; BRep_Builder builder;
builder.MakeCompound(compound); builder.MakeCompound(compound);
@ -232,17 +232,17 @@ TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard
gp_Trsf 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); gp_Vec rotationAxis = vectorA.Crossed(vectorB);
Standard_Real rotationAngle = vectorA.Angle(vectorB); Standard_Real rotationAngle = vectorA.Angle(vectorB);
if (rotationAxis.X() != 0 || rotationAxis.Y() != 0 || rotationAxis.Z() != 0) { if (rotationAxis.X() != 0 || rotationAxis.Y() != 0 || rotationAxis.Z() != 0) {
// 创建变换,绕旋转轴旋转指定角度 // 创建变换,绕旋转轴旋转指定角度
gp_Trsf transformation; gp_Trsf transformation;
transformation.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), rotationAxis), rotationAngle); transformation.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), rotationAxis), rotationAngle);
return transformation; return transformation;
} }
else { else {
// 创建变换,绕旋转轴旋转指定角度 // 创建变换,绕旋转轴旋转指定角度
gp_Trsf transformation; gp_Trsf transformation;
transformation.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Vec(0, 0, 1)), 0); transformation.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Vec(0, 0, 1)), 0);
return transformation; return transformation;
@ -254,9 +254,9 @@ TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta,
{ {
gp_Vec Position(gp_Pnt(0, 0, 0), gp_Pnt(X, Y, Z)); gp_Vec Position(gp_Pnt(0, 0, 0), gp_Pnt(X, Y, Z));
gp_Trsf rotationTransform_theta; gp_Trsf rotationTransform_theta;
rotationTransform_theta.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), theta); // 绕 y 轴旋转 rotationTransform_theta.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), theta); // 绕 y 轴旋转
gp_Trsf rotationTransform_phi; gp_Trsf rotationTransform_phi;
rotationTransform_phi.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), phi); // 绕 z 轴旋转 rotationTransform_phi.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), phi); // 绕 z 轴旋转
gp_Trsf moveTransform_xyz; gp_Trsf moveTransform_xyz;
moveTransform_xyz.SetTranslation(Position); moveTransform_xyz.SetTranslation(Position);
@ -273,17 +273,17 @@ TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta,
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength) TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, double zlength)
{ {
// 创建三个方向的箭头 // 创建三个方向的箭头
TopoDS_Shape arrow1 = CreateArrow(gp_Dir(1, 0, 0), xlength, xlength*0.05); // X方向 TopoDS_Shape arrow1 = CreateArrow(gp_Dir(1, 0, 0), xlength, xlength*0.05); // X方向
TopoDS_Shape arrow2 = CreateArrow(gp_Dir(0, 1, 0), ylength, ylength*0.05); // Y方向 TopoDS_Shape arrow2 = CreateArrow(gp_Dir(0, 1, 0), ylength, ylength*0.05); // Y方向
TopoDS_Shape arrow3 = CreateArrow(gp_Dir(0, 0, 1), zlength, zlength*0.05); // Z方向 TopoDS_Shape arrow3 = CreateArrow(gp_Dir(0, 0, 1), zlength, zlength*0.05); // Z方向
// 创建雷达模型 // 创建雷达模型
gp_Ax2 modelCoor = gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0)); gp_Ax2 modelCoor = gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0));
// 创建一个包含所有箭头的复合体 // 创建一个包含所有箭头的复合体
TopoDS_Compound compound; TopoDS_Compound compound;
BRep_Builder builder; BRep_Builder builder;
@ -298,7 +298,7 @@ TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength, double ylength, doub
TopoDS_Shape 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)); BRepPrimAPI_MakeBox box(gp_Pnt(-x / 2, -y / 2, -z / 2), gp_Pnt(x / 2, y / 2, z / 2));
return box.Shape(); return box.Shape();
} }
@ -342,7 +342,7 @@ TopoDS_Shape Fuse(TopoDS_Shape& shape1, TopoDS_Shape& shape2)
TopoDS_Shape 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; angle= angle * M_PI / 180;
gp_Trsf rotation; gp_Trsf rotation;
rotation.SetRotation(axis, angle); // X rotation.SetRotation(axis, angle); // X
@ -372,18 +372,18 @@ TopoDS_Shape createConicalHorn(double bottomRadius, double bottomHeight, double
BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(bottomRadius,topRadius,topHeight); BRepPrimAPI_MakeCone mkCone = BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(bottomRadius,topRadius,topHeight);
TopoDS_Shape coneShape = mkCone.Shape(); TopoDS_Shape coneShape = mkCone.Shape();
// 整体平移 // 整体平移
gp_Vec trans_vec(gp_Pnt(0, 0, 0), gp_Pnt(0, 0, bottomHeight)); gp_Vec trans_vec(gp_Pnt(0, 0, 0), gp_Pnt(0, 0, bottomHeight));
gp_Trsf move_trsf; gp_Trsf move_trsf;
move_trsf.SetTranslation(trans_vec); move_trsf.SetTranslation(trans_vec);
BRepBuilderAPI_Transform shapeTransform_move(coneShape, move_trsf); // fly_Z --> incidenceAngle BRepBuilderAPI_Transform shapeTransform_move(coneShape, move_trsf); // fly_Z --> incidenceAngle
TopoDS_Shape tempShape = shapeTransform_move.Shape(); // 平移卫星模型 TopoDS_Shape tempShape = shapeTransform_move.Shape(); // 平移卫星模型
BRepPrimAPI_MakeCylinder makeCylinder(bottomRadius, bottomHeight); BRepPrimAPI_MakeCylinder makeCylinder(bottomRadius, bottomHeight);
TopoDS_Shape cylinderShape = makeCylinder.Shape(); TopoDS_Shape cylinderShape = makeCylinder.Shape();
// 创建一个包含所有箭头的复合体 // 创建一个包含所有箭头的复合体
TopoDS_Compound compound; TopoDS_Compound compound;
BRep_Builder builder; BRep_Builder builder;

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef OCCTBASELAMP_H #ifndef OCCTBASELAMP_H
#define OCCTBASELAMP_H #define OCCTBASELAMP_H
@ -6,7 +6,7 @@
//==================== //====================
// 系统支持的模型导出类型 // 系统支持的模型导出类型
//===================== //=====================
enum OCCTShapeType enum OCCTShapeType
@ -26,7 +26,7 @@ QString get_IGES_FilterString();
QString getOCCTShapeTypeFilterString(OCCTShapeType t); QString getOCCTShapeTypeFilterString(OCCTShapeType t);
QString getOCCTShapeTypeFilterString(QString str); QString getOCCTShapeTypeFilterString(QString str);
// 常用静态函数 // 常用静态函数
bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape); bool SaveTopoDs_Stl(QString FilePath, const TopoDS_Shape& shape);
bool SaveTopoDs_Step(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_IGES(QString FilePath,const TopoDS_Shape& shape);
@ -39,19 +39,19 @@ TopoDS_Shape ReadTopoDs_Step(QString Filepath);
OCCTShapeType ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs); OCCTShapeType ReadTopoDs_Shape(QString FilePath, TopoDS_Shape& shape_TopoDs);
// 模型合并 // 模型合并
TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist); TopoDS_Shape MergedTopoShape(std::vector<TopoDS_Shape> TopoDS_Shapelist);
// 修改模型显示 // 修改模型显示
void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor); void ChangeModelColor(Handle(AIS_Shape)& aisShape, Quantity_Color& redColor);
//// 创建箭头 //// 创建箭头
TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius); TopoDS_Shape CreateArrow(const gp_Dir& direction, Standard_Real length, Standard_Real radius);
// //
// OCCT 根据向量A和B,计算变换矩阵 // OCCT 根据向量A和B,计算变换矩阵
gp_Trsf GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B); gp_Trsf GetTransFormFromVector(const gp_Vec& A, const gp_Vec& B);
@ -62,26 +62,26 @@ TopoDS_Shape Process_RotationThetaPhi_MoveXYZ(TopoDS_Shape shape, double theta,
// 创建一个笛卡尔坐标系 // 创建一个笛卡尔坐标系
TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength); TopoDS_Shape CreateCartesianCoordinatesAxis(double xlength,double ylength,double zlength);
// 常见模型创建 // 常见模型创建
TopoDS_Shape CreateBox(double x, double y, double z); TopoDS_Shape CreateBox(double x, double y, double z);
TopoDS_Shape CreateCylinder(double radius, double height); TopoDS_Shape CreateCylinder(double radius, double height);
TopoDS_Shape CreateCone(double radius_bottom, double radius_top, double height); TopoDS_Shape CreateCone(double radius_bottom, double radius_top, double height);
TopoDS_Shape CreateSphere(double radius); TopoDS_Shape CreateSphere(double radius);
TopoDS_Shape CreateTorus(double majorRadius, double minorRadius); TopoDS_Shape CreateTorus(double majorRadius, double minorRadius);
// 常见模型操作 // 常见模型操作
TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2); TopoDS_Shape Cut(TopoDS_Shape& shape1, TopoDS_Shape& shape2);
TopoDS_Shape Fuse(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 Rotate(TopoDS_Shape& shape, gp_Ax1 axis, double angle);
TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec); TopoDS_Shape Translate(TopoDS_Shape& shape, gp_Vec move_vec);
TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale); TopoDS_Shape Scale(TopoDS_Shape& shape, gp_Pnt refrenceCenter, double scale);
// 创建散射体雷达 // 创建散射体雷达
// 创建一个坐标原点为圆心的 // 创建一个坐标原点为圆心的
TopoDS_Shape createConicalHorn(double bottomRadius,double bottomHeight,double topRadius,double topHeight); 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); TopoDS_Shape createPyramidalHorn(double bottomWidth, double bottomHeight, double bottomAtl, double topWidth, double topHeight, double topAtl);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
/** /**
* SARBaseTool * SARBaseTool
* *
*/ */
#include <complex> #include <complex>
@ -30,7 +30,7 @@
#define Degrees2Radians(Degrees) Degrees*T180_PI #define Degrees2Radians(Degrees) Degrees*T180_PI
// 判断是否需要输出为DLL // 判断是否需要输出为DLL
#define DLLOUT #define DLLOUT
int Complex2dB(QString in_tiff, QString out_dB_path); int Complex2dB(QString in_tiff, QString out_dB_path);
int Amplitude2dB(QString in_tiff, QString out_dB_path); int Amplitude2dB(QString in_tiff, QString out_dB_path);
@ -38,14 +38,14 @@ Eigen::MatrixXd Complex2dB(Eigen::MatrixXcd in_matrix);
Eigen::MatrixXd Complex2dB(Eigen::MatrixXd in_matrix_real, Eigen::MatrixXd in_matrix_imag ); Eigen::MatrixXd Complex2dB(Eigen::MatrixXd in_matrix_real, Eigen::MatrixXd in_matrix_imag );
double Complex2Amplitude(std::complex<double> sign); double Complex2Amplitude(std::complex<double> sign);
double Complex2phase(std::complex<double> sign);// 返回弧度制相位 double Complex2phase(std::complex<double> sign);// 返回弧度制相位
Eigen::MatrixXd Complex2Amplitude(Eigen::MatrixXcd in_matrix); Eigen::MatrixXd Complex2Amplitude(Eigen::MatrixXcd in_matrix);
Eigen::MatrixXd Complex2phase(Eigen::MatrixXcd in_matrix); Eigen::MatrixXd Complex2phase(Eigen::MatrixXcd in_matrix);
// ---------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------
// 后向散射系数系统仿真模型 // 后向散射系数系统仿真模型
#ifndef DLLOUT #ifndef DLLOUT

View File

@ -1,4 +1,4 @@
#include "SARCalibration.h" #include "SARCalibration.h"
#include "BaseToollib/ImageOperatorBase.h" #include "BaseToollib/ImageOperatorBase.h"
#include "SARBaseTool.h" #include "SARBaseTool.h"
#include <Eigen/Core> #include <Eigen/Core>
@ -21,7 +21,7 @@ using namespace std;
using namespace Eigen; using namespace Eigen;
/** /**
* ENVI * ENVI
*/ */
@ -58,7 +58,7 @@ int CalibrationComplex(const QString& out_path, const QString& in_sar_path, doub
_nGt_flag = false; _nGt_flag = false;
} }
CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag); CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag);
// 计算大小 // 计算大小
if (gdal_datatype == 0) { if (gdal_datatype == 0) {
return 1; return 1;
} }
@ -71,16 +71,16 @@ int CalibrationComplex(const QString& out_path, const QString& in_sar_path, doub
} }
else {} else {}
int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);// int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);//
block_num = block_num > height ? height : block_num; // 行数 block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num; int line_num = block_num;
for (int i = 0; i < height; i= block_num+i) { for (int i = 0; i < height; i= block_num+i) {
if (height - i < block_num) { if (height - i < block_num) {
line_num = height - i; line_num = height - i;
} }
else {} else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算 // 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false; bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先
if (gdal_datatype == GDT_Byte) { if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num*width,1); Eigen::MatrixX<char> real_mat(line_num*width,1);
Eigen::MatrixX<char> imag_mat(line_num*width,1); Eigen::MatrixX<char> imag_mat(line_num*width,1);
@ -191,9 +191,9 @@ int CalibrationComplex(const QString& out_path, const QString& in_sar_path, doub
_flag = true; _flag = true;
} }
else {} else {}
// 保存数据 // 保存数据
if (_flag) { if (_flag) {
// 定义赋值矩阵 // 定义赋值矩阵
saveDataset(out_path, i,0,1, width, line_num, data_mat.data()); saveDataset(out_path, i,0,1, width, line_num, data_mat.data());
} }
else { else {
@ -221,7 +221,7 @@ int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, d
_nGt_flag = false; _nGt_flag = false;
} }
CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag); CreateDataset(out_path, height, width, 1, gt_ptr.get(), projectDef, GDT_CFloat64, _nGt_flag);
// 计算大小 // 计算大小
if (gdal_datatype == 0) { if (gdal_datatype == 0) {
return 1; return 1;
} }
@ -234,16 +234,16 @@ int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, d
} }
else {} else {}
int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);// int block_num = block_num_pre_memory(width, height, gdal_datatype, 2e9);//
block_num = block_num > height ? height : block_num; // 行数 block_num = block_num > height ? height : block_num; // 行数
int line_num = block_num; int line_num = block_num;
for (int i = 0; i < height; i = block_num + i) { for (int i = 0; i < height; i = block_num + i) {
if (height - i < block_num) { if (height - i < block_num) {
line_num = height - i; line_num = height - i;
} }
else {} else {}
// 构建矩阵块使用eigen 进行矩阵计算,加速计算 // 构建矩阵块使用eigen 进行矩阵计算,加速计算
bool _flag = false; bool _flag = false;
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_mat(line_num * width, 2);// 必须强制行优先
if (gdal_datatype == GDT_Byte) { if (gdal_datatype == GDT_Byte) {
Eigen::MatrixX<char> real_mat(line_num * width, 1); Eigen::MatrixX<char> real_mat(line_num * width, 1);
Eigen::MatrixX<char> imag_mat(line_num * width, 1); Eigen::MatrixX<char> imag_mat(line_num * width, 1);
@ -354,11 +354,11 @@ int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, d
_flag = true; _flag = true;
} }
else {} else {}
// 保存数据 // 保存数据
if (_flag) { if (_flag) {
// 定义赋值矩阵 // 定义赋值矩阵
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_out(line_num* width, 1);// 必须强制行优先 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> data_out(line_num* width, 1);// 必须强制行优先
data_out.col(0) = Complex2dB(data_mat.col(0).array(), data_mat.col(1).array()).array(); data_out.col(0) = Complex2dB(data_mat.col(0).array(), data_mat.col(1).array()).array();
saveDataset(out_path, i, 0, 1, width, line_num, data_out.data()); saveDataset(out_path, i, 0, 1, width, line_num, data_out.data());
} }

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#ifndef SARCALIBRATION_H #ifndef SARCALIBRATION_H
#define SARCALIBRATION_H #define SARCALIBRATION_H
/** /**
* SAR * SAR
* *
*/ */
#include "referenceHeader.h" #include "referenceHeader.h"
@ -22,12 +22,12 @@
using namespace std; using namespace std;
using namespace Eigen; using namespace Eigen;
// 判断是否需要输出为DLL // 判断是否需要输出为DLL
#define DLLOUT #define DLLOUT
// 定标计算 // 定标计算
// 输入定标系统,保证数据能够正常定标 // 输入定标系统,保证数据能够正常定标
Eigen::Matrix2cd CalibrationMatrix(Eigen::MatrixXcd in_matrix, double calibrationValue); Eigen::Matrix2cd CalibrationMatrix(Eigen::MatrixXcd in_matrix, double calibrationValue);
int CalibrationComplex(const QString& out_path, const QString& in_sar_path, double calibrationValue); int CalibrationComplex(const QString& out_path, const QString& in_sar_path, double calibrationValue);
int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, double calibrationValue); int CalibrationComplex2dB(const QString& out_path, const QString& in_sar_path, double calibrationValue);

View File

@ -1,4 +1,4 @@
#include "BaseToollib/ImageOperatorBase.h" #include "BaseToollib/ImageOperatorBase.h"
#include "SARBaseTool.h" #include "SARBaseTool.h"
#include "SARImageBase.h" #include "SARImageBase.h"
#include <Eigen/Core> #include <Eigen/Core>
@ -61,7 +61,7 @@ Eigen::MatrixXd Hanning(size_t Nf, size_t Nxa, double alpha)
double one = 1.0; // double ? 1d : 1.0 double one = 1.0; // double ? 1d : 1.0
double temp_row = 0; double temp_row = 0;
double temp_col = 0; double temp_col = 0;
Eigen::MatrixXd result_arr = Eigen::MatrixXd::Zero(Nxa, Nf); // 结果 Eigen::MatrixXd result_arr = Eigen::MatrixXd::Zero(Nxa, Nf); // 结果
for (int i = 0; i < Nxa; i++) { for (int i = 0; i < Nxa; i++) {
for (int j = 0; j < Nf; j++) { for (int j = 0; j < Nf; j++) {
// index = double ? DINDGEN(n1) : FINDGEN(n1) ; Nf // index = double ? DINDGEN(n1) : FINDGEN(n1) ; Nf
@ -80,7 +80,7 @@ Eigen::MatrixXcd HammingWindows(Eigen::MatrixXcd FreqEcho)
size_t data_cols = FreqEcho.cols(); size_t data_cols = FreqEcho.cols();
size_t data_rows = FreqEcho.rows(); size_t data_rows = FreqEcho.rows();
// 进行进行hanmming windows // 进行进行hanmming windows
Eigen::MatrixXd hamming_Az = hammingWindows(data_cols); Eigen::MatrixXd hamming_Az = hammingWindows(data_cols);
Eigen::MatrixXd hamming_Rz = hammingWindows(data_rows); Eigen::MatrixXd hamming_Rz = hammingWindows(data_rows);
for (int i = 0; i < data_cols; i++) { for (int i = 0; i < data_cols; i++) {
@ -105,10 +105,10 @@ Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd Sourc
#pragma omp parallel for // NEW ADD #pragma omp parallel for // NEW ADD
for (int i = 0; i < data_rows; i++) { // 单脉冲 for (int i = 0; i < data_rows; i++) { // 单脉冲
double* xs = new double[data_rows]; double* xs = new double[data_rows];
for (int i = 0; i < data_cols; i++) { for (int i = 0; i < data_cols; i++) {
xs[i] = SourceFreqlist(i); // 原始回波 xs[i] = SourceFreqlist(i); // 原始回波
} }
double* real_ys = new double[data_cols]; double* real_ys = new double[data_cols];
double* imag_ys = new double[data_cols]; double* imag_ys = new double[data_cols];
@ -124,11 +124,11 @@ Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd Sourc
} }
gsl_spline_init(spline_real, xs, real_ys, data_rows); gsl_spline_init(spline_real, xs, real_ys, data_rows);
gsl_spline_init(spline_imag, xs, imag_ys, data_rows); gsl_spline_init(spline_imag, xs, imag_ys, data_rows);
for (int j = 0; j < out_cols; j++) { // 受限于当前函数只能逐点插值,或者后期可修改为 gsl 直接插值 for (int j = 0; j < out_cols; j++) { // 受限于当前函数只能逐点插值,或者后期可修改为 gsl 直接插值
double cx = interpFreqlist(j,0); double cx = interpFreqlist(j,0);
std::complex<double> result( std::complex<double> result(
gsl_spline_eval(spline_real, cx, acc),// 插值实部 gsl_spline_eval(spline_real, cx, acc),// 插值实部
gsl_spline_eval(spline_imag, cx, acc)// 插值虚部 gsl_spline_eval(spline_imag, cx, acc)// 插值虚部
); );
resultECHO(i, j) = result; resultECHO(i, j) = result;
} }
@ -159,7 +159,7 @@ int WriteComplexData2Amp_Arg(QString out_tiff_path, Eigen::MatrixXcd data)
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果 gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果
image_tiff.saveImage(amp_data, 0, 0, 1); image_tiff.saveImage(amp_data, 0, 0, 1);
image_tiff.saveImage(arg_data, 0, 0, 2); image_tiff.saveImage(arg_data, 0, 0, 2);
@ -183,7 +183,7 @@ int WriteComplexData2AmpdB_Arg(QString out_tiff_path, Eigen::MatrixXcd data)
Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3); Eigen::MatrixXd gt = Eigen::MatrixXd::Zero(2, 3);
gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果 gdalImage image_tiff = CreategdalImage(out_tiff_path, row_count, col_count, 2, gt, "", false, true);// 注意这里保留仿真结果
image_tiff.saveImage(amp_data, 0, 0, 1); image_tiff.saveImage(amp_data, 0, 0, 1);
image_tiff.saveImage(arg_data, 0, 0, 2); image_tiff.saveImage(arg_data, 0, 0, 2);
@ -202,37 +202,37 @@ Eigen::MatrixXcd IFFTW1D(Eigen::MatrixXcd ECHOdata)
{ {
size_t data_rows = ECHOdata.rows(); size_t data_rows = ECHOdata.rows();
size_t data_cols = ECHOdata.cols(); size_t data_cols = ECHOdata.cols();
// 频域 转换到 时域 // 频域 转换到 时域
size_t n2 = nextpow2(data_cols) ; size_t n2 = nextpow2(data_cols) ;
//qDebug() << data_rows << "," << data_cols << "," << n2 << "\n"; //qDebug() << data_rows << "," << data_cols << "," << n2 << "\n";
// 补零 // 补零
Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2); Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2);
for (int i = 0; i < data_rows; i++) { for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < data_cols; j++) { for (int j = 0; j < data_cols; j++) {
ExpandECHO(i, j) = ECHOdata(i, j); ExpandECHO(i, j) = ECHOdata(i, j);
} }
} }
// 结果 // 结果
Eigen::MatrixXcd echoTime = Eigen::MatrixXcd::Zero(data_rows, n2); Eigen::MatrixXcd echoTime = Eigen::MatrixXcd::Zero(data_rows, n2);
fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2); fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2); fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_plan p; fftw_plan p;
double n = 1.0 / n2; // 因为 fftw 的逆傅里叶变换没有除于N,所以实际上是原来的N倍 double n = 1.0 / n2; // 因为 fftw 的逆傅里叶变换没有除于N,所以实际上是原来的N倍
//逐行进行fftw //逐行进行fftw
p = fftw_plan_dft_1d(n2, din, dout, FFTW_BACKWARD, FFTW_MEASURE);//FFTW_BACKWARD 逆, p = fftw_plan_dft_1d(n2, din, dout, FFTW_BACKWARD, FFTW_MEASURE);//FFTW_BACKWARD 逆,
fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案 fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案
// 傅里叶 计算进度 // 傅里叶 计算进度
for (int i = 0; i < data_rows; i++) { for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < n2; j++) { // 初始化输入 for (int j = 0; j < n2; j++) { // 初始化输入
din[j][0] = std::real(ExpandECHO(i, j)); din[j][0] = std::real(ExpandECHO(i, j));
din[j][1] = std::imag(ExpandECHO(i, j)); din[j][1] = std::imag(ExpandECHO(i, j));
} }
// 构建fftw 任务 // 构建fftw 任务
fftw_execute(p); fftw_execute(p);
// 保存结果 // 保存结果
for (int j = 0; j < n2; j++) { //读取结果 for (int j = 0; j < n2; j++) { //读取结果
echoTime(i, j) = std::complex<double>(dout[j][0], dout[j][1]) * n; // 每次变换后都除于n echoTime(i, j) = std::complex<double>(dout[j][0], dout[j][1]) * n; // 每次变换后都除于n
} }
printf("\rIFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1)); printf("\rIFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1));
} }
@ -248,32 +248,32 @@ Eigen::MatrixXcd FFTW1D(Eigen::MatrixXcd ECHO)
{ {
size_t data_rows = ECHO.rows(); size_t data_rows = ECHO.rows();
size_t data_cols = ECHO.cols(); size_t data_cols = ECHO.cols();
// 频域 转换到 时域 // 频域 转换到 时域
size_t n2 = data_cols; size_t n2 = data_cols;
// 补零 // 补零
Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2); Eigen::MatrixXcd ExpandECHO = Eigen::MatrixXcd::Zero(data_rows, n2);
for (int i = 0; i < data_rows; i++) { for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < data_cols; j++) { for (int j = 0; j < data_cols; j++) {
ExpandECHO(i, j) = ECHO(i, j); ExpandECHO(i, j) = ECHO(i, j);
} }
} }
// 结果 // 结果
Eigen::MatrixXcd echofreq = Eigen::MatrixXcd::Zero(data_rows, n2); Eigen::MatrixXcd echofreq = Eigen::MatrixXcd::Zero(data_rows, n2);
fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2); fftw_complex* din = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2); fftw_complex* dout = (fftw_complex*)fftw_malloc(sizeof(double) * n2 * 2);
fftw_plan p; fftw_plan p;
//逐行进行fftw //逐行进行fftw
p = fftw_plan_dft_1d(n2, din, dout, FFTW_FORWARD, FFTW_MEASURE);//FFTW_FORWARD 顺, p = fftw_plan_dft_1d(n2, din, dout, FFTW_FORWARD, FFTW_MEASURE);//FFTW_FORWARD 顺,
fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案 fftw_execute(p); //FFTW_MEASURE 估计最优变换方法,后面复用变换方案
for (int i = 0; i < data_rows; i++) { for (int i = 0; i < data_rows; i++) {
for (int j = 0; j < n2; j++) { // 初始化输入 for (int j = 0; j < n2; j++) { // 初始化输入
din[j][0] = std::real(ExpandECHO(i, j)); din[j][0] = std::real(ExpandECHO(i, j));
din[j][1] = std::imag(ExpandECHO(i, j)); din[j][1] = std::imag(ExpandECHO(i, j));
} }
// 构建fftw 任务 // 构建fftw 任务
fftw_execute(p); fftw_execute(p);
// 保存结果 // 保存结果
for (int j = 0; j < n2; j++) { //读取结果 for (int j = 0; j < n2; j++) { //读取结果
echofreq(i, j) = std::complex<double>(dout[j][0], dout[j][1]); echofreq(i, j) = std::complex<double>(dout[j][0], dout[j][1]);
} }
printf("\rFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1)); printf("\rFFT[%.2lf%%]...:", i * 100.0 / (data_rows - 1));
@ -290,24 +290,24 @@ Eigen::MatrixXcd FFTW1D(Eigen::MatrixXcd ECHO)
Eigen::MatrixXcd FFTW2D(Eigen::MatrixXcd ECHO) Eigen::MatrixXcd FFTW2D(Eigen::MatrixXcd ECHO)
{ {
// 获取数据的尺寸 // 获取数据的尺寸
int rows = ECHO.rows(); int rows = ECHO.rows();
int cols = ECHO.cols(); int cols = ECHO.cols();
// 创建FFTW输入和输出数组 // 创建FFTW输入和输出数组
fftw_complex* in = reinterpret_cast<fftw_complex*>(ECHO.data()); fftw_complex* in = reinterpret_cast<fftw_complex*>(ECHO.data());
fftw_complex* out = static_cast<fftw_complex*>(fftw_malloc(sizeof(fftw_complex) * rows * cols)); fftw_complex* out = static_cast<fftw_complex*>(fftw_malloc(sizeof(fftw_complex) * rows * cols));
// 创建FFTW计划执行傅立叶变换 // 创建FFTW计划执行傅立叶变换
fftw_plan plan = fftw_plan_dft_2d(rows, cols, in, out, FFTW_FORWARD, FFTW_ESTIMATE); fftw_plan plan = fftw_plan_dft_2d(rows, cols, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
fftw_execute(plan); fftw_execute(plan);
// 打印傅立叶变换结果 // 打印傅立叶变换结果
Eigen::MatrixXcd result(rows, cols); Eigen::MatrixXcd result(rows, cols);
result = Map<Eigen::MatrixXcd>(reinterpret_cast<std::complex<double>*>(out), rows, cols); result = Map<Eigen::MatrixXcd>(reinterpret_cast<std::complex<double>*>(out), rows, cols);
//qDebug() << "Fourier Transform Result: " << "\n" << result << "\n"; //qDebug() << "Fourier Transform Result: " << "\n" << result << "\n";
// 销毁FFTW计划和内存 // 销毁FFTW计划和内存
fftw_destroy_plan(plan); fftw_destroy_plan(plan);
fftw_free(out); fftw_free(out);
qDebug() << "\n"; qDebug() << "\n";

View File

@ -1,46 +1,46 @@
#pragma once #pragma once
#ifndef SARIMAGEBASE_H #ifndef SARIMAGEBASE_H
#define SARIMAGEBASE_H #define SARIMAGEBASE_H
/** /**
* *
****/ ****/
#include "referenceHeader.h" #include "referenceHeader.h"
#include "SARBaseTool.h" #include "SARBaseTool.h"
// ------------------------------------------- 成像 公用库---------------------------------------------------------- // ------------------------------------------- 成像 公用库----------------------------------------------------------
// SAR 常用计算的方法 // SAR 常用计算的方法
double getRangeResolution(double startfreq, double endfreq); double getRangeResolution(double startfreq, double endfreq);
/// <summary> /// <summary>
/// 方位向分辨率计算 /// 方位向分辨率计算
/// </summary> /// </summary>
/// <param name="AzAngleRange">弧度制,方位角变化范围(>=0</param> /// <param name="AzAngleRange">弧度制,方位角变化范围(>=0</param>
/// <param name="startFreq">起始频率</param> /// <param name="startFreq">起始频率</param>
/// <returns></returns> /// <returns></returns>
double getAzimuthResolution(double AzAngleRange, double startFreq); double getAzimuthResolution(double AzAngleRange, double startFreq);
// 根据输入数量构建汉明窗 // 根据输入数量构建汉明窗
Eigen::MatrixXd hammingWindows(size_t num); Eigen::MatrixXd hammingWindows(size_t num);
// 频率域汉明窗口 // 频率域汉明窗口
/// <summary> /// <summary>
/// 频率域汉明窗口 /// 频率域汉明窗口
/// </summary> /// </summary>
/// <param name="Nf">频率点数</param> /// <param name="Nf">频率点数</param>
/// <param name="Nxa">脉冲数量</param> /// <param name="Nxa">脉冲数量</param>
/// <param name="alpha">权重</param> /// <param name="alpha">权重</param>
/// <returns>汉明窗权重</returns> /// <returns>汉明窗权重</returns>
Eigen::MatrixXd Hanning(size_t Nf, size_t Nxa, double alpha = 0.54); Eigen::MatrixXd Hanning(size_t Nf, size_t Nxa, double alpha = 0.54);
/// <summary> /// <summary>
/// 获取2的平方数,大于2 /// 获取2的平方数,大于2
/// </summary> /// </summary>
/// <param name="num"></param> /// <param name="num"></param>
/// <returns></returns> /// <returns></returns>
size_t nextpow2(size_t num); size_t nextpow2(size_t num);
/// <summary> /// <summary>
/// 对回波沿着行进行一维傅里叶逆变换 /// 对回波沿着行进行一维傅里叶逆变换
/// </summary> /// </summary>
/// <param name="ECHO"></param> /// <param name="ECHO"></param>
/// <returns></returns> /// <returns></returns>
@ -48,7 +48,7 @@ Eigen::MatrixXcd IFFTW1D(Eigen::MatrixXcd ECHO);
/// <summary> /// <summary>
/// 对回波沿着行进行一维傅里叶变换 /// 对回波沿着行进行一维傅里叶变换
/// </summary> /// </summary>
/// <param name="echo"></param> /// <param name="echo"></param>
/// <returns></returns> /// <returns></returns>
@ -57,26 +57,26 @@ Eigen::MatrixXcd FFTW2D(Eigen::MatrixXcd ECHO);
Eigen::MatrixXcd fftshift(Eigen::MatrixXcd X); Eigen::MatrixXcd fftshift(Eigen::MatrixXcd X);
/// <summary> /// <summary>
/// 对回波 加 hamming 窗 /// 对回波 加 hamming 窗
/// </summary> /// </summary>
/// <param name="FreqEcho">频域的回波数据PRFnum,Freqnum)</param> /// <param name="FreqEcho">频域的回波数据PRFnum,Freqnum)</param>
/// <returns></returns> /// <returns></returns>
Eigen::MatrixXcd HammingWindows(Eigen::MatrixXcd FreqEcho); Eigen::MatrixXcd HammingWindows(Eigen::MatrixXcd FreqEcho);
/// <summary> /// <summary>
/// 对回波进行一维插值(并行),不能用来处理极坐标 /// 对回波进行一维插值(并行),不能用来处理极坐标
/// 插值方式为 实部虚部分别进行线性插值 /// 插值方式为 实部虚部分别进行线性插值
/// </summary> /// </summary>
/// <param name="freqEcho">回波数据,(行数,列数):PRFNUM,freqNUM</param> /// <param name="freqEcho">回波数据,(行数,列数):PRFNUM,freqNUM</param>
/// <param name="SourceFreqlist">回波的 原始频率列表</param> /// <param name="SourceFreqlist">回波的 原始频率列表</param>
/// <param name="interpFreqlist">回波的 插值频率列表</param> /// <param name="interpFreqlist">回波的 插值频率列表</param>
/// <returns></returns> /// <returns></returns>
Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd SourceFreqlist, Eigen::VectorXd interpFreqlist); Eigen::MatrixXcd InterpFreqEcho(Eigen::MatrixXcd freqEcho, Eigen::VectorXd SourceFreqlist, Eigen::VectorXd interpFreqlist);
/// <summary> /// <summary>
/// 保存复数矩阵数据 为tiff 其中band 1: amp (linear) angle(radia) /// 保存复数矩阵数据 为tiff 其中band 1: amp (linear) angle(radia)
/// </summary> /// </summary>
/// <param name="out_tiff_path"></param> /// <param name="out_tiff_path"></param>
/// <param name="data"></param> /// <param name="data"></param>
@ -85,7 +85,7 @@ int WriteComplexData2Amp_Arg(QString out_tiff_path, Eigen::MatrixXcd data);
/// <summary> /// <summary>
/// 保存复数矩阵数据 为tiff 其中band 1: amp (dB) angle(radia) /// 保存复数矩阵数据 为tiff 其中band 1: amp (dB) angle(radia)
/// </summary> /// </summary>
/// <param name="out_tiff_path"></param> /// <param name="out_tiff_path"></param>
/// <param name="data"></param> /// <param name="data"></param>

View File

@ -1,4 +1,4 @@
#include "SARImage/FEKOBaseToolClass.h" #include "SARImage/FEKOBaseToolClass.h"
#include <math.h> #include <math.h>
#include "BaseToolLib/BaseConstVariable.h" #include "BaseToolLib/BaseConstVariable.h"
#include <QMessageBox> #include <QMessageBox>
@ -30,8 +30,8 @@ QString FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode mode)
case CircleSAR: case CircleSAR:
return "CircleSAR"; return "CircleSAR";
} }
// 如果枚举值不匹配任何字符串,则返回一个默认值,或者抛出异常 // 如果枚举值不匹配任何字符串,则返回一个默认值,或者抛出异常
return "UNKNOW"; // 默认返回Unknown return "UNKNOW"; // 默认返回Unknown
} }
FEKOBase::FEKOCoordinateSystem FEKOBase::FEKOCoordinateSystemString2Enum(QString str) FEKOBase::FEKOCoordinateSystem FEKOBase::FEKOCoordinateSystemString2Enum(QString str)
@ -71,8 +71,8 @@ FEKOBase::FEKOImageMode FEKOBase::FEKOImageModeString2Enum(QString str)
else if (str.toUpper() == "CIRCLESAR") { else if (str.toUpper() == "CIRCLESAR") {
return FEKOBase::FEKOImageMode::CircleSAR; return FEKOBase::FEKOImageMode::CircleSAR;
} }
// 如果输入的字符串不匹配任何枚举值,则返回一个默认值,或者抛出异常 // 如果输入的字符串不匹配任何枚举值,则返回一个默认值,或者抛出异常
return FEKOBase::FEKOImageMode::UNKNOW; // 默认返回UNKNOW return FEKOBase::FEKOImageMode::UNKNOW; // 默认返回UNKNOW
} }
FEKOBase::freqParams 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) {
@ -80,10 +80,10 @@ FEKOBase::freqParams FEKOBase::getFreqSetting(double centerFreq, double resoluti
FEKOBase::freqParams result{ 0,0,0 }; FEKOBase::freqParams result{ 0,0,0 };
{ {
if (isResolution) { if (isResolution) {
bandWidth = 0.299792458 / 2 / resolution; // 计算带宽 bandWidth = 0.299792458 / 2 / resolution; // 计算带宽
} }
else { else {
resolution = 0.299792458 / 2 / bandWidth; // 计算分辨率 resolution = 0.299792458 / 2 / bandWidth; // 计算分辨率
} }
} }
size_t samplePoint = std::ceil((scenceRange) / resolution) + 1; size_t samplePoint = std::ceil((scenceRange) / resolution) + 1;
@ -128,11 +128,11 @@ FEKOBase::FEKOantPitionDirect FEKOBase::FEKOSatelliteParams2FEKOantPitionDirect(
TopoDS_Shape 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; // 转换为弧度 incidenceAngle = incidenceAngle * M_PI / 180; // 转换为弧度
AzAngle = AzAngle * M_PI / 180; // 扫描角度转换为弧度 AzAngle = AzAngle * M_PI / 180; // 扫描角度转换为弧度
TopoDS_Shape tempShape; TopoDS_Shape tempShape;
if (!antModel.IsNull()) { if (!antModel.IsNull()) {
// 创建一个复制 // 创建一个复制
BRepBuilderAPI_Copy copyBuilder(antModel); BRepBuilderAPI_Copy copyBuilder(antModel);
tempShape = copyBuilder.Shape(); tempShape = copyBuilder.Shape();
} }
@ -143,16 +143,16 @@ TopoDS_Shape FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double in
double Vx = satepos.vel.Vx; double Vx = satepos.vel.Vx;
double Vy = satepos.vel.Vy; double Vy = satepos.vel.Vy;
double Vz = satepos.vel.Vz; double Vz = satepos.vel.Vz;
//qDebug() << u8"// 0. 卫星状态矢量"; //qDebug() << u8"// 0. 卫星状态矢量";
gp_Vec SateVelocity(gp_Pnt(0, 0, 0), gp_Pnt(Vx, Vy, Vz)); // 卫星速度矢量 gp_Vec SateVelocity(gp_Pnt(0, 0, 0), gp_Pnt(Vx, Vy, Vz)); // 卫星速度矢量
gp_Vec SatePosition(gp_Pnt(0, 0, 0), gp_Pnt(Sx, Sy, Sz)); // 卫星位置矢量 gp_Vec SatePosition(gp_Pnt(0, 0, 0), gp_Pnt(Sx, Sy, Sz)); // 卫星位置矢量
gp_Vec sch_X(gp_Pnt(0, 0, 0), gp_Pnt(1.0, 0.0, 0.0)); gp_Vec sch_X(gp_Pnt(0, 0, 0), gp_Pnt(1.0, 0.0, 0.0));
gp_Vec sch_Y(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 1.0, 0.0)); // 飞行方向 y gp_Vec sch_Y(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 1.0, 0.0)); // 飞行方向 y
gp_Vec sch_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1.0)); // 雷达照射方向 gp_Vec sch_Z(gp_Pnt(0, 0, 0), gp_Pnt(0.0, 0.0, 1.0)); // 雷达照射方向
// qDebug() << u8"// 1. 卫星坐标系 sch -->飞行坐标系 fly 保证Z轴指向不变化"; // qDebug() << u8"// 1. 卫星坐标系 sch -->飞行坐标系 fly 保证Z轴指向不变化";
gp_Vec sch_X_fly; gp_Vec sch_X_fly;
gp_Vec sch_Y_fly; // 飞行向 gp_Vec sch_Y_fly; // 飞行向
gp_Vec sch_Z_fly; gp_Vec sch_Z_fly;
{ {
@ -162,18 +162,18 @@ TopoDS_Shape FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double in
SphericalCoordinates sp_sph = cartesianToSpherical(Sp_car); SphericalCoordinates sp_sph = cartesianToSpherical(Sp_car);
SphericalCoordinates tp_sph = cartesianToSpherical(tp_car); SphericalCoordinates tp_sph = cartesianToSpherical(tp_car);
// 计算 // 计算
double delta_theta = tp_sph.theta - sp_sph.theta; double delta_theta = tp_sph.theta - sp_sph.theta;
double delta_phi = tp_sph.phi - sp_sph.phi; double delta_phi = tp_sph.phi - sp_sph.phi;
gp_Trsf rotationTransform_theta; gp_Trsf rotationTransform_theta;
rotationTransform_theta.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), delta_theta); // 绕 y 轴旋转 rotationTransform_theta.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 1, 0)), delta_theta); // 绕 y 轴旋转
sch_X_fly = sch_X.Transformed(rotationTransform_theta); sch_X_fly = sch_X.Transformed(rotationTransform_theta);
sch_Y_fly = sch_Y.Transformed(rotationTransform_theta); sch_Y_fly = sch_Y.Transformed(rotationTransform_theta);
sch_Z_fly = sch_Z.Transformed(rotationTransform_theta); sch_Z_fly = sch_Z.Transformed(rotationTransform_theta);
gp_Trsf rotationTransform_phi; gp_Trsf rotationTransform_phi;
rotationTransform_phi.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), delta_phi); // 绕 z 轴旋转 rotationTransform_phi.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), delta_phi); // 绕 z 轴旋转
sch_X_fly = sch_X_fly.Transformed(rotationTransform_phi); sch_X_fly = sch_X_fly.Transformed(rotationTransform_phi);
sch_Y_fly = sch_Y_fly.Transformed(rotationTransform_phi); sch_Y_fly = sch_Y_fly.Transformed(rotationTransform_phi);
sch_Z_fly = sch_Z_fly.Transformed(rotationTransform_phi); sch_Z_fly = sch_Z_fly.Transformed(rotationTransform_phi);
@ -186,24 +186,24 @@ TopoDS_Shape FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double in
} }
} }
// qDebug() << u8"// 2. 根据方位角与俯仰角,调整雷达姿态 --- 此步确定 Y 轴已经调整完毕 "; // qDebug() << u8"// 2. 根据方位角与俯仰角,调整雷达姿态 --- 此步确定 Y 轴已经调整完毕 ";
// qDebug() << u8"// 2. a 根据 incidenceAngle 调整 Z 的指向,需要先根据左右视判断出雷达照射方向"; // qDebug() << u8"// 2. a 根据 incidenceAngle 调整 Z 的指向,需要先根据左右视判断出雷达照射方向";
{ // 按照 Y 轴进行计算 { // 按照 Y 轴进行计算
incidenceAngle = M_PI - incidenceAngle; // 下Z轴 incidenceAngle = M_PI - incidenceAngle; // 下Z轴
Standard_Real ZRotation_angle = 0; Standard_Real ZRotation_angle = 0;
if (isRIGHT) { // 右视 + if (isRIGHT) { // 右视 +
ZRotation_angle = incidenceAngle; ZRotation_angle = incidenceAngle;
} }
else { // 左视 - else { // 左视 -
ZRotation_angle = -1 * incidenceAngle; ZRotation_angle = -1 * incidenceAngle;
} }
gp_Trsf fly_incidence_trsf; gp_Trsf fly_incidence_trsf;
fly_incidence_trsf.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), sch_Y_fly), ZRotation_angle); // 计算入射角 fly_incidence_trsf.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), sch_Y_fly), ZRotation_angle); // 计算入射角
sch_X_fly = sch_X_fly.Transformed(fly_incidence_trsf); sch_X_fly = sch_X_fly.Transformed(fly_incidence_trsf);
sch_Y_fly = sch_Y_fly.Transformed(fly_incidence_trsf); sch_Y_fly = sch_Y_fly.Transformed(fly_incidence_trsf);
sch_Z_fly = sch_Z_fly.Transformed(fly_incidence_trsf); // 此时获取雷达的照射方向 sch_Z_fly = sch_Z_fly.Transformed(fly_incidence_trsf); // 此时获取雷达的照射方向
if (!tempShape.IsNull()) { if (!tempShape.IsNull()) {
BRepBuilderAPI_Transform shapeTransform_incidence(tempShape, fly_incidence_trsf); // fly_Z --> incidenceAngle BRepBuilderAPI_Transform shapeTransform_incidence(tempShape, fly_incidence_trsf); // fly_Z --> incidenceAngle
@ -212,53 +212,53 @@ TopoDS_Shape FEKOBase::SatellitePos2FEKOAntPos(SatelliteState satepos, double in
} }
// qDebug() << u8"// 2.b 根据 AzAngle 调整 Z 的指向 "; // qDebug() << u8"// 2.b 根据 AzAngle 调整 Z 的指向 ";
// qDebug() << u8"// Az 应该变化在 YoZ 也就是绕 X 轴 旋转;"; // qDebug() << u8"// Az 应该变化在 YoZ 也就是绕 X 轴 旋转;";
{ // 沿Z 轴进行计算 { // 沿Z 轴进行计算
gp_Trsf fly_AZ_trsf; gp_Trsf fly_AZ_trsf;
fly_AZ_trsf.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), sch_X_fly), AzAngle); // 计算方位角变化 fly_AZ_trsf.SetRotation(gp_Ax1(gp_Pnt(0, 0, 0), sch_X_fly), AzAngle); // 计算方位角变化
sch_X_fly = sch_X_fly.Transformed(fly_AZ_trsf); sch_X_fly = sch_X_fly.Transformed(fly_AZ_trsf);
sch_Y_fly = sch_Y_fly.Transformed(fly_AZ_trsf); sch_Y_fly = sch_Y_fly.Transformed(fly_AZ_trsf);
sch_Z_fly = sch_Z_fly.Transformed(fly_AZ_trsf); // 此时获取雷达的照射方向 sch_Z_fly = sch_Z_fly.Transformed(fly_AZ_trsf); // 此时获取雷达的照射方向
if (!tempShape.IsNull()) { if (!tempShape.IsNull()) {
BRepBuilderAPI_Transform shapeTransform_AZ(tempShape, fly_AZ_trsf); // fly_Z --> incidenceAngle BRepBuilderAPI_Transform shapeTransform_AZ(tempShape, fly_AZ_trsf); // fly_Z --> incidenceAngle
tempShape = shapeTransform_AZ.Shape(); // 旋转卫星模型 tempShape = shapeTransform_AZ.Shape(); // 旋转卫星模型
} }
} }
// qDebug() << u8"// 2.c 参数记录 "; // qDebug() << u8"// 2.c 参数记录 ";
{ {
CartesianCoordinates Sp_car{ 0,0,1 }; CartesianCoordinates Sp_car{ 0,0,1 };
CartesianCoordinates tp_car{ sch_Z_fly.X(),sch_Z_fly.Y(), sch_Z_fly.Z() }; CartesianCoordinates tp_car{ sch_Z_fly.X(),sch_Z_fly.Y(), sch_Z_fly.Z() };
SphericalCoordinates sp_sph = cartesianToSpherical(Sp_car); SphericalCoordinates sp_sph = cartesianToSpherical(Sp_car);
SphericalCoordinates tp_sph = cartesianToSpherical(tp_car); // 计算phi角度 SphericalCoordinates tp_sph = cartesianToSpherical(tp_car); // 计算phi角度
double delta_theta = tp_sph.theta - sp_sph.theta; double delta_theta = tp_sph.theta - sp_sph.theta;
double delta_phi = tp_sph.phi - sp_sph.phi; double delta_phi = tp_sph.phi - sp_sph.phi;
antposition_Direct->x = Sx; //-- FEKO 设置 antposition_Direct->x = Sx; //-- FEKO 设置
antposition_Direct->y = Sy; //-- FEKO 设置 antposition_Direct->y = Sy; //-- FEKO 设置
antposition_Direct->z = Sz; //-- FEKO 设置 antposition_Direct->z = Sz; //-- FEKO 设置
antposition_Direct->theta = delta_theta / M_PI * 180; //-- FEKO 设置 theta antposition_Direct->theta = delta_theta / M_PI * 180; //-- FEKO 设置 theta
antposition_Direct->phi = delta_phi / M_PI * 180;//--- FEKO 设置 phi antposition_Direct->phi = delta_phi / M_PI * 180;//--- FEKO 设置 phi
} }
// qDebug() << u8"//3. 执行模型平移"; // qDebug() << u8"//3. 执行模型平移";
{ {
if (!tempShape.IsNull()) { if (!tempShape.IsNull()) {
gp_Trsf fly_move_trsf; gp_Trsf fly_move_trsf;
fly_move_trsf.SetTranslation(SatePosition); fly_move_trsf.SetTranslation(SatePosition);
BRepBuilderAPI_Transform shapeTransform_move(tempShape, fly_move_trsf); // fly_Z --> incidenceAngle BRepBuilderAPI_Transform shapeTransform_move(tempShape, fly_move_trsf); // fly_Z --> incidenceAngle
tempShape = shapeTransform_move.Shape(); // 平移卫星模型 tempShape = shapeTransform_move.Shape(); // 平移卫星模型
} }
} }
qDebug() << QString(u8"雷达坐标与姿态X,Y,Z,theta,phi): %1,%2,%3,%4,%5)").arg(antposition_Direct->x) qDebug() << QString(u8"雷达坐标与姿态X,Y,Z,theta,phi): %1,%2,%3,%4,%5)").arg(antposition_Direct->x)
.arg(antposition_Direct->y) .arg(antposition_Direct->y)
.arg(antposition_Direct->z) .arg(antposition_Direct->z)
.arg(antposition_Direct->theta) .arg(antposition_Direct->theta)
@ -288,20 +288,20 @@ FEKOBase::NearFieldEchoCSVParser::~NearFieldEchoCSVParser()
bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel() bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
{ {
qDebug() << u8"正在检查是否可以采用脉冲计数模式 configuration Name PRF_{脉冲计数}"; qDebug() << u8"正在检查是否可以采用脉冲计数模式 configuration Name PRF_{脉冲计数}";
QRegExp regex("(\\d+)"); QRegExp regex("(\\d+)");
// 判断是否需要按照脉冲次序排序 // 判断是否需要按照脉冲次序排序
bool usePRFbool = true; bool usePRFbool = true;
QMap<QString, size_t> configName_prfidx; QMap<QString, size_t> configName_prfidx;
// 使用迭代器遍历 QMap // 使用迭代器遍历 QMap
QMap<QString, std::vector<ElectricFieldData>>::const_iterator it; QMap<QString, std::vector<ElectricFieldData>>::const_iterator it;
for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) { for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) {
for (size_t i = 0; i < this->electricFieldDataList[it.key()].size(); i++) { for (size_t i = 0; i < this->electricFieldDataList[it.key()].size(); i++) {
QString value = this->electricFieldDataList[it.key()][i].configurationName; QString value = this->electricFieldDataList[it.key()][i].configurationName;
if (value.indexOf("PRF") != -1) { if (value.indexOf("PRF") != -1) {
if (regex.indexIn(value) != -1) { if (regex.indexIn(value) != -1) {
// 提取匹配到的部分 // 提取匹配到的部分
QString matchedText = regex.cap(1); QString matchedText = regex.cap(1);
size_t PRFidx = matchedText.toInt(&usePRFbool); size_t PRFidx = matchedText.toInt(&usePRFbool);
@ -309,27 +309,27 @@ bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
configName_prfidx.insert(this->electricFieldDataList[it.key()][i].configurationName, PRFidx); configName_prfidx.insert(this->electricFieldDataList[it.key()][i].configurationName, PRFidx);
} }
else { else {
qDebug() << u8"不能采用脉冲计数模型"; qDebug() << u8"不能采用脉冲计数模型";
QMessageBox::information(nullptr, u8"警告", u8"无法根据Configuration Name识别脉冲顺序按照读取顺序计数PRF", QMessageBox::Ok); QMessageBox::information(nullptr, u8"警告", u8"无法根据Configuration Name识别脉冲顺序按照读取顺序计数PRF", QMessageBox::Ok);
this->usePRFCountMode = false; this->usePRFCountMode = false;
return false; return false;
} }
} }
} }
else { else {
qDebug() << u8"不能采用脉冲计数模型"; qDebug() << u8"不能采用脉冲计数模型";
QMessageBox::information(nullptr, u8"警告", u8"无法根据Configuration Name识别脉冲顺序按照读取顺序计数PRF", QMessageBox::Ok); QMessageBox::information(nullptr, u8"警告", u8"无法根据Configuration Name识别脉冲顺序按照读取顺序计数PRF", QMessageBox::Ok);
this->usePRFCountMode = false; this->usePRFCountMode = false;
return false; return false;
} }
} }
} }
// 更新prfidx // 更新prfidx
for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) { for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) {
if (!(this->electricFieldDataList[it.key()].size() > 0)) { if (!(this->electricFieldDataList[it.key()].size() > 0)) {
QMessageBox::warning(nullptr, u8"错误", u8"发现空脉冲:" + it.key()); QMessageBox::warning(nullptr, u8"错误", u8"发现空脉冲:" + it.key());
qWarning() << u8"发现空脉冲:" + it.key(); qWarning() << u8"发现空脉冲:" + it.key();
return false; return false;
} }
else {} else {}
@ -338,8 +338,8 @@ bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
for (size_t i = 0; i < this->electricFieldDataList[it.key()].size(); i++) { for (size_t i = 0; i < this->electricFieldDataList[it.key()].size(); i++) {
if (value != this->electricFieldDataList[it.key()][0].configurationName) { if (value != this->electricFieldDataList[it.key()][0].configurationName) {
QMessageBox::warning(nullptr, u8"错误", u8"脉冲解析错误,名称不一致:" + it.key() + " | " + value); QMessageBox::warning(nullptr, u8"错误", u8"脉冲解析错误,名称不一致:" + it.key() + " | " + value);
qWarning() << u8"脉冲解析错误,名称不一致:" + it.key() + " | " + value; qWarning() << u8"脉冲解析错误,名称不一致:" + it.key() + " | " + value;
} }
else {} else {}
size_t tempprfidx = configName_prfidx[value]; size_t tempprfidx = configName_prfidx[value];
@ -347,18 +347,18 @@ bool FEKOBase::NearFieldEchoCSVParser::checkPRFModel()
} }
} }
qDebug() << u8"结束检查是否可以采用脉冲计数模式 configuration Name PRF_{脉冲计数}"; qDebug() << u8"结束检查是否可以采用脉冲计数模式 configuration Name PRF_{脉冲计数}";
return true; return true;
} }
bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse() bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
{ {
qDebug() << u8"根据数据文件,重新整理成脉冲形式"; qDebug() << u8"根据数据文件,重新整理成脉冲形式";
QMap<QString, PRFPluseData> prfPluseMap; // 采用字典映射方式 QMap<QString, PRFPluseData> prfPluseMap; // 采用字典映射方式
qDebug() << u8"QMap<QString, std::vector<ElectricFieldData>> ==> QMap<QString, PRFPluseData>"; qDebug() << u8"QMap<QString, std::vector<ElectricFieldData>> ==> QMap<QString, PRFPluseData>";
double px; // 2. 计算姿态,近场点坐标 double px; // 2. 计算姿态,近场点坐标
double py; double py;
double pz; double pz;
double R; double R;
@ -368,15 +368,15 @@ bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
for (QMap<QString, std::vector<ElectricFieldData>>::const_iterator it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) { for (QMap<QString, std::vector<ElectricFieldData>>::const_iterator it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) {
PRFPluseData temp; PRFPluseData temp;
std::vector<ElectricFieldData> tempData = this->electricFieldDataList[it.key()]; // 脉冲已经排序号 std::vector<ElectricFieldData> tempData = this->electricFieldDataList[it.key()]; // 脉冲已经排序号
std::sort(tempData.begin(), tempData.end(), compareElectricFieldDataInFreq); std::sort(tempData.begin(), tempData.end(), compareElectricFieldDataInFreq);
temp.electricFieldDataList = tempData; // 按照脉冲排序 temp.electricFieldDataList = tempData; // 按照脉冲排序
temp.freqstart = tempData[0].frequency; // 1. 频率 temp.freqstart = tempData[0].frequency; // 1. 频率
temp.freqend = tempData[tempData.size() - 1].frequency; temp.freqend = tempData[tempData.size() - 1].frequency;
temp.freqpoints = tempData.size(); temp.freqpoints = tempData.size();
px = tempData[0].origin.x; // 2. 近场接收点计算姿态,近场点坐标 px = tempData[0].origin.x; // 2. 近场接收点计算姿态,近场点坐标
py = tempData[0].origin.y; py = tempData[0].origin.y;
pz = tempData[0].origin.z; pz = tempData[0].origin.z;
@ -389,19 +389,19 @@ bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
PRFidx = tempData[0].prfidx; PRFidx = tempData[0].prfidx;
qDebug() << u8"分析姿态:" + it.key(); qDebug() << u8"分析姿态:" + it.key();
for (size_t i = 0; i < tempData.size(); i++) { for (size_t i = 0; i < tempData.size(); i++) {
if (abs(px - tempData[i].origin.x) > 0.001 || abs(py - tempData[i].origin.y) > 0.001 || if (abs(px - tempData[i].origin.x) > 0.001 || abs(py - tempData[i].origin.y) > 0.001 ||
abs(pz - tempData[i].origin.z) > 0.001 || abs(R - tempData[i].radius) > 0.001 || abs(pz - tempData[i].origin.z) > 0.001 || abs(R - tempData[i].radius) > 0.001 ||
abs(theta - tempData[i].theta) > 0.001 || abs(phi - tempData[i].phi) > 0.001) abs(theta - tempData[i].theta) > 0.001 || abs(phi - tempData[i].phi) > 0.001)
{ {
qDebug() << u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查"; qDebug() << u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查";
QMessageBox::warning(nullptr, u8"警告", u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查"); QMessageBox::warning(nullptr, u8"警告", u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查");
return false; return false;
} }
else {} else {}
} }
// 计算增量 R, theta, phi ==> delta_R,delta_theta,delta_phi // 计算增量 R, theta, phi ==> delta_R,delta_theta,delta_phi
theta = theta * M_PI / 180; theta = theta * M_PI / 180;
phi = phi * M_PI / 180; phi = phi * M_PI / 180;
@ -419,13 +419,13 @@ bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
} }
qDebug() << u8"判断是所有回波均一性"; qDebug() << u8"判断是所有回波均一性";
this->prfData = std::vector<PRFPluseData>(0); this->prfData = std::vector<PRFPluseData>(0);
size_t freqpointnum = prfPluseMap.first().freqpoints; size_t freqpointnum = prfPluseMap.first().freqpoints;
for (QMap<QString, PRFPluseData>::const_iterator it = prfPluseMap.constBegin(); it != prfPluseMap.constEnd(); ++it) { for (QMap<QString, PRFPluseData>::const_iterator it = prfPluseMap.constBegin(); it != prfPluseMap.constEnd(); ++it) {
if (it.value().freqpoints != freqpointnum) { if (it.value().freqpoints != freqpointnum) {
qDebug() << u8"回波数据频点数不一致,无法进行脉冲计数"; qDebug() << u8"回波数据频点数不一致,无法进行脉冲计数";
QMessageBox::information(nullptr, u8"警告", u8"回波数据频点数不一致,无法进行脉冲计数", QMessageBox::Ok); QMessageBox::information(nullptr, u8"警告", u8"回波数据频点数不一致,无法进行脉冲计数", QMessageBox::Ok);
this->usePRFCountMode = false; this->usePRFCountMode = false;
return false; return false;
} }
@ -436,7 +436,7 @@ bool FEKOBase::NearFieldEchoCSVParser::resizePRFPluse()
this->freqStart = this->prfData[0].freqstart; this->freqStart = this->prfData[0].freqstart;
this->freqEnd = this->prfData[0].freqend; this->freqEnd = this->prfData[0].freqend;
qDebug() << u8"根据数据文件,结束整理成脉冲形式"; qDebug() << u8"根据数据文件,结束整理成脉冲形式";
return true; return true;
} }
@ -450,7 +450,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file); QTextStream in(&file);
// 读取标题行 // 读取标题行
QString headerLine = in.readLine(); QString headerLine = in.readLine();
QStringList headers = headerLine.split(QRegularExpression(",(?!\\s)")); QStringList headers = headerLine.split(QRegularExpression(",(?!\\s)"));
@ -460,7 +460,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
QStringList fields = line.split(QRegularExpression(",(?!\\s)")); QStringList fields = line.split(QRegularExpression(",(?!\\s)"));
ElectricFieldData data; ElectricFieldData data;
// 解析数据根据列名 // 解析数据根据列名
for (int i = 0; i < headers.size(); ++i) { for (int i = 0; i < headers.size(); ++i) {
QString header = headers[i].trimmed(); QString header = headers[i].trimmed();
QString value = fields[i];// .trimmed(); QString value = fields[i];// .trimmed();
@ -477,13 +477,13 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
else if (header == "Date") { else if (header == "Date") {
data.date = value; data.date = value;
} }
else if (header == "Radius") { // 半径 else if (header == "Radius") { // 半径
data.radius = value.toDouble(); data.radius = value.toDouble();
} }
else if (header == "Theta") { // theta 角 else if (header == "Theta") { // theta 角
data.theta = value.toDouble(); data.theta = value.toDouble();
} }
else if (header == "Phi") {// phi 角 else if (header == "Phi") {// phi 角
data.phi = value.toDouble(); data.phi = value.toDouble();
} }
else if (header == "Re(Er)") { else if (header == "Re(Er)") {
@ -504,7 +504,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
else if (header == "Im(Ephi)") { else if (header == "Im(Ephi)") {
data.imEphi = value.toDouble(); data.imEphi = value.toDouble();
} }
else if (header == "Configuration Name") { // 脉冲次序名称 else if (header == "Configuration Name") { // 脉冲次序名称
data.configurationName = value.trimmed(); data.configurationName = value.trimmed();
} }
else if (header == "Request Name") { else if (header == "Request Name") {
@ -516,7 +516,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
else if (header == "Coordinate System") { else if (header == "Coordinate System") {
data.coordinateSystem = value; data.coordinateSystem = value;
} }
else if (header == "Origin") { // 坐标参考原点 else if (header == "Origin") { // 坐标参考原点
QStringList vls = value.replace("\"", "").replace("(", "").replace(")", "").split(","); QStringList vls = value.replace("\"", "").replace("(", "").replace(")", "").split(",");
if (vls.length() < 3) { if (vls.length() < 3) {
qDebug() << "******************** ERROR INFO ******************************************"; qDebug() << "******************** ERROR INFO ******************************************";
@ -524,7 +524,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
qDebug() << "line: " << line; qDebug() << "line: " << line;
qDebug() << "head: " << header; qDebug() << "head: " << header;
qDebug() << "***************************************************************************"; qDebug() << "***************************************************************************";
QMessageBox::information(nullptr, u8"警告", u8"无法解析Origin 参数,请检查", QMessageBox::Ok); QMessageBox::information(nullptr, u8"警告", u8"无法解析Origin 参数,请检查", QMessageBox::Ok);
return false; return false;
} }
data.origin = Point_3d{ vls.at(0).toDouble(), data.origin = Point_3d{ vls.at(0).toDouble(),
@ -546,7 +546,7 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
else if (header == "Num Header Lines") { else if (header == "Num Header Lines") {
data.numHeaderLines = value.toInt(); data.numHeaderLines = value.toInt();
} }
// 添加其他字段的解析... // 添加其他字段的解析...
} }
dataList.push_back(data); dataList.push_back(data);
} }
@ -560,8 +560,8 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
//this->electricFieldDataList = dataList; //this->electricFieldDataList = dataList;
qDebug() << u8"文件读取结果,对文件结果进行重新整理与检查"; qDebug() << u8"文件读取结果,对文件结果进行重新整理与检查";
//获取脉冲最小值,最大值,如果是 使用软件生产的 configname 应该为 PRF_1 PRF_2 这里通过判断 1,2 来确定脉冲序号 //获取脉冲最小值,最大值,如果是 使用软件生产的 configname 应该为 PRF_1 PRF_2 这里通过判断 1,2 来确定脉冲序号
QSet<QString> configNameSet; QSet<QString> configNameSet;
size_t curPRF = 0; size_t curPRF = 0;
for (int i = 0; i < dataList.size(); i++) { for (int i = 0; i < dataList.size(); i++) {
@ -572,27 +572,27 @@ bool FEKOBase::NearFieldEchoCSVParser::parseCSV(const QString& filePath)
configNameSet.insert(dataList[i].configurationName); configNameSet.insert(dataList[i].configurationName);
} }
// 初始化 // 初始化
for (const QString& elementconfigName : configNameSet) { for (const QString& elementconfigName : configNameSet) {
this->electricFieldDataList.insert(elementconfigName, std::vector<ElectricFieldData>(0)); this->electricFieldDataList.insert(elementconfigName, std::vector<ElectricFieldData>(0));
} }
// 数据初始化 // 数据初始化
for (size_t i = 0; i < dataList.size(); i++) { for (size_t i = 0; i < dataList.size(); i++) {
this->electricFieldDataList[dataList[i].configurationName].push_back(dataList[i]); this->electricFieldDataList[dataList[i].configurationName].push_back(dataList[i]);
} }
// 每个Pluse 进行排序,按照频率: 小 -> 大, // 每个Pluse 进行排序,按照频率: 小 -> 大,
QMap<QString, std::vector<ElectricFieldData>>::const_iterator it; QMap<QString, std::vector<ElectricFieldData>>::const_iterator it;
for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) { for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) {
std::sort(this->electricFieldDataList[it.key()].begin(), this->electricFieldDataList[it.key()].end(), compareElectricFieldDataInFreq); std::sort(this->electricFieldDataList[it.key()].begin(), this->electricFieldDataList[it.key()].end(), compareElectricFieldDataInFreq);
} }
// 检查每个electricFieldDataList 是否按照频率进行排序 // 检查每个electricFieldDataList 是否按照频率进行排序
for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) { for (it = this->electricFieldDataList.constBegin(); it != this->electricFieldDataList.constEnd(); ++it) {
for (size_t i = 0; i < this->electricFieldDataList[it.key()].size() - 1; i++) { for (size_t i = 0; i < this->electricFieldDataList[it.key()].size() - 1; i++) {
if (this->electricFieldDataList[it.key()][i].frequency > this->electricFieldDataList[it.key()][i + 1].frequency) { if (this->electricFieldDataList[it.key()][i].frequency > this->electricFieldDataList[it.key()][i + 1].frequency) {
qDebug() << u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查"; qDebug() << u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查";
QMessageBox::warning(nullptr, u8"警告", u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查"); QMessageBox::warning(nullptr, u8"警告", u8"发现 configuration Name:" + it.key() + u8" , 发现问题,请检查");
return false; return false;
} }
} }
@ -628,13 +628,13 @@ void FEKOBase::NearFieldEchoCSVParser::saveCSV(const QString& filePath)
} }
/// <summary> /// <summary>
/// 输出脉冲回波文件 /// 输出脉冲回波文件
/// </summary> /// </summary>
/// <param name="filePath">文件路径</param> /// <param name="filePath">文件路径</param>
/// <param name="outDataName">0: R,1: phi,2: theta</param> /// <param name="outDataName">0: R,1: phi,2: theta</param>
void 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); Eigen::MatrixXcd echoData = Eigen::MatrixXcd::Zero(this->prfData.size(), this->freqPoints);
Eigen::MatrixXd antpos = Eigen::MatrixXd::Zero(this->prfData.size(), 5); //x,y,z,theta,phi" Eigen::MatrixXd antpos = Eigen::MatrixXd::Zero(this->prfData.size(), 5); //x,y,z,theta,phi"
@ -746,27 +746,27 @@ void FEKOBase::EchoDataClass::loadEchoData(const QString& filePath)
std::ifstream file(reinterpret_cast<const wchar_t*>(filePath.utf16()), std::ios::binary); std::ifstream file(reinterpret_cast<const wchar_t*>(filePath.utf16()), std::ios::binary);
if (file.is_open()) { if (file.is_open()) {
// 保存频率变量 // 保存频率变量
INT32 PRFRow = 0; INT32 PRFRow = 0;
INT32 freqCol = 0; INT32 freqCol = 0;
// 读取其他成员变量 // 读取其他成员变量
file.read(reinterpret_cast<char*>(&freqStart), sizeof(double)); file.read(reinterpret_cast<char*>(&freqStart), sizeof(double));
file.read(reinterpret_cast<char*>(&freqEnd), sizeof(double)); file.read(reinterpret_cast<char*>(&freqEnd), sizeof(double));
file.read(reinterpret_cast<char*>(&freqpoints), sizeof(INT32)); file.read(reinterpret_cast<char*>(&freqpoints), sizeof(INT32));
file.read(reinterpret_cast<char*>(&PRFRow), sizeof(INT32)); file.read(reinterpret_cast<char*>(&PRFRow), sizeof(INT32));
file.read(reinterpret_cast<char*>(&freqCol), sizeof(INT32)); file.read(reinterpret_cast<char*>(&freqCol), sizeof(INT32));
echoData = Eigen::MatrixXcd::Zero(PRFRow, freqCol); // 重新分配内存 echoData = Eigen::MatrixXcd::Zero(PRFRow, freqCol); // 重新分配内存
antPos = Eigen::MatrixXd::Zero(PRFRow, 5); antPos = Eigen::MatrixXd::Zero(PRFRow, 5);
file.read(reinterpret_cast<char*>(antPos.data()), sizeof(double) * PRFRow * 5); // 保存天线位置 file.read(reinterpret_cast<char*>(antPos.data()), sizeof(double) * PRFRow * 5); // 保存天线位置
file.read(reinterpret_cast<char*>(echoData.data()), sizeof(std::complex<double>) * PRFRow * freqCol); // 保存回波数据 file.read(reinterpret_cast<char*>(echoData.data()), sizeof(std::complex<double>) * PRFRow * freqCol); // 保存回波数据
file.close(); // 关闭文件 file.close(); // 关闭文件
this->freqStart = freqStart; this->freqStart = freqStart;
this->freqEnd = freqEnd; this->freqEnd = freqEnd;
this->freqpoints = freqpoints; this->freqpoints = freqpoints;
this->echoData = echoData; this->echoData = echoData;
this->antPos = antPos; this->antPos = antPos;
qDebug() << u8"回波数据加载完成"; qDebug() << u8"回波数据加载完成";
} }
else { else {
qWarning() << "Error: Unable to open file for reading."; qWarning() << "Error: Unable to open file for reading.";
@ -784,22 +784,22 @@ void FEKOBase::EchoDataClass::SaveEchoData(const QString& filePath)
else {} else {}
std::ofstream file(reinterpret_cast<const wchar_t*>(filePath.utf16()), std::ios::binary); std::ofstream file(reinterpret_cast<const wchar_t*>(filePath.utf16()), std::ios::binary);
qDebug() << "==================================================================="; qDebug() << "===================================================================";
qDebug() << u8"回波脉冲文件格式说明:"; qDebug() << u8"回波脉冲文件格式说明:";
qDebug() << u8"|freqStart(double)freqEnd(double)freqpoints(int)|PRFROW(int),PRFCol(int)|antPos|echodata|"; qDebug() << u8"|freqStart(double)freqEnd(double)freqpoints(int)|PRFROW(int),PRFCol(int)|antPos|echodata|";
qDebug() << u8"其中antPos: PRFrow*3 double x,y,z,incidence,azangle,theta,phi"; qDebug() << u8"其中antPos: PRFrow*3 double x,y,z,incidence,azangle,theta,phi";
qDebug() << u8"其中echodata: PRFrow*PRFCol complex<double> "; qDebug() << u8"其中echodata: PRFrow*PRFCol complex<double> ";
qDebug() << "==================================================================="; qDebug() << "===================================================================";
if (file.is_open()) { if (file.is_open()) {
INT32 PRFRow = echoData.rows(); INT32 PRFRow = echoData.rows();
INT32 freqCol = echoData.cols(); INT32 freqCol = echoData.cols();
file.write(reinterpret_cast<const char*>(&freqStart), sizeof(double)); // 保存频率变量 file.write(reinterpret_cast<const char*>(&freqStart), sizeof(double)); // 保存频率变量
file.write(reinterpret_cast<const char*>(&freqEnd), sizeof(double)); file.write(reinterpret_cast<const char*>(&freqEnd), sizeof(double));
file.write(reinterpret_cast<const char*>(&freqpoints), sizeof(INT32)); file.write(reinterpret_cast<const char*>(&freqpoints), sizeof(INT32));
file.write(reinterpret_cast<const char*>(&PRFRow), sizeof(INT32)); file.write(reinterpret_cast<const char*>(&PRFRow), sizeof(INT32));
file.write(reinterpret_cast<const char*>(&freqCol), sizeof(INT32)); file.write(reinterpret_cast<const char*>(&freqCol), sizeof(INT32));
file.write(reinterpret_cast<const char*>(antPos.data()), sizeof(double) * antPos.size()); // 保存天线位置 file.write(reinterpret_cast<const char*>(antPos.data()), sizeof(double) * antPos.size()); // 保存天线位置
file.write(reinterpret_cast<const char*>(echoData.data()), sizeof(std::complex<double>) * echoData.size()); // 保存回波数据 file.write(reinterpret_cast<const char*>(echoData.data()), sizeof(std::complex<double>) * echoData.size()); // 保存回波数据
file.close(); // 关闭文件 file.close(); // 关闭文件
} }
else { else {
@ -813,7 +813,7 @@ Eigen::MatrixXd FEKOBase::WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun wi
{ {
size_t Nxa = echo.rows(); size_t Nxa = echo.rows();
size_t Nf = echo.cols(); size_t Nf = echo.cols();
Eigen::MatrixXd normw = Eigen::MatrixXd::Zero(Nxa, Nf); // 归一化窗函数 Eigen::MatrixXd normw = Eigen::MatrixXd::Zero(Nxa, Nf); // 归一化窗函数
if (winfun == ImageAlgWindowFun::HANMMING) { if (winfun == ImageAlgWindowFun::HANMMING) {
normw = Hanning(Nf, Nxa); normw = Hanning(Nf, Nxa);
@ -850,7 +850,7 @@ FEKOBase::FEKOImageAlgorithm FEKOBase::String2FEKOImageAlgorithm(QString str)
QString FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg) QString FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg)
{ {
// 将FEKOImageAlgorithm 枚举转换为字符串 // 将FEKOImageAlgorithm 枚举转换为字符串
switch (alg) switch (alg)
{ {
case FEKOBase::TBP_TIME: case FEKOBase::TBP_TIME:
@ -862,7 +862,7 @@ QString FEKOBase::FEKOImageAlgorithm2String(FEKOImageAlgorithm alg)
} }
} }
// 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数 // 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数
QList<QString> FEKOBase::getImageAlgWindowFunList() QList<QString> FEKOBase::getImageAlgWindowFunList()
{ {
@ -902,8 +902,8 @@ QString FEKOBase::ImageAlgWindowFun2String(FEKOBase::ImageAlgWindowFun alg)
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) 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成像算法 // BP成像算法
const double c = 0.299792458; // 光速 const double c = 0.299792458; // 光速
return true; return true;
} }
@ -911,22 +911,22 @@ bool FEKOBase::BPImage_TIME(QString& restiffpath, Eigen::MatrixXcd& echoData, Ei
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) 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成像算法 // BP成像算法
const double c = 0.299792458; // 光速 const double c = 0.299792458; // 光速
const std::complex<double> j(0, 1); // 虚数单位 const std::complex<double> j(0, 1); // 虚数单位
const size_t image_height = X.rows(); const size_t image_height = X.rows();
const size_t image_width = X.cols(); const size_t image_width = X.cols();
const size_t PRFCount = echoData.rows(); const size_t PRFCount = echoData.rows();
const size_t frepoints = echoData.cols(); const size_t frepoints = echoData.cols();
Eigen::MatrixXcd factorj = Eigen::MatrixXcd::Zero(1, echoData.cols()); // 1 , freqs Eigen::MatrixXcd factorj = Eigen::MatrixXcd::Zero(1, echoData.cols()); // 1 , freqs
factorj = freqmatrix.array().cast<std::complex<double>>().array() * j * 4 * M_PI / c; // 声明校正矩阵 factorj = freqmatrix.array().cast<std::complex<double>>().array() * j * 4 * M_PI / c; // 声明校正矩阵
Eigen::MatrixXcd im_final = Eigen::MatrixXcd::Zero(image_height, image_width); Eigen::MatrixXcd im_final = Eigen::MatrixXcd::Zero(image_height, image_width);
#ifdef __SHOWPROCESS // 进度条展示 #ifdef __SHOWPROCESS // 进度条展示
QProgressDialog progressDialog(u8"BP_FREQ成像进度", u8"终止", 0, image_height); QProgressDialog progressDialog(u8"BP_FREQ成像进度", u8"终止", 0, image_height);
progressDialog.setWindowTitle(u8"成像中"); progressDialog.setWindowTitle(u8"成像中");
progressDialog.setWindowModality(Qt::WindowModal); progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true); progressDialog.setAutoClose(true);
progressDialog.setValue(0); progressDialog.setValue(0);
@ -937,7 +937,7 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
#ifdef __SHOWIMAGEPROCESSRESULT // 加窗处理 #ifdef __SHOWIMAGEPROCESSRESULT // 加窗处理
Eigen::MatrixXd normw = WINDOWFun(echoData, winfun); Eigen::MatrixXd normw = WINDOWFun(echoData, winfun);
#endif #endif
@ -945,7 +945,7 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
#pragma omp parallel for #pragma omp parallel for
for (long ii = 0; ii < image_height; ii++) for (long ii = 0; ii < image_height; ii++)
{ {
Eigen::MatrixXd im_R = Eigen::MatrixXd::Zero(PRFCount, 1);// 图像到脉冲矩阵 prf*1 Eigen::MatrixXd im_R = Eigen::MatrixXd::Zero(PRFCount, 1);// 图像到脉冲矩阵 prf*1
Eigen::MatrixXcd term_R = Eigen::MatrixXcd::Zero(1, frepoints); Eigen::MatrixXcd term_R = Eigen::MatrixXcd::Zero(1, frepoints);
Eigen::MatrixXcd pluse_R = Eigen::MatrixXcd::Zero(PRFCount, 1); Eigen::MatrixXcd pluse_R = Eigen::MatrixXcd::Zero(PRFCount, 1);
@ -953,18 +953,18 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
im_R.col(0) = ((antPos.col(0).array() - X(ii, jj)).array().pow(2) + im_R.col(0) = ((antPos.col(0).array() - X(ii, jj)).array().pow(2) +
(antPos.col(1).array() - Y(ii, jj)).array().pow(2) + (antPos.col(1).array() - Y(ii, jj)).array().pow(2) +
(antPos.col(2).array() - Z(ii, jj)).array().pow(2)) (antPos.col(2).array() - Z(ii, jj)).array().pow(2))
.array().sqrt().array(); // 获取目标到天线矩阵 计算 ok .array().sqrt().array(); // 获取目标到天线矩阵 计算 ok
// im_R PRF_count x 1 // im_R PRF_count x 1
for (size_t tt = 0; tt < PRFCount; tt++) { for (size_t tt = 0; tt < PRFCount; tt++) {
term_R = (im_R(tt, 0) * factorj.array()).array().exp(); // ok term_R = (im_R(tt, 0) * factorj.array()).array().exp(); // ok
pluse_R(tt, 0) = (echoData.row(tt).array() * term_R.array()).sum(); // 对每个脉冲校正求和 pluse_R(tt, 0) = (echoData.row(tt).array() * term_R.array()).sum(); // 对每个脉冲校正求和
} }
im_final(ii, jj) = pluse_R.array().sum(); // 计算图像 im_final(ii, jj) = pluse_R.array().sum(); // 计算图像
} }
} }
#else #else
Eigen::MatrixXd im_R = Eigen::MatrixXd::Zero(PRFCount, 1);// 图像到脉冲矩阵 prf*1 Eigen::MatrixXd im_R = Eigen::MatrixXd::Zero(PRFCount, 1);// 图像到脉冲矩阵 prf*1
Eigen::MatrixXcd term_R = Eigen::MatrixXcd::Zero(1, frepoints); Eigen::MatrixXcd term_R = Eigen::MatrixXcd::Zero(1, frepoints);
Eigen::MatrixXcd pluse_R = Eigen::MatrixXcd::Zero(PRFCount, 1); Eigen::MatrixXcd pluse_R = Eigen::MatrixXcd::Zero(PRFCount, 1);
for (long ii = 0; ii < image_height; ii++) for (long ii = 0; ii < image_height; ii++)
@ -973,13 +973,13 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
im_R.col(0) = ((antPos.col(0).array() - X(ii, jj)).array().pow(2) + im_R.col(0) = ((antPos.col(0).array() - X(ii, jj)).array().pow(2) +
(antPos.col(1).array() - Y(ii, jj)).array().pow(2) + (antPos.col(1).array() - Y(ii, jj)).array().pow(2) +
(antPos.col(2).array() - Z(ii, jj)).array().pow(2)) (antPos.col(2).array() - Z(ii, jj)).array().pow(2))
.array().sqrt().array(); // 获取目标到天线矩阵 计算 ok .array().sqrt().array(); // 获取目标到天线矩阵 计算 ok
// im_R PRF_count x 1 // im_R PRF_count x 1
for (size_t tt = 0; tt < PRFCount; tt++) { for (size_t tt = 0; tt < PRFCount; tt++) {
term_R = (im_R(tt, 0) * factorj.array()).array().exp(); // ok term_R = (im_R(tt, 0) * factorj.array()).array().exp(); // ok
pluse_R(tt, 0) = (echoData.row(tt).array() * term_R.array()).sum(); // 对每个脉冲校正求和 pluse_R(tt, 0) = (echoData.row(tt).array() * term_R.array()).sum(); // 对每个脉冲校正求和
} }
im_final(ii, jj) = pluse_R.array().sum(); // 计算图像 im_final(ii, jj) = pluse_R.array().sum(); // 计算图像
} }
#ifdef __SHOWPROCESS #ifdef __SHOWPROCESS
progressDialog.setValue(ii); progressDialog.setValue(ii);
@ -987,13 +987,13 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
} }
#endif #endif
#ifdef __SHOWIMAGEPROCESSRESULT // 加窗处理 #ifdef __SHOWIMAGEPROCESSRESULT // 加窗处理
im_final = im_final.array() / (normw.array().sum()); im_final = im_final.array() / (normw.array().sum());
#endif #endif
// 3. 保存图像 // 3. 保存图像
QString newrestiffpath = restiffpath; QString newrestiffpath = restiffpath;
@ -1011,16 +1011,16 @@ bool FEKOBase::FBPImage_FREQ(QString& restiffpath, Eigen::MatrixXcd& echoData, E
im_final_gdal.setData(im_final); im_final_gdal.setData(im_final);
im_final_gdal.saveImage(); im_final_gdal.saveImage();
qDebug() << QString(u8"保存文件地址:" + restiffpath); qDebug() << QString(u8"保存文件地址:" + restiffpath);
#ifdef __SHOWPROCESS #ifdef __SHOWPROCESS
progressDialog.setWindowTitle(u8"保存文件:" + restiffpath); progressDialog.setWindowTitle(u8"保存文件:" + restiffpath);
progressDialog.setValue(image_height); progressDialog.setValue(image_height);
progressDialog.close(); progressDialog.close();
#endif #endif
// 绘制图像 // 绘制图像
#ifdef __SHOWIMAGEPROCESSRESULT #ifdef __SHOWIMAGEPROCESSRESULT
// 将复数矩阵的幅度转换为实数矩阵 // 将复数矩阵的幅度转换为实数矩阵
matplot::figure(); matplot::figure();
matplot::vector_2d amplitude_im_final(im_final.rows(), matplot::vector_1d(im_final.cols())); matplot::vector_2d amplitude_im_final(im_final.rows(), matplot::vector_1d(im_final.cols()));
for (int i = 0; i < im_final.rows(); ++i) { for (int i = 0; i < im_final.rows(); ++i) {

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <complex> #include <complex>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Dense> #include <Eigen/Dense>
@ -20,29 +20,29 @@
/** /**
* FEKO * FEKO
* 1. * 1.
* 2. PRFPRF * 2. PRFPRF
* 3. PRF 90, * 3. PRF 90,
* 4. * 4.
***/ ***/
namespace FEKOBase { namespace FEKOBase {
//========================================================== //==========================================================
// FEKO常用坐标系 // FEKO常用坐标系
//========================================================== //==========================================================
enum FEKOCoordinateSystem { enum FEKOCoordinateSystem {
Spherical, // 球坐标系 Spherical, // 球坐标系
Cartesian, // 笛卡尔坐标系 Cartesian, // 笛卡尔坐标系
UNKONWFEKOCOORDINATESYSTEM // 必须为最后一个表示未知 UNKONWFEKOCOORDINATESYSTEM // 必须为最后一个表示未知
}; };
FEKOBase::FEKOCoordinateSystem FEKOCoordinateSystemString2Enum(QString str); FEKOBase::FEKOCoordinateSystem FEKOCoordinateSystemString2Enum(QString str);
QString QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode); QString QString2FEKOCoordinateSystem(FEKOBase::FEKOCoordinateSystem mode);
//========================================================== //==========================================================
// FEKO成像模式枚举 // FEKO成像模式枚举
//========================================================== //==========================================================
enum FEKOImageMode enum FEKOImageMode
{ {
@ -60,39 +60,39 @@ namespace FEKOBase {
//========================================================== //==========================================================
// FEKO成像仿真参数类主要用来搭建统一的仿真成像模块 // FEKO成像仿真参数类主要用来搭建统一的仿真成像模块
//========================================================== //==========================================================
//========================================================== //==========================================================
// 频率参数 // 频率参数
//========================================================== //==========================================================
struct freqParams { // 频率参数 struct freqParams { // 频率参数
double startfreqs; double startfreqs;
double endfreqs; double endfreqs;
size_t freqpoint; size_t freqpoint;
}; };
//========================================================== //==========================================================
// 输入的卫星参数 // 输入的卫星参数
//========================================================== //==========================================================
struct SatellitePosition { // 卫星姿态 struct SatellitePosition { // 卫星姿态
double Px = 0, Py = 0, Pz = 0; double Px = 0, Py = 0, Pz = 0;
}; };
struct SatelliteVelocity { // 卫星速度 struct SatelliteVelocity { // 卫星速度
double Vx = 0, Vy = 0, Vz = 0; double Vx = 0, Vy = 0, Vz = 0;
}; };
struct SatelliteState { // 卫星矢量 struct SatelliteState { // 卫星矢量
SatellitePosition pos; SatellitePosition pos;
SatelliteVelocity vel; SatelliteVelocity vel;
}; };
//========================================================== //==========================================================
// FEKO 远场等效源姿态参数 // FEKO 远场等效源姿态参数
//========================================================== //==========================================================
struct FEKOantPitionDirect { struct FEKOantPitionDirect {
double x = 0; double x = 0;
@ -104,14 +104,14 @@ namespace FEKOBase {
//=========================================================== //===========================================================
// FEKO成像设置参数 // FEKO成像设置参数
//=========================================================== //===========================================================
struct FEKOImageSettingParams { struct FEKOImageSettingParams {
double min_x = 0; double min_x = 0;
double max_x = 0; double max_x = 0;
double min_y = 0; double min_y = 0;
double max_y = 0; double max_y = 0;
double plane_z = 0; // 平面高程 double plane_z = 0; // 平面高程
size_t ImageWidth = 0; size_t ImageWidth = 0;
size_t ImageHeight = 0; size_t ImageHeight = 0;
@ -120,28 +120,28 @@ namespace FEKOBase {
//========================================================== //==========================================================
// FEKO参数文件等效参数 // FEKO参数文件等效参数
//========================================================== //==========================================================
struct FEKOSatelliteParams { // FEKOPRF脉冲参数 struct FEKOSatelliteParams { // FEKOPRF脉冲参数
size_t PRFidx = 0; // PRF 脉冲计数 size_t PRFidx = 0; // PRF 脉冲计数
SatelliteState pose;// 卫星矢量 SatelliteState pose;// 卫星矢量
double incidenceAngle = 0; // 入射角 double incidenceAngle = 0; // 入射角
double AzAngle = 0; // 姿态角 double AzAngle = 0; // 姿态角
FEKOantPitionDirect antpos;// 天线实际姿态 FEKOantPitionDirect antpos;// 天线实际姿态
bool isRight = false; // 判断左右视false 左right 右 bool isRight = false; // 判断左右视false 左right 右
}; };
///////////////////////////////////////////////// /////////////////////////////////////////////////
///// 函数类 ///// 函数类
////////////////////////////////////////////// //////////////////////////////////////////////
/// <summary> /// <summary>
/// 频率Setting /// 频率Setting
/// </summary> /// </summary>
/// <param name="centerFreq">中心频率 GHZ</param> /// <param name="centerFreq">中心频率 GHZ</param>
/// <param name="resolution">分辨率 米</param> /// <param name="resolution">分辨率 米</param>
/// <param name="bandWidth">带宽 GHz</param> /// <param name="bandWidth">带宽 GHz</param>
/// <param name="scenceRange">分辨率 米</param> /// <param name="scenceRange">分辨率 米</param>
/// <param name="isResolution"></param> /// <param name="isResolution"></param>
/// <returns></returns> /// <returns></returns>
freqParams 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);
@ -153,22 +153,22 @@ namespace FEKOBase {
FEKOantPitionDirect FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas); FEKOantPitionDirect FEKOSatelliteParams2FEKOantPitionDirect(FEKOSatelliteParams parmas);
/// <summary> /// <summary>
/// 将卫星姿态转换为 FEKO 天线坐标, /// 将卫星姿态转换为 FEKO 天线坐标,
/// 注意默认模型的Z轴为天线的指向 /// 注意默认模型的Z轴为天线的指向
/// </summary> /// </summary>
/// <param name="satepos">卫星矢量</param> /// <param name="satepos">卫星矢量</param>
/// <param name="incidenceAngle">入射角</param> /// <param name="incidenceAngle">入射角</param>
/// <param name="AzAngle">侧视角</param> /// <param name="AzAngle">侧视角</param>
/// <param name="isRIGHT">是否为右视</param> /// <param name="isRIGHT">是否为右视</param>
/// <param name="antposition_Direct">结果文件</param> /// <param name="antposition_Direct">结果文件</param>
/// <param name="inDs">输入模型</param> /// <param name="inDs">输入模型</param>
/// <returns></returns> /// <returns></returns>
TopoDS_Shape 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);
//=============================================== //===============================================
// FEKO结果解析文件 // FEKO结果解析文件
//=============================================== //===============================================
struct ElectricFieldData { struct ElectricFieldData {
@ -195,11 +195,11 @@ namespace FEKOBase {
int numPhiSamples; int numPhiSamples;
QString resultType; QString resultType;
int numHeaderLines; int numHeaderLines;
size_t prfidx = -1; // 脉冲计数,>0 size_t prfidx = -1; // 脉冲计数,>0
}; };
struct PRFPluseData { // 单个PRF脉冲数据格式 struct PRFPluseData { // 单个PRF脉冲数据格式
size_t prfidx; //脉冲次数 size_t prfidx; //脉冲次数
double freqstart; double freqstart;
double freqend; double freqend;
size_t freqpoints; size_t freqpoints;
@ -208,7 +208,7 @@ namespace FEKOBase {
//double theta, phi; //double theta, phi;
//double incidence, azangle; //double incidence, azangle;
//std::vector<double> freqlist; //std::vector<double> freqlist;
std::vector<ElectricFieldData> electricFieldDataList; // 单频点信息 std::vector<ElectricFieldData> electricFieldDataList; // 单频点信息
}; };
bool compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b); bool compareElectricFieldDataInFreq(const ElectricFieldData& a, const ElectricFieldData& b);
@ -221,55 +221,55 @@ namespace FEKOBase {
private: private:
bool usePRFCountMode = true; bool usePRFCountMode = true;
//std::vector<ElectricFieldData> electricFieldDataList; //std::vector<ElectricFieldData> electricFieldDataList;
QMap<QString, std::vector<ElectricFieldData>> electricFieldDataList; // 电场数据 QMap<QString, std::vector<ElectricFieldData>> electricFieldDataList; // 电场数据
//QMap<QString, PRFPluseData> prfPluseMap; //QMap<QString, PRFPluseData> prfPluseMap;
std::vector<PRFPluseData> prfData; std::vector<PRFPluseData> prfData;
size_t freqPoints; size_t freqPoints;
double freqStart; double freqStart;
double freqEnd; double freqEnd;
// 频率参数 // 频率参数
private: // 内部检查函数 private: // 内部检查函数
bool checkPRFModel(); bool checkPRFModel();
bool resizePRFPluse(); //回波整理 bool resizePRFPluse(); //回波整理
public: public:
bool parseCSV(const QString& filePath); // 读取回波数据文件 bool parseCSV(const QString& filePath); // 读取回波数据文件
void toThetapolar(const QString& filePath);// 输出theta 极化 void toThetapolar(const QString& filePath);// 输出theta 极化
void toPhiPolar(const QString& filePath);// 输出phi 极化 void toPhiPolar(const QString& filePath);// 输出phi 极化
void toRPolar(const QString& filePath);// 输出phi 极化 void toRPolar(const QString& filePath);// 输出phi 极化
void saveCSV(const QString& filePath);// 输出csv文件 void saveCSV(const QString& filePath);// 输出csv文件
private: private:
void toEchoData(const QString& filePath, size_t outDataName);// 输出回波数据 void toEchoData(const QString& filePath, size_t outDataName);// 输出回波数据
}; };
//======================================================================== //========================================================================
// 成像回波格式 // 成像回波格式
// file type: // file type:
// freqStart,freqEnd,freqPoint,isRight, // freqStart,freqEnd,freqPoint,isRight,
// PRF1,Pos,incidenceAngle,AzAngle,echoDatalist // PRF1,Pos,incidenceAngle,AzAngle,echoDatalist
// PRF2,Pos,incidenceAngle,AzAngle,echoDatalist // PRF2,Pos,incidenceAngle,AzAngle,echoDatalist
// 。 // 。
// 。 // 。
// 。 // 。
// 注意Bp并不关心脉冲的顺序只是关注脉冲的坐标位置默认按照脉冲的解析顺序进行组织 // 注意Bp并不关心脉冲的顺序只是关注脉冲的坐标位置默认按照脉冲的解析顺序进行组织
//======================================================================== //========================================================================
class EchoDataClass { class EchoDataClass {
private: // 成像变量 private: // 成像变量
Eigen::MatrixXcd echoData; // 回波数据 Eigen::MatrixXcd echoData; // 回波数据
Eigen::MatrixXd antPos;// 每个脉冲的坐标 Eigen::MatrixXd antPos;// 每个脉冲的坐标
double freqStart; // 起始频率 double freqStart; // 起始频率
double freqEnd; // 终止频率 double freqEnd; // 终止频率
int freqpoints; // 频率点数 int freqpoints; // 频率点数
public: public:
EchoDataClass(const FEKOBase::EchoDataClass& inecho); EchoDataClass(const FEKOBase::EchoDataClass& inecho);
EchoDataClass(); EchoDataClass();
~EchoDataClass(); ~EchoDataClass();
public: public:
// 根据每个成员变量构建属性 // 根据每个成员变量构建属性
void setEchoData(Eigen::MatrixXcd echoData); void setEchoData(Eigen::MatrixXcd echoData);
Eigen::MatrixXcd getEchoData() const; Eigen::MatrixXcd getEchoData() const;
void setAntPos(Eigen::MatrixXd antPos); void setAntPos(Eigen::MatrixXd antPos);
@ -281,8 +281,8 @@ namespace FEKOBase {
void setFreqpoints(int freqpoints); void setFreqpoints(int freqpoints);
int getFreqpoints() const; int getFreqpoints() const;
void loadEchoData(const QString& filePath); // 加载回波数据文件 void loadEchoData(const QString& filePath); // 加载回波数据文件
void SaveEchoData(const QString& filePath); // 保存回波数据文件 void SaveEchoData(const QString& filePath); // 保存回波数据文件
}; };
@ -290,16 +290,16 @@ namespace FEKOBase {
//========================================================== //==========================================================
// 仿真成像算法类 // 仿真成像算法类
// BP成像算法 // BP成像算法
// 建议将所有的频率处理到 GHz 单位,避免频率过大导致的精度问题 // 建议将所有的频率处理到 GHz 单位,避免频率过大导致的精度问题
// 回波矩阵: // 回波矩阵:
// PRF1:f1,f2,f3,f4 // PRF1:f1,f2,f3,f4
// PRF2f1,f2,f3,f4 // PRF2f1,f2,f3,f4
// PRF2f1,f2,f3,f4 // PRF2f1,f2,f3,f4
//========================================================== //==========================================================
enum ImageAlgWindowFun // 成像方法加窗方法 enum ImageAlgWindowFun // 成像方法加窗方法
{ {
NOWINDOWS, NOWINDOWS,
HANMMING, HANMMING,
@ -307,9 +307,9 @@ namespace FEKOBase {
}; };
/// <summary> /// <summary>
/// 加窗 /// 加窗
/// </summary> /// </summary>
/// <param name="echo">行:脉冲,列:频点</param> /// <param name="echo">行:脉冲,列:频点</param>
/// <returns></returns> /// <returns></returns>
Eigen::MatrixXd WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING); Eigen::MatrixXd WINDOWFun(Eigen::MatrixXcd& echo, ImageAlgWindowFun winfun = ImageAlgWindowFun::HANMMING);
@ -317,21 +317,21 @@ namespace FEKOBase {
{ {
TBP_TIME, TBP_TIME,
TBP_FREQ, TBP_FREQ,
UNKONW // 必须为最后一个表示未知 UNKONW // 必须为最后一个表示未知
}; };
QList<QString> getFEKOImageAlgorithmList(); QList<QString> getFEKOImageAlgorithmList();
FEKOImageAlgorithm String2FEKOImageAlgorithm(QString str); FEKOImageAlgorithm String2FEKOImageAlgorithm(QString str);
QString FEKOImageAlgorithm2String(FEKOImageAlgorithm alg); QString FEKOImageAlgorithm2String(FEKOImageAlgorithm alg);
// 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数 // 请仿照FEKOImageAlgorithm枚举的写法构建QString 与 ImageAlgWindowFun 的转换函数
QList<QString> getImageAlgWindowFunList(); QList<QString> getImageAlgWindowFunList();
ImageAlgWindowFun String2ImageAlgWindowFun(QString str); ImageAlgWindowFun String2ImageAlgWindowFun(QString str);
QString ImageAlgWindowFun2String(ImageAlgWindowFun alg); QString ImageAlgWindowFun2String(ImageAlgWindowFun alg);
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 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成像 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,4 +1,4 @@
#include "FEKONearBPBasic.h" #include "FEKONearBPBasic.h"
#include "BaseToolLib/interpolation.h" #include "BaseToolLib/interpolation.h"
#include "BaseToollib/FileOperator.h" #include "BaseToollib/FileOperator.h"
#include "BaseToollib/BaseTool.h" #include "BaseToollib/BaseTool.h"
@ -25,13 +25,13 @@
// 定义插值函数,以处理复数值 // 定义插值函数,以处理复数值
std::complex<double> 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 m = xi.rows();
int n = xi.cols(); int n = xi.cols();
if (x < xi(0, 0) || x > xi(m - 1, n - 1) || y < yi(0, 0) || y > yi(m - 1, n - 1)) { if (x < xi(0, 0) || x > xi(m - 1, n - 1) || y < yi(0, 0) || y > yi(m - 1, n - 1)) {
std::complex<double> defaultMatrix = std::complex<double>(0,0); // 超出范围时返回默认值 std::complex<double> defaultMatrix = std::complex<double>(0,0); // 超出范围时返回默认值
return defaultMatrix; return defaultMatrix;
} }
@ -81,13 +81,13 @@ Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint)
result(i, 0) = std::sqrt(CartesianPoint(i, 0) * CartesianPoint(i, 0) + result(i, 0) = std::sqrt(CartesianPoint(i, 0) * CartesianPoint(i, 0) +
CartesianPoint(i, 1) * CartesianPoint(i, 1) + CartesianPoint(i, 1) * CartesianPoint(i, 1) +
CartesianPoint(i, 2) * CartesianPoint(i, 2)); CartesianPoint(i, 2) * CartesianPoint(i, 2));
result(i, 1) = std::acos(CartesianPoint(i, 2) / result(i, 0));// 行 theta result(i, 1) = std::acos(CartesianPoint(i, 2) / result(i, 0));// 行 theta
if (CartesianPoint(i, 0) == 0 && CartesianPoint(i, 1) == 0) { if (CartesianPoint(i, 0) == 0 && CartesianPoint(i, 1) == 0) {
result(i, 2) = 0; result(i, 2) = 0;
} }
else { else {
result(i, 2) = std::asin(y / (std::sin(result(i, 1)) * result(i, 0)));//一 三 -pi/2 pi/2 result(i, 2) = std::asin(y / (std::sin(result(i, 1)) * result(i, 0)));//一 三 -pi/2 pi/2
if (CartesianPoint(i, 0) < 0 && CartesianPoint(i, 1) > 0) { // 二 if (CartesianPoint(i, 0) < 0 && CartesianPoint(i, 1) > 0) { // 二
result(i, 2) = PI - result(i, 2);// phi result(i, 2) = PI - result(i, 2);// phi
} }
else if (CartesianPoint(i, 0) < 0 && CartesianPoint(i, 1) < 0) { else if (CartesianPoint(i, 0) < 0 && CartesianPoint(i, 1) < 0) {
@ -120,7 +120,7 @@ int FBP2DProcess(QString in_path, QString out_path, double Rref, double minX, do
int 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)
{ {
/* /*
* % * %
fid=fopen("H_echo.bin","w+"); fid=fopen("H_echo.bin","w+");
fwrite(fid,801,'int32'); fwrite(fid,801,'int32');
fwrite(fid,801,'int32'); fwrite(fid,801,'int32');
@ -137,7 +137,7 @@ for i=1:length(AntPostion)
end end
fclose(fid); fclose(fid);
**/ **/
// 构建二进制文件 // 构建二进制文件
std::ofstream file(path.toUtf8().constData(), std::ios::binary); std::ofstream file(path.toUtf8().constData(), std::ios::binary);
double freq; double freq;
@ -175,13 +175,13 @@ fclose(fid);
template<typename T> template<typename T>
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) 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); // 空指针 bool logfun = !(nullptr == logclss); // 空指针
double delta_x = (maxX - minX) / (ImageWidth - 1); double delta_x = (maxX - minX) / (ImageWidth - 1);
double delta_y = (maxY - minY) / (ImageHeight - 1); double delta_y = (maxY - minY) / (ImageHeight - 1);
double* Rs = new double[timefreqnum]; // 时域 距离插值 double* Rs = new double[timefreqnum]; // 时域 距离插值
for (int i = 0; i < timefreqnum; i++) { for (int i = 0; i < timefreqnum; i++) {
Rs[i] = (LIGHTSPEED / timeFreqBandWidth) * i; // 参考 《雷达成像算法》-- 匹配滤波一章 Rs[i] = (LIGHTSPEED / timeFreqBandWidth) * i; // 参考 《雷达成像算法》-- 匹配滤波一章
} }
double wave_len = LIGHTSPEED / startfreq; double wave_len = LIGHTSPEED / startfreq;
if (logfun) { if (logfun) {
@ -219,8 +219,8 @@ Eigen::MatrixXcd BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
); );
dR = R - Rref; dR = R - Rref;
std::complex<double> echo_temp( std::complex<double> echo_temp(
gsl_spline_eval(spline_time_real, R, accopm),// 插值实部 gsl_spline_eval(spline_time_real, R, accopm),// 插值实部
gsl_spline_eval(spline_time_imag, R, accopm)// 插值虚部 gsl_spline_eval(spline_time_imag, R, accopm)// 插值虚部
); );
img(ii, jj) = img(ii, jj) + echo_temp * std::exp(std::complex<double>(0, 2 * pi * dR / wave_len)); img(ii, jj) = img(ii, jj) + echo_temp * std::exp(std::complex<double>(0, 2 * pi * dR / wave_len));
} }
@ -228,7 +228,7 @@ Eigen::MatrixXcd BP2DImageByPluse(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
gsl_spline_free(spline_time_real); gsl_spline_free(spline_time_real);
gsl_spline_free(spline_time_imag); gsl_spline_free(spline_time_imag);
gsl_interp_accel_free(accopm); gsl_interp_accel_free(accopm);
// 保存文件 // 保存文件
process = process + 1; process = process + 1;
if (logfun) { if (logfun) {
logclss->logFUN((size_t)(process / PRFNUM * 100), "BP process over"); logclss->logFUN((size_t)(process / PRFNUM * 100), "BP process over");
@ -250,18 +250,18 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
double maxRange = delta_x * ImageWidth > delta_y * ImageHeight ? delta_x * ImageWidth : delta_y * ImageHeight; double maxRange = delta_x * ImageWidth > delta_y * ImageHeight ? delta_x * ImageWidth : delta_y * ImageHeight;
double halfR = Rref * 0.1; double halfR = Rref * 0.1;
double maxRLs = std::sqrt(Rref * Rref + halfR * halfR) - Rref; double maxRLs = std::sqrt(Rref * Rref + halfR * halfR) - Rref;
double minR = Rref - maxRange * 2 - maxRLs; // 最小斜距 double minR = Rref - maxRange * 2 - maxRLs; // 最小斜距
double maxR = Rref + maxRange * 2 + maxRLs; // 最大斜距 double maxR = Rref + maxRange * 2 + maxRLs; // 最大斜距
double dftime = timeFreqBandWidth / (timefreqnum - 1); double dftime = timeFreqBandWidth / (timefreqnum - 1);
// 后续需要增加距离窗的计算方法 // 后续需要增加距离窗的计算方法
double dRs = (LIGHTSPEED / 2.0/timeFreqBandWidth); // 距离向分辨率 double dRs = (LIGHTSPEED / 2.0/timeFreqBandWidth); // 距离向分辨率
double* Rs = new double[timefreqnum]; // 时域 距离插值 double* Rs = new double[timefreqnum]; // 时域 距离插值
for (int i = 0; i < timefreqnum; i++) { for (int i = 0; i < timefreqnum; i++) {
Rs[i] = 2*dRs * i; // 参考 《雷达成像算法》-- 匹配滤波一章 Rs[i] = 2*dRs * i; // 参考 《雷达成像算法》-- 匹配滤波一章
} }
//double wave_len = LIGHTSPEED / startfreq; //double wave_len = LIGHTSPEED / startfreq;
if (logfun) { if (logfun) {
@ -274,7 +274,7 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
Eigen::MatrixXcd img = Eigen::MatrixXcd::Zero(ImageHeight, ImageWidth); Eigen::MatrixXcd img = Eigen::MatrixXcd::Zero(ImageHeight, ImageWidth);
omp_lock_t lock; omp_lock_t lock;
omp_init_lock(&lock); // 初始化互斥锁 omp_init_lock(&lock); // 初始化互斥锁
size_t parallel_step = 100; size_t parallel_step = 100;
@ -293,7 +293,7 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
double dR = 0; double dR = 0;
// 估算坐标的夹角,估算双线性距离 // 估算坐标的夹角,估算双线性距离
Eigen::MatrixXd Rline(PRFNUM, 2); Eigen::MatrixXd Rline(PRFNUM, 2);
Point_3d Vpluse_p; Point_3d Vpluse_p;
Point_3d Vs_e; Point_3d Vs_e;
@ -329,14 +329,14 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
dR = 0; dR = 0;
for (int mm = 0; mm < PRFNUM; mm++) { // 计算每个脉冲情况 for (int mm = 0; mm < PRFNUM; mm++) { // 计算每个脉冲情况
Rline(mm, 0) = std::sqrt( Rline(mm, 0) = std::sqrt(
std::pow(AntPosition(mm, 0) - px, 2) + std::pow(AntPosition(mm, 0) - px, 2) +
std::pow(AntPosition(mm, 1) - py, 2) + std::pow(AntPosition(mm, 1) - py, 2) +
std::pow(AntPosition(mm, 2) - pz, 2) std::pow(AntPosition(mm, 2) - pz, 2)
); );
// 计算夹角 // 计算夹角
Vpluse_p.x = px - AntPosition(mm, 0); Vpluse_p.x = px - AntPosition(mm, 0);
Vpluse_p.y = py - AntPosition(mm, 1); Vpluse_p.y = py - AntPosition(mm, 1);
Vpluse_p.z = pz - AntPosition(mm, 2); Vpluse_p.z = pz - AntPosition(mm, 2);
@ -354,16 +354,16 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
Rline(mm, 1) = Vpluse_p.x * Vs_e.x + Vpluse_p.y * Vs_e.y + Vpluse_p.z * Vs_e.z; // cos(90)=0 Rline(mm, 1) = Vpluse_p.x * Vs_e.x + Vpluse_p.y * Vs_e.y + Vpluse_p.z * Vs_e.z; // cos(90)=0
} }
Rline_ref = Rref; Rline_ref = Rref;
// 查找最小值,获取 0多普勒条件下的 最短参考路径 // 查找最小值,获取 0多普勒条件下的 最短参考路径
for (int mm = 0; mm < PRFNUM - 1; mm++) { for (int mm = 0; mm < PRFNUM - 1; mm++) {
if (Rline(mm, 0) == 0) { // 求解最小值 if (Rline(mm, 0) == 0) { // 求解最小值
Rline_ref = Rline(mm, 0); Rline_ref = Rline(mm, 0);
break; break;
} }
else { else {
double flag = Rline(mm, 1) * Rline(mm + 1, 1); double flag = Rline(mm, 1) * Rline(mm + 1, 1);
if (flag < 0) { // 不同号 if (flag < 0) { // 不同号
// 求解目标点到 当前直线的最短距离 // 求解目标点到 当前直线的最短距离
p.x = px; p.x = px;
p.y = py; p.y = py;
p.z = pz; p.z = pz;
@ -380,17 +380,17 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
} }
} }
offer_Rline = Rline_ref - Rref; // 计算偏移线 offer_Rline = Rline_ref - Rref; // 计算偏移线
Rline = Rline.array() + offer_Rline; Rline = Rline.array() + offer_Rline;
for (int mm = 0; mm < PRFNUM; mm++) { for (int mm = 0; mm < PRFNUM; mm++) {
R= Rline(mm, 0); // 已经校正了距离徙动线 R= Rline(mm, 0); // 已经校正了距离徙动线
//if (R<minR || R > maxR) { // 距离窗 //if (R<minR || R > maxR) { // 距离窗
// continue; // continue;
//} //}
dR = R - Rref; dR = R - Rref;
// 插值计算 // 插值计算
index = R / 2 / dRs; index = R / 2 / dRs;
last_ids = size_t(std::floor(index)); last_ids = size_t(std::floor(index));
next_ids = size_t(std::ceil(index)); next_ids = size_t(std::ceil(index));
@ -398,7 +398,7 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
last_value = timeEcho(mm, last_ids); last_value = timeEcho(mm, last_ids);
next_value = timeEcho(mm, next_ids); next_value = timeEcho(mm, next_ids);
// 实部,虚部同时插值 // 实部,虚部同时插值
real = last_value.real() + ((next_value.real() - last_value.real()) / (next_ids - last_ids)) * (index - last_ids); real = last_value.real() + ((next_value.real() - last_value.real()) / (next_ids - last_ids)) * (index - last_ids);
imag = last_value.imag() + ((next_value.imag() - last_value.imag()) / (next_ids - last_ids)) * (index - last_ids); imag = last_value.imag() + ((next_value.imag() - last_value.imag()) / (next_ids - last_ids)) * (index - last_ids);
echo_temp.real(real); echo_temp.real(real);
@ -411,7 +411,7 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
} }
img(i, j) = echo_sum; img(i, j) = echo_sum;
} }
// 保存文件 // 保存文件
} }
omp_set_lock(&lock); omp_set_lock(&lock);
@ -422,7 +422,7 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
} }
omp_unset_lock(&lock); omp_unset_lock(&lock);
} }
omp_destroy_lock(&lock); //销毁互斥器 omp_destroy_lock(&lock); //销毁互斥器
if (logfun) { if (logfun) {
logclss->logFUN(100, "BP process over"); logclss->logFUN(100, "BP process over");
} }
@ -432,10 +432,10 @@ Eigen::MatrixXcd BP2DImageByPixel(Eigen::MatrixXcd timeEcho, Eigen::MatrixXd Ant
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) 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); this->readEchoFile(in_path);
this->out_path = out_path; this->out_path = out_path;
this->Rref = Rref; // 成像中心的参考距离 this->Rref = Rref; // 成像中心的参考距离
this->minX = minX; this->minX = minX;
this->maxX = maxX; this->maxX = maxX;
this->minY = minY; this->minY = minY;
@ -443,13 +443,13 @@ int BP2DProcessClass::initProcess(QString in_path, QString out_path, double Rref
this->Zplane = PlaneZ; this->Zplane = PlaneZ;
this->ImageHeight = ImageHeight; this->ImageHeight = ImageHeight;
this->ImageWidth = ImageWidth; this->ImageWidth = ImageWidth;
// 计算坐标的到成像中心的坐标 // 计算坐标的到成像中心的坐标
this->centerX = (this->maxX + this->minX) / 2; this->centerX = (this->maxX + this->minX) / 2;
this->centerY = (this->minY + this->maxY) / 2; this->centerY = (this->minY + this->maxY) / 2;
this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX; this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX;
this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY; this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY;
this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane; this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane;
// 计算频率相关信息 // 计算频率相关信息
this->f1 = this->Frequencylist(0); this->f1 = this->Frequencylist(0);
this->freqnum = this->Frequencylist.rows(); this->freqnum = this->Frequencylist.rows();
this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1)); this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1));
@ -460,7 +460,7 @@ int BP2DProcessClass::readEchoFile(QString in_path)
{ {
std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary); std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary);
if (!fin.is_open()) exit(2); if (!fin.is_open()) exit(2);
// 读取参数 // 读取参数
int height = 0; int height = 0;
int width = 0; int width = 0;
fin.read((char*)&height, sizeof(int)); fin.read((char*)&height, sizeof(int));
@ -470,14 +470,14 @@ int BP2DProcessClass::readEchoFile(QString in_path)
//frequencylist[width*double] //frequencylist[width*double]
double* freqs = new double[width]; double* freqs = new double[width];
fin.read((char*)freqs, sizeof(double) * width); fin.read((char*)freqs, sizeof(double) * width);
this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量 this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
this->Frequencylist(i) = freqs[i]; this->Frequencylist(i) = freqs[i];
} }
delete[] freqs; delete[] freqs;
freqs = nullptr; freqs = nullptr;
// 读取回波并解析脉冲天线位置 // 读取回波并解析脉冲天线位置
this->AntPosition = Eigen::MatrixXd::Zero(height, 3); this->AntPosition = Eigen::MatrixXd::Zero(height, 3);
this->echo = Eigen::MatrixXcd::Zero(height, width); this->echo = Eigen::MatrixXcd::Zero(height, width);
double tempvalue = 0; double tempvalue = 0;
@ -507,65 +507,65 @@ int BP2DProcessClass::saveTiFF(Eigen::MatrixXcd m)
} }
/// <summary> /// <summary>
/// 成像工作流,注意存在大量的内存浪费,后期可以根据情况进行优化 /// 成像工作流,注意存在大量的内存浪费,后期可以根据情况进行优化
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
int BP2DProcessClass::start() int BP2DProcessClass::start()
{ {
// step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码 // step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码
QString parantPath = getParantFolderNameFromPath(this->out_path); QString parantPath = getParantFolderNameFromPath(this->out_path);
// step 1 插值频率域 -- FEKO 频率插值是均匀插值 // step 1 插值频率域 -- FEKO 频率插值是均匀插值
size_t Nf = this->freqnum; size_t Nf = this->freqnum;
size_t Nxa = this->AntPosition.rows(); size_t Nxa = this->AntPosition.rows();
double df = this->Frequencylist(1) - this->Frequencylist(0); // FEKO 的频率插值比较规整 double df = this->Frequencylist(1) - this->Frequencylist(0); // FEKO 的频率插值比较规整
double startfreq = this->Frequencylist(0); // 起始频率 double startfreq = this->Frequencylist(0); // 起始频率
// 输出频域 图像(未处理前) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出频域 图像(未处理前) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString before_path = JoinPath(parantPath, "freq_ampDB_angle_echo.tiff"); QString before_path = JoinPath(parantPath, "freq_ampDB_angle_echo.tiff");
WriteComplexData2AmpdB_Arg(before_path, this->echo);// 保存为频域回波 WriteComplexData2AmpdB_Arg(before_path, this->echo);// 保存为频域回波
this->logFUN(100, "Read Echo\n"); this->logFUN(100, "Read Echo\n");
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
this->logFUN(100, "hamming windows over"); this->logFUN(100, "hamming windows over");
// ----------------- step2 傅里叶变换 (频域-->时域) ----------------------------------------- // ----------------- step2 傅里叶变换 (频域-->时域) -----------------------------------------
Eigen::MatrixXcd echoTime = IFFTW1D(this->echo); Eigen::MatrixXcd echoTime = IFFTW1D(this->echo);
size_t timefreqnum = echoTime.cols(); size_t timefreqnum = echoTime.cols();
double timeFreqBandWidth = df * (timefreqnum - 1); double timeFreqBandWidth = df * (timefreqnum - 1);
this->logFUN(100, "echo IFFT over"); this->logFUN(100, "echo IFFT over");
// 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString time_echo_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_ifft.tiff"); QString time_echo_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_ifft.tiff");
WriteComplexData2AmpdB_Arg(time_echo_path, echoTime);// 保存为频域回波 WriteComplexData2AmpdB_Arg(time_echo_path, echoTime);// 保存为频域回波
this->logFUN(100, "after ifft ,in Time\n"); this->logFUN(100, "after ifft ,in Time\n");
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// step 3 时域域加窗 // step 3 时域域加窗
Nf = echoTime.cols(); Nf = echoTime.cols();
Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54) Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54)
double normw = wfxa.array().sum(); // normw = TOTAL(wfxa) double normw = wfxa.array().sum(); // normw = TOTAL(wfxa)
Eigen::MatrixXcd dfrex = (echoTime.array())* (wfxa.array()); // dfrex = dfrex * wfxa Eigen::MatrixXcd dfrex = (echoTime.array())* (wfxa.array()); // dfrex = dfrex * wfxa
// 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff"); QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff");
WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波 WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波
this->logFUN(100, "after hanning\n"); this->logFUN(100, "after hanning\n");
echoTime = dfrex; echoTime = dfrex;
// ----------------- step4 TBP成像 (时域) ----------------------------------------------------------- // ----------------- step4 TBP成像 (时域) -----------------------------------------------------------
Eigen::MatrixXcd img = BP2DImageByPixel(echoTime, this->AntPosition, this->minX, this->maxX, this->minY, this->maxY, this->Zplane, this->Rref, this->ImageWidth, this->ImageHeight, startfreq, timefreqnum, timeFreqBandWidth, this); Eigen::MatrixXcd img = BP2DImageByPixel(echoTime, this->AntPosition, this->minX, this->maxX, this->minY, this->maxY, this->Zplane, this->Rref, this->ImageWidth, this->ImageHeight, startfreq, timefreqnum, timeFreqBandWidth, this);
this->logFUN(100, "echo bp over"); this->logFUN(100, "echo bp over");
// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_BP.tiff"); QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_BP.tiff");
WriteComplexData2AmpdB_Arg(FBP_resultDB_path, img);// 保存为频域回波 WriteComplexData2AmpdB_Arg(FBP_resultDB_path, img);// 保存为频域回波
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_BP.tiff"); QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_BP.tiff");
WriteComplexData2Amp_Arg(FBP_result_path, img);// 保存为频域回波 WriteComplexData2Amp_Arg(FBP_result_path, img);// 保存为频域回波
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
this->saveTiFF(img); this->saveTiFF(img);
@ -588,7 +588,7 @@ int BP2DProcessClass::logFUN(int percent, QString logtext) {
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
/// <summary> /// <summary>
/// FBP成像工作流频域参考 bp_linear_2d /// FBP成像工作流频域参考 bp_linear_2d
/// Juan M Lopez-Sanchez, University of Alicante /// Juan M Lopez-Sanchez, University of Alicante
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
@ -611,10 +611,10 @@ int BP2DProcessClass::logFUN(int percent, QString logtext) {
int FBP2DProcessClass::initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth) int FBP2DProcessClass::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); this->readEchoFile(in_path);
this->out_path = out_path; this->out_path = out_path;
this->Rref = Rref; // 成像中心的参考距离 this->Rref = Rref; // 成像中心的参考距离
this->minX = minX; this->minX = minX;
this->maxX = maxX; this->maxX = maxX;
this->minY = minY; this->minY = minY;
@ -622,13 +622,13 @@ int FBP2DProcessClass::initProcess(QString in_path, QString out_path, double Rre
this->Zplane = PlaneZ; this->Zplane = PlaneZ;
this->ImageHeight = ImageHeight; this->ImageHeight = ImageHeight;
this->ImageWidth = ImageWidth; this->ImageWidth = ImageWidth;
// 计算坐标的到成像中心的坐标 // 计算坐标的到成像中心的坐标
this->centerX = (this->maxX + this->minX) / 2; this->centerX = (this->maxX + this->minX) / 2;
this->centerY = (this->minY + this->maxY) / 2; this->centerY = (this->minY + this->maxY) / 2;
this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX; this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX;
this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY; this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY;
this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane; this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane;
// 计算频率相关信息 // 计算频率相关信息
this->f1 = this->Frequencylist(0); this->f1 = this->Frequencylist(0);
this->freqnum = this->Frequencylist.rows(); this->freqnum = this->Frequencylist.rows();
this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1)); this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1));
@ -639,7 +639,7 @@ int FBP2DProcessClass::readEchoFile(QString in_path)
{ {
std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary); std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary);
if (!fin.is_open()) exit(2); if (!fin.is_open()) exit(2);
// 读取参数 // 读取参数
int height = 0; int height = 0;
int width = 0; int width = 0;
fin.read((char*)&height, sizeof(int)); fin.read((char*)&height, sizeof(int));
@ -649,14 +649,14 @@ int FBP2DProcessClass::readEchoFile(QString in_path)
//frequencylist[width*double] //frequencylist[width*double]
double* freqs = new double[width]; double* freqs = new double[width];
fin.read((char*)freqs, sizeof(double) * width); fin.read((char*)freqs, sizeof(double) * width);
this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量 this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
this->Frequencylist(i) = freqs[i]; this->Frequencylist(i) = freqs[i];
} }
delete[] freqs; delete[] freqs;
freqs = nullptr; freqs = nullptr;
// 读取回波并解析脉冲天线位置 // 读取回波并解析脉冲天线位置
this->AntPosition = Eigen::MatrixXd::Zero(height, 3); this->AntPosition = Eigen::MatrixXd::Zero(height, 3);
this->echo = Eigen::MatrixXcd::Zero(height, width); this->echo = Eigen::MatrixXcd::Zero(height, width);
double tempvalue = 0; double tempvalue = 0;
@ -702,45 +702,45 @@ int FBP2DProcessClass::saveTiFF(Eigen::MatrixXcd m)
/// <summary> /// <summary>
/// FBP成像工作流频域参考 bp_linear_2d /// FBP成像工作流频域参考 bp_linear_2d
/// Juan M Lopez-Sanchez, University of Alicante /// Juan M Lopez-Sanchez, University of Alicante
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
int FBP2DProcessClass::start() int FBP2DProcessClass::start()
{ {
// step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码 // step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码
QString parantPath = getParantFolderNameFromPath(this->out_path); QString parantPath = getParantFolderNameFromPath(this->out_path);
// step 1 插值频率域 -- FEKO 频率插值是均匀插值 // step 1 插值频率域 -- FEKO 频率插值是均匀插值
size_t Nf = this->freqnum; size_t Nf = this->freqnum;
size_t Nxa = this->AntPosition.rows(); size_t Nxa = this->AntPosition.rows();
// 输出频域 图像(未处理前) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出频域 图像(未处理前) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString before_path = JoinPath(parantPath, "freq_ampDB_angle_echo.tiff"); QString before_path = JoinPath(parantPath, "freq_ampDB_angle_echo.tiff");
WriteComplexData2AmpdB_Arg(before_path, this->echo);// 保存为频域回波 WriteComplexData2AmpdB_Arg(before_path, this->echo);// 保存为频域回波
this->logFUN(100, "Read Echo\n"); this->logFUN(100, "Read Echo\n");
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// step 2 频率域加窗 // step 2 频率域加窗
Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54) Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54)
double normw = wfxa.array().sum(); // normw = TOTAL(wfxa) double normw = wfxa.array().sum(); // normw = TOTAL(wfxa)
Eigen::MatrixXcd dfrex = (this->echo.array()) * (wfxa.array()); // dfrex = dfrex * wfxa Eigen::MatrixXcd dfrex = (this->echo.array()) * (wfxa.array()); // dfrex = dfrex * wfxa
// 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff"); QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff");
WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波 WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波
this->logFUN(100, "after hanning\n"); this->logFUN(100, "after hanning\n");
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// step 3 Freq Backprojection algorithm // step 3 Freq Backprojection algorithm
Eigen::MatrixXcd result_image = Eigen::MatrixXcd::Zero(this->ImageHeight, this->ImageWidth); // 构建网格,每个网格坐标根据中心点,平面点计算 Eigen::MatrixXcd result_image = Eigen::MatrixXcd::Zero(this->ImageHeight, this->ImageWidth); // 构建网格,每个网格坐标根据中心点,平面点计算
double dx = (this->maxX - this->minX) / (this->ImageWidth - 1); double dx = (this->maxX - this->minX) / (this->ImageWidth - 1);
double dy = (this->maxY - this->minY) / (this->ImageWidth - 1); double dy = (this->maxY - this->minY) / (this->ImageWidth - 1);
double px = 0, py = 0, pz = 0; // 像素坐标 double px = 0, py = 0, pz = 0; // 像素坐标
Eigen::MatrixXd Xdis = Eigen::MatrixXd::Zero(Nxa, Nf); Eigen::MatrixXd Xdis = Eigen::MatrixXd::Zero(Nxa, Nf);
// ; Nxa Nf // ; Nxa Nf
// mfre = fre # replicate(1, Nxa) ---- Nxa * Nf 复制每行 f1,f2,f3 ....... // mfre = fre # replicate(1, Nxa) ---- Nxa * Nf 复制每行 f1,f2,f3 .......
// c = 0.2997925 ; Speed of light // c = 0.2997925 ; Speed of light
// factorj = cj * (4.0*!PI/c) * mfre --- Nxa * Nf 复制每行 f1,f2,f3 ....... // factorj = cj * (4.0*!PI/c) * mfre --- Nxa * Nf 复制每行 f1,f2,f3 .......
// //
Eigen::MatrixXcd factorj = Eigen::MatrixXcd::Zero(Nxa, Nf); Eigen::MatrixXcd factorj = Eigen::MatrixXcd::Zero(Nxa, Nf);
@ -750,7 +750,7 @@ int FBP2DProcessClass::start()
} }
} }
double R0 = this->Rref;// -- 参考斜距 double R0 = this->Rref;// -- 参考斜距
Eigen::MatrixXd R = Eigen::MatrixXd::Zero(Nxa, Nf); Eigen::MatrixXd R = Eigen::MatrixXd::Zero(Nxa, Nf);
Eigen::MatrixXd distR = Eigen::MatrixXd::Zero(Nxa, 1); Eigen::MatrixXd distR = Eigen::MatrixXd::Zero(Nxa, 1);
Eigen::MatrixXcd term = Eigen::MatrixXcd::Zero(Nxa, Nf); Eigen::MatrixXcd term = Eigen::MatrixXcd::Zero(Nxa, Nf);
@ -760,39 +760,39 @@ int FBP2DProcessClass::start()
if (ix % 100 == 0) { if (ix % 100 == 0) {
this->logFUN(size_t(ix * 1.0 / this->ImageWidth * 100), "FBP ....\n"); this->logFUN(size_t(ix * 1.0 / this->ImageWidth * 100), "FBP ....\n");
} }
// theta = theta / !radeg -- 根据入射角 计算 参考坐标 // theta = theta / !radeg -- 根据入射角 计算 参考坐标
// ya = Ro * sin(theta) -- 雷达 y 坐标 // ya = Ro * sin(theta) -- 雷达 y 坐标
// za = Ro * cos(theta) -- 雷达 z 坐标 // za = Ro * cos(theta) -- 雷达 z 坐标
// //
// xa_min = pos_start // xa_min = pos_start
// xa_max = pos_stop // xa_max = pos_stop
// Nxa = Npos // Nxa = Npos
// //
// dxa = ( xa_max - xa_min ) / float(Nxa-1) // dxa = ( xa_max - xa_min ) / float(Nxa-1)
// xa = xa_min + findgen(Nxa) * dxa -- 雷达 x 坐标 // xa = xa_min + findgen(Nxa) * dxa -- 雷达 x 坐标
// //
// dx = (x_max-x_min) / float(Nx-1) // dx = (x_max-x_min) / float(Nx-1)
// x = x_min + findgen(Nx) * dx // x = x_min + findgen(Nx) * dx
// //
// dy = (y_max-y_min) / float(Ny-1) // dy = (y_max-y_min) / float(Ny-1)
// y = y_min + findgen(Ny) * dy // y = y_min + findgen(Ny) * dy
// mxa = replicate(1, Nf) # xa ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,...... // mxa = replicate(1, Nf) # xa ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,......
// xdis = (x[ix]-mxa)^2 + za^2 ;--- Nxa * Nf 每个列 ant_x1_z1ant_x2_z2,ant_x3_z3,...... // xdis = (x[ix]-mxa)^2 + za^2 ;--- Nxa * Nf 每个列 ant_x1_z1ant_x2_z2,ant_x3_z3,......
// R = sqrt( xdis + (ya - y[iy])^2 ) ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,...... // R = sqrt( xdis + (ya - y[iy])^2 ) ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,......
// //
px = ix * dx + this->minX; px = ix * dx + this->minX;
pz = this->Zplane; pz = this->Zplane;
for (size_t iy = 0; iy < this->ImageHeight; iy++) { for (size_t iy = 0; iy < this->ImageHeight; iy++) {
py = iy * dy + this->minY; py = iy * dy + this->minY;
// mxa = replicate(1, Nf) # xa ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,...... // mxa = replicate(1, Nf) # xa ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,......
// xdis = (x[ix]-mxa)^2 + za^2 ;--- Nxa * Nf 每个列 ant_x1_z1ant_x2_z2,ant_x3_z3,...... // xdis = (x[ix]-mxa)^2 + za^2 ;--- Nxa * Nf 每个列 ant_x1_z1ant_x2_z2,ant_x3_z3,......
// R = sqrt( xdis + (ya - y[iy])^2 ) ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,...... // R = sqrt( xdis + (ya - y[iy])^2 ) ;--- Nxa * Nf 每个列 ant_x1 ant_x2, ant_x3,......
// //
distR = ((this->AntPosition.col(0).array() - px).pow(2) + (this->AntPosition.col(1).array() - py).pow(2) + (this->AntPosition.col(2).array() - pz).pow(2)).array().sqrt().array(); // 复制 distR = ((this->AntPosition.col(0).array() - px).pow(2) + (this->AntPosition.col(1).array() - py).pow(2) + (this->AntPosition.col(2).array() - pz).pow(2)).array().sqrt().array(); // 复制
for (size_t jj = 0; jj < Nf; jj++) { // 逐列复制 for (size_t jj = 0; jj < Nf; jj++) { // 逐列复制
R.col(jj) = distR.array(); R.col(jj) = distR.array();
} }
// term = (R/Ro)^2 * exp( factorj * ( R - Ro ) ) ; Nxa x Nf // term = (R/Ro)^2 * exp( factorj * ( R - Ro ) ) ; Nxa x Nf
@ -800,15 +800,15 @@ int FBP2DProcessClass::start()
term = (R.array() / R0).array().pow(2) * ((factorj.array() * (R.array() - R0)).array().exp()); term = (R.array() / R0).array().pow(2) * ((factorj.array() * (R.array() - R0)).array().exp());
data = dfrex.array() * term.array(); data = dfrex.array() * term.array();
result_image(iy, ix) = data.array().sum(); result_image(iy, ix) = data.array().sum();
// 临时文件输出----------------------- // 临时文件输出-----------------------
if (iy == this->ImageHeight / 2 && ix == this->ImageWidth / 2) { if (iy == this->ImageHeight / 2 && ix == this->ImageWidth / 2) {
// 输出 校正值 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 校正值 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_termDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_term_FBP.tiff"); QString FBP_termDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_term_FBP.tiff");
WriteComplexData2AmpdB_Arg(FBP_termDB_path, term);// 保存为频域回波 WriteComplexData2AmpdB_Arg(FBP_termDB_path, term);// 保存为频域回波
// 输出 校正后图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 校正后图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_dataDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_data_FBP.tiff"); QString FBP_dataDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_data_FBP.tiff");
WriteComplexData2AmpdB_Arg(FBP_dataDB_path, data);// 保存为频域回波 WriteComplexData2AmpdB_Arg(FBP_dataDB_path, data);// 保存为频域回波
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
} }
@ -817,13 +817,13 @@ int FBP2DProcessClass::start()
} }
} }
result_image = result_image.array() / normw; result_image = result_image.array() / normw;
// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_FBP.tiff"); QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_FBP.tiff");
WriteComplexData2AmpdB_Arg(FBP_resultDB_path, result_image);// 保存为频域回波 WriteComplexData2AmpdB_Arg(FBP_resultDB_path, result_image);// 保存为频域回波
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- // 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_FBP.tiff"); QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_FBP.tiff");
WriteComplexData2Amp_Arg(FBP_result_path, result_image);// 保存为频域回波 WriteComplexData2Amp_Arg(FBP_result_path, result_image);// 保存为频域回波
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
this->saveTiFF(result_image); this->saveTiFF(result_image);
@ -841,10 +841,10 @@ int FBP2DProcessClass::logFUN(int percent, QString logtext)
int FEKOFarFieldProcessClass::initProcess(QString in_path, QString out_path, double Rref, double minX, double maxX, double minY, double maxY, double PlaneZ, int ImageHeight, int ImageWidth) int FEKOFarFieldProcessClass::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); this->readEchoFile(in_path);
this->out_path = out_path; this->out_path = out_path;
this->Rref = Rref; // 成像中心的参考距离 this->Rref = Rref; // 成像中心的参考距离
this->minX = minX; this->minX = minX;
this->maxX = maxX; this->maxX = maxX;
this->minY = minY; this->minY = minY;
@ -852,13 +852,13 @@ int FEKOFarFieldProcessClass::initProcess(QString in_path, QString out_path, dou
this->Zplane = PlaneZ; this->Zplane = PlaneZ;
this->ImageHeight = ImageHeight; this->ImageHeight = ImageHeight;
this->ImageWidth = ImageWidth; this->ImageWidth = ImageWidth;
// 计算坐标的到成像中心的坐标 // 计算坐标的到成像中心的坐标
this->centerX = (this->maxX + this->minX) / 2; this->centerX = (this->maxX + this->minX) / 2;
this->centerY = (this->minY + this->maxY) / 2; this->centerY = (this->minY + this->maxY) / 2;
this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX; this->AntPosition.col(0) = this->AntPosition.col(0).array() - this->centerX;
this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY; this->AntPosition.col(1) = this->AntPosition.col(1).array() - this->centerY;
this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane; this->AntPosition.col(2) = this->AntPosition.col(2).array() - this->Zplane;
// 计算频率相关信息 // 计算频率相关信息
this->f1 = this->Frequencylist(0); this->f1 = this->Frequencylist(0);
this->freqnum = this->Frequencylist.rows(); this->freqnum = this->Frequencylist.rows();
this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1)); this->fc = (this->f1 + this->Frequencylist(this->freqnum - 1));
@ -869,7 +869,7 @@ int FEKOFarFieldProcessClass::readEchoFile(QString in_path)
{ {
std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary); std::ifstream fin(in_path.toUtf8().constData(), std::ios::in | std::ios::binary);
if (!fin.is_open()) exit(2); if (!fin.is_open()) exit(2);
// 读取参数 // 读取参数
int height = 0; int height = 0;
int width = 0; int width = 0;
fin.read((char*)&height, sizeof(int)); fin.read((char*)&height, sizeof(int));
@ -879,14 +879,14 @@ int FEKOFarFieldProcessClass::readEchoFile(QString in_path)
//frequencylist[width*double] //frequencylist[width*double]
double* freqs = new double[width]; double* freqs = new double[width];
fin.read((char*)freqs, sizeof(double) * width); fin.read((char*)freqs, sizeof(double) * width);
this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量 this->Frequencylist = Eigen::VectorXd::Zero(width, 1); // 列向量
for (int i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
this->Frequencylist(i) = freqs[i]; this->Frequencylist(i) = freqs[i];
} }
delete[] freqs; delete[] freqs;
freqs = nullptr; freqs = nullptr;
// 读取回波并解析脉冲天线位置 // 读取回波并解析脉冲天线位置
this->AntPosition = Eigen::MatrixXd::Zero(height, 3); this->AntPosition = Eigen::MatrixXd::Zero(height, 3);
this->echo = Eigen::MatrixXcd::Zero(height, width); this->echo = Eigen::MatrixXcd::Zero(height, width);
double tempvalue = 0; double tempvalue = 0;
@ -918,22 +918,22 @@ int FEKOFarFieldProcessClass::saveTiFF(Eigen::MatrixXcd m)
int FEKOFarFieldProcessClass::start() int FEKOFarFieldProcessClass::start()
{ {
//// step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码 //// step 0 生成文件夹路径,为中间临时文件输出,构建临时环境,正式版需要注释相关代码
//QString parantPath = getParantFolderNameFromPath(this->out_path); //QString parantPath = getParantFolderNameFromPath(this->out_path);
//double freqbandWidth = this->Frequencylist(this->get_Nf() - 1) - this->Frequencylist(0); //double freqbandWidth = this->Frequencylist(this->get_Nf() - 1) - this->Frequencylist(0);
//double dx = LIGHTSPEED / 2.0 / std::abs(freqbandWidth); // 距离向分辨率 //double dx = LIGHTSPEED / 2.0 / std::abs(freqbandWidth); // 距离向分辨率
//double startPhiAngle = this->AntPosition(0, 1); //double startPhiAngle = this->AntPosition(0, 1);
//double endPhiAngle = this->AntPosition(this->get_Nxa(), 1); //double endPhiAngle = this->AntPosition(this->get_Nxa(), 1);
//double AzAngleWidth = std::abs(endPhiAngle - startPhiAngle); //double AzAngleWidth = std::abs(endPhiAngle - startPhiAngle);
//double halfAzAngleWidth = AzAngleWidth / 2.0; //double halfAzAngleWidth = AzAngleWidth / 2.0;
//double AzBandWidth = 2 * std::tan(Degrees2Radians(halfAzAngleWidth)) * this->get_minFreq(); //double AzBandWidth = 2 * std::tan(Degrees2Radians(halfAzAngleWidth)) * this->get_minFreq();
//double dy = LIGHTSPEED / 2.0 / std::abs(AzBandWidth); // 方位向分辨率 //double dy = LIGHTSPEED / 2.0 / std::abs(AzBandWidth); // 方位向分辨率
//// step 1 插值频率域 -- FEKO 频率插值是均匀插值 //// step 1 插值频率域 -- FEKO 频率插值是均匀插值
//size_t Nf = this->freqnum; //size_t Nf = this->freqnum;
//size_t Nxa = this->AntPosition.rows(); //size_t Nxa = this->AntPosition.rows();
@ -950,8 +950,8 @@ int FEKOFarFieldProcessClass::start()
//double freqSamples = this->Frequencylist.rows(); //double freqSamples = this->Frequencylist.rows();
//double angSamples = this->AntPosition.rows(); //double angSamples = this->AntPosition.rows();
//double ysd = (fyEnd - fyStart) / (angSamples - 1); // 转换为 网格节点 //double ysd = (fyEnd - fyStart) / (angSamples - 1); // 转换为 网格节点
//double xsd = (fxEnd - fxStart) / (freqSamples - 1); // 转换为 网格节点 //double xsd = (fxEnd - fxStart) / (freqSamples - 1); // 转换为 网格节点
//Eigen::MatrixXd image_points_freq(angSamples, freqSamples); //Eigen::MatrixXd image_points_freq(angSamples, freqSamples);
//Eigen::MatrixXd image_points_ang(angSamples, freqSamples); //Eigen::MatrixXd image_points_ang(angSamples, freqSamples);
@ -961,56 +961,56 @@ int FEKOFarFieldProcessClass::start()
//Eigen::MatrixXd yi(Nxa, Nf); //Eigen::MatrixXd yi(Nxa, Nf);
//// 创建网格 //// 创建网格
//for (int f = 0; f < freqSamples; f++) { //for (int f = 0; f < freqSamples; f++) {
// for (int a = 0; a < angSamples; a++) { // for (int a = 0; a < angSamples; a++) {
// double x = fxStart + f * xsd; // double x = fxStart + f * xsd;
// double y = fyStart + a * ysd; // double y = fyStart + a * ysd;
// image_points_freq(a, f) = std::sqrt(x * x + y * y); // 获取每个点的 频率 // image_points_freq(a, f) = std::sqrt(x * x + y * y); // 获取每个点的 频率
// image_points_ang(a, f) = std::atan2(y, x); // 获取每个点的 角度坐标 // image_points_ang(a, f) = std::atan2(y, x); // 获取每个点的 角度坐标
// Echo_data(a, f) = InterpolateComplex(xi, yi, this->echo, image_points_freq(a, f), image_points_ang(a, f)); // 插值得到区域数据 // Echo_data(a, f) = InterpolateComplex(xi, yi, this->echo, image_points_freq(a, f), image_points_ang(a, f)); // 插值得到区域数据
// } // }
//} //}
// //
//// step 2 频率域加窗 //// step 2 频率域加窗
//Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54) //Eigen::MatrixXd wfxa = Hanning(Nf, Nxa, 0.54); // wfxa = hanning(Nf,Nxa,alpha=0.54)
//double normw = wfxa.array().sum(); // normw = TOTAL(wfxa) //double normw = wfxa.array().sum(); // normw = TOTAL(wfxa)
//Eigen::MatrixXcd dfrex = (this->echo.array()) * (wfxa.array()); // dfrex = dfrex * wfxa //Eigen::MatrixXcd dfrex = (this->echo.array()) * (wfxa.array()); // dfrex = dfrex * wfxa
//// 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- //// 输出频域 图像(加窗) 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
//QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff"); //QString hanning_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning.tiff");
//WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波 //WriteComplexData2AmpdB_Arg(hanning_path, dfrex);// 保存为频域回波
//this->logFUN(100, "after hanning\n"); //this->logFUN(100, "after hanning\n");
//Echo_data = dfrex; //Echo_data = dfrex;
// //
//// 执行二维傅立叶变换 //// 执行二维傅立叶变换
//Eigen::MatrixXcd H_echo_win_fft = FFTW2D(Echo_data); //Eigen::MatrixXcd H_echo_win_fft = FFTW2D(Echo_data);
//// 获取矩阵的行数和列数 //// 获取矩阵的行数和列数
//int n_freq = Echo_data.rows(); //int n_freq = Echo_data.rows();
//int n_angle = Echo_data.cols(); //int n_angle = Echo_data.cols();
//// 将傅立叶变换结果归一化 //// 将傅立叶变换结果归一化
//H_echo_win_fft = H_echo_win_fft.array()/(n_freq * n_angle); //H_echo_win_fft = H_echo_win_fft.array()/(n_freq * n_angle);
//// 执行逆傅立叶变换(如果需要) //// 执行逆傅立叶变换(如果需要)
//// MatrixXcd H_echo_win_ifft = ifft2(H_echo_win_fft); //// MatrixXcd H_echo_win_ifft = ifft2(H_echo_win_fft);
//// H_echo_win_ifft /= (n_freq * n_angle); //// H_echo_win_ifft /= (n_freq * n_angle);
//// 执行平移 //// 执行平移
//Eigen::MatrixXcd result_image = fftshift(H_echo_win_fft); //Eigen::MatrixXcd result_image = fftshift(H_echo_win_fft);
//// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- //// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
//QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_FBP.tiff"); //QString FBP_resultDB_path = JoinPath(parantPath, "freq_ampDB_angle_echo_hanning_FBP.tiff");
//WriteComplexData2AmpdB_Arg(FBP_resultDB_path, result_image);// 保存为频域回波 //WriteComplexData2AmpdB_Arg(FBP_resultDB_path, result_image);// 保存为频域回波
//// ---------------------------------------------------------------------------------------------- //// ----------------------------------------------------------------------------------------------
//// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向------------------- //// 输出 最终结果图像 并将复数数据转换为 振幅 与 相位 ,行:方位向,列:距离向-------------------
//QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_FBP.tiff"); //QString FBP_result_path = JoinPath(parantPath, "freq_amp_angle_echo_hanning_FBP.tiff");
//WriteComplexData2Amp_Arg(FBP_result_path, result_image);// 保存为频域回波 //WriteComplexData2Amp_Arg(FBP_result_path, result_image);// 保存为频域回波
//// ---------------------------------------------------------------------------------------------- //// ----------------------------------------------------------------------------------------------
//this->saveTiFF(result_image); //this->saveTiFF(result_image);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
/** /**
* FEKO BP * FEKO BP
* *
**/ **/
#include <complex> #include <complex>
@ -14,17 +14,17 @@
// FEKO 几何关系处理 // FEKO 几何关系处理
/// <summary> /// <summary>
/// 笛卡尔坐标系,转换为 极坐标系 /// 笛卡尔坐标系,转换为 极坐标系
/// </summary> /// </summary>
/// <param name="CartesianPoint">[X,Y,Z;X1,Y1,Z1]</param> /// <param name="CartesianPoint">[X,Y,Z;X1,Y1,Z1]</param>
/// <returns></returns> /// <returns></returns>
Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint); Eigen::MatrixXd Cartesian2Spherical(Eigen::MatrixXd CartesianPoint);
/// <summary> /// <summary>
/// 时域BP /// 时域BP
/// </summary> /// </summary>
class BP2DProcessClass { class BP2DProcessClass {
public: public:
@ -36,7 +36,7 @@ public:
size_t freqnum; size_t freqnum;
double f1; double f1;
double fc; double fc;
double Rref; // 成像中心的参考距离 double Rref; // 成像中心的参考距离
double minX; double minX;
double maxX; double maxX;
double minY; double minY;
@ -57,12 +57,12 @@ public:
int 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) // BP 成像时逐像素点计算计算速度慢回波PRFNUM,freqNUM)
template<typename T> template<typename T>
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); 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> /// <summary>
/// 时域BP --- FBP /// 时域BP --- FBP
/// </summary> /// </summary>
class FBP2DProcessClass:public BP2DProcessClass { class FBP2DProcessClass:public BP2DProcessClass {
public: public:
@ -74,7 +74,7 @@ public:
size_t freqnum; size_t freqnum;
double f1; double f1;
double fc; double fc;
double Rref; // 成像中心的参考距离 double Rref; // 成像中心的参考距离
double minX; double minX;
double maxX; double maxX;
double minY; double minY;
@ -93,23 +93,23 @@ public:
virtual int logFUN(int percent, QString logtext); virtual int logFUN(int percent, QString logtext);
}; };
// BP 成像时逐脉冲计算回波PRFNUM,freqNUM) // BP 成像时逐脉冲计算回波PRFNUM,freqNUM)
template<typename T> template<typename T>
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); 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 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 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> 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>
/// 远场成像 /// 远场成像
/// </summary> /// </summary>
class FEKOFarFieldProcessClass :public BP2DProcessClass { class FEKOFarFieldProcessClass :public BP2DProcessClass {
public: public:
@ -121,7 +121,7 @@ public:
size_t freqnum; size_t freqnum;
double f1; double f1;
double fc; double fc;
double Rref; // 成像中心的参考距离 double Rref; // 成像中心的参考距离
double minX; double minX;
double maxX; double maxX;
double minY; double minY;
@ -139,11 +139,11 @@ public:
virtual int start(); virtual int start();
virtual int logFUN(int percent, QString logtext); virtual int logFUN(int percent, QString logtext);
// 平均频率间隔 // 平均频率间隔
double get_df() { return (this->Frequencylist(this->get_Nf() - 1) - this->Frequencylist(0)) / (this->get_Nf() - 1); }; double get_df() { return (this->Frequencylist(this->get_Nf() - 1) - this->Frequencylist(0)) / (this->get_Nf() - 1); };
// 脉冲数 // 脉冲数
size_t get_Nxa() { return this->AntPosition.rows(); }; size_t get_Nxa() { return this->AntPosition.rows(); };
// 频率点数 // 频率点数
size_t get_Nf() { return this->Frequencylist.rows(); }; size_t get_Nf() { return this->Frequencylist.rows(); };
double get_minFreq() { this->Frequencylist(this->get_Nf() - 1) > this->Frequencylist(0) ? this->Frequencylist(0) : this->Frequencylist(this->get_Nf() - 1); }; double get_minFreq() { this->Frequencylist(this->get_Nf() - 1) > this->Frequencylist(0) ? this->Frequencylist(0) : this->Frequencylist(this->get_Nf() - 1); };

View File

@ -1,4 +1,4 @@

#define __TEST_IMAGEPROCESS #define __TEST_IMAGEPROCESS
//#define __TESTMATHGL //#define __TESTMATHGL
//#define __TEST_FARFIELDFILEREADPROCESS //#define __TEST_FARFIELDFILEREADPROCESS
@ -39,12 +39,12 @@ int main(int argc, char* argv[])
//==================================== //====================================
// 꿎桿FEKO친謹속潼써벎 // 测试FEKO模型加载结果
//==================================== //====================================
//QString antXmlPath = "D:\\codestorage\\LAMPSARtool\\CPluseCpluse\\WBCLFZProgram\\WBCLFZProgram\\help\\FEKOImageSettingTask.xml"; //QString antXmlPath = "D:\\codestorage\\LAMPSARtool\\CPluseCpluse\\WBCLFZProgram\\WBCLFZProgram\\help\\FEKOImageSettingTask.xml";
//QString echocsvpath = u8"D:\\돠헌桔씩牘속쵱\\淃커\\淃커匡도백도\\FEKO列街욋\\친謹\\陶끝係던\\ball_001\\ball001_X_strip.csv"; //QString echocsvpath = u8"D:\\德清研究院加密\\项目\\项目文档归档\\FEKO知识库\\模型\\远场条带\\ball_001\\ball001_X_strip.csv";
//QString thetafilepath = ""; //QString thetafilepath = "";
QString phifilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProject.phi"; QString phifilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProject.phi";
QString tifffilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProjectImage_phi.dat"; QString tifffilepath = u8"D:/codestorage/LAMPSARtool/tmp/antSpace/TESTIMageProjectImage_phi.dat";
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
#include "FEKOFarFieldFileClass.h" #include "FEKOFarFieldFileClass.h"
#include "FEKOSimulationSARClass.h" #include "FEKOSimulationSARClass.h"
int main() { int main() {
QString ffe_filepath = u8"D:\\돠헌桔씩牘속쵱\\淃커\\淃커匡도백도\\FEKO列街욋\\친謹\\係던찧녑친謹\\trihedral\\ant_SAR_new\\ant_SAR_Move\\ant_SAR_new_Horn_conical1_FarField.ffe"; QString ffe_filepath = u8"D:\\德清研究院加密\\项目\\项目文档归档\\FEKO知识库\\模型\\条带脉冲模型\\trihedral\\ant_SAR_new\\ant_SAR_Move\\ant_SAR_new_Horn_conical1_FarField.ffe";
FEKOBase::FEKOFarFieldFileClass ffefile; FEKOBase::FEKOFarFieldFileClass ffefile;
std::cout << ffe_filepath.toLocal8Bit().constData()<< std::endl; std::cout << ffe_filepath.toLocal8Bit().constData()<< std::endl;
ffefile.parseFarFieldFile(ffe_filepath); ffefile.parseFarFieldFile(ffe_filepath);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
//================================== //==================================
// 线性计算库优化 // 线性计算库优化
//=============================== //===============================
//#define EIGEN_NO_DEBUG //#define EIGEN_NO_DEBUG
@ -123,12 +123,12 @@
#include <opencascade\BRepBuilderAPI_MakeFace.hxx> #include <opencascade\BRepBuilderAPI_MakeFace.hxx>
#include <opencascade\TopoDS_Face.hxx> #include <opencascade\TopoDS_Face.hxx>
#include <QRegularExpression> #include <QRegularExpression>
#include <omp.h> // 并行计算库 #include <omp.h> // 并行计算库
#include <cmath> #include <cmath>
//================================================ //================================================
// 常用函数 // 常用函数
//================================================ //================================================
std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList); std::vector<QString> convertQStringListToStdVector(const QStringList& qStringList);
@ -137,14 +137,14 @@ std::vector<QString> convertQStringListToStdVector(const QStringList& qStringLis
// ===================================================== // =====================================================
// 常用宏定义 // 常用宏定义
// __SHOWPROCESS : 展示进度条 // __SHOWPROCESS : 展示进度条
// ====================================================== // ======================================================
#define __SHOWPROCESS #define __SHOWPROCESS
//#define __SHOWMATPLOTLIBCPPTEST // 局部绘制结果调试 //#define __SHOWMATPLOTLIBCPPTEST // 局部绘制结果调试
#define __IMAGEPARALLEL // 成像算法并行版本 #define __IMAGEPARALLEL // 成像算法并行版本
#define __IMAGEWINDOWSPROCESS // 成像算法使用加窗函数 #define __IMAGEWINDOWSPROCESS // 成像算法使用加窗函数
@ -153,9 +153,9 @@ std::vector<QString> convertQStringListToStdVector(const QStringList& qStringLis
#include <matplot/matplot.h> #include <matplot/matplot.h>
#include <matplot/matplot.h> #include <matplot/matplot.h>
#include <mgl2/mgl.h> #include <mgl2/mgl.h>
//#define __SHOWECHOPARSE // 展示解析结果 //#define __SHOWECHOPARSE // 展示解析结果
//#define __SHOWIMAGEPROCESSING // 展示成像中间结果 //#define __SHOWIMAGEPROCESSING // 展示成像中间结果
//#define __SHOWIMAGEPROCESSRESULT// 展示成像结果 //#define __SHOWIMAGEPROCESSRESULT// 展示成像结果
#endif #endif

View File

@ -65,4 +65,4 @@ add_dependencies(MainWindow ${_depend_library})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(FastCAE_MainWindow_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) set(FastCAE_MainWindow_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -331,7 +331,7 @@ namespace GUI {
void MainWindow::registerMoudel() void MainWindow::registerMoudel()
{ {
/// 添加ProjectWindow /// 添加ProjectWindow 为controlpanel 提供窗口绑定
_controlPanel = new MainWidget::ControlPanel(this); _controlPanel = new MainWidget::ControlPanel(this);
_controlPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); _controlPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
addDockWidget(Qt::LeftDockWidgetArea, _controlPanel); addDockWidget(Qt::LeftDockWidgetArea, _controlPanel);

View File

@ -1,4 +1,4 @@
#include "AllHead.h" #include "AllHead.h"
QSettings* getQSetting() QSettings* getQSetting()
{ {
@ -11,8 +11,8 @@ QSettings* getQSetting()
{ {
return setting; return setting;
} }
else {// 文件不存在,写入配置项,生成配置文件 else {// 文件不存在,写入配置项,生成配置文件
setting->setValue("application", u8"微波测量仿真分系统"); setting->setValue("application", u8"微波测量仿真分系统");
setting->sync(); setting->sync();
} }

View File

@ -1,75 +1,77 @@
#pragma once #pragma once
#ifndef ALLHEAD_H #ifndef ALLHEAD_H
#define ALLHEAD_H #define ALLHEAD_H
//================================== //==================================
// 线性计算库优化 // 线性计算库优化
//=============================== //===============================
//#define EIGEN_NO_DEBUG //#define EIGEN_NO_DEBUG
//===================================================== //=====================================================
// 内部库 LAMPTool // 内部库 LAMPTool
//===================================================== //=====================================================
#include "referenceHeader.h"
#include "../LAMPTool/referenceHeader.h"
#include "../LAMPTool/BaseToollib/BaseConstVariable.h"
// Basetoollib // Basetoollib
#include "Basetoollib/BaseConstVariable.h" #include "../LAMPTool/Basetoollib/BaseConstVariable.h"
#include "Basetoollib/BaseTool.h" #include "../LAMPTool/Basetoollib/BaseTool.h"
#include "Basetoollib/FileOperator.h" #include "../LAMPTool/Basetoollib/FileOperator.h"
//#include "Basetoollib/GeoOperator.h" //#include "Basetoollib/GeoOperator.h"
#include "Basetoollib/ImageOperatorBase.h" #include "../LAMPTool/Basetoollib/ImageOperatorBase.h"
//#include "Basetoollib/interpolation.h" //#include "Basetoollib/interpolation.h"
// SARBaseToolLib // SARBaseToolLib
//#include "SARBaseToolLib/BackScatterModel.h" //#include "SARBaseToolLib/BackScatterModel.h"
//#include "SARBaseToolLib/SARBaseTool.h" //#include "SARBaseToolLib/SARBaseTool.h"
//#include "SARBaseToolLib/SARCalibration.h" //#include "SARBaseToolLib/SARCalibration.h"
#include "SARBaseToolLib/SARImageBase.h" #include "../LAMPTool/SARBaseToolLib/SARImageBase.h"
// SARImage // SARImage
#include "SARImage/FEKOBaseToolClass.h" #include "../LAMPTool/SARImage/FEKOBaseToolClass.h"
#include "SARImage/FEKONearBPBasic.h" #include "../LAMPTool/SARImage/FEKONearBPBasic.h"
#include "FEKOSimulationSARClass.h" #include "../LAMPTool/FEKOSimulationSARClass.h"
#include "OCCTBase.h" #include "../LAMPTool/OCCTBase.h"
#include "FEKOFarFieldFileClass.h" #include "../LAMPTool/FEKOFarFieldFileClass.h"
//===================================================== //=====================================================
// 内部库 SharedModuleLib // 内部库 SharedModuleLib
//===================================================== //=====================================================
//===================================================== //=====================================================
// 内置 command // 内置 command
//===================================================== //=====================================================
// ===================================================== // =====================================================
// 其他工程库 // 其他工程库
// //
// ====================================================== // ======================================================
#include "qcustomplot.h" #include "../qcustomplot/qcustomplot.h"
//======================================================= //=======================================================
// 引用库 // 引用库
//======================================================= //=======================================================
#include <QDebug> #include <QDebug>
#include <QDialog> #include <QDialog>
#include <BRepBuilderAPI_Copy.hxx> #include <opencascade/BRepBuilderAPI_Copy.hxx>
#include <AIS_Shape.hxx> #include <opencascade/AIS_Shape.hxx>
#include <QObject> #include <QObject>
#include <TopoDS.hxx> #include <opencascade/TopoDS.hxx>
#include <TopoDS_Shape.hxx> #include <opencascade/TopoDS_Shape.hxx>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QListWidget> #include <QListWidget>
#include <QList> #include <QList>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#include <AIS_TextLabel.hxx> #include <opencascade/AIS_TextLabel.hxx>
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
#include <Graphic3d_Texture2Dplane.hxx> #include <opencascade/Graphic3d_Texture2Dplane.hxx>
#include <Graphic3d_Text.hxx> #include <opencascade/Graphic3d_Text.hxx>
#include <V3d_View.hxx> #include <opencascade/V3d_View.hxx>
#include <V3d_Viewer.hxx> #include <opencascade/V3d_Viewer.hxx>
#include <vector> #include <vector>
#include <string> #include <string>
#include <QMap> #include <QMap>
@ -77,93 +79,93 @@
#include <QCheckBox> #include <QCheckBox>
#include <QMouseEvent> #include <QMouseEvent>
#include <QDialog> #include <QDialog>
#include <BRepGProp.hxx> #include <opencascade/BRepGProp.hxx>
#include <GProp_GProps.hxx> #include <opencascade/GProp_GProps.hxx>
#include <AIS_ViewCube.hxx> #include <opencascade/AIS_ViewCube.hxx>
#include <Geom_Axis2Placement.hxx> #include <opencascade/Geom_Axis2Placement.hxx>
#include <QApplication> #include <QApplication>
#include <QColor> #include <QColor>
#include <QColorDialog> #include <QColorDialog>
#include <QStatusBar> #include <QStatusBar>
#include <StepGeom_Axis2Placement3d.hxx> #include <opencascade/StepGeom_Axis2Placement3d.hxx>
#include <AIS_InteractiveObject.hxx> #include <opencascade/AIS_InteractiveObject.hxx>
#include <Aspect_DisplayConnection.hxx> #include <opencascade/Aspect_DisplayConnection.hxx>
#include <Graphic3d_NameOfMaterial.hxx> #include <opencascade/Graphic3d_NameOfMaterial.hxx>
#include <OpenGl_GraphicDriver.hxx> #include <opencascade/OpenGl_GraphicDriver.hxx>
#include <OSD_Environment.hxx> #include <opencascade/OSD_Environment.hxx>
#include <QFileDialog> #include <QFileDialog>
#include <TCollection_AsciiString.hxx> #include <opencascade/TCollection_AsciiString.hxx>
#include <StlAPI_Reader.hxx> #include <opencascade/StlAPI_Reader.hxx>
#include <AIS_Trihedron.hxx> #include <opencascade/AIS_Trihedron.hxx>
#include <QtWidgets> #include <QtWidgets>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include <IGESControl_Reader.hxx> #include <opencascade/IGESControl_Reader.hxx>
#include <STEPControl_Reader.hxx> #include <opencascade/STEPControl_Reader.hxx>
#include <IGESControl_Writer.hxx> #include <opencascade/IGESControl_Writer.hxx>
#include <STEPControl_Writer.hxx> #include <opencascade/STEPControl_Writer.hxx>
#include <StlAPI_Writer.hxx> #include <opencascade/StlAPI_Writer.hxx>
#include <BRep_Builder.hxx> #include <opencascade/BRep_Builder.hxx>
#include <BRepBuilderAPI_Collect.hxx> #include <opencascade/BRepBuilderAPI_Collect.hxx>
#include <QTreeWidget> #include <QTreeWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <TopExp_Explorer.hxx> #include <opencascade/TopExp_Explorer.hxx>
#include <gp_Pnt.hxx> #include <opencascade/gp_Pnt.hxx>
#include <gp_Ax1.hxx> #include <opencascade/gp_Ax1.hxx>
#include <gp_Dir.hxx> #include <opencascade/gp_Dir.hxx>
#include <BRepAlgoAPI_Fuse.hxx> #include <opencascade/BRepAlgoAPI_Fuse.hxx>
#include <AIS_TexturedShape.hxx> #include <opencascade/AIS_TexturedShape.hxx>
#include <Prs3d_Arrow.hxx> #include <opencascade/Prs3d_Arrow.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx> #include <opencascade/BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeCone.hxx> #include <opencascade/BRepPrimAPI_MakeCone.hxx>
#include <BRepBuilderAPI_Transform.hxx> #include <opencascade/BRepBuilderAPI_Transform.hxx>
#include <QMessageBOx> #include <QMessageBOx>
#include <StlAPI_Writer.hxx> #include <opencascade/StlAPI_Writer.hxx>
#include <AIS_ViewCube.hxx> #include <opencascade/AIS_ViewCube.hxx>
#include <AIS_Shape.hxx> #include <opencascade/AIS_Shape.hxx>
#include <Geom_Axis2Placement.hxx> #include <opencascade/Geom_Axis2Placement.hxx>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QApplication> #include <QApplication>
#include <QColor> #include <QColor>
#include <QColorDialog> #include <QColorDialog>
#include <QStatusBar> #include <QStatusBar>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#include <StepGeom_Axis2Placement3d.hxx> #include <opencascade/StepGeom_Axis2Placement3d.hxx>
#include <QDebug> #include <QDebug>
#include <AIS_InteractiveObject.hxx> #include <opencascade/AIS_InteractiveObject.hxx>
#include <Aspect_DisplayConnection.hxx> #include <opencascade/Aspect_DisplayConnection.hxx>
#include <Graphic3d_NameOfMaterial.hxx> #include <opencascade/Graphic3d_NameOfMaterial.hxx>
#include <OpenGl_GraphicDriver.hxx> #include <opencascade/OpenGl_GraphicDriver.hxx>
#include <OSD_Environment.hxx> #include <opencascade/OSD_Environment.hxx>
#include <QFileDialog> #include <QFileDialog>
#include <TCollection_AsciiString.hxx> #include <opencascade/TCollection_AsciiString.hxx>
#include <StlAPI_Reader.hxx> #include <opencascade/StlAPI_Reader.hxx>
#include <AIS_Trihedron.hxx> #include <opencascade/AIS_Trihedron.hxx>
#include <QCheckBox> #include <QCheckBox>
#include <QtWidgets> #include <QtWidgets>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_Copy.hxx> #include <opencascade/BRepBuilderAPI_Copy.hxx>
#include <IGESControl_Reader.hxx> #include <opencascade/IGESControl_Reader.hxx>
#include <STEPControl_Reader.hxx> #include <opencascade/STEPControl_Reader.hxx>
#include <IGESControl_Writer.hxx> #include <opencascade/IGESControl_Writer.hxx>
#include <STEPControl_Writer.hxx> #include <opencascade/STEPControl_Writer.hxx>
#include <QMessageBox> #include <QMessageBox>
#include <QtXml> #include <QtXml>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <QCloseEvent> #include <QCloseEvent>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include <BRepBuilderAPI_MakeFace.hxx> #include <opencascade/BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx> #include <opencascade/BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <opencascade/BRepBuilderAPI_MakeEdge.hxx>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QJSValueIterator> #include <QJSValueIterator>
#include <Geom_Plane.hxx> #include <opencascade/Geom_Plane.hxx>
#include <QSettings> #include <QSettings>
class QObject; class QObject;
// ===================================================== // =====================================================
// 常用宏定义 // 常用宏定义
// //
// ====================================================== // ======================================================
#define __SHOWPROCESS #define __SHOWPROCESS
@ -179,12 +181,12 @@ class QObject;
//======================================================= //=======================================================
// 常用基础变量类型定义 // 常用基础变量类型定义
//======================================================= //=======================================================
//======================================================= //=======================================================
// 常用基础函数 // 常用基础函数
//======================================================= ] //======================================================= ]
QSettings* getQSetting(); QSettings* getQSetting();
@ -196,7 +198,7 @@ QString getSaveFilePath(QWidget* parent = nullptr, const QString& caption = QStr
/* /*
QString filepath = getOpenFilePath( QString filepath = getOpenFilePath(
nullptr, nullptr,
QString::fromUtf8(u8"导入雷达模型"), QString::fromUtf8(u8"导入雷达模型"),
".", ".",
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)")); QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));

View File

@ -3,10 +3,71 @@
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
# boost
include_directories(D:/vcpkg/installed/x64-windows/include)
# pcl
include_directories(C:/PCL/3rdParty/FLANN/include)
include_directories(C:/PCL/3rdParty/VTK/include/vtk-9.3)
include_directories(C:/PCL/include/pcl-1.14)
# qt5
include_directories(C:/Qt/5.15.2/msvc2019_64/include/QtQml)
# json
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../json)
# qscintilla2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexers)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/lexlib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/Qt4Qt5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qscintilla2/src)
# lamptool
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../LAMPTool/include)
# qcustomplot
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qcustomplot)
# qhexedit
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../qhexedit)
#
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/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 # include
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(CMAKE_INCLUDE_CURRENT_DIR ON) 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})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
@ -18,15 +79,15 @@ qt5_add_resources(_resource ${_qrc} ${_lang})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
file(GLOB _ui "*.ui") file(GLOB_RECURSE _ui "*.ui")
file(GLOB _header "*.h*") file(GLOB_RECURSE _header "*.h" "*.hxx")
file(GLOB _source "*.cpp") file(GLOB_RECURSE _source "*.cpp")
qt5_wrap_ui(_interface ${_ui}) qt5_wrap_ui(_interface ${_ui})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
add_library(WBCLFZSystemModule add_library(WBCLFZSystemModule STATIC
${_resource} ${_resource}
${_interface} ${_interface}
${_header} ${_header}
@ -39,22 +100,30 @@ add_library(WBCLFZSystemModule
target_compile_definitions(WBCLFZSystemModule PRIVATE "WBCLFZSystemModule_API") target_compile_definitions(WBCLFZSystemModule PRIVATE "WBCLFZSystemModule_API")
#-----------------------------------------------------------------------------
# Qt
list(APPEND _depend_library qcustomplot LAMPTool qscintilla2 qhexedit) #-----------------------------------------------------------------------------
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
list(APPEND _runtimes_libraries get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
Qt5::Core Qt5::Gui Qt5::Widgets
)
target_include_directories(WBCLFZSystemModule PRIVATE ${Qwt_INCLUDE_DIRS})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
target_link_libraries(WBCLFZSystemModule PRIVATE list(APPEND _depend_library qcustomplot LAMPTool qscintilla2 qhexedit)
list(APPEND _runtimes_libraries
Qt5::DBus Qt5::Core Qt5::Xml Qt5::OpenGL Qt5::Gui Qt5::Svg Qt5::Widgets Qt5::Qml Qt5::DataVisualization Qt5::Charts Qt5::PrintSupport
)
target_include_directories(WBCLFZSystemModule PUBLIC ${Qwt_INCLUDE_DIRS})
target_link_libraries(WBCLFZSystemModule PUBLIC
${_runtimes_libraries} ${_runtimes_libraries}
${_depend_library} ${_depend_library}
${PCL_LIBRARIES}
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -65,4 +134,7 @@ add_dependencies(WBCLFZSystemModule ${_depend_library})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# #
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(FastCAE_WBCLFZSystemModule_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE) set(FastCAE_WBCLFZSystemModule_Runtimes_Libraries ${_runtimes_libraries} PARENT_SCOPE)

View File

@ -1,4 +1,4 @@
#include "CMDExcuteApp.h" #include "CMDExcuteApp.h"
#include <QProcess> #include <QProcess>
#include <QDebug> #include <QDebug>
#include <QThread> #include <QThread>
@ -25,10 +25,10 @@ CMDExcuteApp::~CMDExcuteApp()
int CMDExcuteApp::excuteCmd(QString cmdText) int CMDExcuteApp::excuteCmd(QString cmdText)
{ {
qDebug() << u8"执行命令:" << cmdText ; qDebug() << u8"执行命令:" << cmdText ;
this->ui.textEdit->append("cmd.exe\n"); this->ui.textEdit->append("cmd.exe\n");
this->cmd->start("cmd.exe"); this->cmd->start("cmd.exe");
this->cmd->waitForStarted(); //等待程序启动 this->cmd->waitForStarted(); //等待程序启动
this->ui.textEdit->append(QString::QString(cmdText)); this->ui.textEdit->append(QString::QString(cmdText));
this->ui.textEdit->append("\n"); this->ui.textEdit->append("\n");
this->cmd->write(cmdText.toUtf8().constData()); this->cmd->write(cmdText.toUtf8().constData());
@ -40,7 +40,7 @@ int CMDExcuteApp::excuteCmd(QString cmdText)
int CMDExcuteApp::excuteCmd(QString exePath, QString params) int CMDExcuteApp::excuteCmd(QString exePath, QString params)
{ {
qDebug() << u8"执行命令:" << exePath<<u8" "<< params; qDebug() << u8"执行命令:" << exePath<<u8" "<< params;
this->setWindowTitle(exePath); this->setWindowTitle(exePath);
QString program = QString::QString(exePath); QString program = QString::QString(exePath);
QStringList prams_txt; QStringList prams_txt;
@ -55,11 +55,11 @@ int CMDExcuteApp::excuteCmd(QString exePath, QString params)
int CMDExcuteApp::waitExcutedFinish() int CMDExcuteApp::waitExcutedFinish()
{ {
while (!this->cmd->waitForFinished()) { while (!this->cmd->waitForFinished()) {
qDebug() << u8"运行状态:" << this->cmd->state(); qDebug() << u8"运行状态:" << this->cmd->state();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
} }
qDebug() << u8"退出循环运行状态:" << this->cmd->state(); qDebug() << u8"退出循环运行状态:" << this->cmd->state();
qDebug() << u8"退出循环码:" << this->cmd->exitCode(); qDebug() << u8"退出循环码:" << this->cmd->exitCode();
this->on_readerror(); this->on_readerror();
this->on_readoutput(); this->on_readoutput();
emit this->callbackExcuteResult(); emit this->callbackExcuteResult();
@ -77,6 +77,6 @@ int CMDExcuteApp::on_readoutput()
{ {
QString out = this->cmd->readAllStandardOutput().data(); QString out = this->cmd->readAllStandardOutput().data();
qDebug() << u8"on_readoutput:\t" << out; qDebug() << u8"on_readoutput:\t" << out;
this->ui.textEdit->append(out); //将输出信息读取到编辑框 this->ui.textEdit->append(out); //将输出信息读取到编辑框
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
#include "EchoTableEditWindow.h" #include "EchoTableEditWindow.h"
#include "TableProcess/TableMainWindow.h" #include "TableProcess/TableMainWindow.h"
#include "TableProcess/TableViewModel.h" #include "TableProcess/TableViewModel.h"
#include "SharedModuleLib/BaseUiTool.h" #include "SharedModuleLib/BaseUiTool.h"
@ -19,13 +19,13 @@ EchoTableEditWindow::EchoTableEditWindow(QWidget* parent)
this->FILEOPENLOCK = false; this->FILEOPENLOCK = false;
this->CheckFieldContextHasEmptyCeilLOCK = false; this->CheckFieldContextHasEmptyCeilLOCK = false;
this->ui.setupUi(this); this->ui.setupUi(this);
this->setWindowTitle(u8"FEKO回波数据解析与导出界面"); this->setWindowTitle(u8"FEKO回波数据解析与导出界面");
this->initTableViewContextMenu(); this->initTableViewContextMenu();
this->initTableViewStatusBarControl(); this->initTableViewStatusBarControl();
// 定标常数界面关闭 // 定标常数界面关闭
this->ui.tab_calibration->setEnabled(false); this->ui.tab_calibration->setEnabled(false);
this->ui.tabWidget->removeTab(1);// 删除定标常数界面 this->ui.tabWidget->removeTab(1);// 删除定标常数界面
} }
@ -43,18 +43,18 @@ EchoTableEditWindow::~EchoTableEditWindow()
int EchoTableEditWindow::initTableViewContextMenu() int EchoTableEditWindow::initTableViewContextMenu()
{ {
qDebug() << u8"正在初始化contextMenu"; qDebug() << u8"正在初始化contextMenu";
m_undoStack = new QUndoStack(this); //存放命令的栈 m_undoStack = new QUndoStack(this); //存放命令的栈
this->ui.tableView->setContextMenuPolicy(Qt::CustomContextMenu); this->ui.tableView->setContextMenuPolicy(Qt::CustomContextMenu);
//this->ui.tableView->setFocusPolicy(Qt::NoFocus); // 允许快捷键 //this->ui.tableView->setFocusPolicy(Qt::NoFocus); // 允许快捷键
this->tableViewContextMenu = new QMenu(this->ui.tableView); // 表格控件的右键菜单 this->tableViewContextMenu = new QMenu(this->ui.tableView); // 表格控件的右键菜单
QAction* m_undoAction = m_undoStack->createUndoAction(this, u8"撤销");//添加QActionCtrl-Z作为回撤的快捷键 QAction* m_undoAction = m_undoStack->createUndoAction(this, u8"撤销");//添加QActionCtrl-Z作为回撤的快捷键
m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
QObject::connect(m_undoAction, SIGNAL(triggered()), this, SLOT(tableView_UndoAction())); QObject::connect(m_undoAction, SIGNAL(triggered()), this, SLOT(tableView_UndoAction()));
QAction* m_redoAction = m_undoStack->createRedoAction(this, u8"重做");//添加QActionCtrl-Y左右前进的快捷键 QAction* m_redoAction = m_undoStack->createRedoAction(this, u8"重做");//添加QActionCtrl-Y左右前进的快捷键
m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y)); m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
QObject::connect(m_redoAction, SIGNAL(triggered()), this, SLOT(tableView_RedoAction())); QObject::connect(m_redoAction, SIGNAL(triggered()), this, SLOT(tableView_RedoAction()));
@ -62,30 +62,30 @@ int EchoTableEditWindow::initTableViewContextMenu()
this->tableViewContextMenu->addAction(m_redoAction); this->tableViewContextMenu->addAction(m_redoAction);
QAction *copyAction= this->tableViewContextMenu->addAction(u8"复制"); // 复制 QAction *copyAction= this->tableViewContextMenu->addAction(u8"复制"); // 复制
copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
QObject::connect(copyAction, SIGNAL(triggered()), this, SLOT(tableView_CopyAction())); QObject::connect(copyAction, SIGNAL(triggered()), this, SLOT(tableView_CopyAction()));
QAction* PasteAction = this->tableViewContextMenu->addAction(u8"粘贴"); // 粘贴 QAction* PasteAction = this->tableViewContextMenu->addAction(u8"粘贴"); // 粘贴
PasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); PasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
QObject::connect(PasteAction, SIGNAL(triggered()), this, SLOT(tableView_PasteAction())); QObject::connect(PasteAction, SIGNAL(triggered()), this, SLOT(tableView_PasteAction()));
QAction* CheckFieldHasEmptyCeilAction = this->tableViewContextMenu->addAction(u8"检查单元格为空"); QAction* CheckFieldHasEmptyCeilAction = this->tableViewContextMenu->addAction(u8"检查单元格为空");
QObject::connect(CheckFieldHasEmptyCeilAction, SIGNAL(triggered()), this, SLOT(tableView_CheckFieldHasEmptyCeilAction())); QObject::connect(CheckFieldHasEmptyCeilAction, SIGNAL(triggered()), this, SLOT(tableView_CheckFieldHasEmptyCeilAction()));
qDebug() << u8"初始化contextMenu结束"; qDebug() << u8"初始化contextMenu结束";
return 0; return 0;
} }
void EchoTableEditWindow::ShowTableViewContextMenu(QPoint p) void EchoTableEditWindow::ShowTableViewContextMenu(QPoint p)
{ {
qDebug() << u8"正在展示tableview 右键菜单"; qDebug() << u8"正在展示tableview 右键菜单";
//Q_UNUSED(pos); //Q_UNUSED(pos);
this->tableViewContextMenu->exec(QCursor::pos()); this->tableViewContextMenu->exec(QCursor::pos());
} }
void EchoTableEditWindow::tableView_CopyAction() void EchoTableEditWindow::tableView_CopyAction()
{ {
qDebug() << u8"正在启动tableview 右键复制代码"; qDebug() << u8"正在启动tableview 右键复制代码";
QItemSelectionModel* selectionModel = this->ui.tableView->selectionModel(); QItemSelectionModel* selectionModel = this->ui.tableView->selectionModel();
QModelIndexList selectedIndexes = selectionModel->selectedIndexes(); QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
if (selectedIndexes.count() == 0) { if (selectedIndexes.count() == 0) {
@ -152,17 +152,17 @@ int EchoTableEditWindow::setTablCalibrationTab(bool flag)
{ {
if (flag) { if (flag) {
this->ui.tab_calibration->setEnabled(true); this->ui.tab_calibration->setEnabled(true);
this->ui.tabWidget->insertTab(1, this->ui.tab_calibration, u8"定标常数"); this->ui.tabWidget->insertTab(1, this->ui.tab_calibration, u8"定标常数");
} }
else { else {
this->ui.tab_calibration->setEnabled(false); this->ui.tab_calibration->setEnabled(false);
this->ui.tabWidget->removeTab(1);// 删除定标常数界面 this->ui.tabWidget->removeTab(1);// 删除定标常数界面
} }
return 0; return 0;
} }
void EchoTableEditWindow::tableView_PasteAction() { void EchoTableEditWindow::tableView_PasteAction() {
qDebug() << u8"正在启动tableview 右键粘贴代码"; qDebug() << u8"正在启动tableview 右键粘贴代码";
QTableView* tableview = this->ui.tableView; QTableView* tableview = this->ui.tableView;
QClipboard* clipboard = QApplication::clipboard(); QClipboard* clipboard = QApplication::clipboard();
QString clipboardData = QApplication::clipboard()->text(); QString clipboardData = QApplication::clipboard()->text();
@ -174,23 +174,23 @@ void EchoTableEditWindow::tableView_PasteAction() {
void EchoTableEditWindow::tableView_UndoAction() void EchoTableEditWindow::tableView_UndoAction()
{ {
qDebug() << u8"正在撤销命令"; qDebug() << u8"正在撤销命令";
int index = this->m_undoStack->index(); int index = this->m_undoStack->index();
this->m_undoStack->setIndex(index); this->m_undoStack->setIndex(index);
} }
void EchoTableEditWindow::tableView_RedoAction() void EchoTableEditWindow::tableView_RedoAction()
{ {
qDebug() << u8"正在重做命令"; qDebug() << u8"正在重做命令";
int index = this->m_undoStack->index(); int index = this->m_undoStack->index();
this->m_undoStack->setIndex(index ); this->m_undoStack->setIndex(index );
} }
// 检查存在空单元格的列,并修改展示 // 检查存在空单元格的列,并修改展示
void EchoTableEditWindow::tableView_CheckFieldHasEmptyCeilAction() void EchoTableEditWindow::tableView_CheckFieldHasEmptyCeilAction()
{ {
this->ui.statusbar->showMessage(u8"正在检查存在空数据的单元列"); this->ui.statusbar->showMessage(u8"正在检查存在空数据的单元列");
size_t colcount = this->ui.tableView->model()->columnCount(); size_t colcount = this->ui.tableView->model()->columnCount();
size_t rowcount = this->ui.tableView->model()->rowCount(); size_t rowcount = this->ui.tableView->model()->rowCount();
this->statusprogressBar->setRange(0, colcount - 1); this->statusprogressBar->setRange(0, colcount - 1);
@ -209,7 +209,7 @@ void EchoTableEditWindow::tableView_CheckFieldHasEmptyCeilAction()
return; return;
} }
else {} else {}
this->ui.statusbar->showMessage(u8"正在选择空格"); this->ui.statusbar->showMessage(u8"正在选择空格");
this->statusprogressBar->setRange(0, cellIndexes.count()-1); this->statusprogressBar->setRange(0, cellIndexes.count()-1);
this->statusprogressBar->setValue(0); this->statusprogressBar->setValue(0);
QItemSelectionModel* selectionModel = this->ui.tableView->selectionModel(); QItemSelectionModel* selectionModel = this->ui.tableView->selectionModel();
@ -240,63 +240,63 @@ void EchoTableEditWindow::on_actionSaveAs_triggered()
void EchoTableEditWindow::on_actionEchoSplitExport_triggered() void EchoTableEditWindow::on_actionEchoSplitExport_triggered()
{ {
// 在窗口关闭事件中询问用户是否关闭 // 在窗口关闭事件中询问用户是否关闭
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
qDebug() << u8"检查乱码文件所在位置"; qDebug() << u8"检查乱码文件所在位置";
reply = QMessageBox::question(this, u8"询问", u8"导出回波文件前,请保存文件", QMessageBox::Yes | QMessageBox::No); reply = QMessageBox::question(this, u8"询问", u8"导出回波文件前,请保存文件", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
// 用户点击了"Yes"按钮,关闭窗口 // 用户点击了"Yes"按钮,关闭窗口
this->SaveCSVDialog(); this->SaveCSVDialog();
} }
else { else {
// 用户点击了"No"按钮,取消关闭操作 // 用户点击了"No"按钮,取消关闭操作
return; return;
} }
// 保存并导出回波文件 // 保存并导出回波文件
this->ui.statusbar->showMessage(u8"正在分析回波文件"); this->ui.statusbar->showMessage(u8"正在分析回波文件");
this->statusprogressBar->setRange(0,100); this->statusprogressBar->setRange(0,100);
this->statusprogressBar->setValue(10); this->statusprogressBar->setValue(10);
FEKOBase::NearFieldEchoCSVParser nearfilePraseclass; FEKOBase::NearFieldEchoCSVParser nearfilePraseclass;
QString echocsvfilepath = this->model->getCSVPath(); QString echocsvfilepath = this->model->getCSVPath();
if (!nearfilePraseclass.parseCSV(echocsvfilepath)) { if (!nearfilePraseclass.parseCSV(echocsvfilepath)) {
QMessageBox::warning(this, u8"警告", u8"回波文件结构解析错误,请检查文件"); QMessageBox::warning(this, u8"警告", u8"回波文件结构解析错误,请检查文件");
return; return;
} }
this->statusprogressBar->setValue(25); this->statusprogressBar->setValue(25);
QMessageBox::information(this, u8"信息", u8"请分别为theta极化、phi极化、R极化分量回波指定保存路径"); QMessageBox::information(this, u8"信息", u8"请分别为theta极化、phi极化、R极化分量回波指定保存路径");
QString thetafilepath = getSaveFilePath( QString thetafilepath = getSaveFilePath(
this, this,
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"theta文件 (*.theta)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"theta文件 (*.theta)"));//多组扩展名用双分号";;"隔开
QString phifilepath = getSaveFilePath( QString phifilepath = getSaveFilePath(
this, this,
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"phi文件 (*.phi)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"phi文件 (*.phi)"));//多组扩展名用双分号";;"隔开
QString Rfilepath = getSaveFilePath( QString Rfilepath = getSaveFilePath(
this, this,
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"R文件 (*.R)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"R文件 (*.R)"));//多组扩展名用双分号";;"隔开
this->ui.statusbar->showMessage(u8"正在导出theta极化"); this->ui.statusbar->showMessage(u8"正在导出theta极化");
nearfilePraseclass.toThetapolar(thetafilepath); nearfilePraseclass.toThetapolar(thetafilepath);
this->statusprogressBar->setValue(50); this->statusprogressBar->setValue(50);
this->ui.statusbar->showMessage(u8"正在导出phi极化"); this->ui.statusbar->showMessage(u8"正在导出phi极化");
nearfilePraseclass.toPhiPolar(phifilepath); nearfilePraseclass.toPhiPolar(phifilepath);
this->statusprogressBar->setValue(75); this->statusprogressBar->setValue(75);
this->ui.statusbar->showMessage(u8"正在导出R极化"); this->ui.statusbar->showMessage(u8"正在导出R极化");
nearfilePraseclass.toRPolar(Rfilepath); nearfilePraseclass.toRPolar(Rfilepath);
this->statusprogressBar->setValue(99); this->statusprogressBar->setValue(99);
QMessageBox::information(this, u8"信息", u8"极化回波已经保存完毕"); QMessageBox::information(this, u8"信息", u8"极化回波已经保存完毕");
// 询问用户是否关闭窗口 // 询问用户是否关闭窗口
reply = QMessageBox::question(this, u8"提示", u8"是否直接进行成像?",QMessageBox::Yes | QMessageBox::No); reply = QMessageBox::question(this, u8"提示", u8"是否直接进行成像?",QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
LAMPImageCreateClass* imagewindows = new LAMPImageCreateClass; LAMPImageCreateClass* imagewindows = new LAMPImageCreateClass;
imagewindows->show(); imagewindows->show();
@ -345,9 +345,9 @@ int EchoTableEditWindow::setTableViewAutoSort(bool flag)
int EchoTableEditWindow::initTableViewStatusBarControl() int EchoTableEditWindow::initTableViewStatusBarControl()
{ {
this->statusprogressBar = new QProgressBar(); this->statusprogressBar = new QProgressBar();
this->statusprogressBar->setRange(0, 100); // 设置进度条范围 this->statusprogressBar->setRange(0, 100); // 设置进度条范围
this->statusprogressBar->setValue(0); // 设置当前进度 this->statusprogressBar->setValue(0); // 设置当前进度
this->ui.statusbar->addPermanentWidget(this->statusprogressBar); // 在状态栏中添加进度条 this->ui.statusbar->addPermanentWidget(this->statusprogressBar); // 在状态栏中添加进度条
return 0; return 0;
} }
@ -362,17 +362,17 @@ int EchoTableEditWindow::OpenCSVDialog()
else {} else {}
QString tableFilepath = getOpenFilePath( QString tableFilepath = getOpenFilePath(
this, this,
QString::fromUtf8(u8"打开表格文件"), QString::fromUtf8(u8"打开表格文件"),
QString::fromUtf8(u8"csv文件 (*.csv);;xls文件(*.xls)")); QString::fromUtf8(u8"csv文件 (*.csv);;xls文件(*.xls)"));
this->ui.statusbar->showMessage(u8"正在打开文件...."); this->ui.statusbar->showMessage(u8"正在打开文件....");
std::shared_ptr< FEKOResultCsvTableModel> tablemode = std::make_shared< FEKOResultCsvTableModel>(); std::shared_ptr< FEKOResultCsvTableModel> tablemode = std::make_shared< FEKOResultCsvTableModel>();
tablemode->loadCSVFilePath(tableFilepath); tablemode->loadCSVFilePath(tableFilepath);
this->loadTablemode(tablemode); this->loadTablemode(tablemode);
this->setTableViewAutoSort(true); this->setTableViewAutoSort(true);
this->LockFileOpen(); this->LockFileOpen();
this->ui.statusbar->showMessage(u8"文件打开结束"); this->ui.statusbar->showMessage(u8"文件打开结束");
return -1; return -1;
} }
@ -387,8 +387,8 @@ int EchoTableEditWindow::SaveAsDialog()
{ {
QString filepath = getSaveFilePath( QString filepath = getSaveFilePath(
this, this,
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"csv文件 (*.csv)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"csv文件 (*.csv)"));//多组扩展名用双分号";;"隔开
this->model->saveAsFilePath(filepath); this->model->saveAsFilePath(filepath);
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef ECHOTABLEEDITWINDOW_H #ifndef ECHOTABLEEDITWINDOW_H
#define ECHOTABLEEDITWINDOW_H #define ECHOTABLEEDITWINDOW_H
#include "AllHead.h" #include "AllHead.h"
@ -12,12 +12,12 @@
/* /*
* *
***/ ***/
/* /*
* *
****/ ****/
class EchoTableEditWindow : public QMainWindow class EchoTableEditWindow : public QMainWindow
{ {
@ -30,7 +30,7 @@ private:
QMenu* tableViewContextMenu; QMenu* tableViewContextMenu;
QUndoStack* m_undoStack; QUndoStack* m_undoStack;
/*菜单*/ /*菜单*/
QProgressBar* statusprogressBar; QProgressBar* statusprogressBar;
@ -39,12 +39,12 @@ public:
~EchoTableEditWindow(); ~EchoTableEditWindow();
int initTableViewStatusBarControl(); int initTableViewStatusBarControl();
int initTableViewContextMenu(); // 初始化上下文菜单 int initTableViewContextMenu(); // 初始化上下文菜单
int LockFileOpen(bool flag=true); // 锁定文件,不允许进行重新打开文件 int LockFileOpen(bool flag=true); // 锁定文件,不允许进行重新打开文件
int setCheckFieldContextHasEmptyCeilLOCK(bool flag=true);// 允许启动当前字段中存在空格检查,-- 提供给FEKOResult分析使用 int setCheckFieldContextHasEmptyCeilLOCK(bool flag=true);// 允许启动当前字段中存在空格检查,-- 提供给FEKOResult分析使用
int loadTablemode(std::shared_ptr<AbstractTableModel> mode); // 加载tableview 使用的model int loadTablemode(std::shared_ptr<AbstractTableModel> mode); // 加载tableview 使用的model
int setTableViewAutoSort(bool flag); int setTableViewAutoSort(bool flag);
int setDragDropOverwriteMode(bool flag); // 是否禁用列调换 int setDragDropOverwriteMode(bool flag); // 是否禁用列调换
int setTablCalibrationTab(bool flag); int setTablCalibrationTab(bool flag);
@ -58,7 +58,7 @@ private:
public slots: public slots:
// tableview 右键菜单 // tableview 右键菜单
void ShowTableViewContextMenu(QPoint p); void ShowTableViewContextMenu(QPoint p);
void tableView_CopyAction(); void tableView_CopyAction();
void tableView_PasteAction(); void tableView_PasteAction();
@ -70,24 +70,24 @@ public slots:
void on_actionSave_triggered(); void on_actionSave_triggered();
void on_actionSaveAs_triggered(); void on_actionSaveAs_triggered();
void on_actionEchoSplitExport_triggered(); // 回波数据导出 void on_actionEchoSplitExport_triggered(); // 回波数据导出
void on_actionCalibrationConst_triggered(); // 计算定标常数 void on_actionCalibrationConst_triggered(); // 计算定标常数
protected: // 重写函数 protected: // 重写函数
void closeEvent(QCloseEvent* event) override { void closeEvent(QCloseEvent* event) override {
// 在窗口关闭事件中询问用户是否关闭 // 在窗口关闭事件中询问用户是否关闭
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, u8"Close", u8"您回波数据导出了吗?", QMessageBox::Yes | QMessageBox::No); reply = QMessageBox::question(this, u8"Close", u8"您回波数据导出了吗?", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
// 用户点击了"Yes"按钮,关闭窗口 // 用户点击了"Yes"按钮,关闭窗口
event->accept(); event->accept();
} }
else { else {
// 用户点击了"No"按钮,取消关闭操作 // 用户点击了"No"按钮,取消关闭操作
event->ignore(); event->ignore();
} }
}; };

View File

@ -1,4 +1,4 @@
#include "FEKOResultImport.h" #include "FEKOResultImport.h"
#include "BaseToolLib/FileOperator.h" #include "BaseToolLib/FileOperator.h"
#include "SharedModuleLib/BaseUiTool.h" #include "SharedModuleLib/BaseUiTool.h"
#include "TaskXml/TaskTreeClass.h" #include "TaskXml/TaskTreeClass.h"
@ -43,7 +43,7 @@ FEKOResultImport::~FEKOResultImport()
} }
if (nullptr == this->selectListViewmodel || NULL == this->selectListViewmodel) {} if (nullptr == this->selectListViewmodel || NULL == this->selectListViewmodel) {}
else { else {
this->selectListViewmodel->clear(); // 释放所有对象的内存 this->selectListViewmodel->clear(); // 释放所有对象的内存
delete this->selectListViewmodel; delete this->selectListViewmodel;
this->selectListViewmodel = nullptr; this->selectListViewmodel = nullptr;
} }
@ -103,23 +103,23 @@ int FEKOResultImport::setSelectFieldNames(std::vector<QString> SelectFieldNames,
this->ui.NearradioButton->setChecked(0); this->ui.NearradioButton->setChecked(0);
this->ui.FarradioButton->setChecked(1); this->ui.FarradioButton->setChecked(1);
} }
// 剔除数据 // 剔除数据
this->ListViewmodel->clear(); this->ListViewmodel->clear();
this->selectListViewmodel->clear(); this->selectListViewmodel->clear();
// 重新分配数据 // 重新分配数据
for (int i = 0; i < SelectFieldNames.size(); i++) { for (int i = 0; i < SelectFieldNames.size(); i++) {
QStandardItem* item = new QStandardItem(QString::QString(SelectFieldNames[i])); QStandardItem* item = new QStandardItem(QString::QString(SelectFieldNames[i]));
this->selectListViewmodel->appendRow(item); this->selectListViewmodel->appendRow(item);
} }
std::unordered_set<QString> selectSET; std::unordered_set<QString> selectSET;
for (int i = 0; i < SelectFieldNames.size(); i++) { for (int i = 0; i < SelectFieldNames.size(); i++) {
selectSET.insert(SelectFieldNames[i]);// 插入 selectSET.insert(SelectFieldNames[i]);// 插入
} }
if (nearOrfar) { if (nearOrfar) {
for (int i = 0; i < this->nearFieldNames.size(); i++) for (int i = 0; i < this->nearFieldNames.size(); i++)
{ {
if (selectSET.insert(this->nearFieldNames[i]).second)//判断是否能插入成功 if (selectSET.insert(this->nearFieldNames[i]).second)//判断是否能插入成功
{ {
QStandardItem* item = new QStandardItem(QString::QString(this->nearFieldNames[i])); QStandardItem* item = new QStandardItem(QString::QString(this->nearFieldNames[i]));
this->ListViewmodel->appendRow(item); this->ListViewmodel->appendRow(item);
@ -134,7 +134,7 @@ int FEKOResultImport::setSelectFieldNames(std::vector<QString> SelectFieldNames,
for (int i = 0; i < this->farFieldNames.size(); i++) for (int i = 0; i < this->farFieldNames.size(); i++)
{ {
if (selectSET.insert(this->farFieldNames[i]).second)//判断是否能插入成功 if (selectSET.insert(this->farFieldNames[i]).second)//判断是否能插入成功
{ {
QStandardItem* item = new QStandardItem(QString::QString(this->farFieldNames[i])); QStandardItem* item = new QStandardItem(QString::QString(this->farFieldNames[i]));
this->ListViewmodel->appendRow(item); this->ListViewmodel->appendRow(item);
@ -240,18 +240,18 @@ QString FEKOResultImport::getSaveCsvFilePath()
} }
// 打开文件并寻找pre文件 // 打开文件并寻找pre文件
int FEKOResultImport::OpenPrejectFolderPath() { int FEKOResultImport::OpenPrejectFolderPath() {
//打开单个文件 //打开单个文件
QString prefileNamePath = getOpenFilePath( QString prefileNamePath = getOpenFilePath(
this, this,
QString::fromUtf8(u8"选择.pre 文件"), QString::fromUtf8(u8"选择.pre 文件"),
QString::fromUtf8(u8"pre文件 (*.pre)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"pre文件 (*.pre)"));//多组扩展名用双分号";;"隔开
this->FEKOProjectFolderPath = getParantFromPath(prefileNamePath); this->FEKOProjectFolderPath = getParantFromPath(prefileNamePath);
this->FEKOPreFileName = getFileNameFromPath(prefileNamePath); this->FEKOPreFileName = getFileNameFromPath(prefileNamePath);
this->farFieldNames = getFilelist(this->FEKOProjectFolderPath, ".ffe"); this->farFieldNames = getFilelist(this->FEKOProjectFolderPath, ".ffe");
this->nearFieldNames = getFilelist(this->FEKOProjectFolderPath, ".efe"); this->nearFieldNames = getFilelist(this->FEKOProjectFolderPath, ".efe");
// 修改显示 // 修改显示
this->ListViewmodel->clear(); this->ListViewmodel->clear();
this->ui.FolderPathtextEdit->setText(this->FEKOProjectFolderPath); this->ui.FolderPathtextEdit->setText(this->FEKOProjectFolderPath);
this->ui.PreFileNametextEdit->setText(this->FEKOPreFileName); this->ui.PreFileNametextEdit->setText(this->FEKOPreFileName);
@ -278,21 +278,21 @@ int FEKOResultImport::OpenPrejectFolderPath() {
void FEKOResultImport::waitCMDExcute() void FEKOResultImport::waitCMDExcute()
{ {
qDebug() << u8"转换程序执行结束"; qDebug() << u8"转换程序执行结束";
if (isExists(this->FEKOResultCSVPath)) { if (isExists(this->FEKOResultCSVPath)) {
messageLog(u8"FEKOResult 保存成功\n路径:\t" + this->FEKOResultCSVPath, 1); messageLog(u8"FEKOResult 保存成功\n路径:\t" + this->FEKOResultCSVPath, 1);
this->saveSucessfully = true; this->saveSucessfully = true;
this->p->close(); this->p->close();
delete p; delete p;
this->p = nullptr; this->p = nullptr;
} }
else { else {
messageLog(u8"FEKOResult 保存失败\n路径:\t" + this->FEKOResultCSVPath, 1); messageLog(u8"FEKOResult 保存失败\n路径:\t" + this->FEKOResultCSVPath, 1);
this->saveSucessfully = false; this->saveSucessfully = false;
} }
// 触发结果时间 // 触发结果时间
qDebug() << u8"准备执行转换结果编辑功能"; qDebug() << u8"准备执行转换结果编辑功能";
emit this->callbackFekoResultImport(this); emit this->callbackFekoResultImport(this);
} }
@ -324,7 +324,7 @@ int FEKOResultImport::FEKOResultImportButtonClick()
if (isExists(this->FEKOResultCSVPath)) { if (isExists(this->FEKOResultCSVPath)) {
QFile file(this->FEKOResultCSVPath); QFile file(this->FEKOResultCSVPath);
if (!file.open(QIODevice::ReadWrite)) { if (!file.open(QIODevice::ReadWrite)) {
QMessageBox::information(nullptr, u8"文件被占用", this->FEKOResultCSVPath); QMessageBox::information(nullptr, u8"文件被占用", this->FEKOResultCSVPath);
return 2; return 2;
} }
else { else {
@ -336,9 +336,9 @@ int FEKOResultImport::FEKOResultImportButtonClick()
QString csvpramarPath = this->FEKOResultCSVPath; QString csvpramarPath = this->FEKOResultCSVPath;
csvpramarPath= csvpramarPath.replace(this->FEKOResultCSVPath.size() - 4, 4, ".params"); csvpramarPath= csvpramarPath.replace(this->FEKOResultCSVPath.size() - 4, 4, ".params");
// 获取选择文件 // 获取选择文件
std::vector<QString> selectfiles = this->getSelectFieldNames(); std::vector<QString> selectfiles = this->getSelectFieldNames();
QString parmas_text = this->FEKOResultCSVPath +"\n";// 输出路径 QString parmas_text = this->FEKOResultCSVPath +"\n";// 输出路径
for (int i = 0; i < selectfiles.size(); i++) { for (int i = 0; i < selectfiles.size(); i++) {
parmas_text = parmas_text + selectfiles[i] + "\n"; parmas_text = parmas_text + selectfiles[i] + "\n";
} }
@ -348,7 +348,7 @@ int FEKOResultImport::FEKOResultImportButtonClick()
writeUTF8StringFile(csvpramarPath, (parmas_text)); writeUTF8StringFile(csvpramarPath, (parmas_text));
// 拼接命令行 // 拼接命令行
QString cmdtext = u8""; QString cmdtext = u8"";
if (this->ui.NearradioButton->isChecked()) { if (this->ui.NearradioButton->isChecked()) {
cmdtext = cmdtext + u8"NearField2csvTool.exe"; cmdtext = cmdtext + u8"NearField2csvTool.exe";
@ -416,11 +416,11 @@ int FEKOResultImport::DeleteFekoResultClick()
int FEKOResultImport::SaveCsvFilePath() int FEKOResultImport::SaveCsvFilePath()
{ {
//打开单个文件 //打开单个文件
QString csvfileNamePath = getSaveFilePath( QString csvfileNamePath = getSaveFilePath(
this, this,
QString::fromUtf8(u8"保存FEKO解析结果 csv "), QString::fromUtf8(u8"保存FEKO解析结果 csv "),
QString::fromUtf8(u8"csv文件 (*.csv)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"csv文件 (*.csv)"));//多组扩展名用双分号";;"隔开
this->FEKOResultCSVPath = csvfileNamePath; this->FEKOResultCSVPath = csvfileNamePath;
this->ui.csvPathText->setPlainText(csvfileNamePath); this->ui.csvPathText->setPlainText(csvfileNamePath);
return 0; return 0;

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef FEKORESULTIMPORT_H #ifndef FEKORESULTIMPORT_H
#define FEKORESULTIMPORT_H #define FEKORESULTIMPORT_H
@ -67,16 +67,16 @@ private:
signals: signals:
void callbackFekoResultImport(FEKOResultImport* obj); void callbackFekoResultImport(FEKOResultImport* obj);
public slots: // 信号(或者事件) public slots: // 信号(或者事件)
int OpenPrejectFolderPath(); int OpenPrejectFolderPath();
int closeWindows(); int closeWindows();
int NearRadioButtonSelect(bool); int NearRadioButtonSelect(bool);
int FarRadioButtonSelect(bool); int FarRadioButtonSelect(bool);
int FEKOResultImportButtonClick(); // 执行导入 int FEKOResultImportButtonClick(); // 执行导入
int AddFekoResultClick(); int AddFekoResultClick();
int DeleteFekoResultClick(); int DeleteFekoResultClick();
int SaveCsvFilePath(); int SaveCsvFilePath();
void waitCMDExcute(); // 导入完成 void waitCMDExcute(); // 导入完成
}; };

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "AllHead.h" #include "AllHead.h"
// 这里将系统环境中的文件默认先导入 // 这里将系统环境中的文件默认先导入
#include <io.h> #include <io.h>

View File

@ -1,4 +1,4 @@
#include "ImageShowDialogClass.h" #include "ImageShowDialogClass.h"
ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent) ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
: QDialog(parent) : QDialog(parent)
@ -9,8 +9,8 @@ ImageShowDialogClass ::ImageShowDialogClass(QWidget *parent)
this->graphclass=LAMPDATASHOWCLASS::NOWINDOWS; this->graphclass=LAMPDATASHOWCLASS::NOWINDOWS;
this->menubar = new QMenuBar(this); this->menubar = new QMenuBar(this);
QMenu* windowsMenu = this->menubar->addMenu(u8"数据"); QMenu* windowsMenu = this->menubar->addMenu(u8"数据");
QAction* action_cursor_enable = windowsMenu->addAction(u8"打开游标"); QAction* action_cursor_enable = windowsMenu->addAction(u8"打开游标");
QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged())); QObject::connect(action_cursor_enable,SIGNAL(triggered()),this,SLOT(on_action_cursor_enable_trigged()));
this->tracer=new QCPItemTracer(this->ui.m_plot); this->tracer=new QCPItemTracer(this->ui.m_plot);
this->m_plot = ui.m_plot; this->m_plot = ui.m_plot;
@ -53,12 +53,12 @@ void ImageShowDialogClass::on_action_cursor_enable_trigged()
} }
} }
//下面的代码就是设置游标的外观 //下面的代码就是设置游标的外观
this->setMouseTracking(true); this->setMouseTracking(true);
tracer->setInterpolating(false);//禁用插值 tracer->setInterpolating(false);//禁用插值
tracer->setPen(QPen(Qt::DashLine));//虚线游标 tracer->setPen(QPen(Qt::DashLine));//虚线游标
tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框 tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
tracer->setBrush(Qt::red);//游标颜色 tracer->setBrush(Qt::red);//游标颜色
if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) { if (this->graphclass == LAMPDATASHOWCLASS::LAMPColorMap) {
this->HlineCursor = new ImageShowCursorLineClass(); this->HlineCursor = new ImageShowCursorLineClass();
@ -78,17 +78,17 @@ void ImageShowDialogClass::on_action_cursor_enable_trigged()
void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QString name) void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QString name)
{ {
int nx = data.rows(); // 行数 int nx = data.rows(); // 行数
int ny = data.cols(); // 列数 int ny = data.cols(); // 列数
// 创建 Color Map // 创建 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()->setSize(nx, ny); // 设置 Color Map 的大小
colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // 设置坐标轴的范围 colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // 设置坐标轴的范围
// 填充数据 // 填充数据
for (int xIndex = 0; xIndex < nx; ++xIndex) { for (int xIndex = 0; xIndex < nx; ++xIndex) {
for (int yIndex = 0; yIndex < ny; ++yIndex) { for (int yIndex = 0; yIndex < ny; ++yIndex) {
double magnitude = data(xIndex, yIndex); // 或者使用 std::arg() 获取相位 double magnitude = data(xIndex, yIndex); // 或者使用 std::arg() 获取相位
colorMap->data()->setCell(xIndex, yIndex, magnitude); colorMap->data()->setCell(xIndex, yIndex, magnitude);
} }
} }
@ -102,18 +102,18 @@ void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd data, QStrin
void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd X, Eigen::MatrixXd Y, Eigen::MatrixXd data, QString name) void ImageShowDialogClass::load_double_MatrixX_data(Eigen::MatrixXd X, Eigen::MatrixXd Y, Eigen::MatrixXd data, QString name)
{ {
int nx = data.cols(); // 行数 int nx = data.cols(); // 行数
int ny = data.rows(); // 列数 int ny = data.rows(); // 列数
// 创建 Color Map // 创建 Color Map
ui.m_plot->xAxis->setRange(X(0, 0), X(0, nx - 1)); ui.m_plot->xAxis->setRange(X(0, 0), X(0, nx - 1));
ui.m_plot->yAxis->setRange(Y(0, 0), Y(ny - 1, 0)); ui.m_plot->yAxis->setRange(Y(0, 0), Y(ny - 1, 0));
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(ny, nx); // 设置 Color Map 的大小 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))); // 设置坐标轴的范围 colorMap->data()->setRange(QCPRange(X(0,0), X(0,nx-1)), QCPRange(Y(0,0),Y(ny-1,0))); // 设置坐标轴的范围
// 填充数据 // 填充数据
for (int xIndex = 0; xIndex < nx; ++xIndex) { for (int xIndex = 0; xIndex < nx; ++xIndex) {
for (int yIndex = 0; yIndex < ny; ++yIndex) { for (int yIndex = 0; yIndex < ny; ++yIndex) {
double magnitude = data(yIndex, xIndex); // 或者使用 std::arg() 获取相位 double magnitude = data(yIndex, xIndex); // 或者使用 std::arg() 获取相位
colorMap->data()->setCell(yIndex, xIndex, magnitude); colorMap->data()->setCell(yIndex, xIndex, magnitude);
} }
} }
@ -183,13 +183,13 @@ void ImageShowDialogClass::updateCursor(QMouseEvent *event)
if (this->desCursorflag &&this->HlineCursorflag &&this->VlineCursorflag) { if (this->desCursorflag &&this->HlineCursorflag &&this->VlineCursorflag) {
//下面的代码就是设置游标的外观 //下面的代码就是设置游标的外观
this->setMouseTracking(false); this->setMouseTracking(false);
} }
else { else {
// 准备获取数据 // 准备获取数据
QPoint pos = event->pos(); QPoint pos = event->pos();
double x=this->m_plot->xAxis->pixelToCoord(pos.x()); // 将鼠标位置映射到图表坐标系中 double x=this->m_plot->xAxis->pixelToCoord(pos.x()); // 将鼠标位置映射到图表坐标系中
double y = this->m_plot->yAxis->pixelToCoord(pos.y()); double y = this->m_plot->yAxis->pixelToCoord(pos.y());
this->statusbar->showMessage(u8"X: "+QString::number(x,'f', 6)+" y: "+QString::number(y, 'f', 6)); this->statusbar->showMessage(u8"X: "+QString::number(x,'f', 6)+" y: "+QString::number(y, 'f', 6));
@ -208,7 +208,7 @@ void ImageShowDialogClass::updateCursor(QMouseEvent *event)
} }
else { else {
this->desCursor->updateCursorContent(u8"无法识别图像类型"); this->desCursor->updateCursorContent(u8"无法识别图像类型");
} }
} }
if (this->HlineCursorflag) { if (this->HlineCursorflag) {
@ -224,14 +224,14 @@ void ImageShowDialogClass::updateCursor(QMouseEvent *event)
ImageShowCursorDesClass::ImageShowCursorDesClass(QWidget* parent) ImageShowCursorDesClass::ImageShowCursorDesClass(QWidget* parent)
{ {
// 创建 QLabel // 创建 QLabel
label = new QLabel(this); label = new QLabel(this);
// 创建布局 // 创建布局
QVBoxLayout* layout = new QVBoxLayout(this); QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(label); layout->addWidget(label);
// 设置布局 // 设置布局
setLayout(layout); setLayout(layout);
} }
@ -256,22 +256,22 @@ void ImageShowCursorDesClass::updateCursorContent(QString content) {
ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent) ImageShowCursorLineClass::ImageShowCursorLineClass(QWidget* parent)
{ {
this->menubar = new QMenuBar(this); this->menubar = new QMenuBar(this);
//QMenu* toolMenu = this->menubar->addMenu(u8"工具"); //QMenu* toolMenu = this->menubar->addMenu(u8"工具");
//QAction* action_add_compare_line = toolMenu->addAction(u8"添加对比数据"); //QAction* action_add_compare_line = toolMenu->addAction(u8"添加对比数据");
//QObject::connect(action_add_compare_line, SIGNAL(triggered()), this, SLOT(load_new_compare_line())); //QObject::connect(action_add_compare_line, SIGNAL(triggered()), this, SLOT(load_new_compare_line()));
this->tracerEnable = false; this->tracerEnable = false;
this->tracer = nullptr; this->tracer = nullptr;
this->tracerXText = nullptr; this->tracerXText = nullptr;
this->tracerYText = nullptr; this->tracerYText = nullptr;
// 创建 QLabel // 创建 QLabel
this->customPlot = new QCustomPlot(this); this->customPlot = new QCustomPlot(this);
// 创建布局 // 创建布局
QVBoxLayout* layout = new QVBoxLayout(this); QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(this->customPlot); layout->addWidget(this->customPlot);
// 设置布局 // 设置布局
setLayout(layout); setLayout(layout);
this->tracer = new QCPItemTracer(this->customPlot); this->tracer = new QCPItemTracer(this->customPlot);
this->tracerYText = new QCPItemText(this->customPlot); this->tracerYText = new QCPItemText(this->customPlot);
@ -301,38 +301,38 @@ void ImageShowCursorLineClass::loadPlotLine(QVector<double> xs, QVector<double>
customPlot->replot(); customPlot->replot();
//下面的代码就是设置游标的外观 //下面的代码就是设置游标的外观
this->setMouseTracking(true); this->setMouseTracking(true);
tracer->setInterpolating(false);//禁用插值 tracer->setInterpolating(false);//禁用插值
tracer->setPen(QPen(Qt::DashLine));//虚线游标 tracer->setPen(QPen(Qt::DashLine));//虚线游标
tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框 tracer->setStyle(QCPItemTracer::tsPlus);//游标样式:十字星、圆圈、方框
tracer->setBrush(Qt::red);//游标颜色 tracer->setBrush(Qt::red);//游标颜色
tracer->setGraph(graph); // 确保游标跟随 tracer->setGraph(graph); // 确保游标跟随
this->m_graphMap.insert(Name, graph); this->m_graphMap.insert(Name, graph);
this->TrackName = Name; this->TrackName = Name;
} }
void ImageShowCursorLineClass::updateCursor(QMouseEvent* event) void ImageShowCursorLineClass::updateCursor(QMouseEvent* event)
{ {
if (tracerEnable)//游标使能 if (tracerEnable)//游标使能
{ {
double x = this->customPlot->xAxis->pixelToCoord(event->pos().x());//鼠标点的像素坐标转plot坐标 double x = this->customPlot->xAxis->pixelToCoord(event->pos().x());//鼠标点的像素坐标转plot坐标
tracer->setGraphKey(x);//设置游标的X值这就是游标随动的关键代码 tracer->setGraphKey(x);//设置游标的X值这就是游标随动的关键代码
double traceX = tracer->position->key(); double traceX = tracer->position->key();
double traceY = tracer->position->value(); double traceY = tracer->position->value();
tracerXText->setText(QDateTime::fromMSecsSinceEpoch(traceX * 1000.0).toString("hh:mm:ss.zzz"));//游标文本框指示游标的X值 tracerXText->setText(QDateTime::fromMSecsSinceEpoch(traceX * 1000.0).toString("hh:mm:ss.zzz"));//游标文本框指示游标的X值
tracerYText->setText(QString::number(traceY));//游标文本框指示游标的Y值 tracerYText->setText(QString::number(traceY));//游标文本框指示游标的Y值
////计算游标X值对应的所有曲线的Y值 ////计算游标X值对应的所有曲线的Y值
//for (int i = 0; i < this->customPlot->graphCount(); i++) //for (int i = 0; i < this->customPlot->graphCount(); i++)
//{ //{
// QCPGraph* graph = dynamic_cast<QCPGraph*>(this->customPlot->plottable(i)); // QCPGraph* graph = dynamic_cast<QCPGraph*>(this->customPlot->plottable(i));
// //搜索左边离traceX最近的key对应的点详情参考findBegin函数的帮助 // //搜索左边离traceX最近的key对应的点详情参考findBegin函数的帮助
// QCPDataContainer<QCPGraphData>::const_iterator coorPoint = graph->data().data()->findBegin(traceX, true);//true代表向左搜索 // QCPDataContainer<QCPGraphData>::const_iterator coorPoint = graph->data().data()->findBegin(traceX, true);//true代表向左搜索
// qDebug() << QString("graph%1对应的Y值是").arg(i) << coorPoint->value; // qDebug() << QString("graph%1对应的Y值是").arg(i) << coorPoint->value;
//} //}
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef IMAGESHOWDIALOGCLASS_H #ifndef IMAGESHOWDIALOGCLASS_H
#define IMAGESHOWDIALOGCLASS_H #define IMAGESHOWDIALOGCLASS_H
#include "AllHead.h" #include "AllHead.h"
@ -7,7 +7,7 @@
#include "ui_ImageShowDialogClass.h" #include "ui_ImageShowDialogClass.h"
//=========================== //===========================
// 定义需要绘制的图像的类型 // 定义需要绘制的图像的类型
//=========================== //===========================
enum LAMPDATASHOWCLASS { enum LAMPDATASHOWCLASS {
LAMPGraph, LAMPGraph,
@ -22,9 +22,9 @@ enum LAMPDATASHOWCLASS {
//=========================== //===========================
// 构建游标类型 // 构建游标类型
// 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息 // 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息
// 2. 区域性描述游标,通过线,等用来展示某一个区域的信息 // 2. 区域性描述游标,通过线,等用来展示某一个区域的信息
//=========================== //===========================
class ImageShowCursorDesClass : public QDialog class ImageShowCursorDesClass : public QDialog
{ {
@ -56,9 +56,9 @@ public:
QCustomPlot* customPlot; QCustomPlot* customPlot;
bool tracerEnable; bool tracerEnable;
QCPItemTracer* tracer; //游标 QCPItemTracer* tracer; //游标
QCPItemText* tracerYText; //图标标签 QCPItemText* tracerYText; //图标标签
QCPItemText* tracerXText; //游标标签 QCPItemText* tracerXText; //游标标签
QMap<QString, QCPAbstractPlottable*> m_graphMap; QMap<QString, QCPAbstractPlottable*> m_graphMap;
QMap<QString, QAction*> data_action_map; QMap<QString, QAction*> data_action_map;
QString TrackName; QString TrackName;
@ -88,9 +88,9 @@ protected:
//=========================== //===========================
// 构建数据展示窗口 // 构建数据展示窗口
// 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息 // 1. 单纯的描述游标,主要用来展示坐标,还有当前数据信息
// 2. 区域性描述游标,通过线,等用来展示某一个区域的信息 // 2. 区域性描述游标,通过线,等用来展示某一个区域的信息
//=========================== //===========================
class ImageShowDialogClass : public QDialog class ImageShowDialogClass : public QDialog
{ {
@ -100,16 +100,16 @@ private:
public: public:
QMenuBar* menubar; QMenuBar* menubar;
QStatusBar* statusbar; QStatusBar* statusbar;
ImageShowCursorDesClass* desCursor; // 描述游标 ImageShowCursorDesClass* desCursor; // 描述游标
ImageShowCursorLineClass* HlineCursor;// H 游标 ImageShowCursorLineClass* HlineCursor;// H 游标
ImageShowCursorLineClass* VlineCursor;// V 游标 ImageShowCursorLineClass* VlineCursor;// V 游标
bool desCursorflag; bool desCursorflag;
bool HlineCursorflag; bool HlineCursorflag;
bool VlineCursorflag; bool VlineCursorflag;
QCustomPlot* m_plot; QCustomPlot* m_plot;
QCPItemTracer* tracer; //游标 QCPItemTracer* tracer; //游标
public: public:
QMap<QString, QCPAbstractPlottable*> m_graphMap; QMap<QString, QCPAbstractPlottable*> m_graphMap;

View File

@ -1,19 +1,19 @@
#include "LAMPDataShowClass.h" #include "LAMPDataShowClass.h"
LAMPDataShowClass::LAMPDataShowClass(QWidget *parent) LAMPDataShowClass::LAMPDataShowClass(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
{ {
ui.setupUi(this); 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文件"); // 添加菜单项 QAction* action_openfile_tiff = FileOpenMenu->addAction(u8"tiff文件"); // 添加菜单项
QObject::connect(action_openfile_tiff, SIGNAL(triggered()), this, SLOT(on_action_openfile_tiff_triggered())); 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文件"); // 添加菜单项 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())); 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文件"); // 添加菜单项 QAction* action_openfile_envi_complex = ComplexFileOpenMenu->addAction(u8"envi文件"); // 添加菜单项
QObject::connect(action_openfile_envi_complex, SIGNAL(triggered()), this, SLOT(on_action_openfile_envi_complex_triggered())); QObject::connect(action_openfile_envi_complex, SIGNAL(triggered()), this, SLOT(on_action_openfile_envi_complex_triggered()));
this->setContextMenuPolicy(Qt::CustomContextMenu); this->setContextMenuPolicy(Qt::CustomContextMenu);
@ -34,17 +34,17 @@ void LAMPDataShowClass::add_DataTree(TaskNode* node) {
} }
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix) { void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix) {
int nx = complexMatrix.rows(); // 行数 int nx = complexMatrix.rows(); // 行数
int ny = complexMatrix.cols(); // 列数 int ny = complexMatrix.cols(); // 列数
// 创建 Color Map // 创建 Color Map
QCPColorMap* colorMap = new QCPColorMap(customPlot->xAxis, customPlot->yAxis); QCPColorMap* colorMap = new QCPColorMap(customPlot->xAxis, customPlot->yAxis);
colorMap->data()->setSize(nx, ny); // 设置 Color Map 的大小 colorMap->data()->setSize(nx, ny); // 设置 Color Map 的大小
colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // 设置坐标轴的范围 colorMap->data()->setRange(QCPRange(0, nx), QCPRange(0, ny)); // 设置坐标轴的范围
// 填充数据 // 填充数据
for (int xIndex = 0; xIndex < nx; ++xIndex) { for (int xIndex = 0; xIndex < nx; ++xIndex) {
for (int yIndex = 0; yIndex < ny; ++yIndex) { for (int yIndex = 0; yIndex < ny; ++yIndex) {
double magnitude = std::abs(complexMatrix(xIndex, yIndex)); // 或者使用 std::arg() 获取相位 double magnitude = std::abs(complexMatrix(xIndex, yIndex)); // 或者使用 std::arg() 获取相位
colorMap->data()->setCell(xIndex, yIndex, magnitude); colorMap->data()->setCell(xIndex, yIndex, magnitude);
} }
} }
@ -69,7 +69,7 @@ void LAMPDataShowClass::on_action_openfile_tiff_complex_triggered()
{ {
ComplexDataShowNode* node = new ComplexDataShowNode(); ComplexDataShowNode* node = new ComplexDataShowNode();
node->bangdindWindows(this); node->bangdindWindows(this);
node->TaskXmlPath = getOpenFilePath(nullptr, u8"打开复数数据", u8" tiff文件(*.tiff ,*.tif)"); node->TaskXmlPath = getOpenFilePath(nullptr, u8"打开复数数据", u8" tiff文件(*.tiff ,*.tif)");
if (!isExists(node->TaskXmlPath)) { if (!isExists(node->TaskXmlPath)) {
return; return;
} }
@ -83,7 +83,7 @@ void LAMPDataShowClass::on_action_openfile_envi_complex_triggered()
{ {
ComplexDataShowNode* node = new ComplexDataShowNode(); ComplexDataShowNode* node = new ComplexDataShowNode();
node->bangdindWindows(this); node->bangdindWindows(this);
node->TaskXmlPath = getOpenFilePath(nullptr, u8"打开复数数据", u8"envi文件(*.dat ) "); node->TaskXmlPath = getOpenFilePath(nullptr, u8"打开复数数据", u8"envi文件(*.dat ) ");
if (!isExists(node->TaskXmlPath)) { if (!isExists(node->TaskXmlPath)) {
return; return;
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef LAMPDATASHOWClASS_H #ifndef LAMPDATASHOWClASS_H
#define LAMPDATASHOWClASS_H #define LAMPDATASHOWClASS_H
@ -24,7 +24,7 @@ public:
public slots: // 菜单action 槽函数 public slots: // 菜单action 槽函数
void add_DataTree(TaskNode* node); void add_DataTree(TaskNode* node);
void on_action_openfile_tiff_triggered(); void on_action_openfile_tiff_triggered();
void on_action_openfile_envi_triggered(); void on_action_openfile_envi_triggered();
@ -39,7 +39,7 @@ private:
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// 基础函数 // 基础函数
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix); void ShowComplexMatrixPlot(QCustomPlot* customPlot, const Eigen::MatrixXcd& complexMatrix);

View File

@ -1,4 +1,4 @@
#include "LAMPImageCreateClass.h" #include "LAMPImageCreateClass.h"
LAMPImageCreateClass::LAMPImageCreateClass(QWidget *parent) LAMPImageCreateClass::LAMPImageCreateClass(QWidget *parent)
: QDialog(parent) : QDialog(parent)
@ -13,7 +13,7 @@ LAMPImageCreateClass::LAMPImageCreateClass(QWidget *parent)
// 限制lineedit输入为数值 // 限制lineedit输入为数值
QDoubleValidator* doubleValidator = new QDoubleValidator(); QDoubleValidator* doubleValidator = new QDoubleValidator();
this->ui.lineEdit_minX->setValidator(doubleValidator); this->ui.lineEdit_minX->setValidator(doubleValidator);
this->ui.lineEdit__maxX->setValidator(doubleValidator); this->ui.lineEdit__maxX->setValidator(doubleValidator);
@ -56,25 +56,25 @@ Q_INVOKABLE FEKOBase::FEKOImageSettingParams LAMPImageCreateClass::getFEKOImageS
void LAMPImageCreateClass::on_pushButton_theta_clicked() void LAMPImageCreateClass::on_pushButton_theta_clicked()
{ {
QString thetaechopath = getOpenFilePath(this, u8"打开theta回波文件", u8"theta Files (*.theta)"); QString thetaechopath = getOpenFilePath(this, u8"打开theta回波文件", u8"theta Files (*.theta)");
this->ui.lineEdit_thetaechopath->setText(thetaechopath); this->ui.lineEdit_thetaechopath->setText(thetaechopath);
} }
void LAMPImageCreateClass::on_pushButton_phi_clicked() void LAMPImageCreateClass::on_pushButton_phi_clicked()
{ {
QString phiechopath = getOpenFilePath(this, u8"打开phi回波文件", u8"theta Files (*.phi)"); QString phiechopath = getOpenFilePath(this, u8"打开phi回波文件", u8"theta Files (*.phi)");
this->ui.lineEdit_phiechopath->setText(phiechopath); this->ui.lineEdit_phiechopath->setText(phiechopath);
} }
void LAMPImageCreateClass::on_pushButton_thetaimage_clicked() void LAMPImageCreateClass::on_pushButton_thetaimage_clicked()
{ {
QString thetaimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)"); QString thetaimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)");
this->ui.lineEdit_thetaimagepath->setText(thetaimagePath); this->ui.lineEdit_thetaimagepath->setText(thetaimagePath);
} }
void LAMPImageCreateClass::on_pushButton_phiImage_clicked() void LAMPImageCreateClass::on_pushButton_phiImage_clicked()
{ {
QString phiimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)"); QString phiimagePath = getSaveFilePath(this, u8"保存theta极化回波成像结果", u8"ENVI (*.dat)");
this->ui.lineEdit_phiimagepath->setText(phiimagePath); this->ui.lineEdit_phiimagepath->setText(phiimagePath);
} }
@ -99,7 +99,7 @@ void LAMPImageCreateClass::on_pushButton_OK_clicked()
{ {
FEKOBase::FEKOImageSettingParams imageparams = this->getFEKOImageSettingParams(); FEKOBase::FEKOImageSettingParams imageparams = this->getFEKOImageSettingParams();
// 计算回波 // 计算回波
if (this->ui.checkBoxTheta->isChecked()) { // theta if (this->ui.checkBoxTheta->isChecked()) { // theta
QString thetafileptah= this->ui.lineEdit_thetaechopath->text().trimmed(); QString thetafileptah= this->ui.lineEdit_thetaechopath->text().trimmed();
@ -137,7 +137,7 @@ void LAMPImageCreateClass::on_pushButton_OK_clicked()
} }
QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否查看图像", QMessageBox::Yes | QMessageBox::No); QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否查看图像", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
LAMPDataShowClass* datashow=new LAMPDataShowClass(); LAMPDataShowClass* datashow=new LAMPDataShowClass();
datashow->show(); datashow->show();
@ -166,7 +166,7 @@ void LAMPImageCreateClass::on_pushButton_cancel_clicked()
void LAMPImageCreateClass::on_pushButton_loadfekosimulationxml_clicked() void LAMPImageCreateClass::on_pushButton_loadfekosimulationxml_clicked()
{ {
QString xmlpath = getOpenFilePath(this, u8"仿真任务xml", u8"xml文件 (*.xml)"); QString xmlpath = getOpenFilePath(this, u8"仿真任务xml", u8"xml文件 (*.xml)");
if (isExists(xmlpath)) { if (isExists(xmlpath)) {
this->OpenFEKOSimulationImageSettingXml(xmlpath); this->OpenFEKOSimulationImageSettingXml(xmlpath);
} }

View File

@ -1,4 +1,4 @@
#include "AllHead.h" #include "AllHead.h"
#include "LAMP_ScatterSettingClass.h" #include "LAMP_ScatterSettingClass.h"
@ -6,7 +6,7 @@ LAMP_ScatterSettingClass::LAMP_ScatterSettingClass(QWidget* parent)
: QDialog(parent) : QDialog(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
this->setWindowTitle(u8"散射仪器仿真设置界面"); this->setWindowTitle(u8"散射仪器仿真设置界面");
this->settingobj = new LAMP_ScatterSettingXmlClass; this->settingobj = new LAMP_ScatterSettingXmlClass;
this->myContext = nullptr; this->myContext = nullptr;
QDoubleValidator* doubleValidator = new QDoubleValidator; QDoubleValidator* doubleValidator = new QDoubleValidator;
@ -59,7 +59,7 @@ void LAMP_ScatterSettingClass::savexml()
{ {
this->sycnSettingObj(); this->sycnSettingObj();
if (this->xmlpath.isEmpty()) { if (this->xmlpath.isEmpty()) {
QString xmlpath=getSaveFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)"); QString xmlpath=getSaveFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)");
if (xmlpath.isEmpty()) { if (xmlpath.isEmpty()) {
return; return;
} }
@ -133,7 +133,7 @@ void LAMP_ScatterSettingClass::renderSettingObj()
void LAMP_ScatterSettingClass::sycnSettingObj() void LAMP_ScatterSettingClass::sycnSettingObj()
{ {
//renderSettingObj 函数的关系,使用界面控件值,更新 settingobj 的值 //renderSettingObj 函数的关系,使用界面控件值,更新 settingobj 的值
this->settingobj->A1 = this->ui.checkBox_A1->isChecked(); this->settingobj->A1 = this->ui.checkBox_A1->isChecked();
this->settingobj->A2 = this->ui.checkBox_A2->isChecked(); this->settingobj->A2 = this->ui.checkBox_A2->isChecked();
this->settingobj->incidence_A1 = this->ui.lineEdit_A1_incAngle->text().toDouble(); this->settingobj->incidence_A1 = this->ui.lineEdit_A1_incAngle->text().toDouble();
@ -174,7 +174,7 @@ void LAMP_ScatterSettingClass::sycnSettingObj()
void LAMP_ScatterSettingClass::createAntModel() void LAMP_ScatterSettingClass::createAntModel()
{ {
// 分块计算 // 分块计算
for (map<std::string, SphericalCoordinates>::iterator iter = AntSettingdict.begin(); iter != AntSettingdict.end(); ++iter) { for (map<std::string, SphericalCoordinates>::iterator iter = AntSettingdict.begin(); iter != AntSettingdict.end(); ++iter) {
std::string k = iter->first; std::string k = iter->first;
SphericalCoordinates sp = iter->second; SphericalCoordinates sp = iter->second;
@ -191,7 +191,7 @@ void LAMP_ScatterSettingClass::createAntModel()
void LAMP_ScatterSettingClass::initAntModelSettingParams() void LAMP_ScatterSettingClass::initAntModelSettingParams()
{ {
QString fileName = QCoreApplication::applicationDirPath() + "/ScattingAntParams/ScatteringAntSetting.ini"; // 散射模型设置 QString fileName = QCoreApplication::applicationDirPath() + "/ScattingAntParams/ScatteringAntSetting.ini"; // 散射模型设置
QSettings* setting = new QSettings(fileName, QSettings::IniFormat); QSettings* setting = new QSettings(fileName, QSettings::IniFormat);
setting->setIniCodec(QTextCodec::codecForName("UTF-8")); setting->setIniCodec(QTextCodec::codecForName("UTF-8"));
@ -201,8 +201,8 @@ void LAMP_ScatterSettingClass::initAntModelSettingParams()
} }
else { else {
setting->setValue("CoordinateSystemName", u8"Spheric(R,theta,phi)"); setting->setValue("CoordinateSystemName", u8"Spheric(R,theta,phi)");
setting->setValue("description", u8"R半径theta 入射角phi 方位角"); setting->setValue("description", u8"R半径theta 入射角phi 方位角");
// 天线坐标 // 天线坐标
// A1 ,A2 S1 S3 S5 S8 S10 S12 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 // A1 ,A2 S1 S3 S5 S8 S10 S12 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
setting->setValue("A1", u8"9.3,90,0"); setting->setValue("A1", u8"9.3,90,0");
setting->setValue("A2", u8"9.3,90,180"); setting->setValue("A2", u8"9.3,90,180");
@ -225,7 +225,7 @@ void LAMP_ScatterSettingClass::initAntModelSettingParams()
setting->setValue("F11", u8"9.3,75,151"); setting->setValue("F11", u8"9.3,75,151");
setting->setValue("F12", u8"9.3,75,165"); setting->setValue("F12", u8"9.3,75,165");
// A1,A2, 为 S1 S3 S5 S8 S10 S12 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 的雷达辐射方向图仿真模型 // A1,A2, 为 S1 S3 S5 S8 S10 S12 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 的雷达辐射方向图仿真模型
setting->setValue("ant_A1", u8"A1_ant.ffe"); setting->setValue("ant_A1", u8"A1_ant.ffe");
setting->setValue("ant_A2", u8"A2_ant.ffe"); setting->setValue("ant_A2", u8"A2_ant.ffe");
setting->setValue("ant_S1", u8"S1_ant.ffe"); setting->setValue("ant_S1", u8"S1_ant.ffe");
@ -249,7 +249,7 @@ void LAMP_ScatterSettingClass::initAntModelSettingParams()
setting->sync(); setting->sync();
} }
// 重新加载配置向 // 重新加载配置向
AntSettingdict["A1"] = antsettingstring2Spherical(setting->value("A1").toString()); AntSettingdict["A1"] = antsettingstring2Spherical(setting->value("A1").toString());
AntSettingdict["A2"] = antsettingstring2Spherical(setting->value("A2").toString()); AntSettingdict["A2"] = antsettingstring2Spherical(setting->value("A2").toString());
AntSettingdict["S1"] = antsettingstring2Spherical(setting->value("S1").toString()); AntSettingdict["S1"] = antsettingstring2Spherical(setting->value("S1").toString());
@ -271,7 +271,7 @@ void LAMP_ScatterSettingClass::initAntModelSettingParams()
AntSettingdict["F11"] = antsettingstring2Spherical(setting->value("F11").toString()); AntSettingdict["F11"] = antsettingstring2Spherical(setting->value("F11").toString());
AntSettingdict["F12"] = antsettingstring2Spherical(setting->value("F12").toString()); AntSettingdict["F12"] = antsettingstring2Spherical(setting->value("F12").toString());
// 获取雷达的辐射仿真方向图,并加载到 AntffePathDict, // 获取雷达的辐射仿真方向图,并加载到 AntffePathDict,
AntffePathDict["A1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A1").toString(); AntffePathDict["A1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A1").toString();
AntffePathDict["A2"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A2").toString(); AntffePathDict["A2"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_A2").toString();
AntffePathDict["S1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S1").toString(); AntffePathDict["S1"] = QCoreApplication::applicationDirPath() + "/ScattingAntParams/" + setting->value("ant_S1").toString();
@ -317,9 +317,9 @@ void LAMP_ScatterSettingClass::setDocument3d(Handle(AIS_InteractiveContext) myCo
void LAMP_ScatterSettingClass::createFEKOLua() void LAMP_ScatterSettingClass::createFEKOLua()
{ {
// 展示计算 // 展示计算
QProgressDialog progressDialog(u8"创建脚本..", u8"终止", 0, AntSettingdict.size() * 2); QProgressDialog progressDialog(u8"创建脚本..", u8"终止", 0, AntSettingdict.size() * 2);
progressDialog.setWindowTitle(u8"成像中"); progressDialog.setWindowTitle(u8"成像中");
progressDialog.setWindowModality(Qt::WindowModal); progressDialog.setWindowModality(Qt::WindowModal);
progressDialog.setAutoClose(true); progressDialog.setAutoClose(true);
progressDialog.setValue(0); progressDialog.setValue(0);
@ -330,16 +330,16 @@ void LAMP_ScatterSettingClass::createFEKOLua()
this->sycnSettingObj(); this->sycnSettingObj();
std::map<QString, QString> antfarfiledatastr; std::map<QString, QString> antfarfiledatastr;
if (isExists(this->workpsace)) { if (isExists(this->workpsace)) {
// 复制天线方向图 // 复制天线方向图
for (map<std::string, QString>::iterator iter = AntffePathDict.begin(); iter != AntffePathDict.end(); ++iter) { for (map<std::string, QString>::iterator iter = AntffePathDict.begin(); iter != AntffePathDict.end(); ++iter) {
QString sourcepath = iter->second; QString sourcepath = iter->second;
QString desPath= this->workpsace + u8"/" + getFileNameFromPath(sourcepath); QString desPath= this->workpsace + u8"/" + getFileNameFromPath(sourcepath);
copyFile(sourcepath, desPath); copyFile(sourcepath, desPath);
progressDialog.setWindowTitle(u8"解析仿真天线方向图....."); progressDialog.setWindowTitle(u8"解析仿真天线方向图.....");
FEKOBase::FEKOFarFieldFileClass temp; FEKOBase::FEKOFarFieldFileClass temp;
temp.parseFarFieldFile(desPath); temp.parseFarFieldFile(desPath);
if (temp.dataBlockList.count() == 0) { if (temp.dataBlockList.count() == 0) {
QMessageBox::warning(nullptr, u8"警告", u8"ffe文件解析失败请检查文件格式是否正确"); QMessageBox::warning(nullptr, u8"警告", u8"ffe文件解析失败请检查文件格式是否正确");
} }
size_t thetapoints = temp.dataBlockList[0].thetaSamples; size_t thetapoints = temp.dataBlockList[0].thetaSamples;
size_t phipoints = temp.dataBlockList[0].phiSamples; size_t phipoints = temp.dataBlockList[0].phiSamples;
@ -358,7 +358,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
// 创建脚本 // 创建脚本
QString luascript = QString(u8"--- create feko task :%1\n--- mode:Scatter\n\n").arg(this->settingobj->taskName); QString luascript = QString(u8"--- create feko task :%1\n--- mode:Scatter\n\n").arg(this->settingobj->taskName);
luascript = luascript + QString(u8"-- create strip pulse \n"); luascript = luascript + QString(u8"-- create strip pulse \n");
luascript = luascript + QString(u8"-- LAMP \n\n"); luascript = luascript + QString(u8"-- LAMP \n\n");
@ -368,7 +368,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
luascript = luascript + QString(u8"app=cf.GetApplication()\n"); luascript = luascript + QString(u8"app=cf.GetApplication()\n");
luascript = luascript + QString(u8"project=app.Project --- get current project\n"); luascript = luascript + QString(u8"project=app.Project --- get current project\n");
if (this->settingobj->nearfield) { // 构建天线方向图 if (this->settingobj->nearfield) { // 构建天线方向图
for (map<QString, QString>::iterator iter = antfarfiledatastr.begin(); iter != antfarfiledatastr.end(); ++iter) { for (map<QString, QString>::iterator iter = antfarfiledatastr.begin(); iter != antfarfiledatastr.end(); ++iter) {
luascript = luascript + iter->second; luascript = luascript + iter->second;
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
@ -386,15 +386,15 @@ void LAMP_ScatterSettingClass::createFEKOLua()
luascript = luascript + QString(u8"-- varables \n"); luascript = luascript + QString(u8"-- varables \n");
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
// 设置频率 // 设置频率
luascript = luascript + QString(u8"local f1=%1 -- start freq\n").arg(QString::number(this->settingobj->startfre * 1e9)); luascript = luascript + QString(u8"local f1=%1 -- start freq\n").arg(QString::number(this->settingobj->startfre * 1e9));
luascript = luascript + QString(u8"local f2=%2 -- end freq\n").arg(QString::number(this->settingobj->endfre * 1e9)); luascript = luascript + QString(u8"local f2=%2 -- end freq\n").arg(QString::number(this->settingobj->endfre * 1e9));
luascript = luascript + QString(u8"local freq_num=%3 -- freq point \n").arg(QString::number(this->settingobj->freponts)); luascript = luascript + QString(u8"local freq_num=%3 -- freq point \n").arg(QString::number(this->settingobj->freponts));
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
// 创建configuration // 创建configuration
luascript = luascript + QString(u8"temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n"); luascript = luascript + QString(u8"temp_standardConfiguration = project.SolutionConfigurations:AddStandardConfiguration()\n");
luascript = luascript + QString(u8"temp_standardConfiguration.Label=\"ScatterFEKOSetting\" -- set standardConfiguration label PRF Count\n"); luascript = luascript + QString(u8"temp_standardConfiguration.Label=\"ScatterFEKOSetting\" -- set standardConfiguration label PRF Count\n");
luascript = luascript + QString(u8"--- set frequency\n"); // 设置频率 luascript = luascript + QString(u8"--- set frequency\n"); // 设置频率
luascript = luascript + QString(u8"frequencyRange=temp_standardConfiguration.Frequency\n"); luascript = luascript + QString(u8"frequencyRange=temp_standardConfiguration.Frequency\n");
luascript = luascript + QString(u8"properties = frequencyRange:GetProperties()\n"); luascript = luascript + QString(u8"properties = frequencyRange:GetProperties()\n");
luascript = luascript + QString(u8"properties.RangeType = cf.Enums.FrequencyRangeTypeEnum.LinearSpacedDiscrete\n"); luascript = luascript + QString(u8"properties.RangeType = cf.Enums.FrequencyRangeTypeEnum.LinearSpacedDiscrete\n");
@ -402,12 +402,12 @@ void LAMP_ScatterSettingClass::createFEKOLua()
luascript = luascript + QString(u8"properties.End=f2 --end \n"); luascript = luascript + QString(u8"properties.End=f2 --end \n");
luascript = luascript + QString(u8"properties.NumberOfDiscreteValues=freq_num -- freq_num\n"); luascript = luascript + QString(u8"properties.NumberOfDiscreteValues=freq_num -- freq_num\n");
luascript = luascript + QString(u8"frequencyRange:SetProperties(properties)\n"); luascript = luascript + QString(u8"frequencyRange:SetProperties(properties)\n");
if (this->settingobj->nearfield) { //近场 if (this->settingobj->nearfield) { //近场
if (this->settingobj->A1) { if (this->settingobj->A1) {
SphericalCoordinates p = AntSettingdict["A1"]; SphericalCoordinates p = AntSettingdict["A1"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"A1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A1_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"A1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A1_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"A1_farFieldSource.Label=\"A1\"\n"); luascript = luascript + QString(u8"A1_farFieldSource.Label=\"A1\"\n");
luascript = luascript + QString(u8"A1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"A1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"A1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"A1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -425,7 +425,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"A1_nearFieldRequest.Label=\"A1\"\n"); luascript = luascript + QString(u8"A1_nearFieldRequest.Label=\"A1\"\n");
luascript = luascript + QString(u8"A1_nearFieldRequest_workplane=A1_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"A1_nearFieldRequest_workplane=A1_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"A1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"A1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -447,7 +447,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["A2"]; SphericalCoordinates p = AntSettingdict["A2"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"A2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A2_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"A2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(A2_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"A2_farFieldSource.Label=\"A2\"\n"); luascript = luascript + QString(u8"A2_farFieldSource.Label=\"A2\"\n");
luascript = luascript + QString(u8"A2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"A2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"A2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"A2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -465,7 +465,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"A2_nearFieldRequest.Label=\"A2\"\n"); luascript = luascript + QString(u8"A2_nearFieldRequest.Label=\"A2\"\n");
luascript = luascript + QString(u8"A2_nearFieldRequest_workplane=A2_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"A2_nearFieldRequest_workplane=A2_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"A2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"A2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -488,7 +488,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S1"]; SphericalCoordinates p = AntSettingdict["S1"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S1_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S1_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S1_farFieldSource.Label=\"S1\"\n"); luascript = luascript + QString(u8"S1_farFieldSource.Label=\"S1\"\n");
luascript = luascript + QString(u8"S1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -506,7 +506,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S1_nearFieldRequest.Label=\"S1\"\n"); luascript = luascript + QString(u8"S1_nearFieldRequest.Label=\"S1\"\n");
luascript = luascript + QString(u8"S1_nearFieldRequest_workplane=S1_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S1_nearFieldRequest_workplane=S1_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -527,7 +527,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S3"]; SphericalCoordinates p = AntSettingdict["S3"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S3_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S3_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S3_farFieldSource.Label=\"S3\"\n"); luascript = luascript + QString(u8"S3_farFieldSource.Label=\"S3\"\n");
luascript = luascript + QString(u8"S3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -545,7 +545,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S3_nearFieldRequest.Label=\"S3\"\n"); luascript = luascript + QString(u8"S3_nearFieldRequest.Label=\"S3\"\n");
luascript = luascript + QString(u8"S3_nearFieldRequest_workplane=S3_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S3_nearFieldRequest_workplane=S3_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -565,7 +565,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S5"]; SphericalCoordinates p = AntSettingdict["S5"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S5_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S5_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S5_farFieldSource.Label=\"S5\"\n"); luascript = luascript + QString(u8"S5_farFieldSource.Label=\"S5\"\n");
luascript = luascript + QString(u8"S5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -583,7 +583,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S5_nearFieldRequest.Label=\"S5\"\n"); luascript = luascript + QString(u8"S5_nearFieldRequest.Label=\"S5\"\n");
luascript = luascript + QString(u8"S5_nearFieldRequest_workplane=S5_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S5_nearFieldRequest_workplane=S5_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -603,7 +603,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S8"]; SphericalCoordinates p = AntSettingdict["S8"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S8_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S8_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S8_farFieldSource.Label=\"S8\"\n"); luascript = luascript + QString(u8"S8_farFieldSource.Label=\"S8\"\n");
luascript = luascript + QString(u8"S8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -621,7 +621,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S8_nearFieldRequest.Label=\"S8\"\n"); luascript = luascript + QString(u8"S8_nearFieldRequest.Label=\"S8\"\n");
luascript = luascript + QString(u8"S8_nearFieldRequest_workplane=S8_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S8_nearFieldRequest_workplane=S8_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -641,7 +641,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S10"]; SphericalCoordinates p = AntSettingdict["S10"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S10_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S10_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S10_farFieldSource.Label=\"S10\"\n"); luascript = luascript + QString(u8"S10_farFieldSource.Label=\"S10\"\n");
luascript = luascript + QString(u8"S10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -659,7 +659,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S10_nearFieldRequest.Label=\"S10\"\n"); luascript = luascript + QString(u8"S10_nearFieldRequest.Label=\"S10\"\n");
luascript = luascript + QString(u8"S10_nearFieldRequest_workplane=S10_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S10_nearFieldRequest_workplane=S10_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -680,7 +680,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["S12"]; SphericalCoordinates p = AntSettingdict["S12"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"S12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S12_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"S12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(S12_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"S12_farFieldSource.Label=\"S12\"\n"); luascript = luascript + QString(u8"S12_farFieldSource.Label=\"S12\"\n");
luascript = luascript + QString(u8"S12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"S12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"S12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -698,7 +698,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"S12_nearFieldRequest.Label=\"S12\"\n"); luascript = luascript + QString(u8"S12_nearFieldRequest.Label=\"S12\"\n");
luascript = luascript + QString(u8"S12_nearFieldRequest_workplane=S12_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"S12_nearFieldRequest_workplane=S12_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"S12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"S12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -718,7 +718,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F1"]; SphericalCoordinates p = AntSettingdict["F1"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F1_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F1_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F1_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F1_farFieldSource.Label=\"F1\"\n"); luascript = luascript + QString(u8"F1_farFieldSource.Label=\"F1\"\n");
luascript = luascript + QString(u8"F1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F1_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F1_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -736,7 +736,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F1_nearFieldRequest.Label=\"F1\"\n"); luascript = luascript + QString(u8"F1_nearFieldRequest.Label=\"F1\"\n");
luascript = luascript + QString(u8"F1_nearFieldRequest_workplane=F1_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F1_nearFieldRequest_workplane=F1_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F1_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -756,7 +756,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F2"]; SphericalCoordinates p = AntSettingdict["F2"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F2_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F2_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F2_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F2_farFieldSource.Label=\"F2\"\n"); luascript = luascript + QString(u8"F2_farFieldSource.Label=\"F2\"\n");
luascript = luascript + QString(u8"F2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F2_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F2_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -774,7 +774,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F2_nearFieldRequest.Label=\"F2\"\n"); luascript = luascript + QString(u8"F2_nearFieldRequest.Label=\"F2\"\n");
luascript = luascript + QString(u8"F2_nearFieldRequest_workplane=F2_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F2_nearFieldRequest_workplane=F2_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F2_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -794,7 +794,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F3"]; SphericalCoordinates p = AntSettingdict["F3"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F3_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F3_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F3_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F3_farFieldSource.Label=\"F3\"\n"); luascript = luascript + QString(u8"F3_farFieldSource.Label=\"F3\"\n");
luascript = luascript + QString(u8"F3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F3_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F3_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -812,7 +812,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F3_nearFieldRequest.Label=\"F3\"\n"); luascript = luascript + QString(u8"F3_nearFieldRequest.Label=\"F3\"\n");
luascript = luascript + QString(u8"F3_nearFieldRequest_workplane=F3_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F3_nearFieldRequest_workplane=F3_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F3_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -832,7 +832,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F4"]; SphericalCoordinates p = AntSettingdict["F4"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F4_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F4_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F4_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F4_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F4_farFieldSource.Label=\"F4\"\n"); luascript = luascript + QString(u8"F4_farFieldSource.Label=\"F4\"\n");
luascript = luascript + QString(u8"F4_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F4_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F4_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F4_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -850,7 +850,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F4_nearFieldRequest.Label=\"F4\"\n"); luascript = luascript + QString(u8"F4_nearFieldRequest.Label=\"F4\"\n");
luascript = luascript + QString(u8"F4_nearFieldRequest_workplane=F4_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F4_nearFieldRequest_workplane=F4_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F4_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F4_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -870,7 +870,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F5"]; SphericalCoordinates p = AntSettingdict["F5"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F5_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F5_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F5_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F5_farFieldSource.Label=\"F5\"\n"); luascript = luascript + QString(u8"F5_farFieldSource.Label=\"F5\"\n");
luascript = luascript + QString(u8"F5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F5_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F5_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -888,7 +888,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F5_nearFieldRequest.Label=\"F5\"\n"); luascript = luascript + QString(u8"F5_nearFieldRequest.Label=\"F5\"\n");
luascript = luascript + QString(u8"F5_nearFieldRequest_workplane=F5_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F5_nearFieldRequest_workplane=F5_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F5_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -908,7 +908,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F6"]; SphericalCoordinates p = AntSettingdict["F6"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F6_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F6_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F6_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F6_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F6_farFieldSource.Label=\"F6\"\n"); luascript = luascript + QString(u8"F6_farFieldSource.Label=\"F6\"\n");
luascript = luascript + QString(u8"F6_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F6_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F6_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F6_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -926,7 +926,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F6_nearFieldRequest.Label=\"F6\"\n"); luascript = luascript + QString(u8"F6_nearFieldRequest.Label=\"F6\"\n");
luascript = luascript + QString(u8"F6_nearFieldRequest_workplane=F6_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F6_nearFieldRequest_workplane=F6_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F6_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F6_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -946,7 +946,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F7"]; SphericalCoordinates p = AntSettingdict["F7"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F7_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F7_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F7_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F7_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F7_farFieldSource.Label=\"F7\"\n"); luascript = luascript + QString(u8"F7_farFieldSource.Label=\"F7\"\n");
luascript = luascript + QString(u8"F7_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F7_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F7_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F7_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -964,7 +964,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F7_nearFieldRequest.Label=\"F7\"\n"); luascript = luascript + QString(u8"F7_nearFieldRequest.Label=\"F7\"\n");
luascript = luascript + QString(u8"F7_nearFieldRequest_workplane=F7_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F7_nearFieldRequest_workplane=F7_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F7_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F7_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -984,7 +984,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F8"]; SphericalCoordinates p = AntSettingdict["F8"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F8_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F8_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F8_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F8_farFieldSource.Label=\"F8\"\n"); luascript = luascript + QString(u8"F8_farFieldSource.Label=\"F8\"\n");
luascript = luascript + QString(u8"F8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F8_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F8_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -1002,7 +1002,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F8_nearFieldRequest.Label=\"F8\"\n"); luascript = luascript + QString(u8"F8_nearFieldRequest.Label=\"F8\"\n");
luascript = luascript + QString(u8"F8_nearFieldRequest_workplane=F8_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F8_nearFieldRequest_workplane=F8_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F8_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -1022,7 +1022,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F9"]; SphericalCoordinates p = AntSettingdict["F9"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F9_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F9_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F9_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F9_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F9_farFieldSource.Label=\"F9\"\n"); luascript = luascript + QString(u8"F9_farFieldSource.Label=\"F9\"\n");
luascript = luascript + QString(u8"F9_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F9_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F9_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F9_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -1040,7 +1040,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F9_nearFieldRequest.Label=\"F9\"\n"); luascript = luascript + QString(u8"F9_nearFieldRequest.Label=\"F9\"\n");
luascript = luascript + QString(u8"F9_nearFieldRequest_workplane=F9_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F9_nearFieldRequest_workplane=F9_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F9_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F9_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -1060,7 +1060,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F10"]; SphericalCoordinates p = AntSettingdict["F10"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F10_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F10_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F10_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F10_farFieldSource.Label=\"F10\"\n"); luascript = luascript + QString(u8"F10_farFieldSource.Label=\"F10\"\n");
luascript = luascript + QString(u8"F10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F10_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F10_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -1078,7 +1078,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F10_nearFieldRequest.Label=\"F10\"\n"); luascript = luascript + QString(u8"F10_nearFieldRequest.Label=\"F10\"\n");
luascript = luascript + QString(u8"F10_nearFieldRequest_workplane=F10_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F10_nearFieldRequest_workplane=F10_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F10_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -1098,7 +1098,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F11"]; SphericalCoordinates p = AntSettingdict["F11"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F11_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F11_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F11_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F11_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F11_farFieldSource.Label=\"F11\"\n"); luascript = luascript + QString(u8"F11_farFieldSource.Label=\"F11\"\n");
luascript = luascript + QString(u8"F11_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F11_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F11_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F11_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -1116,7 +1116,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F11_nearFieldRequest.Label=\"F11\"\n"); luascript = luascript + QString(u8"F11_nearFieldRequest.Label=\"F11\"\n");
luascript = luascript + QString(u8"F11_nearFieldRequest_workplane=F11_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F11_nearFieldRequest_workplane=F11_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F11_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F11_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -1136,7 +1136,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
SphericalCoordinates p = AntSettingdict["F12"]; SphericalCoordinates p = AntSettingdict["F12"];
CartesianCoordinates cp = sphericalToCartesian(p); CartesianCoordinates cp = sphericalToCartesian(p);
luascript = luascript + QString(u8"-- set Source\n"); luascript = luascript + QString(u8"-- set Source\n");
luascript = luascript + QString(u8"F12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F12_farfieldData)\n"); // 设置发射源 luascript = luascript + QString(u8"F12_farFieldSource = temp_standardConfiguration.Sources:AddFarFieldSource(F12_farfieldData)\n"); // 设置发射源
luascript = luascript + QString(u8"F12_farFieldSource.Label=\"F12\"\n"); luascript = luascript + QString(u8"F12_farFieldSource.Label=\"F12\"\n");
luascript = luascript + QString(u8"F12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F12_farFieldSource.Position.U=%1\n").arg(QString::number(cp.x));
luascript = luascript + QString(u8"F12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y)); luascript = luascript + QString(u8"F12_farFieldSource.Position.V=%1\n").arg(QString::number(cp.y));
@ -1154,7 +1154,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
.arg(QString::number(p.phi)) .arg(QString::number(p.phi))
.arg(QString::number(0)) .arg(QString::number(0))
.arg(QString::number(p.theta)) .arg(QString::number(p.theta))
.arg(QString::number(p.phi)); // 设置接收点 .arg(QString::number(p.phi)); // 设置接收点
luascript = luascript + QString(u8"F12_nearFieldRequest.Label=\"F12\"\n"); luascript = luascript + QString(u8"F12_nearFieldRequest.Label=\"F12\"\n");
luascript = luascript + QString(u8"F12_nearFieldRequest_workplane=F12_nearFieldRequest.LocalWorkplane\n"); luascript = luascript + QString(u8"F12_nearFieldRequest_workplane=F12_nearFieldRequest.LocalWorkplane\n");
luascript = luascript + QString(u8"F12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x)); luascript = luascript + QString(u8"F12_nearFieldRequest_workplane.Origin.X=%1\n").arg(QString::number(cp.x));
@ -1175,7 +1175,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
} }
else {} else {}
if (this->settingobj->farfield) { // 远场 if (this->settingobj->farfield) { // 远场
if (this->settingobj->A1) { if (this->settingobj->A1) {
SphericalCoordinates p = AntSettingdict["A1"]; SphericalCoordinates p = AntSettingdict["A1"];
@ -1229,7 +1229,7 @@ void LAMP_ScatterSettingClass::createFEKOLua()
luascript = luascript + QString(u8"\n"); luascript = luascript + QString(u8"\n");
} }
else {} else {}
if (this->settingobj->S3) { // 仿照S1 ,构建 S3 的创建 if (this->settingobj->S3) { // 仿照S1 ,构建 S3 的创建
SphericalCoordinates p_S3 = AntSettingdict["S3"]; SphericalCoordinates p_S3 = AntSettingdict["S3"];
luascript = luascript + QString(u8"S3_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S3.theta)).arg(QString::number(p_S3.phi)); luascript = luascript + QString(u8"S3_temp_source = temp_standardConfiguration.Sources:AddPlaneWave(%1, %2)\n").arg(QString::number(p_S3.theta)).arg(QString::number(p_S3.phi));
luascript = luascript + QString(u8"S3_temp_source.Label = \"%1\"\n").arg("S3"); luascript = luascript + QString(u8"S3_temp_source.Label = \"%1\"\n").arg("S3");
@ -1552,18 +1552,18 @@ void LAMP_ScatterSettingClass::createFEKOLua()
QString filePath = this->workpsace + QDir::separator() + this->settingobj->taskName+ QString(u8"_Scattering.lua"); QString filePath = this->workpsace + QDir::separator() + this->settingobj->taskName+ QString(u8"_Scattering.lua");
QFile file(filePath); // 创建文件对象 QFile file(filePath); // 创建文件对象
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream stream(&file); // 创建文本流并设置编码为UTF-8 QTextStream stream(&file); // 创建文本流并设置编码为UTF-8
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
stream << luascript; stream << luascript;
file.close(); file.close();
QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入成功!\n%1").arg(filePath)); // 提示文件写入成功 QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入成功!\n%1").arg(filePath)); // 提示文件写入成功
qDebug() << "File written successfully."; qDebug() << "File written successfully.";
} }
else { else {
qDebug() << "Could not open file for writing."; qDebug() << "Could not open file for writing.";
QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入失败")); QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入失败"));
} }
progressDialog.setValue(progressDialog.maximum()); progressDialog.setValue(progressDialog.maximum());
progressDialog.close(); progressDialog.close();
@ -1750,7 +1750,7 @@ void LAMP_ScatterSettingClass::on_checkBox_AllScatter_toggled(bool flag)
void LAMP_ScatterSettingClass::on_lineEdit_A1_incAngle_editingFinished() void LAMP_ScatterSettingClass::on_lineEdit_A1_incAngle_editingFinished()
{ {
// 根据坐标计算 // 根据坐标计算
this->myContext->Erase(DataAISMap["A1"], Standard_True); this->myContext->Erase(DataAISMap["A1"], Standard_True);
AntSettingdict["A1"].theta = this->ui.lineEdit_A1_incAngle->text().toDouble(); AntSettingdict["A1"].theta = this->ui.lineEdit_A1_incAngle->text().toDouble();
SphericalCoordinates sp = AntSettingdict["A1"]; SphericalCoordinates sp = AntSettingdict["A1"];
@ -1765,7 +1765,7 @@ void LAMP_ScatterSettingClass::on_lineEdit_A1_incAngle_editingFinished()
} }
void LAMP_ScatterSettingClass::on_lineEdit_A2_incAngle_editingFinished() void LAMP_ScatterSettingClass::on_lineEdit_A2_incAngle_editingFinished()
{ {
// 根据坐标计算 // 根据坐标计算
this->myContext->Erase(DataAISMap["A2"], Standard_True); this->myContext->Erase(DataAISMap["A2"], Standard_True);
AntSettingdict["A2"].theta = this->ui.lineEdit_A2_incAngle->text().toDouble(); AntSettingdict["A2"].theta = this->ui.lineEdit_A2_incAngle->text().toDouble();
SphericalCoordinates sp = AntSettingdict["A2"]; SphericalCoordinates sp = AntSettingdict["A2"];
@ -1780,7 +1780,7 @@ void LAMP_ScatterSettingClass::on_lineEdit_A2_incAngle_editingFinished()
} }
void LAMP_ScatterSettingClass::on_pushButton_load_clicked() void LAMP_ScatterSettingClass::on_pushButton_load_clicked()
{ {
QString xmlpath = getOpenFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)"); QString xmlpath = getOpenFilePath(this, u8"散射任务配置xml", u8"xml文件 (*.xml)");
if (isExists(xmlpath)) { if (isExists(xmlpath)) {
this->loadxml(xmlpath); this->loadxml(xmlpath);
} }
@ -1800,8 +1800,8 @@ void LAMP_ScatterSettingClass::on_okButton_clicked()
this->savexml(); this->savexml();
this->createFEKOLua(); this->createFEKOLua();
// 确定按钮判断是否需要接口 // 确定按钮判断是否需要接口
QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否关闭窗口", QMessageBox::Yes | QMessageBox::No); QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否关闭窗口", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
this->closeWindows(); this->closeWindows();
} }
@ -1836,7 +1836,7 @@ SphericalCoordinates LAMP_ScatterSettingClass::antsettingstring2Spherical(QStrin
LAMP_ScatterSettingXmlClass::LAMP_ScatterSettingXmlClass() LAMP_ScatterSettingXmlClass::LAMP_ScatterSettingXmlClass()
{ {
// 对成员变量进行初始化 // 对成员变量进行初始化
this->taskName = u8"TESTScatterimage"; this->taskName = u8"TESTScatterimage";
this->A1 = true; this->A1 = true;
this->A2 = true; this->A2 = true;
@ -1876,7 +1876,7 @@ void LAMP_ScatterSettingXmlClass::loadxml(QString fileName)
{ {
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件"); QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件");
return; return;
} }
@ -1980,7 +1980,7 @@ void LAMP_ScatterSettingXmlClass::loadxml(QString fileName)
} }
} }
if (xmlReader.hasError()) { if (xmlReader.hasError()) {
QMessageBox::warning(nullptr, u8"警告", u8"XML文件解析错误"); QMessageBox::warning(nullptr, u8"警告", u8"XML文件解析错误");
} }
file.close(); file.close();
} }
@ -1989,7 +1989,7 @@ void LAMP_ScatterSettingXmlClass::savexml(QString fileName)
{ {
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件"); QMessageBox::warning(nullptr, u8"警告", u8"无法打开文件");
return; return;
} }
@ -2026,7 +2026,7 @@ void LAMP_ScatterSettingXmlClass::savexml(QString fileName)
xmlWriter.writeTextElement("F10", F10 ? "true" : "false"); xmlWriter.writeTextElement("F10", F10 ? "true" : "false");
xmlWriter.writeTextElement("F11", F11 ? "true" : "false"); xmlWriter.writeTextElement("F11", F11 ? "true" : "false");
xmlWriter.writeTextElement("F12", F12 ? "true" : "false"); xmlWriter.writeTextElement("F12", F12 ? "true" : "false");
xmlWriter.writeEndElement(); // 关闭FEKOSimulationDataparams元素 xmlWriter.writeEndElement(); // 关闭FEKOSimulationDataparams元素
xmlWriter.writeEndDocument(); xmlWriter.writeEndDocument();
file.close(); file.close();
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef LAMP_SCATTERSETTINGCLASS_H #ifndef LAMP_SCATTERSETTINGCLASS_H
#define LAMP_SCATTERSETTINGCLASS_H #define LAMP_SCATTERSETTINGCLASS_H
@ -56,13 +56,13 @@ public:
~LAMP_ScatterSettingClass(); ~LAMP_ScatterSettingClass();
public: public:
Handle(AIS_InteractiveContext) myContext; // 窗口交互 // 模型管理 Handle(AIS_InteractiveContext) myContext; // 窗口交互 // 模型管理
QString xmlpath; QString xmlpath;
QString workpsace; QString workpsace;
LAMP_ScatterSettingXmlClass* settingobj; LAMP_ScatterSettingXmlClass* settingobj;
//QMap<QString, Handle(AIS_InteractiveObject)> DataAISMap; //QMap<QString, Handle(AIS_InteractiveObject)> DataAISMap;
std::map<std::string, Handle(AIS_InteractiveObject)> DataAISMap; // 构建雷达照射模型 std::map<std::string, Handle(AIS_InteractiveObject)> DataAISMap; // 构建雷达照射模型
std::map<std::string, SphericalCoordinates> AntSettingdict; // 构建雷达照射模型 std::map<std::string, SphericalCoordinates> AntSettingdict; // 构建雷达照射模型
std::map<std::string, QString> AntffePathDict; std::map<std::string, QString> AntffePathDict;
public: public:
void loadxml(QString xmlpath); void loadxml(QString xmlpath);
@ -70,7 +70,7 @@ public:
void renderSettingObj(); void renderSettingObj();
void sycnSettingObj(); void sycnSettingObj();
void createAntModel(); void createAntModel();
void initAntModelSettingParams(); // 模型设置参数 void initAntModelSettingParams(); // 模型设置参数
void closeWindows(); void closeWindows();
void setDocument3d(Handle(AIS_InteractiveContext) myContext); void setDocument3d(Handle(AIS_InteractiveContext) myContext);
void createFEKOLua(); void createFEKOLua();

View File

@ -1,7 +1,7 @@
#include "OCCTModelOperator.h" #include "OCCTModelOperator.h"
#include <BRepBuilderAPI_Transform.hxx> #include <opencascade/BRepBuilderAPI_Transform.hxx>
#include <Bnd_Box.hxx> #include <opencascade/Bnd_Box.hxx>
#include <BRepBndLib.hxx> #include <opencascade/BRepBndLib.hxx>
OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext) OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AIS_InteractiveContext) myContext)
@ -10,14 +10,14 @@ OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AI
ui.setupUi(this); ui.setupUi(this);
setWindowFlags(Qt::Window); setWindowFlags(Qt::Window);
setWindowTitle(TopoName); setWindowTitle(TopoName);
// 参数初设 // 参数初设
this->ui.radioButton_NoCopy->setChecked(true); this->ui.radioButton_NoCopy->setChecked(true);
this->ui.radioButton_Time->setChecked(true); this->ui.radioButton_Time->setChecked(true);
this->myContext = myContext; this->myContext = myContext;
this->ModelName = TopoName; this->ModelName = TopoName;
// 处理平移 // 处理平移
QDoubleValidator* validator = new QDoubleValidator(); // 限制参数 QDoubleValidator* validator = new QDoubleValidator(); // 限制参数
ui.lineEdit_Move_From_X->setValidator(validator); ui.lineEdit_Move_From_X->setValidator(validator);
ui.lineEdit_Move_From_Z->setValidator(validator); ui.lineEdit_Move_From_Z->setValidator(validator);
ui.lineEdit_Move_From_Y->setValidator(validator); ui.lineEdit_Move_From_Y->setValidator(validator);
@ -39,7 +39,7 @@ OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AI
validatorScale->setBottom(0.0); 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_X->setText(u8"0.0");
ui.lineEdit_Move_From_Z->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_From_Y->setText(u8"0.0");
@ -56,11 +56,11 @@ OCCTModelOperator::OCCTModelOperator(QString TopoName,QWidget *parent, Handle(AI
ui.lineEdit_Scale_refrence_point_X->setText(u8"0.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_Y->setText(u8"0.0");
ui.lineEdit_Scale_refrence_point_Z->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(); this->UpdataVariable();
// 事件绑定 // 事件绑定
if (TopoName.isEmpty()) { if (TopoName.isEmpty()) {
this->ui.radioButton_Copy->setChecked(true); this->ui.radioButton_Copy->setChecked(true);
@ -74,17 +74,17 @@ OCCTModelOperator::~OCCTModelOperator()
void OCCTModelOperator::setTopoDs_Shape(TopoDS_Shape ds) void OCCTModelOperator::setTopoDs_Shape(TopoDS_Shape ds)
{ {
// 创建一个复制模型 // 创建一个复制模型
BRepBuilderAPI_Copy copyBuilder; BRepBuilderAPI_Copy copyBuilder;
copyBuilder.Perform(ds); copyBuilder.Perform(ds);
this->Datashape = copyBuilder.Shape(); this->Datashape = copyBuilder.Shape();
// 创建一个复制模型 // 创建一个复制模型
BRepBuilderAPI_Copy copyBuilder2; BRepBuilderAPI_Copy copyBuilder2;
copyBuilder2.Perform(ds); copyBuilder2.Perform(ds);
this->DataShapeBAK = copyBuilder2.Shape(); this->DataShapeBAK = copyBuilder2.Shape();
this->Data_AIS = new AIS_Shape(this->Datashape); // 计算 this->Data_AIS = new AIS_Shape(this->Datashape); // 计算
this->UpdateScaleRefrencepoint(); this->UpdateScaleRefrencepoint();
this->UpdataVariable(); this->UpdataVariable();
@ -112,7 +112,7 @@ void OCCTModelOperator::toString()
qDebug() <<QString("Y: %1").arg(Rotation_Center_Y); qDebug() <<QString("Y: %1").arg(Rotation_Center_Y);
qDebug() <<QString("Z: %1").arg(Rotation_Center_Z); qDebug() <<QString("Z: %1").arg(Rotation_Center_Z);
qDebug() << u8"Rotatino Axis Angle "; qDebug() << u8"Rotatino Axis Angle ";
qDebug() <<QString("%1").arg(Rotation_angle_X); // 绕X轴旋转角度 qDebug() <<QString("%1").arg(Rotation_angle_X); // 绕X轴旋转角度
qDebug() <<QString("%1").arg(Rotation_angle_Y); qDebug() <<QString("%1").arg(Rotation_angle_Y);
qDebug() <<QString("%1").arg(Rotation_angle_Z); qDebug() <<QString("%1").arg(Rotation_angle_Z);
qDebug() << u8"Scale "; qDebug() << u8"Scale ";
@ -135,7 +135,7 @@ Handle(AIS_InteractiveObject) OCCTModelOperator::getAISBAK()
void OCCTModelOperator::ExcuteOperator() void OCCTModelOperator::ExcuteOperator()
{ {
this->ProcesssModel(); this->ProcesssModel();
if (this->ui.radioButton_Copy->isChecked()) { // 复制模型 if (this->ui.radioButton_Copy->isChecked()) { // 复制模型
emit this->ResultExportCopyAndCreateNew(this); emit this->ResultExportCopyAndCreateNew(this);
} }
else { else {
@ -168,14 +168,14 @@ void OCCTModelOperator::UpdataVariable()
void OCCTModelOperator::UpdateScaleRefrencepoint() void OCCTModelOperator::UpdateScaleRefrencepoint()
{ {
if (this->ui.radioButton_Auto->isChecked()) { if (this->ui.radioButton_Auto->isChecked()) {
// 假设你有一个 TopoDS_Shape 对象,例如一个立方体 // 假设你有一个 TopoDS_Shape 对象,例如一个立方体
TopoDS_Shape myShape = this->DataShapeBAK; // 你需要将其替换为实际的形状对象 TopoDS_Shape myShape = this->DataShapeBAK; // 你需要将其替换为实际的形状对象
GProp_GProps volumeProperties; GProp_GProps volumeProperties;
// 计算几何特性 // 计算几何特性
BRepGProp::VolumeProperties(myShape, volumeProperties, Standard_False, Standard_False, Standard_False); BRepGProp::VolumeProperties(myShape, volumeProperties, Standard_False, Standard_False, Standard_False);
//// 获取质心 //// 获取质心
gp_Pnt centerOfMass = volumeProperties.CentreOfMass(); 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_X->setText(QString("%1").arg(centerOfMass.X(), 0, 'e', 8));
@ -198,7 +198,7 @@ void OCCTModelOperator::ApplyModel()
{ {
if (this->myContext) { if (this->myContext) {
qDebug() << u8"模型移除"; qDebug() << u8"模型移除";
//this->myContext->Erase(this->Data_AIS, Standard_True); //this->myContext->Erase(this->Data_AIS, Standard_True);
this->myContext->Remove(this->Data_AIS, Standard_False); this->myContext->Remove(this->Data_AIS, Standard_False);
@ -208,12 +208,12 @@ void OCCTModelOperator::ApplyModel()
//this->myContext->Remove(this->Datashape, Standard_True); //this->myContext->Remove(this->Datashape, Standard_True);
} }
// 平移模型 // 平移模型
double move_x = this->Move_To_X - this->Move_From_X; double move_x = this->Move_To_X - this->Move_From_X;
double move_y = this->Move_To_Y - this->Move_From_Y; double move_y = this->Move_To_Y - this->Move_From_Y;
double move_z = this->Move_To_Z - this->Move_From_Z; double move_z = this->Move_To_Z - this->Move_From_Z;
// 进行平移 // 进行平移
gp_Trsf translation; gp_Trsf translation;
translation.SetTranslation(gp_Vec(move_x, move_y, move_z)); translation.SetTranslation(gp_Vec(move_x, move_y, move_z));
BRepBuilderAPI_Transform translateTransform(this->DataShapeBAK, translation); BRepBuilderAPI_Transform translateTransform(this->DataShapeBAK, translation);
@ -223,9 +223,9 @@ void OCCTModelOperator::ApplyModel()
double Rotation_centor_x = this->Rotation_Center_X; double Rotation_centor_x = this->Rotation_Center_X;
double Rotation_centor_y = this->Rotation_Center_Y; double Rotation_centor_y = this->Rotation_Center_Y;
double Rotation_centor_z = this->Rotation_Center_Z; double Rotation_centor_z = this->Rotation_Center_Z;
// 确定旋转中心 // 确定旋转中心
gp_Pnt rotationCenter(Rotation_centor_x, Rotation_centor_y, Rotation_centor_z); // 中心点坐标 gp_Pnt rotationCenter(Rotation_centor_x, Rotation_centor_y, Rotation_centor_z); // 中心点坐标
// 计算旋转轴 // 计算旋转轴
gp_Ax1 rotationAxis_X(rotationCenter, gp_Dir(1.0, 0.0, 0.0)); gp_Ax1 rotationAxis_X(rotationCenter, gp_Dir(1.0, 0.0, 0.0));
gp_Ax1 rotationAxis_Y(rotationCenter, gp_Dir(0.0, 1.0, 0.0)); gp_Ax1 rotationAxis_Y(rotationCenter, gp_Dir(0.0, 1.0, 0.0));
gp_Ax1 rotationAxis_Z(rotationCenter, gp_Dir(0.0, 0.0, 1.0)); gp_Ax1 rotationAxis_Z(rotationCenter, gp_Dir(0.0, 0.0, 1.0));
@ -234,61 +234,61 @@ void OCCTModelOperator::ApplyModel()
double angle_y = this->Rotation_angle_Y / 180.0 * M_PI; double angle_y = this->Rotation_angle_Y / 180.0 * M_PI;
double angle_z = this->Rotation_angle_Z / 180.0 * M_PI; double angle_z = this->Rotation_angle_Z / 180.0 * M_PI;
// 进行旋转 // 进行旋转
gp_Trsf rotation_X; gp_Trsf rotation_X;
rotation_X.SetRotation(rotationAxis_X, angle_x); // X rotation_X.SetRotation(rotationAxis_X, angle_x); // X
BRepBuilderAPI_Transform rotateTransform_X(translatedShape, rotation_X); BRepBuilderAPI_Transform rotateTransform_X(translatedShape, rotation_X);
TopoDS_Shape rotatedShape_X = rotateTransform_X.Shape(); TopoDS_Shape rotatedShape_X = rotateTransform_X.Shape();
// 进行旋转 // 进行旋转
gp_Trsf rotation_Y; gp_Trsf rotation_Y;
rotation_Y.SetRotation(rotationAxis_Y, angle_y); // Y rotation_Y.SetRotation(rotationAxis_Y, angle_y); // Y
BRepBuilderAPI_Transform rotateTransform_Y(rotatedShape_X, rotation_Y); BRepBuilderAPI_Transform rotateTransform_Y(rotatedShape_X, rotation_Y);
TopoDS_Shape rotatedShape_Y = rotateTransform_Y.Shape(); TopoDS_Shape rotatedShape_Y = rotateTransform_Y.Shape();
// 进行旋转 // 进行旋转
gp_Trsf rotation_Z; gp_Trsf rotation_Z;
rotation_Z.SetRotation(rotationAxis_Z, angle_z); // Z rotation_Z.SetRotation(rotationAxis_Z, angle_z); // Z
BRepBuilderAPI_Transform rotateTransform_Z(rotatedShape_Y, rotation_Z); BRepBuilderAPI_Transform rotateTransform_Z(rotatedShape_Y, rotation_Z);
TopoDS_Shape rotatedShape = rotateTransform_Z.Shape(); TopoDS_Shape rotatedShape = rotateTransform_Z.Shape();
// 创建一个 BRepBuilderAPI_Transform 对象来进行缩放 // 创建一个 BRepBuilderAPI_Transform 对象来进行缩放
gp_Pnt refrenceCenter(ScaleRefrencePoint_X, ScaleRefrencePoint_Y, ScaleRefrencePoint_Z); // 中心点坐标 gp_Pnt refrenceCenter(ScaleRefrencePoint_X, ScaleRefrencePoint_Y, ScaleRefrencePoint_Z); // 中心点坐标
gp_Trsf scaleTransform; gp_Trsf scaleTransform;
scaleTransform.SetScale(refrenceCenter, ScaleDouble); scaleTransform.SetScale(refrenceCenter, ScaleDouble);
BRepBuilderAPI_Transform scaleTransformBuilder(rotatedShape, scaleTransform); BRepBuilderAPI_Transform scaleTransformBuilder(rotatedShape, scaleTransform);
// 应用变换 // 应用变换
if (scaleTransformBuilder.IsDone()) { if (scaleTransformBuilder.IsDone()) {
this->Datashape = scaleTransformBuilder.Shape(); this->Datashape = scaleTransformBuilder.Shape();
} }
else { else {
} }
// 内存释放 // 内存释放
translatedShape.Nullify(); translatedShape.Nullify();
rotatedShape_X.Nullify(); rotatedShape_X.Nullify();
rotatedShape_Y.Nullify(); rotatedShape_Y.Nullify();
rotatedShape.Nullify(); rotatedShape.Nullify();
if (this->myContext) { if (this->myContext) {
qDebug() << u8"图像刷新"; qDebug() << u8"图像刷新";
this->Data_AIS.Nullify(); this->Data_AIS.Nullify();
// 创建或获取对象的 AIS_Shape // 创建或获取对象的 AIS_Shape
Handle(AIS_Shape) aisShape = new AIS_Shape(this->Datashape); Handle(AIS_Shape) aisShape = new AIS_Shape(this->Datashape);
// 创建一个颜色对象,例如红色 // 创建一个颜色对象,例如红色
Quantity_Color redColor(1.0, 0.0, 0.0, Quantity_TOC_RGB); // RGB红色 Quantity_Color redColor(1.0, 0.0, 0.0, Quantity_TOC_RGB); // RGB红色
ChangeModelColor(aisShape, redColor); ChangeModelColor(aisShape, redColor);
this->Data_AIS = aisShape; this->Data_AIS = aisShape;
this->myContext->Display(this->Data_AIS, Standard_True); // 立刻刷新 this->myContext->Display(this->Data_AIS, Standard_True); // 立刻刷新
this->myContext->AddOrRemoveSelected(this->Data_AIS, Standard_True); this->myContext->AddOrRemoveSelected(this->Data_AIS, Standard_True);
} }
// 处理响应逻辑 // 处理响应逻辑
emit this->RefreshResult(this); emit this->RefreshResult(this);
} }
@ -414,12 +414,12 @@ void OCCTModelOperator::on_pushButton_ok_clicked()
this->ApplyModel(); this->ApplyModel();
if (this->myContext) { if (this->myContext) {
qDebug() << u8"模型移除"; qDebug() << u8"模型移除";
this->myContext->Remove(this->Data_AIS, Standard_False); this->myContext->Remove(this->Data_AIS, Standard_False);
this->myContext->UpdateCurrentViewer(); this->myContext->UpdateCurrentViewer();
} }
// 创建一个复制模型 // 创建一个复制模型
BRepBuilderAPI_Copy copyBuilder; BRepBuilderAPI_Copy copyBuilder;
copyBuilder.Perform(this->Datashape); copyBuilder.Perform(this->Datashape);
this->DataShapeBAK = copyBuilder.Shape(); this->DataShapeBAK = copyBuilder.Shape();
@ -440,13 +440,13 @@ void OCCTModelOperator::on_pushButton_apply_clicked()
this->ApplyModel(); this->ApplyModel();
if (this->myContext) { if (this->myContext) {
qDebug() << u8"模型移除"; qDebug() << u8"模型移除";
//this->myContext->Erase(this->Data_AIS, Standard_True); //this->myContext->Erase(this->Data_AIS, Standard_True);
this->myContext->Remove(this->Data_AIS, Standard_False); this->myContext->Remove(this->Data_AIS, Standard_False);
this->myContext->UpdateCurrentViewer(); this->myContext->UpdateCurrentViewer();
} }
// 创建一个复制模型 // 创建一个复制模型
BRepBuilderAPI_Copy copyBuilder; BRepBuilderAPI_Copy copyBuilder;
copyBuilder.Perform(this->Datashape); copyBuilder.Perform(this->Datashape);
this->DataShapeBAK = copyBuilder.Shape(); this->DataShapeBAK = copyBuilder.Shape();

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
/// ///
/// 控制模型整体平移转换 /// 控制模型整体平移转换
/// 1. 平移方法 /// 1. 平移方法
/// a. 矢量平移法 /// a. 矢量平移法
/// b. 重心设置 /// b. 重心设置
/// 2. 旋转方法 /// 2. 旋转方法
/// a. 重心转换方法,根据坐标系 /// a. 重心转换方法,根据坐标系
/// b. /// b.
/// ///
@ -34,9 +34,9 @@ private:
Ui::OCCTModelOperatorClass ui; Ui::OCCTModelOperatorClass ui;
public: public:
TopoDS_Shape Datashape; // 处理控制的模型 TopoDS_Shape Datashape; // 处理控制的模型
TopoDS_Shape DataShapeBAK; TopoDS_Shape DataShapeBAK;
Handle(AIS_InteractiveObject) Data_AIS; // 处理模型 Handle(AIS_InteractiveObject) Data_AIS; // 处理模型
QString ModelName; QString ModelName;
@ -53,7 +53,7 @@ public:
double Rotation_Center_Y; double Rotation_Center_Y;
double Rotation_Center_Z; double Rotation_Center_Z;
double Rotation_angle_X; // 绕X轴旋转角度 double Rotation_angle_X; // 绕X轴旋转角度
double Rotation_angle_Y; double Rotation_angle_Y;
double Rotation_angle_Z; double Rotation_angle_Z;
@ -62,10 +62,10 @@ public:
double ScaleRefrencePoint_Z; double ScaleRefrencePoint_Z;
double ScaleDouble; double ScaleDouble;
signals: // 信号域 signals: // 信号域
void ResultExportCopyAndCreateNew( OCCTModelOperator*); // 创建并复制模型 void ResultExportCopyAndCreateNew( OCCTModelOperator*); // 创建并复制模型
void ResultExport(OCCTModelOperator*); // 返回修改后的模型 void ResultExport(OCCTModelOperator*); // 返回修改后的模型
void RefreshResult(OCCTModelOperator*); // 模型重新绘制 void RefreshResult(OCCTModelOperator*); // 模型重新绘制
public slots: public slots:
void on_lineEdit_Move_From_X_returnPressed(); void on_lineEdit_Move_From_X_returnPressed();
@ -92,32 +92,32 @@ public slots:
void on_radioButton_Auto_toggled(bool flag); void on_radioButton_Auto_toggled(bool flag);
void on_radioButton_NoAuto_toggled(bool flag); void on_radioButton_NoAuto_toggled(bool flag);
// 按钮 // 按钮
void on_pushButton_ok_clicked(); void on_pushButton_ok_clicked();
void on_pushButton_apply_clicked(); void on_pushButton_apply_clicked();
void on_pushButton_Cancel_clicked(); void on_pushButton_Cancel_clicked();
// //
void PreViewOperator(); // 预处理 void PreViewOperator(); // 预处理
void ApplyModel(); void ApplyModel();
void ProcesssModel(); void ProcesssModel();
void ExcuteOperator(); // 执行替换操作 void ExcuteOperator(); // 执行替换操作
void UpdataVariable(); void UpdataVariable();
// 更新缩放参数 // 更新缩放参数
void UpdateScaleRefrencepoint(); void UpdateScaleRefrencepoint();
void toString(); void toString();
// //
protected: protected:
// 重写 closeEvent 函数来捕获关闭事件 // 重写 closeEvent 函数来捕获关闭事件
void closeEvent(QCloseEvent* event) override { void closeEvent(QCloseEvent* event) override {
// 在关闭事件发生时执行你想要的操作 // 在关闭事件发生时执行你想要的操作
qDebug() << u8"模型操作类 is closing!"; qDebug() << u8"模型操作类 is closing!";
this->myContext->Remove(this->Data_AIS, Standard_False); this->myContext->Remove(this->Data_AIS, Standard_False);
this->myContext->UpdateCurrentViewer(); this->myContext->UpdateCurrentViewer();
this->Datashape.Nullify(); this->Datashape.Nullify();
this->Data_AIS.Nullify(); this->Data_AIS.Nullify();
// 调用父类的 closeEvent 函数,以确保正确处理窗口的关闭 // 调用父类的 closeEvent 函数,以确保正确处理窗口的关闭
QDialog::closeEvent(event); QDialog::closeEvent(event);
}; };
}; };

View File

@ -1,15 +1,15 @@

#include "OCCTopoShapeTreeViewer.h" #include "OCCTopoShapeTreeViewer.h"
#include <qDebug> #include <qDebug>
#include "SharedModuleLib/BaseUiTool.h" #include "SharedModuleLib/BaseUiTool.h"
#include <BRep_Tool.hxx> #include <opencascade/BRep_Tool.hxx>
#include <TopoDS_Vertex.hxx> #include <opencascade/TopoDS_Vertex.hxx>
OCCTopoShapeTreeViewer::OCCTopoShapeTreeViewer(QWidget* parent) OCCTopoShapeTreeViewer::OCCTopoShapeTreeViewer(QWidget* parent)
: QTreeWidget(parent) : QTreeWidget(parent)
{ {
// 构造函数 // 构造函数
} }
void OCCTopoShapeTreeViewer::setTopoShape(const TopoDS_Shape& shape) void OCCTopoShapeTreeViewer::setTopoShape(const TopoDS_Shape& shape)
@ -19,23 +19,23 @@ void OCCTopoShapeTreeViewer::setTopoShape(const TopoDS_Shape& shape)
void OCCTopoShapeTreeViewer::displayTopoShape(const TopoDS_Shape& shape) void OCCTopoShapeTreeViewer::displayTopoShape(const TopoDS_Shape& shape)
{ {
// 清空QTreeWidget // 清空QTreeWidget
clear(); clear();
// 调用递归函数来添加Topo_Shape的层次结构 // 调用递归函数来添加Topo_Shape的层次结构
addTopoShapeToTreeWidget(shape, nullptr); addTopoShapeToTreeWidget(shape, nullptr);
// 展开所有项目 // 展开所有项目
expandAll(); expandAll();
} }
void OCCTopoShapeTreeViewer::addTopoShapeToTreeWidget(const TopoDS_Shape& shape, QTreeWidgetItem* parentItem) void OCCTopoShapeTreeViewer::addTopoShapeToTreeWidget(const TopoDS_Shape& shape, QTreeWidgetItem* parentItem)
{ {
// 获取当前Topo_Shape的类型 // 获取当前Topo_Shape的类型
TopAbs_ShapeEnum shapeType = shape.ShapeType(); TopAbs_ShapeEnum shapeType = shape.ShapeType();
// 创建一个新的QTreeWidgetItem来表示当前Topo_Shape // 创建一个新的QTreeWidgetItem来表示当前Topo_Shape
QTreeWidgetItem* currentItem = new QTreeWidgetItem(parentItem); QTreeWidgetItem* currentItem = new QTreeWidgetItem(parentItem);
currentItem->setText(0, TopAbs_ShapeEnum2QString(shapeType)); currentItem->setText(0, TopAbs_ShapeEnum2QString(shapeType));

View File

@ -1,4 +1,4 @@
#ifndef OCCTOPOSHAPETREEVIEWER_H #ifndef OCCTOPOSHAPETREEVIEWER_H
#define OCCTOPOSHAPETREEVIEWER_H #define OCCTOPOSHAPETREEVIEWER_H
@ -10,11 +10,11 @@ class OCCTopoShapeTreeViewer : public QTreeWidget
public: public:
OCCTopoShapeTreeViewer(QWidget* parent = nullptr); OCCTopoShapeTreeViewer(QWidget* parent = nullptr);
void setTopoShape(const TopoDS_Shape& shape); void setTopoShape(const TopoDS_Shape& shape);
// 显示Topo_Shape的层次结构 // 显示Topo_Shape的层次结构
void displayTopoShape(const TopoDS_Shape& shape); void displayTopoShape(const TopoDS_Shape& shape);
private: private:
// 递归函数用于在QTreeWidget中添加Topo_Shape的层次结构 // 递归函数用于在QTreeWidget中添加Topo_Shape的层次结构
void addTopoShapeToTreeWidget(const TopoDS_Shape& shape, QTreeWidgetItem* parentItem); void addTopoShapeToTreeWidget(const TopoDS_Shape& shape, QTreeWidgetItem* parentItem);
}; };

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -25,7 +25,7 @@
#include "DocumentCommon.h" #include "DocumentCommon.h"
#include "Transparency.h" #include "Transparency.h"
#include "AllHead.h" #include "AllHead.h"
#include <BRepBndLib.hxx> #include <opencascade/BRepBndLib.hxx>
@ -60,13 +60,13 @@ Handle(V3d_Viewer) DocumentCommon::Viewer(const Standard_ExtString,
} }
void DocumentCommon::ShowOrHideActivateGridMesh() { void DocumentCommon::ShowOrHideActivateGridMesh() {
qDebug() << u8"切换平面网格显示 \n"; qDebug() << u8"切换平面网格显示 \n";
if (this->isActivateGridMesh) { if (this->isActivateGridMesh) {
myViewer->DeactivateGrid(); myViewer->DeactivateGrid();
this->isActivateGridMesh = false; this->isActivateGridMesh = false;
} }
else { else {
// 设置XOY平面的网格 // 设置XOY平面的网格
myViewer->SetGridEcho(Standard_True); myViewer->SetGridEcho(Standard_True);
myViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines); myViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
this->isActivateGridMesh = true; this->isActivateGridMesh = true;
@ -76,7 +76,7 @@ void DocumentCommon::ShowOrHideActivateGridMesh() {
void DocumentCommon::ShowOrHideActivateAxisGris() void DocumentCommon::ShowOrHideActivateAxisGris()
{ {
qDebug() << u8"切换坐标轴网格显示 \n"; qDebug() << u8"切换坐标轴网格显示 \n";
if (this->isActivateAxisGrid) { if (this->isActivateAxisGrid) {
for (NCollection_List<Handle(V3d_View)>::Iterator anIter(this->myViewer->ActiveViews()); for (NCollection_List<Handle(V3d_View)>::Iterator anIter(this->myViewer->ActiveViews());
@ -93,7 +93,7 @@ void DocumentCommon::ShowOrHideActivateAxisGris()
anIter.More(); anIter.Next()) anIter.More(); anIter.Next())
{ {
const Handle(V3d_View)& anObject = anIter.Value(); const Handle(V3d_View)& anObject = anIter.Value();
// 创建立方体网格对象 // 创建立方体网格对象
Graphic3d_GraduatedTrihedron grid; Graphic3d_GraduatedTrihedron grid;
anObject->GraduatedTrihedronDisplay(grid); anObject->GraduatedTrihedronDisplay(grid);
} }
@ -153,13 +153,13 @@ DocumentCommon::DocumentCommon(QWidget* theApp)
myContext = new AIS_InteractiveContext(myViewer); myContext = new AIS_InteractiveContext(myViewer);
this->setColumnCount(1); this->setColumnCount(1);
this->initTaskTreeRootNode(); this->initTaskTreeRootNode();
this->initDocumentCommonContextMenu(); // 初始化右键菜单 this->initDocumentCommonContextMenu(); // 初始化右键菜单
} }
void DocumentCommon::SetObjects(const NCollection_Vector<Handle(AIS_InteractiveObject)>& theObjects, void DocumentCommon::SetObjects(const NCollection_Vector<Handle(AIS_InteractiveObject)>& theObjects,
Standard_Boolean theDisplayShaded) Standard_Boolean theDisplayShaded)
{ {
myContext->RemoveAll(Standard_False); // 清空对象 myContext->RemoveAll(Standard_False); // 清空对象
myContextIsEmpty = theObjects.IsEmpty(); myContextIsEmpty = theObjects.IsEmpty();
for (NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(theObjects); for (NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(theObjects);
@ -186,7 +186,7 @@ void DocumentCommon::ClearShape()
void DocumentCommon::AppendCube() void DocumentCommon::AppendCube()
{ {
qDebug() << u8"初始化坐标系 \n"; qDebug() << u8"初始化坐标系 \n";
Handle(AIS_ViewCube) aViewCube = new AIS_ViewCube(); Handle(AIS_ViewCube) aViewCube = new AIS_ViewCube();
myObject3d.Append(aViewCube); myObject3d.Append(aViewCube);
@ -267,17 +267,17 @@ std::shared_ptr<Bnd_Box> DocumentCommon::getSenceExtend(QString name)
void DocumentCommon::OpenOCCTShapeFile() void DocumentCommon::OpenOCCTShapeFile()
{ {
qDebug() << u8"打开文件 \n"; qDebug() << u8"打开文件 \n";
QString stlpath = getOpenFilePath( QString stlpath = getOpenFilePath(
nullptr, nullptr,
QString::fromUtf8(u8"导入模型"), QString::fromUtf8(u8"导入模型"),
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)")); QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));
this->addShapeDsItem(stlpath); this->addShapeDsItem(stlpath);
} }
// 打开模型 // 打开模型
void DocumentCommon::addShapeDsItem(QString filepath) void DocumentCommon::addShapeDsItem(QString filepath)
{ {
OCCTShapeModelNode* checkBox = new OCCTShapeModelNode(this); OCCTShapeModelNode* checkBox = new OCCTShapeModelNode(this);
@ -286,7 +286,7 @@ void DocumentCommon::addShapeDsItem(QString filepath)
this->addOCCTObjectItem(checkBox); this->addOCCTObjectItem(checkBox);
} }
else { else {
qDebug() << u8"没有打开文件:" << filepath << "\n"; qDebug() << u8"没有打开文件:" << filepath << "\n";
} }
} }
@ -297,66 +297,66 @@ void DocumentCommon::oncheckBoxStateChanged(int state) {
void DocumentCommon::initDocumentCommonContextMenu() void DocumentCommon::initDocumentCommonContextMenu()
{ {
qDebug() << u8"初始化initDocumentCommonContextMenu模型编辑模块"; qDebug() << u8"初始化initDocumentCommonContextMenu模型编辑模块";
this->m_undoStack = new QUndoStack(this); //存放命令的栈 this->m_undoStack = new QUndoStack(this); //存放命令的栈
this->setContextMenuPolicy(Qt::CustomContextMenu); this->setContextMenuPolicy(Qt::CustomContextMenu);
this->ContentListContextMenu = new QMenu(this); // 表格控件的右键菜单 this->ContentListContextMenu = new QMenu(this); // 表格控件的右键菜单
//QAction* m_undoAction = m_undoStack->createUndoAction(this, u8"撤销");//添加QActionCtrl-Z作为回撤的快捷键 //QAction* m_undoAction = m_undoStack->createUndoAction(this, u8"撤销");//添加QActionCtrl-Z作为回撤的快捷键
//m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); //m_undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
//QObject::connect(m_undoAction, SIGNAL(triggered()), this, SLOT(tableView_UndoAction())); //QObject::connect(m_undoAction, SIGNAL(triggered()), this, SLOT(tableView_UndoAction()));
//QAction* m_redoAction = m_undoStack->createRedoAction(this, u8"重做");//添加QActionCtrl-Y左右前进的快捷键 //QAction* m_redoAction = m_undoStack->createRedoAction(this, u8"重做");//添加QActionCtrl-Y左右前进的快捷键
//m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y)); //m_redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
//QObject::connect(m_redoAction, SIGNAL(triggered()), this, SLOT(tableView_RedoAction())); //QObject::connect(m_redoAction, SIGNAL(triggered()), this, SLOT(tableView_RedoAction()));
//this->ContentListContextMenu->addAction(m_undoAction); //this->ContentListContextMenu->addAction(m_undoAction);
//this->ContentListContextMenu->addAction(m_redoAction); //this->ContentListContextMenu->addAction(m_redoAction);
//QAction* TranslationdAction = this->ContentListContextMenu->addAction(u8"模型操作"); // //QAction* TranslationdAction = this->ContentListContextMenu->addAction(u8"模型操作"); //
//QObject::connect(TranslationdAction, SIGNAL(triggered()), this, SLOT(TranslationObjectWindShow())); //QObject::connect(TranslationdAction, SIGNAL(triggered()), this, SLOT(TranslationObjectWindShow()));
//QAction* BatchExportAction = this->ContentListContextMenu->addAction(u8"模型批量导出"); // //QAction* BatchExportAction = this->ContentListContextMenu->addAction(u8"模型批量导出"); //
//QObject::connect(BatchExportAction, SIGNAL(triggered()), this, SLOT(ContentListContextMenu_BatchExportAction())); //QObject::connect(BatchExportAction, SIGNAL(triggered()), this, SLOT(ContentListContextMenu_BatchExportAction()));
QObject::connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContentListContextMenu(QPoint))); QObject::connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(ShowContentListContextMenu(QPoint)));
qDebug() << u8"初始化contextMenu结束"; qDebug() << u8"初始化contextMenu结束";
} }
void DocumentCommon::initTaskTreeRootNode() void DocumentCommon::initTaskTreeRootNode()
{ {
this->clear(); //删除所有节点 this->clear(); //删除所有节点
this->setHeaderHidden(true); // 显示表头 this->setHeaderHidden(true); // 显示表头
// 创建2个根节点 数据 任务 // 创建2个根节点 数据 任务
dataRoot = new QTreeWidgetItem(this); dataRoot = new QTreeWidgetItem(this);
dataRoot->setText(0, u8"数据"); dataRoot->setText(0, u8"数据");
// 创建3个节点 模型 图像 点云 // 创建3个节点 模型 图像 点云
modelRoot = new QTreeWidgetItem(dataRoot); modelRoot = new QTreeWidgetItem(dataRoot);
modelRoot->setText(0, u8"模型"); modelRoot->setText(0, u8"模型");
imageRoot = new QTreeWidgetItem(dataRoot); imageRoot = new QTreeWidgetItem(dataRoot);
imageRoot->setText(0, u8"图像"); imageRoot->setText(0, u8"图像");
pointCloudRoot = new QTreeWidgetItem(dataRoot); pointCloudRoot = new QTreeWidgetItem(dataRoot);
pointCloudRoot->setText(0, u8"属性数据库"); pointCloudRoot->setText(0, u8"属性数据库");
atriTableRoot = new QTreeWidgetItem(dataRoot); atriTableRoot = new QTreeWidgetItem(dataRoot);
atriTableRoot->setText(0, u8"属性数据库"); atriTableRoot->setText(0, u8"属性数据库");
taskRoot = new QTreeWidgetItem(this); taskRoot = new QTreeWidgetItem(this);
taskRoot->setText(0, u8"任务"); taskRoot->setText(0, u8"任务");
// 创建3个节点 仿真图像任务、后向散射系数导出任务、仿真后向散射任务 // 创建3个节点 仿真图像任务、后向散射系数导出任务、仿真后向散射任务
fekoSimulationRoot = new QTreeWidgetItem(taskRoot); fekoSimulationRoot = new QTreeWidgetItem(taskRoot);
fekoSimulationRoot->setText(0, u8"仿真任务"); fekoSimulationRoot->setText(0, u8"仿真任务");
exportScatteringRoot = new QTreeWidgetItem(taskRoot); exportScatteringRoot = new QTreeWidgetItem(taskRoot);
exportScatteringRoot->setText(0, u8"后向散射系数导出任务"); exportScatteringRoot->setText(0, u8"后向散射系数导出任务");
fekoScatteringRoot = new QTreeWidgetItem(taskRoot); fekoScatteringRoot = new QTreeWidgetItem(taskRoot);
fekoScatteringRoot->setText(0, u8"仿真后向散射任务"); fekoScatteringRoot->setText(0, u8"仿真后向散射任务");
// 将根节点添加到 QTreeWidget 中 // 将根节点添加到 QTreeWidget 中
this->addTopLevelItem(dataRoot); this->addTopLevelItem(dataRoot);
this->addTopLevelItem(taskRoot); this->addTopLevelItem(taskRoot);
this->show(); this->show();
@ -366,31 +366,31 @@ void DocumentCommon::addTaskNode(TaskNode* node)
{ {
if (node) { if (node) {
node->setParent(this); node->setParent(this);
if (dynamic_cast<OCCTShapeModelNode*>(node) != nullptr) { // 模型数据节点 if (dynamic_cast<OCCTShapeModelNode*>(node) != nullptr) { // 模型数据节点
this->addOCCTObjectItem(node); this->addOCCTObjectItem(node);
} }
else if (dynamic_cast<ComplexDataShowNode*>(node) != nullptr) { // 辅助图像节点 else if (dynamic_cast<ComplexDataShowNode*>(node) != nullptr) { // 辅助图像节点
this->addImageObjectItem(node); this->addImageObjectItem(node);
} }
else if (dynamic_cast<DataShowNode*>(node) != nullptr) { // 辅助图像节点 else if (dynamic_cast<DataShowNode*>(node) != nullptr) { // 辅助图像节点
this->addImageObjectItem(node); this->addImageObjectItem(node);
} }
else if (dynamic_cast<FEKOScatterSettingTaskNodeClass*>(node) != nullptr) { // 后向散射系数模拟任务节点 else if (dynamic_cast<FEKOScatterSettingTaskNodeClass*>(node) != nullptr) { // 后向散射系数模拟任务节点
this->addScatterSettingTaskItem(node); this->addScatterSettingTaskItem(node);
} }
else if (dynamic_cast<FEKOResultImportTaskNode*>(node) != nullptr) { // 后向散射导入 else if (dynamic_cast<FEKOResultImportTaskNode*>(node) != nullptr) { // 后向散射导入
this->addFEKOResultDataConvertItem(node); this->addFEKOResultDataConvertItem(node);
} }
else if (dynamic_cast<FEKOImageSettingTaskNodeClass*>(node) != nullptr) { // 仿真成像参数任务 else if (dynamic_cast<FEKOImageSettingTaskNodeClass*>(node) != nullptr) { // 仿真成像参数任务
this->addFEKOSimulationImageSettingItem(node); this->addFEKOSimulationImageSettingItem(node);
} }
else { else {
QMessageBox::warning(this, u8"警告", u8"未知任务节点"); QMessageBox::warning(this, u8"警告", u8"未知任务节点");
delete node; delete node;
return; return;
} }
// 添加信号连接 // 添加信号连接
QObject::connect(node, SIGNAL(renameNode(QString, QString)), this, SLOT(renameTaskNode(QString, QString))); QObject::connect(node, SIGNAL(renameNode(QString, QString)), this, SLOT(renameTaskNode(QString, QString)));
QObject::connect(node, SIGNAL(deleteItem(QString)), this, SLOT(removeTaskNode(QString))); QObject::connect(node, SIGNAL(deleteItem(QString)), this, SLOT(removeTaskNode(QString)));
QObject::connect(node, SIGNAL(deleteNode(QString)), this, SLOT(removeTaskNode(QString))); QObject::connect(node, SIGNAL(deleteNode(QString)), this, SLOT(removeTaskNode(QString)));
@ -497,7 +497,7 @@ void DocumentCommon::removeTaskNode(QTreeWidgetItem* node)
this->dataMap.remove(node->text(0)); this->dataMap.remove(node->text(0));
} }
else { else {
QMessageBox::warning(this, u8"警告", u8"未知节点"); QMessageBox::warning(this, u8"警告", u8"未知节点");
} }
} }
void DocumentCommon::removeTaskNode(QString itemName) void DocumentCommon::removeTaskNode(QString itemName)
@ -506,19 +506,19 @@ void DocumentCommon::removeTaskNode(QString itemName)
QTreeWidgetItem* item = this->dataMap.value(itemName); QTreeWidgetItem* item = this->dataMap.value(itemName);
TaskNode* obj = item->data(0, Qt::UserRole).value<TaskNode*>(); TaskNode* obj = item->data(0, Qt::UserRole).value<TaskNode*>();
if (obj->status != TaskStatusEnum::finish) { if (obj->status != TaskStatusEnum::finish) {
obj->FinishTask(); // 调用执行结束流程 obj->FinishTask(); // 调用执行结束流程
} }
this->removeTaskNode(item); this->removeTaskNode(item);
} }
else { else {
QMessageBox::warning(this, u8"警告", u8"未找到节点:"+ itemName); QMessageBox::warning(this, u8"警告", u8"未找到节点:"+ itemName);
} }
} }
bool DocumentCommon::addUniqueNode(QTreeWidgetItem* item) bool DocumentCommon::addUniqueNode(QTreeWidgetItem* item)
{ {
if (this->dataMap.contains(item->text(0))) { if (this->dataMap.contains(item->text(0))) {
QMessageBox::warning(this, u8"警告", u8"发现同名节点:"+ item->text(0)); QMessageBox::warning(this, u8"警告", u8"发现同名节点:"+ item->text(0));
return false; return false;
} }
else { else {
@ -533,36 +533,36 @@ QTreeWidgetItem* DocumentCommon::newQTaskTreeWidgetItem(TaskNode* node)
QTreeWidgetItem* itemtemp; QTreeWidgetItem* itemtemp;
if (node) { if (node) {
if (dynamic_cast<OCCTShapeModelNode*>(node) != nullptr) { // 模型数据节点 if (dynamic_cast<OCCTShapeModelNode*>(node) != nullptr) { // 模型数据节点
itemtemp = new QTreeWidgetItem(this->modelRoot); itemtemp = new QTreeWidgetItem(this->modelRoot);
} }
else if (dynamic_cast<ComplexDataShowNode*>(node) != nullptr) { // 辅助图像节点 else if (dynamic_cast<ComplexDataShowNode*>(node) != nullptr) { // 辅助图像节点
itemtemp = new QTreeWidgetItem(this->imageRoot); itemtemp = new QTreeWidgetItem(this->imageRoot);
} }
else if (dynamic_cast<DataShowNode*>(node) != nullptr) { // 辅助图像节点 else if (dynamic_cast<DataShowNode*>(node) != nullptr) { // 辅助图像节点
itemtemp = new QTreeWidgetItem(this->imageRoot); itemtemp = new QTreeWidgetItem(this->imageRoot);
} }
else if (dynamic_cast<FEKOScatterSettingTaskNodeClass*>(node) != nullptr) { // 后向散射系数模拟任务节点 else if (dynamic_cast<FEKOScatterSettingTaskNodeClass*>(node) != nullptr) { // 后向散射系数模拟任务节点
itemtemp = new QTreeWidgetItem(this->fekoScatteringRoot); itemtemp = new QTreeWidgetItem(this->fekoScatteringRoot);
} }
else if (dynamic_cast<FEKOResultImportTaskNode*>(node) != nullptr) { // 后向散射导入 else if (dynamic_cast<FEKOResultImportTaskNode*>(node) != nullptr) { // 后向散射导入
itemtemp = new QTreeWidgetItem(this->exportScatteringRoot); itemtemp = new QTreeWidgetItem(this->exportScatteringRoot);
} }
else if (dynamic_cast<FEKOImageSettingTaskNodeClass*>(node) != nullptr) { // 仿真成像参数任务 else if (dynamic_cast<FEKOImageSettingTaskNodeClass*>(node) != nullptr) { // 仿真成像参数任务
itemtemp = new QTreeWidgetItem(this->fekoSimulationRoot); itemtemp = new QTreeWidgetItem(this->fekoSimulationRoot);
} }
else { else {
QMessageBox::warning(this, u8"警告", u8"未知任务节点"); QMessageBox::warning(this, u8"警告", u8"未知任务节点");
delete node; delete node;
return nullptr; return nullptr;
} }
// 添加信号连接 // 添加信号连接
QObject::connect(node, SIGNAL(renameNode(QString, QString)), this, SLOT(renameTaskNode(QString, QString))); QObject::connect(node, SIGNAL(renameNode(QString, QString)), this, SLOT(renameTaskNode(QString, QString)));
QObject::connect(node, SIGNAL(deleteItem(QString)), this, SLOT(removeTaskNode(QString))); QObject::connect(node, SIGNAL(deleteItem(QString)), this, SLOT(removeTaskNode(QString)));
} }
else { else {
QMessageBox::warning(this, u8"警告", u8"未知任务节点"); QMessageBox::warning(this, u8"警告", u8"未知任务节点");
delete node; delete node;
return nullptr; return nullptr;
} }
@ -570,7 +570,7 @@ QTreeWidgetItem* DocumentCommon::newQTaskTreeWidgetItem(TaskNode* node)
itemtemp->setText(0, node->getTaskName()); itemtemp->setText(0, node->getTaskName());
itemtemp->setData(0, Qt::UserRole, QVariant::fromValue(node)); itemtemp->setData(0, Qt::UserRole, QVariant::fromValue(node));
// 处理事件绑定 // 处理事件绑定
if (this->addUniqueNode(itemtemp)) { if (this->addUniqueNode(itemtemp)) {
return itemtemp; return itemtemp;
@ -583,9 +583,9 @@ QTreeWidgetItem* DocumentCommon::newQTaskTreeWidgetItem(TaskNode* node)
void DocumentCommon::renameTaskNode(QString olditemName, QString newitemName) void DocumentCommon::renameTaskNode(QString olditemName, QString newitemName)
{ {
qDebug() << u8"正在执行重命名命令"; qDebug() << u8"正在执行重命名命令";
if (this->dataMap.contains(newitemName)) { if (this->dataMap.contains(newitemName)) {
QMessageBox::warning(this, u8"警告", u8"存在同名节点"); QMessageBox::warning(this, u8"警告", u8"存在同名节点");
} }
else { else {
QTreeWidgetItem* item = this->dataMap.value(olditemName); QTreeWidgetItem* item = this->dataMap.value(olditemName);
@ -600,10 +600,10 @@ void DocumentCommon::renameTaskNode(QString olditemName, QString newitemName)
void DocumentCommon::copyNewNode(TaskNode* newNode) void DocumentCommon::copyNewNode(TaskNode* newNode)
{ {
if (newNode) { if (newNode) {
QString newName = QInputDialog::getText(this, u8"重命名", u8"请输入新的名称", QLineEdit::Normal, newNode->getName() + u8"_1"); QString newName = QInputDialog::getText(this, u8"重命名", u8"请输入新的名称", QLineEdit::Normal, newNode->getName() + u8"_1");
if (newName.isEmpty()) { if (newName.isEmpty()) {
QMessageBox::warning(this, u8"警告", u8"无效名称"); QMessageBox::warning(this, u8"警告", u8"无效名称");
delete newNode;// 无效对象,直接删除 delete newNode;// 无效对象,直接删除
} }
else { else {
newNode->setName(newName); newNode->setName(newName);
@ -620,7 +620,7 @@ void DocumentCommon::copyNewNode(TaskNode* newNode)
void DocumentCommon::UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p) void DocumentCommon::UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p)
{ {
if (n) { if (n) {
QTreeWidgetItem * parentOfn =n->parent();//获取节点 n 的父节点 QTreeWidgetItem * parentOfn =n->parent();//获取节点 n 的父节点
if (parentOfn) { if (parentOfn) {
parentOfn->removeChild(n); parentOfn->removeChild(n);
if (p) { if (p) {
@ -636,14 +636,14 @@ void DocumentCommon::UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p
this->takeTopLevelItem(index); this->takeTopLevelItem(index);
p->addChild(n); p->addChild(n);
} }
else { // 本身就是节点就是根节点,无须再提升 else { // 本身就是节点就是根节点,无须再提升
return; return;
} }
} }
} }
else { else {
// 不是根节点,直接返回 // 不是根节点,直接返回
} }
} }
@ -661,10 +661,10 @@ void DocumentCommon::addOCCTObjItem(TopoDS_Shape shape, QString name, bool ishow
//QObject::connect(checkBox, SIGNAL(ModelModify(OCCTShapeModelNode*)), this, SLOT(ShapeModifyShape(OCCTShapeModelNode*))); //QObject::connect(checkBox, SIGNAL(ModelModify(OCCTShapeModelNode*)), this, SLOT(ShapeModifyShape(OCCTShapeModelNode*)));
this->addTaskNode(checkBox); this->addTaskNode(checkBox);
if (ishow) { if (ishow) {
checkBox->ShowShape(); // 展示模型 checkBox->ShowShape(); // 展示模型
} }
else { else {
checkBox->HideShape(); // 隐藏模型 checkBox->HideShape(); // 隐藏模型
} }
} }
@ -674,33 +674,33 @@ TopoDS_Shape DocumentCommon::MergeCOntextAllModels() {
BRep_Builder builder; BRep_Builder builder;
builder.MakeCompound(compound); builder.MakeCompound(compound);
this->myContext->InitSelected(); // 初始化模型 this->myContext->InitSelected(); // 初始化模型
for (; myContext->MoreSelected(); myContext->NextSelected()) { for (; myContext->MoreSelected(); myContext->NextSelected()) {
Handle(AIS_InteractiveObject) selectedObject = myContext->SelectedInteractive(); Handle(AIS_InteractiveObject) selectedObject = myContext->SelectedInteractive();
if (!selectedObject.IsNull()) { if (!selectedObject.IsNull()) {
TopoDS_Shape shape = this->getTopoDSShape(selectedObject); TopoDS_Shape shape = this->getTopoDSShape(selectedObject);
// 将每个形状添加到 Compound // 将每个形状添加到 Compound
builder.Add(compound, shape); builder.Add(compound, shape);
} }
} }
return compound; return compound;
} }
// 保存模型 // 保存模型
void DocumentCommon::SaveModelFile() { void DocumentCommon::SaveModelFile() {
// 选择保存文件 // 选择保存文件
qDebug() << u8"打开文件 \n"; qDebug() << u8"打开文件 \n";
QString filepath = getSaveFilePath( QString filepath = getSaveFilePath(
nullptr, nullptr,
QString::fromUtf8(u8"保存FEKO结果导入场景模型"), QString::fromUtf8(u8"保存FEKO结果导入场景模型"),
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)")); QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));
QFileInfo fileinfo(filepath); QFileInfo fileinfo(filepath);
QString filename = fileinfo.fileName(); QString filename = fileinfo.fileName();
QString fileSuffix = fileinfo.suffix(); QString fileSuffix = fileinfo.suffix();
TopoDS_Shape shape_TopoDs = this->MergeCOntextAllModels(); // 合并所有模型 TopoDS_Shape shape_TopoDs = this->MergeCOntextAllModels(); // 合并所有模型
// 保存模型 // 保存模型
if (fileSuffix.compare(u8"stl") == 0 || fileSuffix.compare(u8"stla") == 0) { if (fileSuffix.compare(u8"stl") == 0 || fileSuffix.compare(u8"stla") == 0) {
SaveTopoDs_Stl(filepath, shape_TopoDs); SaveTopoDs_Stl(filepath, shape_TopoDs);
} }
@ -718,12 +718,12 @@ void DocumentCommon::SaveModelFile() {
void DocumentCommon::ShowContentListContextMenu(QPoint p) { void DocumentCommon::ShowContentListContextMenu(QPoint p) {
qDebug() << u8"正在展示ShowContentListContextMenu 右键菜单"; qDebug() << u8"正在展示ShowContentListContextMenu 右键菜单";
QList < QTreeWidgetItem* > selectitems =this->selectedItems(); QList < QTreeWidgetItem* > selectitems =this->selectedItems();
if (selectitems.count() == 0) { if (selectitems.count() == 0) {
// 初始化右键菜单 // 初始化右键菜单
return; return;
} }
else if (selectitems.count() == 1) { else if (selectitems.count() == 1) {
@ -749,21 +749,21 @@ void DocumentCommon::ShowContentListContextMenu(QPoint p) {
void DocumentCommon::ContentListContextMenu_UndoAction() void DocumentCommon::ContentListContextMenu_UndoAction()
{ {
qDebug() << u8"正在撤销命令"; qDebug() << u8"正在撤销命令";
int index = this->m_undoStack->index(); int index = this->m_undoStack->index();
this->m_undoStack->setIndex(index); this->m_undoStack->setIndex(index);
} }
void DocumentCommon::ContentListContextMenu_RedoAction() void DocumentCommon::ContentListContextMenu_RedoAction()
{ {
qDebug() << u8"正在重做命令"; qDebug() << u8"正在重做命令";
int index = this->m_undoStack->index(); int index = this->m_undoStack->index();
this->m_undoStack->setIndex(index); this->m_undoStack->setIndex(index);
} }
void DocumentCommon::ContentListContextMenu_BatchExportAction() void DocumentCommon::ContentListContextMenu_BatchExportAction()
{ {
qDebug() << u8"批量导出模型"; qDebug() << u8"批量导出模型";
DialogBatchExport* exportWindows = new DialogBatchExport(); DialogBatchExport* exportWindows = new DialogBatchExport();
for (int i = 0; i < this->modelRoot->childCount(); ++i) { for (int i = 0; i < this->modelRoot->childCount(); ++i) {
QTreeWidgetItem* item = this->modelRoot->child(i); QTreeWidgetItem* item = this->modelRoot->child(i);
@ -773,7 +773,7 @@ void DocumentCommon::ContentListContextMenu_BatchExportAction()
exportWindows->addDataShape(checkBox->text(), checkBox->Shape()); exportWindows->addDataShape(checkBox->text(), checkBox->Shape());
} }
else { else {
QMessageBox::warning(this, u8"错误", u8"发现错误:" + item->text(0)); QMessageBox::warning(this, u8"错误", u8"发现错误:" + item->text(0));
continue; continue;
} }
} }
@ -782,45 +782,45 @@ void DocumentCommon::ContentListContextMenu_BatchExportAction()
/////////////////////////// ///////////////////////////
// 窗口右键菜单 // 窗口右键菜单
////////////////////////// //////////////////////////
void DocumentCommon::VerticesSelect3dSample() void DocumentCommon::VerticesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为TopAbs_VERTEX"; qDebug() << u8"切换选择模式为TopAbs_VERTEX";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_VERTEX)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_VERTEX));
} }
void DocumentCommon::EdgesSelect3dSample() void DocumentCommon::EdgesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为TopAbs_EDGE"; qDebug() << u8"切换选择模式为TopAbs_EDGE";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_EDGE)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_EDGE));
} }
void DocumentCommon::FacesSelect3dSample() void DocumentCommon::FacesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为TopAbs_FACE"; qDebug() << u8"切换选择模式为TopAbs_FACE";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_FACE)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_FACE));
} }
void DocumentCommon::NeutralPointSelect3dSample() void DocumentCommon::NeutralPointSelect3dSample()
{ {
qDebug() << u8"切换选择模式为TopAbs_COMPOUND"; qDebug() << u8"切换选择模式为TopAbs_COMPOUND";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(TopAbs_COMPOUND); myContext->Activate(TopAbs_COMPOUND);
} }
//void DocumentCommon::ShapeModifyShape(OCCTShapeModelNode* dataItem) //void DocumentCommon::ShapeModifyShape(OCCTShapeModelNode* dataItem)
//{ //{
// qDebug() << u8"模型操作"; // qDebug() << u8"模型操作";
// OCCTModelOperator* operatorWindows = new OCCTModelOperator(dataItem->text(), nullptr, this->myContext); // OCCTModelOperator* operatorWindows = new OCCTModelOperator(dataItem->text(), nullptr, this->myContext);
// operatorWindows->setModal(false); // operatorWindows->setModal(false);
// //operatorWindows->setTopoDs_Shape(dataItem->DataShape); // //operatorWindows->setTopoDs_Shape(dataItem->DataShape);
// // 绑定模型 // // 绑定模型
// QObject::connect(operatorWindows, SIGNAL(ResultExportCopyAndCreateNew(OCCTModelOperator*)), this, SLOT(TranslationExportCopy(OCCTModelOperator*))); // QObject::connect(operatorWindows, SIGNAL(ResultExportCopyAndCreateNew(OCCTModelOperator*)), this, SLOT(TranslationExportCopy(OCCTModelOperator*)));
// QObject::connect(operatorWindows, SIGNAL(ResultExport(OCCTModelOperator*)), this, SLOT(TranslationExport(OCCTModelOperator*))); // QObject::connect(operatorWindows, SIGNAL(ResultExport(OCCTModelOperator*)), this, SLOT(TranslationExport(OCCTModelOperator*)));
// QObject::connect(operatorWindows, SIGNAL(RefreshResult(OCCTModelOperator*)), this, SLOT(RefreshResult(OCCTModelOperator*))); // QObject::connect(operatorWindows, SIGNAL(RefreshResult(OCCTModelOperator*)), this, SLOT(RefreshResult(OCCTModelOperator*)));
@ -828,18 +828,18 @@ void DocumentCommon::NeutralPointSelect3dSample()
//} //}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// 模型界面的选择事件 // 模型界面的选择事件
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void DocumentCommon::ViewerMousePressEvent(QMouseEvent* theEvent) { void DocumentCommon::ViewerMousePressEvent(QMouseEvent* theEvent) {
qDebug() << u8"view 窗体按键按下点击事件被激活 \n"; qDebug() << u8"view 窗体按键按下点击事件被激活 \n";
} }
void DocumentCommon::ViewerMouseReleaseEvent(QMouseEvent* theEvent) void DocumentCommon::ViewerMouseReleaseEvent(QMouseEvent* theEvent)
{ {
qDebug() << u8"view 窗体按键释放事件被激活 \n"; qDebug() << u8"view 窗体按键释放事件被激活 \n";
for (this->myContext->InitSelected(); this->myContext->MoreSelected(); this->myContext->NextSelected()) { for (this->myContext->InitSelected(); this->myContext->MoreSelected(); this->myContext->NextSelected()) {
Handle(AIS_InteractiveObject) selectedObject = this->myContext->SelectedInteractive(); Handle(AIS_InteractiveObject) selectedObject = this->myContext->SelectedInteractive();
qDebug() << u8"view 发现选中对象 \n"; qDebug() << u8"view 发现选中对象 \n";
TopoDS_Shape selectShape = this->getTopoDSShape(selectedObject); TopoDS_Shape selectShape = this->getTopoDSShape(selectedObject);
emit this->SelectObjectList(selectShape); emit this->SelectObjectList(selectShape);
this->showSelectShape(selectShape); this->showSelectShape(selectShape);
@ -877,7 +877,7 @@ TopoDS_Shape DocumentCommon::getTopoDSShape(const Handle(AIS_InteractiveObject)&
void DocumentCommon::showSelectShape(const TopoDS_Shape& selectShape) void DocumentCommon::showSelectShape(const TopoDS_Shape& selectShape)
{ {
qDebug() << u8"显示选中的对象 \n"; qDebug() << u8"显示选中的对象 \n";
if (this->ShapeInfomationWindows) { if (this->ShapeInfomationWindows) {
this->ShapeInfomationWindows->setTopoShape(selectShape); this->ShapeInfomationWindows->setTopoShape(selectShape);
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -34,7 +34,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 文件模型控制 // 文件模型控制
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! Implements visualization of samples content //! Implements visualization of samples content
@ -47,104 +47,104 @@ public:
~DocumentCommon() { } ~DocumentCommon() { }
//========================================= //=========================================
// 任务节点管理 // 任务节点管理
//========================================= //=========================================
public: // 数据管理层次 public: // 数据管理层次
QTreeWidgetItem* dataRoot; // 根节点 QTreeWidgetItem* dataRoot; // 根节点
QTreeWidgetItem* taskRoot; QTreeWidgetItem* taskRoot;
QTreeWidgetItem* modelRoot; // 数据类型 QTreeWidgetItem* modelRoot; // 数据类型
QTreeWidgetItem* imageRoot; QTreeWidgetItem* imageRoot;
QTreeWidgetItem* pointCloudRoot; QTreeWidgetItem* pointCloudRoot;
QTreeWidgetItem* atriTableRoot; QTreeWidgetItem* atriTableRoot;
QTreeWidgetItem* fekoSimulationRoot; // 任务类型 QTreeWidgetItem* fekoSimulationRoot; // 任务类型
QTreeWidgetItem* exportScatteringRoot; QTreeWidgetItem* exportScatteringRoot;
QTreeWidgetItem* fekoScatteringRoot; QTreeWidgetItem* fekoScatteringRoot;
QMap<QString, QTreeWidgetItem*> dataMap; // 数据名-节点项绑定 QMap<QString, QTreeWidgetItem*> dataMap; // 数据名-节点项绑定
public slots: public slots:
void initTaskTreeRootNode(); //初始化任务树 void initTaskTreeRootNode(); //初始化任务树
TaskNode* getItemByName(QString name);// 场景节点 TaskNode* getItemByName(QString name);// 场景节点
void addTaskNode(TaskNode*); // 添加节点 void addTaskNode(TaskNode*); // 添加节点
void removeTaskNode(QString itemName); // 移除节点 void removeTaskNode(QString itemName); // 移除节点
bool addUniqueNode(QTreeWidgetItem* item); // 添加唯一性节点 bool addUniqueNode(QTreeWidgetItem* item); // 添加唯一性节点
QTreeWidgetItem* newQTaskTreeWidgetItem(TaskNode* node); // 创建任务节点 QTreeWidgetItem* newQTaskTreeWidgetItem(TaskNode* node); // 创建任务节点
void renameTaskNode(QString olditemName,QString newitemName); // 重命名节点 void renameTaskNode(QString olditemName,QString newitemName); // 重命名节点
void copyNewNode(TaskNode* newNode); void copyNewNode(TaskNode* newNode);
void UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p = nullptr);// 更变父节点,如果是空指针,标识提升为根节点 void UpdateItemParantNode(QTreeWidgetItem* n, QTreeWidgetItem* p = nullptr);// 更变父节点,如果是空指针,标识提升为根节点
public slots: // 添加 文件节点分布 public slots: // 添加 文件节点分布
void addOCCTObjectItem(TaskNode*); // 加载数据 void addOCCTObjectItem(TaskNode*); // 加载数据
void addImageObjectItem(TaskNode*); void addImageObjectItem(TaskNode*);
void addPointCloudObjectItem(TaskNode*); // 功能待实现 void addPointCloudObjectItem(TaskNode*); // 功能待实现
void addAtriTableObjectItem(TaskNode*); // 功能待实现 void addAtriTableObjectItem(TaskNode*); // 功能待实现
void addScatterSettingTaskItem(TaskNode*); // 加载任务 void addScatterSettingTaskItem(TaskNode*); // 加载任务
void addFEKOResultDataConvertItem(TaskNode*); void addFEKOResultDataConvertItem(TaskNode*);
void addFEKOSimulationImageSettingItem(TaskNode*); void addFEKOSimulationImageSettingItem(TaskNode*);
void addOCCTObjItem(TopoDS_Shape shape, QString name, bool ishow = true);// 添加模型 void addOCCTObjItem(TopoDS_Shape shape, QString name, bool ishow = true);// 添加模型
void addShapeDsItem(QString filepath); // 加载模型 void addShapeDsItem(QString filepath); // 加载模型
public slots: // 移除节点 public slots: // 移除节点
void removeTaskNode(QTreeWidgetItem*); void removeTaskNode(QTreeWidgetItem*);
public slots: // 任务节点,共有内容 public slots: // 任务节点,共有内容
void ContentListContextMenu_UndoAction(); // 撤销 void ContentListContextMenu_UndoAction(); // 撤销
void ContentListContextMenu_RedoAction(); // 重做 void ContentListContextMenu_RedoAction(); // 重做
void ContentListContextMenu_BatchExportAction(); void ContentListContextMenu_BatchExportAction();
public slots: public slots:
void initDocumentCommonContextMenu(); // 初始化右键菜单 void initDocumentCommonContextMenu(); // 初始化右键菜单
void ShowContentListContextMenu(QPoint p); void ShowContentListContextMenu(QPoint p);
//========================================= //=========================================
// 模型操作 // 模型操作
//========================================= //=========================================
private:// 私有变量 private:// 私有变量
bool isActivateGridMesh ; bool isActivateGridMesh ;
bool isActivateAxisGrid; bool isActivateAxisGrid;
Graphic3d_GraduatedTrihedron aTrihedron_aixs; Graphic3d_GraduatedTrihedron aTrihedron_aixs;
public:// 公开变量 public:// 公开变量
Handle(V3d_Viewer) myViewer; Handle(V3d_Viewer) myViewer;
Handle(AIS_InteractiveContext) myContext; Handle(AIS_InteractiveContext) myContext;
bool myContextIsEmpty; bool myContextIsEmpty;
NCollection_Vector<Handle(AIS_InteractiveObject)> myObject3d; // 控制器列表 NCollection_Vector<Handle(AIS_InteractiveObject)> myObject3d; // 控制器列表
QUndoStack* m_undoStack; QUndoStack* m_undoStack;
QSet<QString> ItemSets; QSet<QString> ItemSets;
QMenu* ContentListContextMenu; QMenu* ContentListContextMenu;
OCCTopoShapeTreeViewer* ShapeInfomationWindows; //展示被选择的模型 OCCTopoShapeTreeViewer* ShapeInfomationWindows; //展示被选择的模型
public: public:
Handle(AIS_InteractiveObject) ShowTopoDS_Shape(TopoDS_Shape& shape); // 显示模型 Handle(AIS_InteractiveObject) ShowTopoDS_Shape(TopoDS_Shape& shape); // 显示模型
bool HideTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 隐藏模型 bool HideTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 隐藏模型
bool ShowTopoDs_ShapeAIS(Handle(AIS_InteractiveObject) aShape); // 显示模型 bool ShowTopoDs_ShapeAIS(Handle(AIS_InteractiveObject) aShape); // 显示模型
bool RemoveTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 移除模型 bool RemoveTopoDS_Shape(Handle(AIS_InteractiveObject) aShape); // 移除模型
const Handle(AIS_InteractiveContext)& getContext() { return myContext; } const Handle(AIS_InteractiveContext)& getContext() { return myContext; }
const Handle(V3d_Viewer)& getViewer() { return myViewer; } const Handle(V3d_Viewer)& getViewer() { return myViewer; }
void setViewer(const Handle(V3d_Viewer)& theViewer) { myViewer = theViewer; } void setViewer(const Handle(V3d_Viewer)& theViewer) { myViewer = theViewer; }
void SetObjects(const NCollection_Vector<Handle(AIS_InteractiveObject)>& theObjects, Standard_Boolean theDisplayShaded = Standard_False); void SetObjects(const NCollection_Vector<Handle(AIS_InteractiveObject)>& theObjects, Standard_Boolean theDisplayShaded = Standard_False);
void ClearShape(); // 清除模型 void ClearShape(); // 清除模型
bool IsEmpty() const { return myContextIsEmpty; } bool IsEmpty() const { return myContextIsEmpty; }
void AppendCube(); // 增加视觉立方体 void AppendCube(); // 增加视觉立方体
void InitAixs(); // 增加三维坐标轴 void InitAixs(); // 增加三维坐标轴
std::shared_ptr<Bnd_Box> getSenceExtend(); // 场景数据获取 std::shared_ptr<Bnd_Box> getSenceExtend(); // 场景数据获取
std::shared_ptr<Bnd_Box> getSenceExtend(QString name); std::shared_ptr<Bnd_Box> getSenceExtend(QString name);
@ -174,7 +174,7 @@ public slots:
void EdgesSelect3dSample(); void EdgesSelect3dSample();
void FacesSelect3dSample(); void FacesSelect3dSample();
void NeutralPointSelect3dSample(); void NeutralPointSelect3dSample();
//void ShapeModifyShape(OCCTShapeModelNode* dataItem); // 模型修改 //void ShapeModifyShape(OCCTShapeModelNode* dataItem); // 模型修改
@ -186,11 +186,11 @@ public:
TopoDS_Shape MergeCOntextAllModels(); TopoDS_Shape MergeCOntextAllModels();
public slots: // 模型窗口右键菜单 public slots: // 模型窗口右键菜单
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// 获取view窗体中的 选择模型 // 获取view窗体中的 选择模型
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
signals: signals:
void SelectObjectList(const TopoDS_Shape& selectShape); void SelectObjectList(const TopoDS_Shape& selectShape);

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -21,16 +21,16 @@
#include "GeomWidget.h" #include "GeomWidget.h"
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QFrame> #include <QFrame>
#include <QBoxLayout> #include <QBoxLayout>
#include <QTextEdit> #include <QTextEdit>
#include <QStackedLayout> #include <QStackedLayout>
#include <QToolBar> #include <QToolBar>
#include <QStackedWidget> #include <QStackedWidget>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#include <Quantity_Color.hxx> #include <opencascade/Quantity_Color.hxx>
#include <AIS_Shape.hxx> #include <opencascade/AIS_Shape.hxx>
GeomWidget::GeomWidget (DocumentCommon* theDocument3d, QWidget* theParent) GeomWidget::GeomWidget (DocumentCommon* theDocument3d, QWidget* theParent)
@ -41,12 +41,12 @@ GeomWidget::GeomWidget (DocumentCommon* theDocument3d, QWidget* theParent)
aMainLayout->setContentsMargins(0, 0, 0, 0); aMainLayout->setContentsMargins(0, 0, 0, 0);
this->my3dVidget = new QWidget;// 3D模型 显示 this->my3dVidget = new QWidget;// 3D模型 显示
QVBoxLayout* a3dLayout = new QVBoxLayout(my3dVidget); QVBoxLayout* a3dLayout = new QVBoxLayout(my3dVidget);
a3dLayout->setContentsMargins(0, 0, 0, 0); a3dLayout->setContentsMargins(0, 0, 0, 0);
a3dLayout->setSpacing(0); a3dLayout->setSpacing(0);
myView3d = new View(myDocument3d->getContext(), true, my3dVidget); // 创建一个 3D 模型 View myView3d = new View(myDocument3d->getContext(), true, my3dVidget); // 创建一个 3D 模型 View
QToolBar* aToolBar3d = new QToolBar; QToolBar* aToolBar3d = new QToolBar;
aToolBar3d->addActions(myView3d->getViewActions()); aToolBar3d->addActions(myView3d->getViewActions());
@ -90,9 +90,9 @@ void GeomWidget::initEvents()
void GeomWidget::ShowExtend(const TopoDS_Shape& Data_Shape) { void GeomWidget::ShowExtend(const TopoDS_Shape& Data_Shape) {
// 缩放到选定的模型 // 缩放到选定的模型
qDebug() << "缩放到选定的模型"; qDebug() << "缩放到选定的模型";
this->myDocument3d->myContext->FitSelected(this->Get3dView()); // 缩放到选择图层 this->myDocument3d->myContext->FitSelected(this->Get3dView()); // 缩放到选择图层
this->myDocument3d->myContext->ClearSelected(Standard_True); this->myDocument3d->myContext->ClearSelected(Standard_True);
} }

View File

@ -25,19 +25,17 @@
#include "OCCViewer\View.h" #include "OCCViewer\View.h"
#include "OCCViewer\DocumentCommon.h" #include "OCCViewer\DocumentCommon.h"
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <opencascade/Standard_WarningsRestore.hxx>
#include <Standard_WarningsRestore.hxx>
#include <QGLWidget> #include <QGLWidget>
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
#include <QtWidgets> #include <QtWidgets>
#include <QOpenGLWidget> #include <QOpenGLWidget>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <V3d_View.hxx> #include <opencascade/V3d_View.hxx>
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
#include <Graphic3d_GraphicDriver.hxx> #include <opencascade/Graphic3d_GraphicDriver.hxx>
#include <OpenGl_GraphicDriver.hxx> #include <opencascade/OpenGl_GraphicDriver.hxx>
#include <QWidget> #include <QWidget>
#include <QObject> #include <QObject>
//! Qt widget for organize 3D & 2D documents //! Qt widget for organize 3D & 2D documents

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -26,15 +26,15 @@
#include <exception> #include <exception>
#include <stack> #include <stack>
#include <AIS_ViewCube.hxx> #include <opencascade/AIS_ViewCube.hxx>
#include <Message.hxx> #include <opencascade/Message.hxx>
#include <OSD_File.hxx> #include <opencascade/OSD_File.hxx>
#include <OSD_Path.hxx> #include <opencascade/OSD_Path.hxx>
#include <OSD_Protection.hxx> #include <opencascade/OSD_Protection.hxx>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QDir> #include <QDir>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
const TCollection_AsciiString BaseSample::FILE_EXTENSION = "cxx"; const TCollection_AsciiString BaseSample::FILE_EXTENSION = "cxx";

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -24,9 +24,9 @@
#include <sstream> #include <sstream>
#include <AIS_InteractiveObject.hxx> #include <opencascade/AIS_InteractiveObject.hxx>
#include <NCollection_Vector.hxx> #include <opencascade/NCollection_Vector.hxx>
#include <TCollection_AsciiString.hxx> #include <opencascade/TCollection_AsciiString.hxx>
//! Base class for specified category classes //! Base class for specified category classes
class BaseSample: public Standard_Transient class BaseSample: public Standard_Transient

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -20,60 +20,60 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
#include "MakeBottle.h" #include "MakeBottle.h"
#include <opencascade/BRep_Tool.hxx>
#include <BRep_Tool.hxx> #include <opencascade/BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Fuse.hxx> #include <opencascade/BRepBuilderAPI_MakeEdge.hxx>
#include <opencascade/BRepBuilderAPI_MakeFace.hxx>
#include <opencascade/BRepBuilderAPI_MakeWire.hxx>
#include <opencascade/BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx> #include <opencascade/BRepFilletAPI_MakeFillet.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepFilletAPI_MakeFillet.hxx> #include <opencascade/BRepLib.hxx>
#include <BRepLib.hxx> #include <opencascade/BRepOffsetAPI_MakeThickSolid.hxx>
#include <opencascade/BRepOffsetAPI_ThruSections.hxx>
#include <BRepOffsetAPI_MakeThickSolid.hxx> #include <opencascade/BRepPrimAPI_MakeCylinder.hxx>
#include <BRepOffsetAPI_ThruSections.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx> #include <opencascade/GC_MakeArcOfCircle.hxx>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/GC_MakeSegment.hxx>
#include <GC_MakeArcOfCircle.hxx> #include <opencascade/GCE2d_MakeSegment.hxx>
#include <GC_MakeSegment.hxx>
#include <GCE2d_MakeSegment.hxx> #include <opencascade/gp.hxx>
#include <opencascade/gp_Ax1.hxx>
#include <opencascade/gp_Ax2.hxx>
#include <opencascade/gp_Ax2d.hxx>
#include <opencascade/gp_Dir.hxx>
#include <opencascade/gp_Dir2d.hxx>
#include <opencascade/gp_Pnt.hxx>
#include <opencascade/gp_Pnt2d.hxx>
#include <opencascade/gp_Trsf.hxx>
#include <opencascade/gp_Vec.hxx>
#include <gp.hxx> #include <opencascade/Geom_CylindricalSurface.hxx>
#include <gp_Ax1.hxx> #include <opencascade/Geom_Plane.hxx>
#include <gp_Ax2.hxx> #include <opencascade/Geom_Surface.hxx>
#include <gp_Ax2d.hxx> #include <opencascade/Geom_TrimmedCurve.hxx>
#include <gp_Dir.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <Geom_CylindricalSurface.hxx> #include <opencascade/Geom2d_Ellipse.hxx>
#include <Geom_Plane.hxx> #include <opencascade/Geom2d_TrimmedCurve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_Ellipse.hxx> #include <opencascade/TopExp_Explorer.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <TopExp_Explorer.hxx> #include <opencascade/TopoDS.hxx>
#include <opencascade/TopoDS_Edge.hxx>
#include <opencascade/TopoDS_Face.hxx>
#include <opencascade/TopoDS_Wire.hxx>
#include <opencascade/TopoDS_Shape.hxx>
#include <opencascade/TopoDS_Compound.hxx>
#include <TopoDS.hxx> #include <opencascade/TopTools_ListOfShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_ListOfShape.hxx>
TopoDS_Shape MakeBottle (const Standard_Real theWidth, TopoDS_Shape MakeBottle (const Standard_Real theWidth,
const Standard_Real theHeight, const Standard_Real theHeight,
@ -149,7 +149,7 @@ TopoDS_Shape MakeBottle (const Standard_Real theWidth,
for (TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE); aFaceExplorer.More(); aFaceExplorer.Next()) for (TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE); aFaceExplorer.More(); aFaceExplorer.Next())
{ {
TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current()); TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());
// Check if <aFace> is the top face of the bottles neck // Check if <aFace> is the top face of the bottle<EFBFBD>s neck
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
if (aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)) if (aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane))
{ {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -22,8 +22,8 @@
#ifndef MAKEBOTTLE_H #ifndef MAKEBOTTLE_H
#define MAKEBOTTLE_H #define MAKEBOTTLE_H
#include <Standard_Macro.hxx> #include <opencascade/Standard_Macro.hxx>
#include <TopoDS_Shape.hxx> #include <opencascade/TopoDS_Shape.hxx>
//! Returns sample bottle TopoDS_Shape //! Returns sample bottle TopoDS_Shape
TopoDS_Shape MakeBottle(const Standard_Real theWidth, TopoDS_Shape MakeBottle(const Standard_Real theWidth,

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -23,13 +23,13 @@
#include "MakeBottle.h" #include "MakeBottle.h"
#include <AIS_Shape.hxx> #include <opencascade/AIS_Shape.hxx>
#include <AIS_ViewCube.hxx> #include <opencascade/AIS_ViewCube.hxx>
#include <OpenGl_GraphicDriver.hxx> #include <opencascade/OpenGl_GraphicDriver.hxx>
#include <V3d_SpotLight.hxx> #include <opencascade/V3d_SpotLight.hxx>
#include <V3d_PositionalLight.hxx> #include <opencascade/V3d_PositionalLight.hxx>
#include <V3d_DirectionalLight.hxx> #include <opencascade/V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx> #include <opencascade/V3d_AmbientLight.hxx>
void Viewer3dSamples::ExecuteSample(const TCollection_AsciiString& theSampleName) void Viewer3dSamples::ExecuteSample(const TCollection_AsciiString& theSampleName)
{ {
@ -181,28 +181,28 @@ void Viewer3dSamples::ClearLight3dSample()
void Viewer3dSamples::VerticesSelect3dSample() void Viewer3dSamples::VerticesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为:TopAbs_VERTEX"; qDebug() << u8"<EFBFBD>л<EFBFBD>ѡ<EFBFBD><EFBFBD>ģʽΪ<EFBFBD><EFBFBD>TopAbs_VERTEX";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_VERTEX)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_VERTEX));
} }
void Viewer3dSamples::EdgesSelect3dSample() void Viewer3dSamples::EdgesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为:TopAbs_EDGE"; qDebug() << u8"<EFBFBD>л<EFBFBD>ѡ<EFBFBD><EFBFBD>ģʽΪ<EFBFBD><EFBFBD>TopAbs_EDGE";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_EDGE)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_EDGE));
} }
void Viewer3dSamples::FacesSelect3dSample() void Viewer3dSamples::FacesSelect3dSample()
{ {
qDebug() << u8"切换选择模式为:TopAbs_FACE"; qDebug() << u8"<EFBFBD>л<EFBFBD>ѡ<EFBFBD><EFBFBD>ģʽΪ<EFBFBD><EFBFBD>TopAbs_FACE";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(AIS_Shape::SelectionMode(TopAbs_FACE)); myContext->Activate(AIS_Shape::SelectionMode(TopAbs_FACE));
} }
void Viewer3dSamples::NeutralPointSelect3dSample() void Viewer3dSamples::NeutralPointSelect3dSample()
{ {
qDebug() << u8"切换选择模式为:TopAbs_COMPOUND"; qDebug() << u8"<EFBFBD>л<EFBFBD>ѡ<EFBFBD><EFBFBD>ģʽΪ<EFBFBD><EFBFBD>TopAbs_COMPOUND";
myContext->Deactivate(); myContext->Deactivate();
myContext->Activate(TopAbs_COMPOUND); myContext->Activate(TopAbs_COMPOUND);
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -24,8 +24,8 @@
#include "BaseSample.h" #include "BaseSample.h"
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
#include <V3d_View.hxx> #include <opencascade/V3d_View.hxx>
//! Implements viewer 3D samples. //! Implements viewer 3D samples.
class Viewer3dSamples : public BaseSample class Viewer3dSamples : public BaseSample

View File

@ -21,10 +21,10 @@
#include "OcctHighlighter.h" #include "OcctHighlighter.h"
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QFont> #include <QFont>
#include <QStringList> #include <QStringList>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>

View File

@ -22,15 +22,15 @@
#ifndef OCCTHIGHLIGHTER_H #ifndef OCCTHIGHLIGHTER_H
#define OCCTHIGHLIGHTER_H #define OCCTHIGHLIGHTER_H
#include <Standard_Macro.hxx> #include <opencascade/Standard_Macro.hxx>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QRegExp> #include <QRegExp>
#include <QSyntaxHighlighter> #include <QSyntaxHighlighter>
#include <QString> #include <QString>
#include <QTextDocument> #include <QTextDocument>
#include <QTextCharFormat> #include <QTextCharFormat>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QTextDocument; class QTextDocument;

View File

@ -21,9 +21,9 @@
#include "TranslateDialog.h" #include "TranslateDialog.h"
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QGridLayout> #include <QGridLayout>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
TranslateDialog::TranslateDialog(QWidget* parent, Qt::WindowFlags flags, bool modal) TranslateDialog::TranslateDialog(QWidget* parent, Qt::WindowFlags flags, bool modal)
: QFileDialog(parent, flags) : QFileDialog(parent, flags)

View File

@ -22,14 +22,14 @@
#ifndef TRANSLATEDIALOG_H #ifndef TRANSLATEDIALOG_H
#define TRANSLATEDIALOG_H #define TRANSLATEDIALOG_H
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QComboBox> #include <QComboBox>
#include <QFileDialog> #include <QFileDialog>
#include <QList> #include <QList>
#include <QListView> #include <QListView>
#include <QShowEvent> #include <QShowEvent>
#include <QWidget> #include <QWidget>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
//! Qt file dialog for save and restore sample files //! Qt file dialog for save and restore sample files
class TranslateDialog : public QFileDialog class TranslateDialog : public QFileDialog

View File

@ -21,10 +21,10 @@
#include "Transparency.h" #include "Transparency.h"
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
DialogTransparency::DialogTransparency(QWidget* parent) DialogTransparency::DialogTransparency(QWidget* parent)
: QDialog(parent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint) : QDialog(parent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)

View File

@ -23,13 +23,13 @@
#define TRANSPARENCY_H #define TRANSPARENCY_H
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QDialog> #include <QDialog>
#include <QSlider> #include <QSlider>
#include <QWidget> #include <QWidget>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
class QSlider; class QSlider;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2020 OPEN CASCADE SAS // Copyright (c) 2020 OPEN CASCADE SAS
// //
// This file is part of the examples of the Open CASCADE Technology software library. // This file is part of the examples of the Open CASCADE Technology software library.
// //
@ -22,12 +22,12 @@
#if !defined _WIN32 #if !defined _WIN32
#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */ #define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
#endif #endif
#include <AIS_ViewCube.hxx> #include <opencascade/AIS_ViewCube.hxx>
#include "OCCViewer\View.h" #include "OCCViewer\View.h"
#include <OpenGl_GraphicDriver.hxx> #include <opencascade/OpenGl_GraphicDriver.hxx>
#include "Transparency.h" #include "Transparency.h"
#include <WNT_Window.hxx> #include <opencascade/WNT_Window.hxx>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QApplication> #include <QApplication>
#include <QBoxLayout> #include <QBoxLayout>
#include <QFileInfo> #include <QFileInfo>
@ -39,15 +39,15 @@
#include <QPainter> #include <QPainter>
#include <QStyleFactory> #include <QStyleFactory>
#include <QDebug> #include <QDebug>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && QT_VERSION < 0x050000 #if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && QT_VERSION < 0x050000
#include <QX11Info> #include <QX11Info>
#endif #endif
#include <Aspect_DisplayConnection.hxx> #include <opencascade/Aspect_DisplayConnection.hxx>
#include <Graphic3d_GraphicDriver.hxx> #include <opencascade/Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_TextureEnv.hxx> #include <opencascade/Graphic3d_TextureEnv.hxx>
namespace namespace
@ -295,10 +295,10 @@ void View::initializeGL()
myV3dView->ChangeRenderingParams().Method = Graphic3d_RM_RAYTRACING; myV3dView->ChangeRenderingParams().Method = Graphic3d_RM_RAYTRACING;
} }
// 坐标轴 // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//myV3dView->ZBufferTriedronSetup(); //myV3dView->ZBufferTriedronSetup();
qDebug() << u8"初始化三维窗口\n"; qDebug() << u8"<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
} }
void View::resizeGL(int w, int h) void View::resizeGL(int w, int h)
@ -436,40 +436,40 @@ void View::initViewActions()
{ {
if (!myViewActions.empty()) if (!myViewActions.empty())
return; return;
myViewActions[ViewAction_FitAll] = RegisterAction(":/icons/view_fitall.png", tr(u8"缩放全图")); myViewActions[ViewAction_FitAll] = RegisterAction(":/icons/view_fitall.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ"));
connect(myViewActions[ViewAction_FitAll], SIGNAL(triggered()), this, SLOT(fitAll())); connect(myViewActions[ViewAction_FitAll], SIGNAL(triggered()), this, SLOT(fitAll()));
if (myIs3dView) if (myIs3dView)
{ {
myViewActions[ViewAction_Axo] = RegisterAction(":/icons/view_axo.png", tr(u8"视角复位")); myViewActions[ViewAction_Axo] = RegisterAction(":/icons/view_axo.png", tr(u8"<EFBFBD>ӽǸ<EFBFBD>λ"));
connect(myViewActions[ViewAction_Axo], SIGNAL(triggered()), this, SLOT(axo())); connect(myViewActions[ViewAction_Axo], SIGNAL(triggered()), this, SLOT(axo()));
QActionGroup* aShadingActionGroup = new QActionGroup(this); QActionGroup* aShadingActionGroup = new QActionGroup(this);
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr(u8"增加阴影")); QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ"));
connect(aShadingAction, SIGNAL(triggered()), this, SLOT(shading())); connect(aShadingAction, SIGNAL(triggered()), this, SLOT(shading()));
aShadingAction->setCheckable(true); aShadingAction->setCheckable(true);
aShadingActionGroup->addAction(aShadingAction); aShadingActionGroup->addAction(aShadingAction);
myViewActions[ViewAction_Shading] = aShadingAction; myViewActions[ViewAction_Shading] = aShadingAction;
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr(u8"线框模式")); QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr(u8"<EFBFBD>߿<EFBFBD>ģʽ"));
connect(aWireframeAction, SIGNAL(triggered()), this, SLOT(wireframe())); connect(aWireframeAction, SIGNAL(triggered()), this, SLOT(wireframe()));
aWireframeAction->setCheckable(true); aWireframeAction->setCheckable(true);
aShadingActionGroup->addAction(aWireframeAction); aShadingActionGroup->addAction(aWireframeAction);
myViewActions[ViewAction_Wireframe] = aWireframeAction; myViewActions[ViewAction_Wireframe] = aWireframeAction;
QActionGroup* aHlrActionGroup = new QActionGroup(this); QActionGroup* aHlrActionGroup = new QActionGroup(this);
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr(u8"隐藏线框")); QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD>"));
connect(aHlrOffAction, SIGNAL(triggered()), this, SLOT(hlrOff())); connect(aHlrOffAction, SIGNAL(triggered()), this, SLOT(hlrOff()));
aHlrOffAction->setCheckable(true); aHlrOffAction->setCheckable(true);
aHlrActionGroup->addAction(aHlrOffAction); aHlrActionGroup->addAction(aHlrOffAction);
myViewActions[ViewAction_HlrOff] = aHlrOffAction; myViewActions[ViewAction_HlrOff] = aHlrOffAction;
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr(u8"显示线框")); QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr(u8"<EFBFBD><EFBFBD>ʾ<EFBFBD>߿<EFBFBD>"));
connect(aHlrOnAction, SIGNAL(triggered()), this, SLOT(hlrOn())); connect(aHlrOnAction, SIGNAL(triggered()), this, SLOT(hlrOn()));
aHlrOnAction->setCheckable(true); aHlrOnAction->setCheckable(true);
aHlrActionGroup->addAction(aHlrOnAction); aHlrActionGroup->addAction(aHlrOnAction);
myViewActions[ViewAction_HlrOn] = aHlrOnAction; myViewActions[ViewAction_HlrOn] = aHlrOnAction;
QAction* aTransparencyAction = RegisterAction(":/icons/tool_transparency.png", tr(u8"透明度")); QAction* aTransparencyAction = RegisterAction(":/icons/tool_transparency.png", tr(u8"͸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
connect(aTransparencyAction, SIGNAL(triggered()), this, SLOT(onTransparency())); connect(aTransparencyAction, SIGNAL(triggered()), this, SLOT(onTransparency()));
myViewActions[ViewAction_Transparency] = aTransparencyAction; myViewActions[ViewAction_Transparency] = aTransparencyAction;
} }
@ -482,25 +482,25 @@ void View::initRaytraceActions()
return; return;
} }
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr(u8"光线追踪渲染")); QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ"));
connect(aRayTraceAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction())); connect(aRayTraceAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Raytracing] = aRayTraceAction; myRaytraceActions[RaytraceAction_Raytracing] = aRayTraceAction;
aRayTraceAction->setCheckable(true); aRayTraceAction->setCheckable(true);
aRayTraceAction->setChecked(false); aRayTraceAction->setChecked(false);
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr(u8"阴影渲染")); QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr(u8"<EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD>Ⱦ"));
connect(aShadowAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction())); connect(aShadowAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Shadows] = aShadowAction; myRaytraceActions[RaytraceAction_Shadows] = aShadowAction;
aShadowAction->setCheckable(true); aShadowAction->setCheckable(true);
aShadowAction->setChecked(true); aShadowAction->setChecked(true);
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr(u8"发射")); QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
connect(aReflectAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction())); connect(aReflectAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Reflections] = aReflectAction; myRaytraceActions[RaytraceAction_Reflections] = aReflectAction;
aReflectAction->setCheckable(true); aReflectAction->setCheckable(true);
aReflectAction->setChecked(false); aReflectAction->setChecked(false);
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr(u8"抗锯齿")); QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
connect(anAntiAliasingAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction())); connect(anAntiAliasingAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
myRaytraceActions[RaytraceAction_Antialiasing] = anAntiAliasingAction; myRaytraceActions[RaytraceAction_Antialiasing] = anAntiAliasingAction;
anAntiAliasingAction->setCheckable(true); anAntiAliasingAction->setCheckable(true);

View File

@ -26,18 +26,18 @@
#include "AllHead.h" #include "AllHead.h"
#include <functional> #include <functional>
#include <QColor> #include <QColor>
#include <Standard_WarningsDisable.hxx> #include <opencascade/Standard_WarningsDisable.hxx>
#include <QAction> #include <QAction>
#include <QList> #include <QList>
#include <QMenu> #include <QMenu>
#include <QToolBar> #include <QToolBar>
#include <QWidget> #include <QWidget>
#include <Standard_WarningsRestore.hxx> #include <opencascade/Standard_WarningsRestore.hxx>
#include <QOpenGLWidget> #include <QOpenGLWidget>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <AIS_InteractiveContext.hxx> #include <opencascade/AIS_InteractiveContext.hxx>
#include <AIS_ViewController.hxx> #include <opencascade/AIS_ViewController.hxx>
#include <V3d_View.hxx> #include <opencascade/V3d_View.hxx>
#include <qDebug> #include <qDebug>

View File

@ -1,4 +1,4 @@
#include "OcctExportClass.h" #include "OcctExportClass.h"
#include <qDebug> #include <qDebug>
#include <qmessagebox.h> #include <qmessagebox.h>
@ -31,23 +31,23 @@ void OcctExportClass::setDataShape(const TopoDS_Shape & data)
void OcctExportClass::ExportButonClick() { void OcctExportClass::ExportButonClick() {
this->Filepath = this->ui.lineEdit->text(); this->Filepath = this->ui.lineEdit->text();
// 开始保存模型对象 // 开始保存模型对象
QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex()); QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex());
OCCTShapeType type = str2OCCTShapeType(comboxStr); OCCTShapeType type = str2OCCTShapeType(comboxStr);
ui.label_text->setText(u8"数据正在导出中........"); ui.label_text->setText(u8"数据正在导出中........");
SaveTopoDs(this->Filepath, this->Datashape, type); SaveTopoDs(this->Filepath, this->Datashape, type);
QMessageBox::information(this, "info", u8"数据导出成功!!!"); QMessageBox::information(this, "info", u8"数据导出成功!!!");
this->close(); this->close();
} }
void OcctExportClass::SaveButonClick() { void OcctExportClass::SaveButonClick() {
qDebug() << u8"选择导出路径"; qDebug() << u8"选择导出路径";
QString filterStr; QString filterStr;
QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex()); QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex());
OCCTShapeType type = str2OCCTShapeType(comboxStr); OCCTShapeType type = str2OCCTShapeType(comboxStr);
filterStr = getOCCTShapeTypeFilterString(type); filterStr = getOCCTShapeTypeFilterString(type);
QString savePath = getSaveFilePath( QString savePath = getSaveFilePath(
nullptr,QString::fromUtf8(u8"导出路径") ,filterStr); nullptr,QString::fromUtf8(u8"导出路径") ,filterStr);
this->Filepath = savePath; this->Filepath = savePath;
this->ui.lineEdit->setText(this->Filepath); this->ui.lineEdit->setText(this->Filepath);
} }
@ -82,7 +82,7 @@ TopoDS_Shape DialogBatchExport::getMerged()
{ {
std::vector< TopoDS_Shape> dsList; std::vector< TopoDS_Shape> dsList;
// 使用迭代器遍历 QMap 中的元素 // 使用迭代器遍历 QMap 中的元素
QMap<QString, TopoDS_Shape>::const_iterator it; QMap<QString, TopoDS_Shape>::const_iterator it;
for (it = this->Datashapelist.constBegin(); it != this->Datashapelist.constEnd(); ++it) { for (it = this->Datashapelist.constBegin(); it != this->Datashapelist.constEnd(); ++it) {
QString key = it.key(); QString key = it.key();
@ -93,24 +93,24 @@ TopoDS_Shape DialogBatchExport::getMerged()
} }
void DialogBatchExport::ExportButonClick() { void DialogBatchExport::ExportButonClick() {
// 分批 // 分批
QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex()); QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex());
OCCTShapeType type = str2OCCTShapeType(comboxStr); OCCTShapeType type = str2OCCTShapeType(comboxStr);
ui.label_text->setText(u8"数据正在导出中........"); ui.label_text->setText(u8"数据正在导出中........");
this->Filepath = this->ui.lineEdit->text(); this->Filepath = this->ui.lineEdit->text();
if (this->Filepath.isEmpty()) { if (this->Filepath.isEmpty()) {
QMessageBox::warning(this, "warning", u8"没有选中文件夹"); QMessageBox::warning(this, "warning", u8"没有选中文件夹");
return; return;
} }
else { else {
if (this->ui.radioButton_Split->isChecked()) { // 分批导出文件 if (this->ui.radioButton_Split->isChecked()) { // 分批导出文件
// 使用迭代器遍历 QMap 中的元素 // 使用迭代器遍历 QMap 中的元素
QMap<QString, TopoDS_Shape>::const_iterator it; QMap<QString, TopoDS_Shape>::const_iterator it;
for (it = this->Datashapelist.constBegin(); it != this->Datashapelist.constEnd(); ++it) { for (it = this->Datashapelist.constBegin(); it != this->Datashapelist.constEnd(); ++it) {
QString key = it.key(); QString key = it.key();
TopoDS_Shape value = it.value(); TopoDS_Shape value = it.value();
QMessageBox::information(this, "info", u8"数据导出成功!!!"); QMessageBox::information(this, "info", u8"数据导出成功!!!");
QString saveResultPath= QDir::cleanPath(this->Filepath +"\\" + key); QString saveResultPath= QDir::cleanPath(this->Filepath +"\\" + key);
SaveTopoDs(saveResultPath, value, type); SaveTopoDs(saveResultPath, value, type);
} }
@ -125,44 +125,44 @@ void DialogBatchExport::ExportButonClick() {
void DialogBatchExport::SaveButonClick() void DialogBatchExport::SaveButonClick()
{ {
qDebug() << u8"选择导出路径"; qDebug() << u8"选择导出路径";
if (this->ui.radioButton_Split->isChecked()) { // 分批导出文件 if (this->ui.radioButton_Split->isChecked()) { // 分批导出文件
// 弹出选择文件夹的对话框 // 弹出选择文件夹的对话框
QString selectedDirectory = QFileDialog::getExistingDirectory(nullptr, QString selectedDirectory = QFileDialog::getExistingDirectory(nullptr,
"选择文件夹", "选择文件夹",
".", ".",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
// 用户点击了选择文件夹按钮 // 用户点击了选择文件夹按钮
if (!selectedDirectory.isEmpty()) { if (!selectedDirectory.isEmpty()) {
qDebug() << "文件夹路径是:" << selectedDirectory; qDebug() << "文件夹路径是:" << selectedDirectory;
this->Filepath = selectedDirectory; this->Filepath = selectedDirectory;
} }
else { else {
QMessageBox::warning(this, "warning", u8"没有选中文件夹"); QMessageBox::warning(this, "warning", u8"没有选中文件夹");
qDebug() << "取消文件夹操作。"; qDebug() << "取消文件夹操作。";
this->Filepath.clear(); this->Filepath.clear();
return; return;
} }
} }
else { // 选择合并文件 else { // 选择合并文件
QString filterStr; QString filterStr;
QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex()); QString comboxStr = ui.comboBox->itemText(ui.comboBox->currentIndex());
OCCTShapeType type = str2OCCTShapeType(comboxStr); OCCTShapeType type = str2OCCTShapeType(comboxStr);
filterStr = getOCCTShapeTypeFilterString(type); filterStr = getOCCTShapeTypeFilterString(type);
QString savePath = getSaveFilePath( QString savePath = getSaveFilePath(
nullptr, QString::fromUtf8(u8"合并模型导出路径"), filterStr); nullptr, QString::fromUtf8(u8"合并模型导出路径"), filterStr);
// 用户点击了选择文件夹按钮 // 用户点击了选择文件夹按钮
if (!savePath.isEmpty()) { if (!savePath.isEmpty()) {
qDebug() << "文件夹路径是:" << savePath; qDebug() << "文件夹路径是:" << savePath;
this->Filepath = savePath; this->Filepath = savePath;
} }
else { else {
QMessageBox::warning(this, "warning", u8"没有选中文件夹"); QMessageBox::warning(this, "warning", u8"没有选中文件夹");
qDebug() << "取消文件夹操作。"; qDebug() << "取消文件夹操作。";
this->Filepath.clear(); this->Filepath.clear();
return; return;
} }

View File

@ -1,4 +1,4 @@
#include "BasePCL.h" #include "BasePCL.h"
#include <pcl/io/vtk_io.h> #include <pcl/io/vtk_io.h>
#include <QColor> #include <QColor>
#include <QColorDialog> #include <QColorDialog>
@ -9,7 +9,7 @@
#include <QTextList> #include <QTextList>
#include <QTextStream> #include <QTextStream>
#include <QVTKOpenGLNativeWidget.h> #include <QVTKOpenGLNativeWidget.h>
#include <vtk-9.2/vtkGenericOpenGLRenderWindow.h> #include <vtkGenericOpenGLRenderWindow.h>
#include <pcl/io/vtk_io.h> #include <pcl/io/vtk_io.h>
#include <iostream> #include <iostream>
#include <pcl/common/common.h> #include <pcl/common/common.h>
@ -27,7 +27,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -44,17 +44,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -62,8 +62,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -71,12 +71,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -98,7 +98,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
// PCL 基础操作 // PCL 基础操作
#include <io.h> #include <io.h>
#include <pcl/io/vtk_io.h> #include <pcl/io/vtk_io.h>
#include <QColor> #include <QColor>
@ -31,7 +31,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -48,17 +48,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -66,8 +66,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -75,12 +75,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -102,7 +102,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -116,7 +116,7 @@
// Visualization Toolkit (VTK) // Visualization Toolkit (VTK)
#include <vtkRenderWindow.h> #include <vtkRenderWindow.h>
//使用的点云格式 //使用的点云格式

View File

@ -1,4 +1,4 @@
#include "PointCloudAlg.h" #include "PointCloudAlg.h"
#include <QAction> #include <QAction>
#include <QCloseEvent> #include <QCloseEvent>
#include <QColor> #include <QColor>
@ -27,7 +27,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QApplication> #include <QApplication>
#include <QDateTime> //添加QDateTime头文件 #include <QDateTime> //添加QDateTime头文件
#include <QMovie> #include <QMovie>
#include <QPixmap> #include <QPixmap>
#include <QSplashScreen> #include <QSplashScreen>
@ -51,7 +51,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -68,17 +68,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -86,8 +86,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -95,12 +95,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -122,7 +122,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -139,10 +139,10 @@
#include "BasePCL.h" #include "BasePCL.h"
// //
// //
//// 构建 //// 构建
void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals) void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals)
{ {
//----------------法线估计------------------------- //----------------法线估计-------------------------
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in(new pcl::PointCloud<pcl::PointXYZ>);
pcl::copyPointCloud(*cloud, *cloud_in); pcl::copyPointCloud(*cloud, *cloud_in);
@ -159,7 +159,7 @@ void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointC
} }
// //
///* ///*
// 下采样 // 下采样
//*/ //*/
void downSampling(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, void downSampling(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered,
@ -176,7 +176,7 @@ void downSampling(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
}; };
/* /*
*/ */
void GenerateGaussNoise(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& cloud, void GenerateGaussNoise(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& cloud,
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& noise_cloud, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& noise_cloud,
@ -184,14 +184,14 @@ void GenerateGaussNoise(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& cloud,
double sigma ) double sigma )
{ {
noise_cloud->points.resize( noise_cloud->points.resize(
cloud->points.size()); //将点云cloud的size赋值给噪声 cloud->points.size()); //将点云cloud的size赋值给噪声
noise_cloud->header = cloud->header; noise_cloud->header = cloud->header;
noise_cloud->width = cloud->width; noise_cloud->width = cloud->width;
noise_cloud->height = cloud->height; noise_cloud->height = cloud->height;
boost::mt19937 my_seed; // 随机数生成 boost::mt19937 my_seed; // 随机数生成
my_seed.seed(static_cast<unsigned int>(time(0))); my_seed.seed(static_cast<unsigned int>(time(0)));
boost::normal_distribution<> nd( boost::normal_distribution<> nd(
miu, sigma); // 创建一个有特定期望值和标准差的正态分布: miu, sigma); // 创建一个有特定期望值和标准差的正态分布:
boost::variate_generator<boost::mt19937&, boost::normal_distribution<>> ok( boost::variate_generator<boost::mt19937&, boost::normal_distribution<>> ok(
my_seed, nd); my_seed, nd);
for (size_t i = 0; i < cloud->size(); ++i) { for (size_t i = 0; i < cloud->size(); ++i) {
@ -202,7 +202,7 @@ void GenerateGaussNoise(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr& cloud,
}; };
/* /*
*/ */
void gaussian_filter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, void gaussian_filter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
@ -257,8 +257,8 @@ void bilateralFilter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input,
fbf.filter(*output); fbf.filter(*output);
}; };
/* /*
: :
*/ */
void radius_filter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, void radius_filter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered,
@ -268,16 +268,16 @@ void radius_filter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
{ {
pcl::RadiusOutlierRemoval<pcl::PointXYZRGBA> sor; pcl::RadiusOutlierRemoval<pcl::PointXYZRGBA> sor;
sor.setInputCloud(cloud); sor.setInputCloud(cloud);
sor.setRadiusSearch(RadiusSearch); //设置半径为0.04m的范围内找临近点 sor.setRadiusSearch(RadiusSearch); //设置半径为0.04m的范围内找临近点
sor.setMinNeighborsInRadius(minNearSearch); //设置查询点的邻域点集数小于2的删除 sor.setMinNeighborsInRadius(minNearSearch); //设置查询点的邻域点集数小于2的删除
sor.filter(*cloud_filtered); // sor.filter(*cloud_filtered); //
sor.setNegative(true); //以获取离群点数据(也就是原本滤除掉的点) sor.setNegative(true); //以获取离群点数据(也就是原本滤除掉的点)
sor.filter(*cloud_filtered_out); sor.filter(*cloud_filtered_out);
}; };
/* /*
: :
*/ */
void statistical_filter( void statistical_filter(
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud,
@ -286,13 +286,13 @@ void statistical_filter(
int meanK , int meanK ,
double StddevThresh) double StddevThresh)
{ {
// 创建滤波器对象 // 创建滤波器对象
pcl::StatisticalOutlierRemoval<pcl::PointXYZRGBA> sor; pcl::StatisticalOutlierRemoval<pcl::PointXYZRGBA> sor;
sor.setInputCloud(cloud); //设置待滤波的点云 sor.setInputCloud(cloud); //设置待滤波的点云
sor.setMeanK(meanK); //设置在进行统计时考虑查询点邻居点数K个最近邻点 sor.setMeanK(meanK); //设置在进行统计时考虑查询点邻居点数K个最近邻点
sor.setStddevMulThresh(StddevThresh); //设置判断是否为离群点的阈值 sor.setStddevMulThresh(StddevThresh); //设置判断是否为离群点的阈值
sor.filter(*cloud_filtered); //将滤波结果保存在cloud_filtered中 sor.filter(*cloud_filtered); //将滤波结果保存在cloud_filtered中
sor.setNegative(true); //以获取离群点数据(也就是原本滤除掉的点) sor.setNegative(true); //以获取离群点数据(也就是原本滤除掉的点)
sor.filter(*cloud_filtered_out); sor.filter(*cloud_filtered_out);
// writer.write<PointTRGBA>("table_scene_lms400_outliers.pcd", // writer.write<PointTRGBA>("table_scene_lms400_outliers.pcd",
// *cloud_filtered, false); // *cloud_filtered, false);
@ -301,7 +301,7 @@ void statistical_filter(
// //
///************************************************************************/ ///************************************************************************/
///* 表面重建 */ ///* 表面重建 */
///************************************************************************/ ///************************************************************************/
// //
//void MLS(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_in, //void MLS(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_in,
@ -309,18 +309,18 @@ void statistical_filter(
//{ //{
// qDebug() << "MLS alg module:" << cloud_in->points.size(); // qDebug() << "MLS alg module:" << cloud_in->points.size();
// //
// pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGBA>); // 创建一个KD树 // pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGBA>); // 创建一个KD树
// // 输出文件中有PointNormal类型用来存储移动最小二乘法算出的法线 // // 输出文件中有PointNormal类型用来存储移动最小二乘法算出的法线
// // pcl::PointCloud<pcl::PointNormal> mls_points; // // pcl::PointCloud<pcl::PointNormal> mls_points;
// // 定义对象 (第二种定义类型是为了存储法线, 即使用不到也需要定义出来) // // 定义对象 (第二种定义类型是为了存储法线, 即使用不到也需要定义出来)
// pcl::MovingLeastSquares<pcl::PointXYZRGBA, pcl::PointNormal> mls; // pcl::MovingLeastSquares<pcl::PointXYZRGBA, pcl::PointNormal> mls;
// mls.setComputeNormals(true); // mls.setComputeNormals(true);
// //设置参数 // //设置参数
// mls.setInputCloud(cloud_in); // mls.setInputCloud(cloud_in);
// mls.setPolynomialOrder(5); // 在未设置拟合阶数时默认阶数是2 // mls.setPolynomialOrder(5); // 在未设置拟合阶数时默认阶数是2
// mls.setSearchMethod(tree); // mls.setSearchMethod(tree);
// mls.setSearchRadius(0.005); // mls.setSearchRadius(0.005);
// // 曲面重建 // // 曲面重建
// mls.process(*cloud_with_normals); // mls.process(*cloud_with_normals);
// qDebug() << "MLS alg module over:" << cloud_with_normals->points.size(); // qDebug() << "MLS alg module over:" << cloud_with_normals->points.size();
//}; //};
@ -332,30 +332,30 @@ void statistical_filter(
// float SamplesPerNode, // float SamplesPerNode,
// int SolverDivide) // int SolverDivide)
//{ //{
// //------------泊松重建----------------------------- // //------------泊松重建-----------------------------
// pcl::search::KdTree<pcl::PointNormal>::Ptr tree2( new pcl::search::KdTree<pcl::PointNormal>); // pcl::search::KdTree<pcl::PointNormal>::Ptr tree2( new pcl::search::KdTree<pcl::PointNormal>);
// tree2->setInputCloud(cloud_with_normals); // tree2->setInputCloud(cloud_with_normals);
// pcl::Poisson<pcl::PointNormal> pn; // pcl::Poisson<pcl::PointNormal> pn;
// pn.setConfidence(false); //是否使用法向量的大小作为置信信息。如果false所有法向量均归一化。 // pn.setConfidence(false); //是否使用法向量的大小作为置信信息。如果false所有法向量均归一化。
// pn.setDegree(Degree); //设置参数degree[1,5],值越大越精细,耗时越久。 // pn.setDegree(Degree); //设置参数degree[1,5],值越大越精细,耗时越久。
// pn.setDepth(Depth); //树的最大深度求解2^d x 2^d x 2^d立方体元。 // pn.setDepth(Depth); //树的最大深度求解2^d x 2^d x 2^d立方体元。
// // 由于八叉树自适应采样密度,指定值仅为最大深度。 // // 由于八叉树自适应采样密度,指定值仅为最大深度。
// //
// pn.setIsoDivide(IsoDivide); //用于提取ISO等值面的算法的深度 // pn.setIsoDivide(IsoDivide); //用于提取ISO等值面的算法的深度
// pn.setManifold(false); //是否添加多边形的重心,当多边形三角化时。 // pn.setManifold(false); //是否添加多边形的重心,当多边形三角化时。
// // 设置流行标志如果设置为true则对多边形进行细分三角话时添加重心设置false则不添加 // // 设置流行标志如果设置为true则对多边形进行细分三角话时添加重心设置false则不添加
// pn.setOutputPolygons(false); //是否输出多边形网格(而不是三角化移动立方体的结果) // pn.setOutputPolygons(false); //是否输出多边形网格(而不是三角化移动立方体的结果)
// pn.setSamplesPerNode(SamplesPerNode); //设置落入一个八叉树结点中的样本点的最小数量。无噪声,[1.0-5.0],有噪声[15.-20.]平滑 // pn.setSamplesPerNode(SamplesPerNode); //设置落入一个八叉树结点中的样本点的最小数量。无噪声,[1.0-5.0],有噪声[15.-20.]平滑
// pn.setScale(1); //设置用于重构的立方体直径和样本边界立方体直径的比率。 // pn.setScale(1); //设置用于重构的立方体直径和样本边界立方体直径的比率。
// pn.setSolverDivide(SolverDivide); //设置求解线性方程组的Gauss-Seidel迭代方法的深度 // pn.setSolverDivide(SolverDivide); //设置求解线性方程组的Gauss-Seidel迭代方法的深度
// // pn.setIndices(); // // pn.setIndices();
// //
// //设置搜索方法和输入点云 // //设置搜索方法和输入点云
// pn.setSearchMethod(tree2); // pn.setSearchMethod(tree2);
// pn.setInputCloud(cloud_with_normals); // pn.setInputCloud(cloud_with_normals);
// pn.performReconstruction(mesh); // pn.performReconstruction(mesh);
//}; //};
//// 贪婪三角网 //// 贪婪三角网
void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
pcl::PolygonMesh& mesh, pcl::PolygonMesh& mesh,
double SearchRadius , double SearchRadius ,
@ -366,33 +366,33 @@ void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
double MaximumAngle) double MaximumAngle)
{ {
qDebug() << "[GP ]The number of points :" << cloud_with_normals->points.size(); qDebug() << "[GP ]The number of points :" << cloud_with_normals->points.size();
//------------------定义搜索树对象------------------------ //------------------定义搜索树对象------------------------
pcl::search::KdTree<pcl::PointNormal>::Ptr tree2( pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(
new pcl::search::KdTree<pcl::PointNormal>); new pcl::search::KdTree<pcl::PointNormal>);
tree2->setInputCloud(cloud_with_normals); tree2->setInputCloud(cloud_with_normals);
//------------------贪婪投影三角化------------------ //------------------贪婪投影三角化------------------
pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; //定义三角化对象 pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3; //定义三角化对象
gp3.setSearchRadius(SearchRadius); //设置连接点之间的最大距离(即三角形的最大边长) gp3.setSearchRadius(SearchRadius); //设置连接点之间的最大距离(即三角形的最大边长)
gp3.setMu(Mu); //设置被样本点搜索其临近点的最远距离,为了适应点云密度的变化 gp3.setMu(Mu); //设置被样本点搜索其临近点的最远距离,为了适应点云密度的变化
gp3.setMaximumNearestNeighbors(MaximumNearestNeighbors); //设置样本点可搜索的邻域个数 gp3.setMaximumNearestNeighbors(MaximumNearestNeighbors); //设置样本点可搜索的邻域个数
gp3.setMaximumSurfaceAngle(MaximumSurfaceAngle); // 设置某点法线方向偏离样本点法线方向的最大角度 gp3.setMaximumSurfaceAngle(MaximumSurfaceAngle); // 设置某点法线方向偏离样本点法线方向的最大角度
gp3.setMinimumAngle(MinimumAngle); // 设置三角化后得到三角形内角的最小角度 gp3.setMinimumAngle(MinimumAngle); // 设置三角化后得到三角形内角的最小角度
gp3.setMaximumAngle(MaximumAngle); // 设置三角化后得到三角形内角的最大角度 gp3.setMaximumAngle(MaximumAngle); // 设置三角化后得到三角形内角的最大角度
gp3.setNormalConsistency(false); //设置该参数保证法线朝向一致 gp3.setNormalConsistency(false); //设置该参数保证法线朝向一致
//qDebug() << "[GP] start reconstruct :" << cloud_in->points.size(); //qDebug() << "[GP] start reconstruct :" << cloud_in->points.size();
// Get result // Get result
gp3.setInputCloud(cloud_with_normals); //设置输入点云为有向点云 gp3.setInputCloud(cloud_with_normals); //设置输入点云为有向点云
gp3.setSearchMethod(tree2); //设置搜索方式 gp3.setSearchMethod(tree2); //设置搜索方式
gp3.reconstruct(mesh); //重建提取三角化 gp3.reconstruct(mesh); //重建提取三角化
// cout << triangles; // cout << triangles;
// qDebug() << "[GP ] reconstruct process over :" << cloud_in->points.size(); // qDebug() << "[GP ] reconstruct process over :" << cloud_in->points.size();
}; };
// //
////移动立方体 ////移动立方体
//void MC(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PolygonMesh& mesh) //void MC(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PolygonMesh& mesh)
//{ //{
// ////-------------------法线估计---------------------- // ////-------------------法线估计----------------------
// pcl::NormalEstimation<pcl::PointXYZRGBA, pcl::Normal> n; // pcl::NormalEstimation<pcl::PointXYZRGBA, pcl::Normal> n;
// pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>); // pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
// pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree( // pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree(
@ -402,48 +402,48 @@ void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
// n.setSearchMethod(tree); // n.setSearchMethod(tree);
// n.setKSearch(5); // n.setKSearch(5);
// n.compute(*normals); // n.compute(*normals);
// //----------将点云和法线放到一起------------------ // //----------将点云和法线放到一起------------------
// pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals( // pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(
// new pcl::PointCloud<pcl::PointNormal>); // new pcl::PointCloud<pcl::PointNormal>);
// pcl::concatenateFields(*cloud, *normals, *cloud_with_normals); // pcl::concatenateFields(*cloud, *normals, *cloud_with_normals);
// //---------初始化MarchingCubes对象并设置参数------- // //---------初始化MarchingCubes对象并设置参数-------
// pcl::MarchingCubes<pcl::PointNormal>* mc; // pcl::MarchingCubes<pcl::PointNormal>* mc;
// mc = new pcl::MarchingCubesHoppe<pcl::PointNormal>(); // mc = new pcl::MarchingCubesHoppe<pcl::PointNormal>();
// // mc = new pcl::MarchingCubesRBF<pcl::PointNormal>(); // // mc = new pcl::MarchingCubesRBF<pcl::PointNormal>();
// //创建搜索树 // //创建搜索树
// pcl::search::KdTree<pcl::PointNormal>::Ptr tree2( // pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(
// new pcl::search::KdTree<pcl::PointNormal>); // new pcl::search::KdTree<pcl::PointNormal>);
// tree2->setInputCloud(cloud_with_normals); // tree2->setInputCloud(cloud_with_normals);
// mc->setInputCloud(cloud_with_normals); // mc->setInputCloud(cloud_with_normals);
// //设置MarchingCubes对象的参数 // //设置MarchingCubes对象的参数
// mc->setIsoLevel(0.0f); //该方法设置要提取表面的iso级别 // mc->setIsoLevel(0.0f); //该方法设置要提取表面的iso级别
// int resolution = 50; // int resolution = 50;
// mc->setGridResolution( // mc->setGridResolution(
// resolution, resolution, resolution); //用于设置行进立方体网格分辨率 // resolution, resolution, resolution); //用于设置行进立方体网格分辨率
// mc->setPercentageExtendGrid( 0.02); //该参数定义在点云的边框和网格限制之间的网格内应该保留多少自由空间 // mc->setPercentageExtendGrid( 0.02); //该参数定义在点云的边框和网格限制之间的网格内应该保留多少自由空间
// //
// mc->reconstruct(mesh); //执行重构结果保存在mesh中 // mc->reconstruct(mesh); //执行重构结果保存在mesh中
//}; //};
// //
///************************************************************************/ ///************************************************************************/
///* 点云配准算法 */ ///* 点云配准算法 */
///************************************************************************/ ///************************************************************************/
// //
////// 接下来使用的点云指针 ////// 接下来使用的点云指针
////PointCloudT::Ptr cloud_in; // Original point cloud ////PointCloudT::Ptr cloud_in; // Original point cloud
////PointCloudT::Ptr cloud_tr; // Transformed point cloud ////PointCloudT::Ptr cloud_tr; // Transformed point cloud
////PointCloudT::Ptr cloud_RE; // ICP output point cloud ////PointCloudT::Ptr cloud_RE; // ICP output point cloud
//// ////
//////使用配准基类Registration来实现多态 //////使用配准基类Registration来实现多态
////pcl::Registration<PointT, PointT>::Ptr ALIGN; ////pcl::Registration<PointT, PointT>::Ptr ALIGN;
////pcl::IterativeClosestPoint<PointT, PointT>::Ptr icp; ////pcl::IterativeClosestPoint<PointT, PointT>::Ptr icp;
//// ////
//////迭代次数 //////迭代次数
////int iterations = 1; // Default number of ICP iterations ////int iterations = 1; // Default number of ICP iterations
////// bool next_iteration = false; ////// bool next_iteration = false;
// //
///* ///*
// 打印4*4的矩阵 // 打印4*4的矩阵
//*/ //*/
void print4x4Matrix(const Eigen::Matrix4d& matrix) void print4x4Matrix(const Eigen::Matrix4d& matrix)
{ {
@ -463,7 +463,7 @@ void print4x4Matrix(const Eigen::Matrix4d& matrix)
// //
//// TODO //// TODO
///* ///*
// 4*4的矩阵 // 4*4的矩阵
//*/ //*/
QString get4x4MatrixStr(const Eigen::Matrix4d& matrix) QString get4x4MatrixStr(const Eigen::Matrix4d& matrix)
{ {

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <QAction> #include <QAction>
#include <QCloseEvent> #include <QCloseEvent>
@ -28,7 +28,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QApplication> #include <QApplication>
#include <QDateTime> //添加QDateTime头文件 #include <QDateTime> //添加QDateTime头文件
#include <QMovie> #include <QMovie>
#include <QPixmap> #include <QPixmap>
#include <QSplashScreen> #include <QSplashScreen>
@ -52,7 +52,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -69,17 +69,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -87,8 +87,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -96,12 +96,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -123,7 +123,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -142,17 +142,17 @@
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
//// 构建 点法向量 //// 构建 点法向量
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// 构建点云法向量 // 构建点云法向量
void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals); void NormalEstimation(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud, pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// 离群点 + 滤波 // 离群点 + 滤波
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
/* /*
*/ */
void downSampling(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, void downSampling(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered,
@ -160,14 +160,14 @@ void downSampling(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
/* /*
*/ */
void gaussian_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, void gaussian_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered,
double radius); double radius);
/* /*
1 1
*/ */
void bilateralFilter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input, void bilateralFilter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input,
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output,
@ -175,8 +175,8 @@ void bilateralFilter(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr input,
float sigma_r); float sigma_r);
/* /*
: :
*/ */
void radius_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, void radius_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered,
@ -184,8 +184,8 @@ void radius_filter(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
double RadiusSearch=0.015, double RadiusSearch=0.015,
int minNearSearch=35); int minNearSearch=35);
/* /*
: :
*/ */
void statistical_filter( void statistical_filter(
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud,
@ -198,11 +198,11 @@ void statistical_filter(
/************************************************************************/ /************************************************************************/
/* 表面重建 */ /* 表面重建 */
/************************************************************************/ /************************************************************************/
/* /*
*/ */
@ -219,7 +219,7 @@ void Pos(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
int SolverDivide=8 int SolverDivide=8
); );
// 贪婪三角网 // 贪婪三角网
void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals, void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
pcl::PolygonMesh& mesh, pcl::PolygonMesh& mesh,
double SearchRadius=1, double SearchRadius=1,
@ -230,7 +230,7 @@ void GP(pcl::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals,
double MaximumAngle=M_PI/3 double MaximumAngle=M_PI/3
); );
//移动立方体 //移动立方体
void MC(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PolygonMesh& mesh); void MC(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PolygonMesh& mesh);
@ -238,30 +238,30 @@ void MC(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PolygonMesh& mesh);
/************************************************************************/ /************************************************************************/
/* 点云配准算法 */ /* 点云配准算法 */
/************************************************************************/ /************************************************************************/
//// 接下来使用的点云指针 //// 接下来使用的点云指针
//PointCloudT::Ptr cloud_in; // Original point cloud //PointCloudT::Ptr cloud_in; // Original point cloud
//PointCloudT::Ptr cloud_tr; // Transformed point cloud //PointCloudT::Ptr cloud_tr; // Transformed point cloud
//PointCloudT::Ptr cloud_RE; // ICP output point cloud //PointCloudT::Ptr cloud_RE; // ICP output point cloud
// //
////使用配准基类Registration来实现多态 ////使用配准基类Registration来实现多态
//pcl::Registration<PointT, PointT>::Ptr ALIGN; //pcl::Registration<PointT, PointT>::Ptr ALIGN;
//pcl::IterativeClosestPoint<PointT, PointT>::Ptr icp; //pcl::IterativeClosestPoint<PointT, PointT>::Ptr icp;
// //
////迭代次数 ////迭代次数
//int iterations = 1; // Default number of ICP iterations //int iterations = 1; // Default number of ICP iterations
//// bool next_iteration = false; //// bool next_iteration = false;
/* /*
4*4 4*4
*/ */
void print4x4Matrix(const Eigen::Matrix4d& matrix); void print4x4Matrix(const Eigen::Matrix4d& matrix);
// TODO // TODO
/* /*
4*4 4*4
*/ */
QString get4x4MatrixStr(const Eigen::Matrix4d& matrix); QString get4x4MatrixStr(const Eigen::Matrix4d& matrix);

View File

@ -1,4 +1,4 @@
#include "PointManagerClass.h" #include "PointManagerClass.h"
#include <memory> #include <memory>
#include <QAction> #include <QAction>
#include <QCloseEvent> #include <QCloseEvent>
@ -28,7 +28,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QApplication> #include <QApplication>
#include <QDateTime> //添加QDateTime头文件 #include <QDateTime> //添加QDateTime头文件
#include <QMovie> #include <QMovie>
#include <QPixmap> #include <QPixmap>
#include <QSplashScreen> #include <QSplashScreen>
@ -52,7 +52,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -69,17 +69,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -87,8 +87,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -96,12 +96,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -125,7 +125,7 @@
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <pcl/io/vtk_lib_io.h> #include <pcl/io/vtk_lib_io.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -150,28 +150,28 @@ int CloudPointManagerClass::addMeshSTL(QString filepath)
{ {
// 生成点云对象 // 生成点云对象
std::shared_ptr<MeshItemClass> meshItem(new MeshItemClass); std::shared_ptr<MeshItemClass> meshItem(new MeshItemClass);
QFileInfo fileinfo(filepath); QFileInfo fileinfo(filepath);
meshItem->name = fileinfo.fileName();// 文件名 meshItem->name = fileinfo.fileName();// 文件名
meshItem->filepath = filepath; meshItem->filepath = filepath;
meshItem->mesh_ptr.reset(new pcl::PolygonMesh); meshItem->mesh_ptr.reset(new pcl::PolygonMesh);
// 加载STL文件 // 加载STL文件
pcl::PolygonMesh mesh; pcl::PolygonMesh mesh;
pcl::io::loadPolygonFileSTL(filepath.toUtf8().constData(), *(meshItem->mesh_ptr)); // 加载mesh pcl::io::loadPolygonFileSTL(filepath.toUtf8().constData(), *(meshItem->mesh_ptr)); // 加载mesh
// 绑定item // 绑定item
this->DataList.insert(meshItem->name, meshItem); this->DataList.insert(meshItem->name, meshItem);
// 添加到 filelist // 添加到 filelist
QListWidgetItem* item = new QListWidgetItem; QListWidgetItem* item = new QListWidgetItem;
item->setBackground(QBrush(QColor(220, 230, 250))); item->setBackground(QBrush(QColor(220, 230, 250)));
item->setData(Qt::DisplayRole, meshItem->name); item->setData(Qt::DisplayRole, meshItem->name);
item->setData(Qt::CheckStateRole, Qt::Checked); item->setData(Qt::CheckStateRole, Qt::Checked);
this->filelist->addItem(item); this->filelist->addItem(item);
// 添加到渲染 // 添加到渲染
meshItem->ViewerShow(this->viewerPtr); meshItem->ViewerShow(this->viewerPtr);
meshItem->ZoomOnExtend(this->viewerPtr); meshItem->ZoomOnExtend(this->viewerPtr);
return 0; return 0;
@ -225,18 +225,18 @@ void MeshItemClass::ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer)
{ {
pcl::PointXYZ minPt, maxPt; pcl::PointXYZ minPt, maxPt;
// 获取包围盒 // 获取包围盒
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::fromPCLPointCloud2(this->mesh_ptr->cloud, *cloud); pcl::fromPCLPointCloud2(this->mesh_ptr->cloud, *cloud);
pcl::getMinMax3D(*cloud, minPt, maxPt); pcl::getMinMax3D(*cloud, minPt, maxPt);
// 计算点云中心位置和对角线长度 // 计算点云中心位置和对角线长度
Eigen::Vector3f center((maxPt.x + minPt.x) / 2, (maxPt.y + minPt.y) / 2, (maxPt.z + minPt.z) / 2); Eigen::Vector3f center((maxPt.x + minPt.x) / 2, (maxPt.y + minPt.y) / 2, (maxPt.z + minPt.z) / 2);
Eigen::Vector3f diff = maxPt.getVector3fMap() - minPt.getVector3fMap(); Eigen::Vector3f diff = maxPt.getVector3fMap() - minPt.getVector3fMap();
float distance = diff.norm(); float distance = diff.norm();
// 设置相机位置和视角 // 设置相机位置和视角
// (场景中心点的坐标, 摄像机到场景中心点的距离, 摄像机的方向向量) // (场景中心点的坐标, 摄像机到场景中心点的距离, 摄像机的方向向量)
viewer->setCameraPosition(center(0), center(1), center(2) + distance, center(0), center(1), center(2), -0.7, -0.9, 0.2); viewer->setCameraPosition(center(0), center(1), center(2) + distance, center(0), center(1), center(2), -0.7, -0.9, 0.2);
viewer->spin(); viewer->spin();
return; return;
@ -245,8 +245,8 @@ void MeshItemClass::ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer)
void CloudPointItemClass::ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer) void CloudPointItemClass::ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer)
{ {
pcl::visualization::PointCloudColorHandlerRandom<pcl::PointXYZRGBA> RandomColor(this->pointCloud); // 随机给点云生成颜色 pcl::visualization::PointCloudColorHandlerRandom<pcl::PointXYZRGBA> RandomColor(this->pointCloud); // 随机给点云生成颜色
viewer->addPointCloud<pcl::PointXYZRGBA>(this->pointCloud, RandomColor, this->name.toUtf8().constData()); // 添加点云 viewer->addPointCloud<pcl::PointXYZRGBA>(this->pointCloud, RandomColor, this->name.toUtf8().constData()); // 添加点云
viewer->getRenderWindow()->Render(); viewer->getRenderWindow()->Render();
} }
@ -254,13 +254,13 @@ void CloudPointItemClass::ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr vi
{ {
pcl::PointXYZRGBA minPt, maxPt; pcl::PointXYZRGBA minPt, maxPt;
pcl::getMinMax3D(*(this->pointCloud), minPt, maxPt); pcl::getMinMax3D(*(this->pointCloud), minPt, maxPt);
// 计算点云中心位置和对角线长度 // 计算点云中心位置和对角线长度
Eigen::Vector3f center((maxPt.x + minPt.x) / 2, (maxPt.y + minPt.y) / 2, (maxPt.z + minPt.z) / 2); Eigen::Vector3f center((maxPt.x + minPt.x) / 2, (maxPt.y + minPt.y) / 2, (maxPt.z + minPt.z) / 2);
Eigen::Vector3f diff = maxPt.getVector3fMap() - minPt.getVector3fMap(); Eigen::Vector3f diff = maxPt.getVector3fMap() - minPt.getVector3fMap();
float distance = diff.norm(); float distance = diff.norm();
// 设置相机位置和视角 // 设置相机位置和视角
// (场景中心点的坐标, 摄像机到场景中心点的距离, 摄像机的方向向量) // (场景中心点的坐标, 摄像机到场景中心点的距离, 摄像机的方向向量)
viewer->setCameraPosition(center(0), center(1), center(2) + distance, center(0), center(1), center(2), -0.7, -0.9, 0.2); viewer->setCameraPosition(center(0), center(1), center(2) + distance, center(0), center(1), center(2), -0.7, -0.9, 0.2);
viewer->spin(); viewer->spin();
return; return;

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <QAction> #include <QAction>
#include <QCloseEvent> #include <QCloseEvent>
@ -28,7 +28,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QApplication> #include <QApplication>
#include <QDateTime> //添加QDateTime头文件 #include <QDateTime> //添加QDateTime头文件
#include <QMovie> #include <QMovie>
#include <QPixmap> #include <QPixmap>
#include <QSplashScreen> #include <QSplashScreen>
@ -52,7 +52,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -69,17 +69,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -87,8 +87,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -96,12 +96,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -123,7 +123,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -153,21 +153,21 @@ public:
QString filepath; QString filepath;
FileListManagerAbstractItemType itemtype; FileListManagerAbstractItemType itemtype;
public: public:
virtual void ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer); // 虚拟函数 virtual void ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer); // 虚拟函数
virtual void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer); virtual void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer);
virtual FileListManagerAbstractItemType getType(); virtual FileListManagerAbstractItemType getType();
}; };
class CloudPointItemClass :public FileListManagerAbstractItem { // 点云对象 class CloudPointItemClass :public FileListManagerAbstractItem { // 点云对象
public: public:
pcl::PointCloud< pcl::PointXYZRGBA>::Ptr pointCloud; // 点云对象 pcl::PointCloud< pcl::PointXYZRGBA>::Ptr pointCloud; // 点云对象
public: public:
FileListManagerAbstractItemType itemtype = FileListManagerAbstractItemType::PointCloudType; FileListManagerAbstractItemType itemtype = FileListManagerAbstractItemType::PointCloudType;
void ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer) override; void ViewerShow(pcl::visualization::PCLVisualizer::Ptr viewer) override;
void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer) override; void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer) override;
}; };
class MeshItemClass :public FileListManagerAbstractItem { // 网格对象 class MeshItemClass :public FileListManagerAbstractItem { // 网格对象
public: public:
pcl::PolygonMesh::Ptr mesh_ptr; pcl::PolygonMesh::Ptr mesh_ptr;
public: public:
@ -176,20 +176,20 @@ public:
void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer) override; void ZoomOnExtend(pcl::visualization::PCLVisualizer::Ptr viewer) override;
}; };
// 点云状态管理类 // 点云状态管理类
class CloudPointManagerClass : public QObject { class CloudPointManagerClass : public QObject {
Q_OBJECT Q_OBJECT
QMap<QString, std::shared_ptr<FileListManagerAbstractItem>> DataList; // 点云管理对象 QMap<QString, std::shared_ptr<FileListManagerAbstractItem>> DataList; // 点云管理对象
pcl::visualization::PCLVisualizer::Ptr viewerPtr;// 指针 pcl::visualization::PCLVisualizer::Ptr viewerPtr;// 指针
QListWidget* filelist;// 文件列表 QListWidget* filelist;// 文件列表
public: public:
CloudPointManagerClass(QWidget* parent = nullptr); CloudPointManagerClass(QWidget* parent = nullptr);
~CloudPointManagerClass(); ~CloudPointManagerClass();
int bandingViewer(pcl::visualization::PCLVisualizer::Ptr viewerPtr, QListWidget* filelist); // 绑定指针 int bandingViewer(pcl::visualization::PCLVisualizer::Ptr viewerPtr, QListWidget* filelist); // 绑定指针
int addPointCloud(QString filePathWithName, QString formatstr); // 点云数据处理 int addPointCloud(QString filePathWithName, QString formatstr); // 点云数据处理
int addMeshSTL(QString filepath); int addMeshSTL(QString filepath);
int RemovePointCloud(QString name); // 点云数据移除 int RemovePointCloud(QString name); // 点云数据移除
int ZoomOn(QString cloudname); // 缩放到指定点云 int ZoomOn(QString cloudname); // 缩放到指定点云
QStringList getItemNames(); QStringList getItemNames();
std::shared_ptr<FileListManagerAbstractItem> getItemFromName(QString Name); std::shared_ptr<FileListManagerAbstractItem> getItemFromName(QString Name);
std::shared_ptr<CloudPointItemClass> getCloudPointItemFromName(QString Name); std::shared_ptr<CloudPointItemClass> getCloudPointItemFromName(QString Name);

View File

@ -1,4 +1,4 @@
#include "ToolDialog.h" #include "ToolDialog.h"
#include <pcl/io/vtk_lib_io.h> #include <pcl/io/vtk_lib_io.h>
BilateralFilterWindows::BilateralFilterWindows(QWidget* parent):ToolBaseFunClass(parent) BilateralFilterWindows::BilateralFilterWindows(QWidget* parent):ToolBaseFunClass(parent)
@ -20,18 +20,18 @@ BilateralFilterWindows::~BilateralFilterWindows()
} }
// //
// 返回计算结果 ply // 返回计算结果 ply
// //
QString BilateralFilterWindows::ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr) QString BilateralFilterWindows::ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr)
{ {
// 计算点云滤波结果 // 计算点云滤波结果
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output(new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output(new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果
float sigma_s = this->ui.lineEdit_NearSearchNumber->text().toFloat(); // 窗口 float sigma_s = this->ui.lineEdit_NearSearchNumber->text().toFloat(); // 窗口
float sigma_r = this->ui.lineEdit_NearSearchDistance->text().toFloat(); // 标准差 float sigma_r = this->ui.lineEdit_NearSearchDistance->text().toFloat(); // 标准差
//bilateralFilter(pointcloudPtr, output, sigma_s, sigma_r); // 执行滤波 //bilateralFilter(pointcloudPtr, output, sigma_s, sigma_r); // 执行滤波
// 保存滤波结果 // 保存滤波结果
QString save_path = this->ui.lineEdit_savePath->text(); QString save_path = this->ui.lineEdit_savePath->text();
save_path = save_path.trimmed(); save_path = save_path.trimmed();
int flag=pcl::io::savePLYFileBinary(save_path.toUtf8().constData(), *output); int flag=pcl::io::savePLYFileBinary(save_path.toUtf8().constData(), *output);
@ -132,8 +132,8 @@ DialogTriangulationSurfaceMesh::~DialogTriangulationSurfaceMesh()
QString DialogTriangulationSurfaceMesh::ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr) QString DialogTriangulationSurfaceMesh::ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr)
{ {
// 计算点云滤波结果 // 计算点云滤波结果
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr output(new pcl::PointCloud<pcl::PointXYZRGBA>); // 输出结果 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::PointCloud<pcl::PointNormal>::Ptr cloud_with_normals(new pcl::PointCloud<pcl::PointNormal>);
NormalEstimation(pointcloudPtr, cloud_with_normals); NormalEstimation(pointcloudPtr, cloud_with_normals);
@ -154,7 +154,7 @@ QString DialogTriangulationSurfaceMesh::ExcuteCmd(pcl::PointCloud<pcl::PointXYZR
MinimumAngle, MinimumAngle,
MaximumAngle MaximumAngle
); );
// 保存滤波结果 // 保存滤波结果
QString save_path = this->ui.lineEdit_savePath->text(); QString save_path = this->ui.lineEdit_savePath->text();
save_path = save_path.trimmed(); save_path = save_path.trimmed();
int flag = pcl::io::savePolygonFileSTL(save_path.toUtf8().constData(), mesh); int flag = pcl::io::savePolygonFileSTL(save_path.toUtf8().constData(), mesh);
@ -169,8 +169,8 @@ void DialogTriangulationSurfaceMesh::SaveFileSTLButton() {
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this->FileOpenpushButton->parentWidget(), this->FileOpenpushButton->parentWidget(),
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"stl文件 (*.stl)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"stl文件 (*.stl)"));//多组扩展名用双分号";;"隔开
this->lineEdit_savePath->setText(filepath); this->lineEdit_savePath->setText(filepath);
this->saveOk = true; this->saveOk = true;
} }
@ -218,9 +218,9 @@ QString ToolBaseFunClass::getComboxSelect()
void ToolBaseFunClass::SaveFileButton() { void ToolBaseFunClass::SaveFileButton() {
QString filepath = QFileDialog::getSaveFileName( QString filepath = QFileDialog::getSaveFileName(
this->FileOpenpushButton->parentWidget(), this->FileOpenpushButton->parentWidget(),
QString::fromUtf8(u8"另存为"), QString::fromUtf8(u8"另存为"),
QString::fromUtf8(u8"ply文件 (*.ply)"));//多组扩展名用双分号";;"隔开 QString::fromUtf8(u8"ply文件 (*.ply)"));//多组扩展名用双分号";;"隔开
this->lineEdit_savePath->setText(filepath); this->lineEdit_savePath->setText(filepath);
this->saveOk = true; this->saveOk = true;
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <QAction> #include <QAction>
#include <QCloseEvent> #include <QCloseEvent>
#include <QColor> #include <QColor>
@ -27,7 +27,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QApplication> #include <QApplication>
#include <QDateTime> //添加QDateTime头文件 #include <QDateTime> //添加QDateTime头文件
#include <QMovie> #include <QMovie>
#include <QPixmap> #include <QPixmap>
#include <QSplashScreen> #include <QSplashScreen>
@ -52,7 +52,7 @@
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <boost/random.hpp> //随机数 #include <boost/random.hpp> //随机数
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <iostream> #include <iostream>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
@ -69,17 +69,17 @@
#include <pcl/kdtree/kdtree_flann.h> #include <pcl/kdtree/kdtree_flann.h>
#include <pcl/point_cloud.h> #include <pcl/point_cloud.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/registration/ia_fpcs.h> // 4PCS算法 #include <pcl/registration/ia_fpcs.h> // 4PCS算法
#include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件 #include <pcl/registration/ia_kfpcs.h> //K4PCS算法头文件
#include <pcl/registration/icp.h> #include <pcl/registration/icp.h>
#include <pcl/registration/registration.h> #include <pcl/registration/registration.h>
#include <pcl/search/flann_search.h> #include <pcl/search/flann_search.h>
#include <pcl/surface/concave_hull.h> #include <pcl/surface/concave_hull.h>
#include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件 #include <pcl/surface/gp3.h> //贪婪投影三角化算法类定义的头文件
#include <pcl/surface/marching_cubes_hoppe.h> //移动立方体 #include <pcl/surface/marching_cubes_hoppe.h> //移动立方体
#include <pcl/surface/marching_cubes_rbf.h> #include <pcl/surface/marching_cubes_rbf.h>
#include <pcl/surface/mls.h> //MLS #include <pcl/surface/mls.h> //MLS
#include <pcl/surface/poisson.h> //泊松重建 #include <pcl/surface/poisson.h> //泊松重建
#include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/cloud_viewer.h>
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <string> #include <string>
@ -87,8 +87,8 @@
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <pcl/console/time.h> // TicToc #include <pcl/console/time.h> // TicToc
#include <pcl/filters/approximate_voxel_grid.h> // 体素滤波 #include <pcl/filters/approximate_voxel_grid.h> // 体素滤波
#include <pcl/filters/voxel_grid.h> // 体素滤波 #include <pcl/filters/voxel_grid.h> // 体素滤波
#include <vtkOutputWindow.h> #include <vtkOutputWindow.h>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -96,12 +96,12 @@
#include <pcl/filters/extract_indices.h> #include <pcl/filters/extract_indices.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/point_types.h> #include <pcl/point_types.h>
#include <pcl/sample_consensus/method_types.h> //随机参数估计方法 #include <pcl/sample_consensus/method_types.h> //随机参数估计方法
#include <pcl/sample_consensus/model_types.h> //模型定义 #include <pcl/sample_consensus/model_types.h> //模型定义
#include <pcl/segmentation/sac_segmentation.h> //RANSAC分割 #include <pcl/segmentation/sac_segmentation.h> //RANSAC分割
#include <pcl/visualization/pcl_visualizer.h> #include <pcl/visualization/pcl_visualizer.h>
#include <sstream> #include <sstream>
#include <stdlib.h> //rand()头文件 #include <stdlib.h> //rand()头文件
#include <vtkMassProperties.h> #include <vtkMassProperties.h>
#include <vtkPLYReader.h> #include <vtkPLYReader.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
@ -123,7 +123,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
//可视化相关头文件 //可视化相关头文件
#include <vtkActor.h> #include <vtkActor.h>
#include <vtkAutoInit.h> #include <vtkAutoInit.h>
#include <vtkInteractorStyleTrackballCamera.h> #include <vtkInteractorStyleTrackballCamera.h>
@ -140,7 +140,7 @@
#include "BasePCL.h" #include "BasePCL.h"
#include "PointCloudAlg.h" #include "PointCloudAlg.h"
// 工具窗口 // 工具窗口
#include "ui_BilateralFilterWindows.h" #include "ui_BilateralFilterWindows.h"
#include "ui_MedianFilterWindows.h" #include "ui_MedianFilterWindows.h"
@ -152,16 +152,16 @@
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
// 公用方法 // 公用方法
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
class ToolBaseFunClass:public QDialog class ToolBaseFunClass:public QDialog
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QLineEdit* lineEdit_savePath; QLineEdit* lineEdit_savePath;
QComboBox* comboBox_clouldName; QComboBox* comboBox_clouldName;
QPushButton* FileOpenpushButton; QPushButton* FileOpenpushButton;
bool isok=false; // 是否执行 bool isok=false; // 是否执行
bool saveOk = false; bool saveOk = false;
public: public:
ToolBaseFunClass(QWidget* parent = nullptr); ToolBaseFunClass(QWidget* parent = nullptr);
@ -180,12 +180,12 @@ public slots:
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// 参数窗口 // 参数窗口
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
class BilateralFilterWindows : public ToolBaseFunClass class BilateralFilterWindows : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;
@ -195,7 +195,7 @@ public:
BilateralFilterWindows(QWidget* parent = nullptr); BilateralFilterWindows(QWidget* parent = nullptr);
~BilateralFilterWindows(); ~BilateralFilterWindows();
// 执行操作 // 执行操作
QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr); QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr);
private: private:
@ -207,7 +207,7 @@ private:
class MedianFilterWindows : public ToolBaseFunClass class MedianFilterWindows : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;
@ -225,7 +225,7 @@ private:
class RadiusOutlierRemovalWindows : public ToolBaseFunClass class RadiusOutlierRemovalWindows : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;
@ -242,7 +242,7 @@ private:
class StatisticalOutlierRemovalWindows : public ToolBaseFunClass class StatisticalOutlierRemovalWindows : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;
@ -260,7 +260,7 @@ private:
class DialogTriangulationSurfaceMesh : public ToolBaseFunClass class DialogTriangulationSurfaceMesh : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;
@ -269,7 +269,7 @@ public:
public: public:
DialogTriangulationSurfaceMesh(QWidget* parent = nullptr); DialogTriangulationSurfaceMesh(QWidget* parent = nullptr);
~DialogTriangulationSurfaceMesh(); ~DialogTriangulationSurfaceMesh();
// 执行操作 // 执行操作
QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr); QString ExcuteCmd(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudPtr);
private: private:
Ui::DialogTriangulationSurfaceMeshDialog ui; Ui::DialogTriangulationSurfaceMeshDialog ui;
@ -281,7 +281,7 @@ public slots:
class PoissonReSurfaceWindows : public ToolBaseFunClass class PoissonReSurfaceWindows : public ToolBaseFunClass
{ {
Q_OBJECT // 每个子类必须使用这个宏 Q_OBJECT // 每个子类必须使用这个宏
public: public:
QString TaskXmlPath; QString TaskXmlPath;

View File

@ -1,4 +1,4 @@
#include "inputdialog.h" #include "inputdialog.h"
#include "ui_inputdialog.h" #include "ui_inputdialog.h"
inputDialog::inputDialog(QWidget *parent) : inputDialog::inputDialog(QWidget *parent) :

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#ifndef INPUTDIALOG_H #ifndef INPUTDIALOG_H
#define INPUTDIALOG_H #define INPUTDIALOG_H

View File

@ -11,7 +11,7 @@
#include <QTextList> #include <QTextList>
#include <QTextStream> #include <QTextStream>
#include <QVTKOpenGLNativeWidget.h> #include <QVTKOpenGLNativeWidget.h>
#include <vtk-9.2/vtkGenericOpenGLRenderWindow.h> #include <vtkGenericOpenGLRenderWindow.h>
#include <pcl/io/vtk_io.h> #include <pcl/io/vtk_io.h>
#include <iostream> #include <iostream>
#include <ostream> #include <ostream>

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
/////////////////////////// ///////////////////////////
// 系统环境变量类 // 系统环境变量类
////////////////////////// //////////////////////////
#ifndef PROGRAMPARAMLOADINGCLASS_H #ifndef PROGRAMPARAMLOADINGCLASS_H
@ -10,8 +10,8 @@
class ProgramParamLoadingClass class ProgramParamLoadingClass
{ {
public: public:
QString programName ; // 程序名称 QString programName ; // 程序名称
QString lastFilePath ; // 上次打开的文件路径 QString lastFilePath ; // 上次打开的文件路径
}; };

View File

@ -1,4 +1,4 @@
#include "QConsoleCommandAction.h" #include "QConsoleCommandAction.h"
@ -11,7 +11,7 @@ void BandingModelPrcessAndQConsoleWidget(ModelProcess* w)
void OpenQConsoleWidgetFromModelProcess(ModelProcess* w) void OpenQConsoleWidgetFromModelProcess(ModelProcess* w)
{ {
// 初始化命令行控制台 // 初始化命令行控制台
QConsoleWidget* console = new QConsoleWidget(); QConsoleWidget* console = new QConsoleWidget();
console->setModelProcess(w); console->setModelProcess(w);
} }

View File

@ -1,4 +1,4 @@
#include "QConsoleWidget.h" #include "QConsoleWidget.h"
#include "QConsoleIODevice.h" #include "QConsoleIODevice.h"
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
@ -19,18 +19,18 @@
void QConsoleWidget::setModelProcess(ModelProcess* app) void QConsoleWidget::setModelProcess(ModelProcess* app)
{ {
this->application = app; this->application = app;
// 创建dockerWidget // 创建dockerWidget
qDebug() << u8"initCommandDocker,等待初始化命令行窗口"; qDebug() << u8"initCommandDocker,等待初始化命令行窗口";
QDockWidget* dockWidget_command = this->application->getdockWidget_command(u8"命令行窗口"); QDockWidget* dockWidget_command = this->application->getdockWidget_command(u8"命令行窗口");
dockWidget_command->setHidden(false); dockWidget_command->setHidden(false);
dockWidget_command->setWidget(this); dockWidget_command->setWidget(this);
this->qs = new ScriptSession(this); // 创建脚本 this->qs = new ScriptSession(this); // 创建脚本
QTimer::singleShot(200,qs, SLOT(REPL())); QTimer::singleShot(200,qs, SLOT(REPL()));
// 绑定application // 绑定application
//this->qs->settingApplication() //this->qs->settingApplication()
this->qs->settingApplication(this->application); this->qs->settingApplication(this->application);
qDebug() << u8"initCommandDocker,结束初始化命令行窗口"; qDebug() << u8"initCommandDocker,结束初始化命令行窗口";
} }
QConsoleWidget::QConsoleWidget(QWidget* parent) QConsoleWidget::QConsoleWidget(QWidget* parent)

View File

@ -0,0 +1,10 @@
#include "QtEchoExportWindows.h"
QtEchoExportWindows::QtEchoExportWindows(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
QtEchoExportWindows::~QtEchoExportWindows()
{}

View File

@ -0,0 +1,16 @@
#pragma once
#include <QMainWindow>
#include "ui_QtEchoExportWindows.h"
class QtEchoExportWindows : public QMainWindow
{
Q_OBJECT
public:
QtEchoExportWindows(QWidget *parent = nullptr);
~QtEchoExportWindows();
private:
Ui::QtEchoExportWindowsClass ui;
};

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Form</class> <class>QtEchoExportWindowsClass</class>
<widget class="QWidget" name="Form"> <widget class="QWidget" name="QtEchoExportWindowsClass">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@ -1,17 +1,17 @@
#include "QtFreqParamsSetting.h" #include "QtFreqParamsSetting.h"
QtFreqParamsSetting::QtFreqParamsSetting(QWidget* parent) QtFreqParamsSetting::QtFreqParamsSetting(QWidget* parent)
: QWidget(parent) : QWidget(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
QDoubleValidator* validator = new QDoubleValidator(); // 限制参数 QDoubleValidator* validator = new QDoubleValidator(); // 限制参数
this->ui.lineEdit_centerfreq->setValidator(validator); this->ui.lineEdit_centerfreq->setValidator(validator);
this->ui.lineEdit_bandwidth->setValidator(validator); this->ui.lineEdit_bandwidth->setValidator(validator);
this->ui.lineEdit_Resolution->setValidator(validator); this->ui.lineEdit_Resolution->setValidator(validator);
this->ui.lineEdit_SenceRange->setValidator(validator); this->ui.lineEdit_SenceRange->setValidator(validator);
// 初始化 // 初始化
ui.lineEdit_centerfreq->setText(u8"9.6"); ui.lineEdit_centerfreq->setText(u8"9.6");
ui.lineEdit_bandwidth->setText(u8"0.8"); ui.lineEdit_bandwidth->setText(u8"0.8");
ui.lineEdit_Resolution->setText(u8"1.0"); ui.lineEdit_Resolution->setText(u8"1.0");
@ -36,9 +36,9 @@ void QtFreqParamsSetting::CalcFreqParams()
double senceRange = 1; double senceRange = 1;
{ // 检查参数 { // 检查参数
if (centerfreq_str.isEmpty()) { if (centerfreq_str.isEmpty()) {
QMessageBox::warning(this, u8"警告", u8"中心频率不能为空"); QMessageBox::warning(this, u8"警告", u8"中心频率不能为空");
return; return;
} }
else { else {
@ -46,7 +46,7 @@ void QtFreqParamsSetting::CalcFreqParams()
} }
if (senceRange_str.isEmpty()) { if (senceRange_str.isEmpty()) {
QMessageBox::warning(this, u8"警告", u8"距离场景最小值不能为空"); QMessageBox::warning(this, u8"警告", u8"距离场景最小值不能为空");
return; return;
} }
else { else {
@ -54,7 +54,7 @@ void QtFreqParamsSetting::CalcFreqParams()
} }
if (resolution_str.isEmpty() && resolutionRadio) { if (resolution_str.isEmpty() && resolutionRadio) {
QMessageBox::warning(this, u8"警告", u8"分辨率不能为空"); QMessageBox::warning(this, u8"警告", u8"分辨率不能为空");
return; return;
} }
else { else {
@ -62,7 +62,7 @@ void QtFreqParamsSetting::CalcFreqParams()
} }
if (bandwidth_str.isEmpty() && bandwidthRadio) { if (bandwidth_str.isEmpty() && bandwidthRadio) {
QMessageBox::warning(this, u8"警告", u8"带宽不能为空"); QMessageBox::warning(this, u8"警告", u8"带宽不能为空");
return; return;
} }
else { else {
@ -70,35 +70,35 @@ void QtFreqParamsSetting::CalcFreqParams()
} }
if (senceRange < 0) { if (senceRange < 0) {
QMessageBox::warning(this, u8"警告", u8"距离场景最小值不能小于0"); QMessageBox::warning(this, u8"警告", u8"距离场景最小值不能小于0");
return; return;
} }
else {} else {}
} }
{ // 合法性检查 { // 合法性检查
if (resolutionRadio && resolution <= 0) { if (resolutionRadio && resolution <= 0) {
QMessageBox::warning(this, u8"警告", u8"分辨率不能小于0"); QMessageBox::warning(this, u8"警告", u8"分辨率不能小于0");
return; return;
} }
if (bandwidthRadio && bandwidth <= 0) { if (bandwidthRadio && bandwidth <= 0) {
QMessageBox::warning(this, u8"警告", u8"带宽不能小于0"); QMessageBox::warning(this, u8"警告", u8"带宽不能小于0");
return; return;
} }
if(centerfreq<=0){ if(centerfreq<=0){
QMessageBox::warning(this, u8"警告", u8"中心频率不能小于0"); QMessageBox::warning(this, u8"警告", u8"中心频率不能小于0");
return; return;
} }
if (senceRange <= 0) { if (senceRange <= 0) {
QMessageBox::warning(this, u8"警告", u8"场景范围不能小于0"); QMessageBox::warning(this, u8"警告", u8"场景范围不能小于0");
return; return;
} }
} }
// 计算 // 计算
this->freqParams=FEKOBase::getFreqSetting(centerfreq, resolution, bandwidth, senceRange, resolutionRadio); this->freqParams=FEKOBase::getFreqSetting(centerfreq, resolution, bandwidth, senceRange, resolutionRadio);
// 显示 // 显示
this->ui.lineEdit_Startfreq->setText(QString::number(freqParams.startfreqs)); this->ui.lineEdit_Startfreq->setText(QString::number(freqParams.startfreqs));
this->ui.lineEdit_endFreq->setText(QString::number(freqParams.endfreqs)); this->ui.lineEdit_endFreq->setText(QString::number(freqParams.endfreqs));
this->ui.lineEdit_PointNum->setText(QString::number(freqParams.freqpoint)); this->ui.lineEdit_PointNum->setText(QString::number(freqParams.freqpoint));
@ -112,7 +112,7 @@ void QtFreqParamsSetting::CalcFreqParams()
} }
double bandwidthcal = this->freqParams.endfreqs - this->freqParams.startfreqs; double bandwidthcal = this->freqParams.endfreqs - this->freqParams.startfreqs;
resolution = 0.299792458 / bandwidth / 2; resolution = 0.299792458 / bandwidth / 2;
// 更新频率参数 // 更新频率参数
this->simulationparams->setStartfreq(freqParams.startfreqs); this->simulationparams->setStartfreq(freqParams.startfreqs);
this->simulationparams->setEndfreq(freqParams.endfreqs); this->simulationparams->setEndfreq(freqParams.endfreqs);
this->simulationparams->setFreqpoints(freqParams.freqpoint); this->simulationparams->setFreqpoints(freqParams.freqpoint);

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "AllHead.h" #include "AllHead.h"
#include <QWidget> #include <QWidget>
@ -9,7 +9,7 @@ class QtFreqParamsSetting : public QWidget, public FEKOBase::FEKOSimulationDatap
Q_OBJECT Q_OBJECT
public: public:
FEKOBase::freqParams freqParams; // 卫星参数 FEKOBase::freqParams freqParams; // <EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD>
public: public:
QtFreqParamsSetting(QWidget*parent = nullptr); QtFreqParamsSetting(QWidget*parent = nullptr);

View File

@ -1,14 +1,14 @@
#include "QtSARAntModelSetting.h" #include "QtSARAntModelSetting.h"
#include "AllHead.h" #include "AllHead.h"
#include <QMessageBox> #include <QMessageBox>
#include <BRepBuilderAPI_MakeSolid.hxx> #include <opencascade/BRepBuilderAPI_MakeSolid.hxx>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include <BRepPrimAPI_MakePrism.hxx> #include <opencascade/BRepPrimAPI_MakePrism.hxx>
#include "OCCTBase.h" #include "OCCTBase.h"
antModelClass::antModelClass(QString filpath) antModelClass::antModelClass(QString filpath)
{ {
QMessageBox::information(nullptr, QString::fromUtf8(u8"模型坐标系提示"), QString::fromUtf8(u8"模型的Y轴为飞行方向Z轴为雷达指向")); QMessageBox::information(nullptr, QString::fromUtf8(u8"模型坐标系提示"), QString::fromUtf8(u8"模型的Y轴为飞行方向Z轴为雷达指向"));
if (QFile::exists(filpath)) { if (QFile::exists(filpath)) {
ReadTopoDs_Shape(filpath, this->antModel); ReadTopoDs_Shape(filpath, this->antModel);
} }
@ -19,7 +19,7 @@ antModelClass::antModelClass(QString filpath)
antModelClass::antModelClass() antModelClass::antModelClass()
{ {
QMessageBox::information(nullptr, QString::fromUtf8(u8"模型坐标系提示"), QString::fromUtf8(u8"模型的Y轴为飞行方向Z轴为雷达指向")); QMessageBox::information(nullptr, QString::fromUtf8(u8"模型坐标系提示"), QString::fromUtf8(u8"模型的Y轴为飞行方向Z轴为雷达指向"));
this->createDefaultAntModel(); this->createDefaultAntModel();
} }
@ -38,7 +38,7 @@ void antModelClass::initAxis()
} }
// //
// 根据侧视角摆动时,应该是在卫星飞行与雷达照射的平面上进行摆动 // 根据侧视角摆动时,应该是在卫星飞行与雷达照射的平面上进行摆动
// //
void antModelClass::applyAntModel( void antModelClass::applyAntModel(
double Sx, double Sy, double Sz, double Sx, double Sy, double Sz,
@ -63,19 +63,19 @@ void antModelClass::applyAntModel(
void antModelClass::createDefaultAntModel() void antModelClass::createDefaultAntModel()
{ {
// 创建三个方向的箭头 // 创建三个方向的箭头
//TopoDS_Shape arrow1 = CreateArrow(gp_Dir(1, 0, 0), 0.3, 0.1); // X方向 //TopoDS_Shape arrow1 = CreateArrow(gp_Dir(1, 0, 0), 0.3, 0.1); // X方向
TopoDS_Shape arrow2 = CreateArrow(gp_Dir(0, 1, 0), 1, 0.1); // Y方向 TopoDS_Shape arrow2 = CreateArrow(gp_Dir(0, 1, 0), 1, 0.1); // Y方向
TopoDS_Shape arrow3 = CreateArrow(gp_Dir(0, 0, 1), 1.5, 0.1); // Z方向 TopoDS_Shape arrow3 = CreateArrow(gp_Dir(0, 0, 1), 1.5, 0.1); // Z方向
// 创建雷达模型 // 创建雷达模型
gp_Ax2 modelCoor = gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0)); gp_Ax2 modelCoor = gp_Ax2(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(1, 0, 0));
//TopoDS_Shape ant_pyramid = BRepPrimAPI_MakeWedge(modelCoor, 0.1, 0.1, 1.0,-1.0,-1.0,1.0,1.0).Shape(); //TopoDS_Shape ant_pyramid = BRepPrimAPI_MakeWedge(modelCoor, 0.1, 0.1, 1.0,-1.0,-1.0,1.0,1.0).Shape();
// 创建一个包含所有箭头的复合体 // 创建一个包含所有箭头的复合体
TopoDS_Compound compound; TopoDS_Compound compound;
BRep_Builder builder; BRep_Builder builder;
@ -85,7 +85,7 @@ void antModelClass::createDefaultAntModel()
builder.Add(compound, arrow2); builder.Add(compound, arrow2);
builder.Add(compound, arrow3); builder.Add(compound, arrow3);
//builder.Add(compound, ant_pyramid); //builder.Add(compound, ant_pyramid);
this->antModel = compound; // 雷达三维模型 this->antModel = compound; // 雷达三维模型
} }
@ -103,7 +103,7 @@ antModelClass antModelClassFactory()
{ {
QString filepath = getOpenFilePath( QString filepath = getOpenFilePath(
nullptr, nullptr,
QString::fromUtf8(u8"导入雷达模型"), QString::fromUtf8(u8"导入雷达模型"),
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)")); QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));
antModelClass result(filepath); antModelClass result(filepath);
return result; return result;
@ -113,13 +113,13 @@ antModelClass antModelClassFactory()
QtSARAntModelSettingClass::QtSARAntModelSettingClass(QWidget* parent) QtSARAntModelSettingClass::QtSARAntModelSettingClass(QWidget* parent)
{ {
ui.setupUi(this); ui.setupUi(this);
this->simulationparams = std::make_shared<FEKOBase::FEKOSimulationDataparams>(); // 参数初始化 this->simulationparams = std::make_shared<FEKOBase::FEKOSimulationDataparams>(); // 参数初始化
this->ui.lineEdit_TaskName->setText(this->simulationparams->taskName); this->ui.lineEdit_TaskName->setText(this->simulationparams->taskName);
this->ui.lineEdit_farsourcePath->setText(this->simulationparams->AntennaRadiationFileName); this->ui.lineEdit_farsourcePath->setText(this->simulationparams->AntennaRadiationFileName);
this->Widgetfreqsetting=new QtFreqParamsSetting(this); this->Widgetfreqsetting=new QtFreqParamsSetting(this);
this->WidgetImageSetting = new QtWidgetsClass_ImageSetting(this); this->WidgetImageSetting = new QtWidgetsClass_ImageSetting(this);
// 添加成像模式 // 添加成像模式
this->WidgetISARMode = new QtWidgetsClass_ISAR(); this->WidgetISARMode = new QtWidgetsClass_ISAR();
this->WidgetCirCleSARMode = new QtWidgetsClass_CircleSAR(); this->WidgetCirCleSARMode = new QtWidgetsClass_CircleSAR();
this->WidgetScanMode = new QtWidgetsClass_Scan(); this->WidgetScanMode = new QtWidgetsClass_Scan();
@ -133,23 +133,23 @@ QtSARAntModelSettingClass::QtSARAntModelSettingClass(QWidget* parent)
QObject::connect(this->WidgetScanMode, SIGNAL(OKClick()), this, SLOT(OKClickScane( ))); QObject::connect(this->WidgetScanMode, SIGNAL(OKClick()), this, SLOT(OKClickScane( )));
QObject::connect(this->Widgetfreqsetting, SIGNAL(OKClick()), this, SLOT(OKClickFreqSetting( ))); QObject::connect(this->Widgetfreqsetting, SIGNAL(OKClick()), this, SLOT(OKClickFreqSetting( )));
QObject::connect(this->WidgetImageSetting, SIGNAL(OKClick()), this, SLOT(OKClickImageSetting( ))); QObject::connect(this->WidgetImageSetting, SIGNAL(OKClick()), this, SLOT(OKClickImageSetting( )));
// 添加频率 // 添加频率
//this->Widgetfreqsetting->freqParams = this->freqSetting; //this->Widgetfreqsetting->freqParams = this->freqSetting;
this->ui.tabWidget->removeTab(0); this->ui.tabWidget->removeTab(0);
this->ui.tabWidget->insertTab(0, this->Widgetfreqsetting, u8"频率设置"); this->ui.tabWidget->insertTab(0, this->Widgetfreqsetting, u8"频率设置");
this->ui.tabWidget->removeTab(2); this->ui.tabWidget->removeTab(2);
this->ui.tabWidget->insertTab(2, this->WidgetImageSetting, u8"成像设置"); this->ui.tabWidget->insertTab(2, this->WidgetImageSetting, u8"成像设置");
this->ui.comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::Strip)); 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::Scane));
this->ui.comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::ISAR)); this->ui.comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::ISAR));
this->ui.comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::CircleSAR)); this->ui.comboBox_ImageMode->addItem(FEKOBase::FEKOImageModeenumToString(FEKOBase::FEKOImageMode::CircleSAR));
this->ui.comboBox_LookSide->addItem(u8"左视"); this->ui.comboBox_LookSide->addItem(u8"左视");
this->ui.comboBox_LookSide->addItem(u8"右视"); this->ui.comboBox_LookSide->addItem(u8"右视");
// 绘制模型 // 绘制模型
this->antModel = nullptr; this->antModel = nullptr;
this->myContext = nullptr; this->myContext = nullptr;
this->ui.tabantModeMove->setEnabled(false); this->ui.tabantModeMove->setEnabled(false);
@ -170,14 +170,14 @@ void QtSARAntModelSettingClass::removeModeSettingWidget()
void QtSARAntModelSettingClass::switchStripImageParamsWeight() void QtSARAntModelSettingClass::switchStripImageParamsWeight()
{ {
this->removeModeSettingWidget(); this->removeModeSettingWidget();
this->ui.tabWidget->insertTab(1, this->WidgetstriMode, u8"条带成像设置"); this->ui.tabWidget->insertTab(1, this->WidgetstriMode, u8"条带成像设置");
this->ui.comboBox_LookSide->setEnabled(true); this->ui.comboBox_LookSide->setEnabled(true);
} }
void QtSARAntModelSettingClass::switchScanImageParamsWeight() void QtSARAntModelSettingClass::switchScanImageParamsWeight()
{ {
this->removeModeSettingWidget(); this->removeModeSettingWidget();
this->ui.tabWidget->insertTab(1, this->WidgetScanMode, u8"扫描成像设置"); this->ui.tabWidget->insertTab(1, this->WidgetScanMode, u8"扫描成像设置");
this->ui.comboBox_LookSide->setEnabled(true); this->ui.comboBox_LookSide->setEnabled(true);
} }
@ -185,14 +185,14 @@ void QtSARAntModelSettingClass::switchScanImageParamsWeight()
void QtSARAntModelSettingClass::switchISARImageParamsWeight() void QtSARAntModelSettingClass::switchISARImageParamsWeight()
{ {
this->removeModeSettingWidget(); this->removeModeSettingWidget();
this->ui.tabWidget->insertTab(1, this->WidgetISARMode, u8"ISAR成像设置"); this->ui.tabWidget->insertTab(1, this->WidgetISARMode, u8"ISAR成像设置");
this->ui.comboBox_LookSide->setEnabled(false); this->ui.comboBox_LookSide->setEnabled(false);
} }
void QtSARAntModelSettingClass::switchCircleSARImageParamsWeight() void QtSARAntModelSettingClass::switchCircleSARImageParamsWeight()
{ {
this->removeModeSettingWidget(); this->removeModeSettingWidget();
this->ui.tabWidget->insertTab(1, this->WidgetCirCleSARMode, u8"圆迹SAR成像设置"); this->ui.tabWidget->insertTab(1, this->WidgetCirCleSARMode, u8"圆迹SAR成像设置");
this->ui.comboBox_LookSide->setEnabled(false); this->ui.comboBox_LookSide->setEnabled(false);
} }
@ -226,7 +226,7 @@ void QtSARAntModelSettingClass::ReferenceWindows()
this->ui.lineEdit_refRange->setText(QString::number(this->simulationparams->refRange)); this->ui.lineEdit_refRange->setText(QString::number(this->simulationparams->refRange));
this->ui.lineEdit_incangle->setText(QString::number(this->simulationparams->incangle)); this->ui.lineEdit_incangle->setText(QString::number(this->simulationparams->incangle));
emit this->simulationparams->FEKOSimulationDataparamsChanged(); // 将参数修改发送到不同界面中 emit this->simulationparams->FEKOSimulationDataparamsChanged(); // 将参数修改发送到不同界面中
this->generator_FEKOSatelliteParams(); this->generator_FEKOSatelliteParams();
@ -248,7 +248,7 @@ void QtSARAntModelSettingClass::setOCCTDocument(Handle(AIS_InteractiveContext) m
QString antFilePath=getOpenFilePath( QString antFilePath=getOpenFilePath(
nullptr, nullptr,
QString::fromUtf8(u8"导入雷达模型"), QString::fromUtf8(u8"导入雷达模型"),
QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)")); QString::fromUtf8(u8"STL Files (*.stl);;STL Files (*.stla);;step Files (*.stp);;step Files (*.step);;IGES Files (*.iges);;IGES Files (*.igs)"));
if (isExists(antFilePath)) { if (isExists(antFilePath)) {
@ -266,7 +266,7 @@ void QtSARAntModelSettingClass::OKClickISAR( )
this->refreshFEKOSimulationParams(); this->refreshFEKOSimulationParams();
this->generator_FEKOSatelliteParams(); this->generator_FEKOSatelliteParams();
// 绘制展示模型 // 绘制展示模型
if (this->myContext.IsNull()) { if (this->myContext.IsNull()) {
this->ui.horizontalSlider_PRF->setValue(0); this->ui.horizontalSlider_PRF->setValue(0);
//this->on_horizontalSlider_PRF_valueChanged(0); //this->on_horizontalSlider_PRF_valueChanged(0);
@ -275,7 +275,7 @@ void QtSARAntModelSettingClass::OKClickISAR( )
} }
void QtSARAntModelSettingClass::OKClickStrip( ) void QtSARAntModelSettingClass::OKClickStrip( )
{ {
qDebug() << u8"计算 Strip..."; qDebug() << u8"计算 Strip...";
this->refreshFEKOSimulationParams(); this->refreshFEKOSimulationParams();
this->generator_FEKOSatelliteParams(); this->generator_FEKOSatelliteParams();
if (this->myContext.IsNull()) { if (this->myContext.IsNull()) {
@ -287,7 +287,7 @@ void QtSARAntModelSettingClass::OKClickCircleSAR( )
{ {
this->refreshFEKOSimulationParams(); this->refreshFEKOSimulationParams();
this->generator_FEKOSatelliteParams(); this->generator_FEKOSatelliteParams();
// 绘制展示模型 // 绘制展示模型
if (this->myContext.IsNull()) { if (this->myContext.IsNull()) {
this->ui.horizontalSlider_PRF->setValue(0); this->ui.horizontalSlider_PRF->setValue(0);
//this->on_horizontalSlider_PRF_valueChanged(0); //this->on_horizontalSlider_PRF_valueChanged(0);
@ -322,7 +322,7 @@ void QtSARAntModelSettingClass::on_comboBox_ImageMode_currentIndexChanged(int in
QString text = this->ui.comboBox_ImageMode->currentText(); QString text = this->ui.comboBox_ImageMode->currentText();
this->simulationparams->imagemode = FEKOBase::FEKOImageModeString2Enum(text.trimmed()); this->simulationparams->imagemode = FEKOBase::FEKOImageModeString2Enum(text.trimmed());
if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::UNKNOW) { if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::UNKNOW) {
QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"未知的成像模式")); QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"未知的成像模式"));
return; return;
} }
else if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::Strip) { else if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::Strip) {
@ -338,7 +338,7 @@ void QtSARAntModelSettingClass::on_comboBox_ImageMode_currentIndexChanged(int in
this->switchCircleSARImageParamsWeight(); this->switchCircleSARImageParamsWeight();
} }
else { else {
QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"未知的成像模式")); QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"未知的成像模式"));
} }
} }
@ -352,7 +352,7 @@ void QtSARAntModelSettingClass::on_pushButton_ffe_clicked()
void QtSARAntModelSettingClass::on_comboBox_LookSide_currentIndexChanged(int index) void QtSARAntModelSettingClass::on_comboBox_LookSide_currentIndexChanged(int index)
{ {
QString lookside = this->ui.comboBox_LookSide->currentText(); QString lookside = this->ui.comboBox_LookSide->currentText();
if (lookside == u8"左视") { if (lookside == u8"左视") {
this->simulationparams->isRight = false; this->simulationparams->isRight = false;
} }
else { else {
@ -370,11 +370,11 @@ void QtSARAntModelSettingClass::on_horizontalSlider_PRF_valueChanged(int value)
this->ui.horizontalSlider_PRF->setMaximum(this->FEKOAntPoselist.size()-1); this->ui.horizontalSlider_PRF->setMaximum(this->FEKOAntPoselist.size()-1);
// 移除旧 // 移除旧
Handle(AIS_InteractiveObject) moveShapeold = this->antModel->get_antModelShow(); Handle(AIS_InteractiveObject) moveShapeold = this->antModel->get_antModelShow();
this->myContext->Remove(moveShapeold,Standard_False); this->myContext->Remove(moveShapeold,Standard_False);
// 增加新 // 增加新
FEKOBase::FEKOSatelliteParams temp = this->FEKOAntPoselist[value]; FEKOBase::FEKOSatelliteParams temp = this->FEKOAntPoselist[value];
this->antModel->applyAntModel(temp.pose.pos.Px, temp.pose.pos.Py, temp.pose.pos.Pz, temp.pose.vel.Vx, temp.pose.vel.Vy, temp.pose.vel.Vz, temp.incidenceAngle, temp.AzAngle, this->simulationparams->isRight); this->antModel->applyAntModel(temp.pose.pos.Px, temp.pose.pos.Py, temp.pose.pos.Pz, temp.pose.vel.Vx, temp.pose.vel.Vy, temp.pose.vel.Vz, temp.incidenceAngle, temp.AzAngle, this->simulationparams->isRight);
Handle(AIS_InteractiveObject) moveShape = this->antModel->get_antModelShow(); Handle(AIS_InteractiveObject) moveShape = this->antModel->get_antModelShow();
@ -382,10 +382,10 @@ void QtSARAntModelSettingClass::on_horizontalSlider_PRF_valueChanged(int value)
if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::ISAR || this->simulationparams->imagemode == FEKOBase::FEKOImageMode::CircleSAR) { if (this->simulationparams->imagemode == FEKOBase::FEKOImageMode::ISAR || this->simulationparams->imagemode == FEKOBase::FEKOImageMode::CircleSAR) {
this->ui.label_AZ_Angle->setText(u8"方位角:"); this->ui.label_AZ_Angle->setText(u8"方位角:");
} }
else { else {
this->ui.label_AZ_Angle->setText(u8"侧摆角:"); this->ui.label_AZ_Angle->setText(u8"侧摆角:");
} }
this->ui.lineEdit_PRF_Show->setText(QString::number(temp.PRFidx)); this->ui.lineEdit_PRF_Show->setText(QString::number(temp.PRFidx));
this->ui.lineEdit_X_Show->setText(QString::number(temp.pose.pos.Px)); this->ui.lineEdit_X_Show->setText(QString::number(temp.pose.pos.Px));
@ -405,35 +405,35 @@ void QtSARAntModelSettingClass::on_horizontalSlider_PRF_valueChanged(int value)
void QtSARAntModelSettingClass::on_pushButton_OK_clicked() void QtSARAntModelSettingClass::on_pushButton_OK_clicked()
{ {
this->refreshFEKOSimulationParams(); // 最后更新下参数 this->refreshFEKOSimulationParams(); // 最后更新下参数
this->saveFEKOImageSettingXML(); this->saveFEKOImageSettingXML();
QString luatext = this->createLuaSciptString(0, this->FEKOAntPoselist.size()); QString luatext = this->createLuaSciptString(0, this->FEKOAntPoselist.size());
// 写入文件 // 写入文件
QString filePath = this->workSpace + QDir::separator() + this->simulationparams->taskName + QString(u8"_%1.lua").arg(FEKOBase::FEKOImageModeenumToString(this->simulationparams->imagemode)); QString filePath = this->workSpace + QDir::separator() + this->simulationparams->taskName + QString(u8"_%1.lua").arg(FEKOBase::FEKOImageModeenumToString(this->simulationparams->imagemode));
// 创建文件对象 // 创建文件对象
QFile file(filePath); QFile file(filePath);
// 打开文件以供写入,如果文件不存在将创建新文件 // 打开文件以供写入,如果文件不存在将创建新文件
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
// 创建文本流并设置编码为UTF-8 // 创建文本流并设置编码为UTF-8
QTextStream stream(&file); QTextStream stream(&file);
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
stream << luatext; stream << luatext;
// 关闭文件 // 关闭文件
file.close(); file.close();
// 提示文件写入成功 // 提示文件写入成功
QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入成功!\n%1").arg(filePath)); QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入成功!\n%1").arg(filePath));
qDebug() << "File written successfully."; qDebug() << "File written successfully.";
} }
else { else {
qDebug() << "Could not open file for writing."; qDebug() << "Could not open file for writing.";
QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入失败")); QMessageBox::information(nullptr, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"文件写入失败"));
} }
// 询问用户是否关闭窗口 // 询问用户是否关闭窗口
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"是否关闭窗口?"), reply = QMessageBox::question(this, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"是否关闭窗口?"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
this->close(); this->close();
@ -445,9 +445,9 @@ void QtSARAntModelSettingClass::on_pushButton_OK_clicked()
void QtSARAntModelSettingClass::on_pushButton_Cancel_clicked() void QtSARAntModelSettingClass::on_pushButton_Cancel_clicked()
{ {
// 询问用户是否关闭窗口 // 询问用户是否关闭窗口
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"是否关闭窗口?"), reply = QMessageBox::question(this, QString::fromUtf8(u8"提示"), QString::fromUtf8(u8"是否关闭窗口?"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
this->close(); this->close();
@ -459,9 +459,9 @@ void QtSARAntModelSettingClass::on_pushButton_Cancel_clicked()
void QtSARAntModelSettingClass::on_lineEdit_Range_editingFinished() void QtSARAntModelSettingClass::on_lineEdit_Range_editingFinished()
{ {
// 传播计算 // 传播计算
this->simulationparams->setRefRange(this->ui.lineEdit_refRange->text().toDouble()); this->simulationparams->setRefRange(this->ui.lineEdit_refRange->text().toDouble());
QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否重新计算姿态", QMessageBox::Yes | QMessageBox::No); QMessageBox::StandardButton reply = QMessageBox::question(this, u8"提示", u8"是否重新计算姿态", QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
this->generator_FEKOSatelliteParams(); this->generator_FEKOSatelliteParams();
} }
@ -473,8 +473,8 @@ void QtSARAntModelSettingClass::on_lineEdit_Range_editingFinished()
void QtSARAntModelSettingClass::SelectFFESourcePath(size_t thetaPoints, size_t phiPoints, QString ffePath) void QtSARAntModelSettingClass::SelectFFESourcePath(size_t thetaPoints, size_t phiPoints, QString ffePath)
{ {
if (!isExists(ffePath)) { if (!isExists(ffePath)) {
// 警告文件不存在 // 警告文件不存在
QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"文件不存在")); QMessageBox::information(nullptr, QString::fromUtf8(u8"错误"), QString::fromUtf8(u8"文件不存在"));
return; return;
} }
QString filename = getFileNameFromPath(ffePath); QString filename = getFileNameFromPath(ffePath);
@ -484,21 +484,21 @@ void QtSARAntModelSettingClass::SelectFFESourcePath(size_t thetaPoints, size_t p
QString fullpath = QDir::cleanPath(this->workSpace + QDir::separator() + filename); QString fullpath = QDir::cleanPath(this->workSpace + QDir::separator() + filename);
QFile destinationFile(fullpath); QFile destinationFile(fullpath);
// 打开源文件以供读取 // 打开源文件以供读取
if (sourceFile.open(QIODevice::ReadOnly)) { if (sourceFile.open(QIODevice::ReadOnly)) {
// 打开目标文件以供写入 // 打开目标文件以供写入
if (destinationFile.open(QIODevice::WriteOnly)) { if (destinationFile.open(QIODevice::WriteOnly)) {
// 将源文件内容复制到目标文件 // 将源文件内容复制到目标文件
QByteArray data = sourceFile.readAll(); QByteArray data = sourceFile.readAll();
destinationFile.write(data); destinationFile.write(data);
// 关闭文件 // 关闭文件
destinationFile.close(); destinationFile.close();
} }
else { else {
qDebug() << "Could not open destination file for writing."; qDebug() << "Could not open destination file for writing.";
} }
// 关闭源文件 // 关闭源文件
sourceFile.close(); sourceFile.close();
} }
else { else {
@ -531,7 +531,7 @@ void QtSARAntModelSettingClass::bandingsetFEKOSimulationDataparams()
this->Widgetfreqsetting->setFEKOSimulationDataparams(this->simulationparams); this->Widgetfreqsetting->setFEKOSimulationDataparams(this->simulationparams);
this->WidgetImageSetting->setFEKOSimulationDataparams(this->simulationparams); this->WidgetImageSetting->setFEKOSimulationDataparams(this->simulationparams);
// 添加成像模式 // 添加成像模式
this->WidgetISARMode->setFEKOSimulationDataparams(this->simulationparams); this->WidgetISARMode->setFEKOSimulationDataparams(this->simulationparams);
this->WidgetCirCleSARMode->setFEKOSimulationDataparams(this->simulationparams); this->WidgetCirCleSARMode->setFEKOSimulationDataparams(this->simulationparams);
this->WidgetScanMode->setFEKOSimulationDataparams(this->simulationparams); this->WidgetScanMode->setFEKOSimulationDataparams(this->simulationparams);

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "AllHead.h" #include "AllHead.h"
#include "OCCTBaseOperaorClass.h" #include "OCCTBaseOperaorClass.h"
#include <QDialog> #include <QDialog>
@ -13,42 +13,42 @@
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// 卫星雷达模型 // 卫星雷达模型
// 默认雷达中心 // 默认雷达中心
// X轴为飞行方向 // X轴为飞行方向
// Z轴为照射方向 默认左入射为 - ,右入射为 + // Z轴为照射方向 默认左入射为 - ,右入射为 +
// X // X
// ^ // ^
// L | R // L | R
// Y<--Z // Y<--Z
// | // |
// TopoSAR : http://radarst.cnjournals.com/html/2022/2/202202004.html // TopoSAR : http://radarst.cnjournals.com/html/2022/2/202202004.html
// 1. 创建模型 // 1. 创建模型
// 2. 注入位置、速度方向、入射角、方位角 // 2. 注入位置、速度方向、入射角、方位角
// 3. 获取雷达天线计算结果 // 3. 获取雷达天线计算结果
// 4. 渲染模型 // 4. 渲染模型
////////////////////////////////////////////////// //////////////////////////////////////////////////
class antModelClass { // 模型参数 class antModelClass { // 模型参数
public: public:
antModelClass(QString filpath); // 1. 创建模型 antModelClass(QString filpath); // 1. 创建模型
antModelClass(); antModelClass();
~antModelClass(); ~antModelClass();
void initAxis(); void initAxis();
public: public:
void applyAntModel( // 2. 注入位置、速度方向、入射角、方位角 void applyAntModel( // 2. 注入位置、速度方向、入射角、方位角
double Sx, double Sy, double Sz, // 卫星坐标 double Sx, double Sy, double Sz, // 卫星坐标
double Vx,double Vy,double Vz, // 卫星速度 double Vx,double Vy,double Vz, // 卫星速度
double incidenceAngle, double AzAngle ,bool isRIGHT=false); // 入射角、方位角 、 左右视 double incidenceAngle, double AzAngle ,bool isRIGHT=false); // 入射角、方位角 、 左右视
void createDefaultAntModel(); // 创建默认模型 void createDefaultAntModel(); // 创建默认模型
FEKOBase::FEKOantPitionDirect get_antposition_Direct(); // 3. 获取雷达天线计算结果 FEKOBase::FEKOantPitionDirect get_antposition_Direct(); // 3. 获取雷达天线计算结果
Handle(AIS_InteractiveObject) get_antModelShow(); // 4. 渲染模型 Handle(AIS_InteractiveObject) get_antModelShow(); // 4. 渲染模型
private: private:
Handle(AIS_InteractiveObject) antModelShow; // 用于展示的雷达模型, Handle(AIS_InteractiveObject) antModelShow; // 用于展示的雷达模型,
TopoDS_Shape antModel; // 原始雷达模型 TopoDS_Shape antModel; // 原始雷达模型
FEKOBase::FEKOantPitionDirect antposition_Direct; // 雷达天线的坐标与指向 FEKOBase::FEKOantPitionDirect antposition_Direct; // 雷达天线的坐标与指向
}; };
@ -56,7 +56,7 @@ private:
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// 雷达指向模型设置类 // 雷达指向模型设置类
////////////////////////////////////////////////// //////////////////////////////////////////////////
class QtSARAntModelSettingClass : public QDialog, public FEKOBase::FEKOSimulationSARClass class QtSARAntModelSettingClass : public QDialog, public FEKOBase::FEKOSimulationSARClass
{ {
@ -67,27 +67,27 @@ public:
private: private:
Ui::QtSARAntModelSettingClass ui; Ui::QtSARAntModelSettingClass ui;
QtFreqParamsSetting* Widgetfreqsetting; // 频率设置窗口 QtFreqParamsSetting* Widgetfreqsetting; // 频率设置窗口
QtWidgetsClass_Strip* WidgetstriMode;// 成像参数设置 QtWidgetsClass_Strip* WidgetstriMode;// 成像参数设置
QtWidgetsClass_Scan* WidgetScanMode; QtWidgetsClass_Scan* WidgetScanMode;
QtWidgetsClass_ISAR* WidgetISARMode; QtWidgetsClass_ISAR* WidgetISARMode;
QtWidgetsClass_CircleSAR* WidgetCirCleSARMode; QtWidgetsClass_CircleSAR* WidgetCirCleSARMode;
QtWidgetsClass_ImageSetting* WidgetImageSetting; QtWidgetsClass_ImageSetting* WidgetImageSetting;
antModelClass* antModel; // 模型 antModelClass* antModel; // 模型
//DocumentCommon* occtdocument; // 文档 //DocumentCommon* occtdocument; // 文档
Handle(AIS_InteractiveContext) myContext; // 窗口交互 Handle(AIS_InteractiveContext) myContext; // 窗口交互
public: public:
void removeModeSettingWidget(); // 移除模式设置窗口 void removeModeSettingWidget(); // 移除模式设置窗口
void setOCCTDocument(Handle(AIS_InteractiveContext) myContext); void setOCCTDocument(Handle(AIS_InteractiveContext) myContext);
// 切换 条带图像、扫描图像、ISAR、圆迹SAR // 切换 条带图像、扫描图像、ISAR、圆迹SAR
void switchStripImageParamsWeight(); // 切换条带图像参数权重 void switchStripImageParamsWeight(); // 切换条带图像参数权重
void switchScanImageParamsWeight(); // 切换扫描图像参数权重 void switchScanImageParamsWeight(); // 切换扫描图像参数权重
void switchISARImageParamsWeight(); // 切换ISAR图像参数权重 void switchISARImageParamsWeight(); // 切换ISAR图像参数权重
void switchCircleSARImageParamsWeight(); // 切换圆迹SAR图像参数权重 void switchCircleSARImageParamsWeight(); // 切换圆迹SAR图像参数权重
void ReferenceWindows(); // 渲染窗体 void ReferenceWindows(); // 渲染窗体
void refreshFEKOSimulationParams(); void refreshFEKOSimulationParams();

View File

@ -1,4 +1,4 @@
#include "QtWidgetsClass_FarSourceSetting.h" #include "QtWidgetsClass_FarSourceSetting.h"
QtWidgetsClass_FarSourceSetting::QtWidgetsClass_FarSourceSetting(QWidget *parent) QtWidgetsClass_FarSourceSetting::QtWidgetsClass_FarSourceSetting(QWidget *parent)
: QDialog(parent) : QDialog(parent)
@ -33,11 +33,11 @@ void QtWidgetsClass_FarSourceSetting::on_pushButton_select_clicked()
QString fileName = getOpenFilePath(this, u8"Open File", u8"FFE Files (*.ffe)"); QString fileName = getOpenFilePath(this, u8"Open File", u8"FFE Files (*.ffe)");
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
this->ui.lineEdit_filepath->setText(fileName); this->ui.lineEdit_filepath->setText(fileName);
// 打开文件 // 打开文件
FEKOBase::FEKOFarFieldFileClass* farfieldfile = new FEKOBase::FEKOFarFieldFileClass(); FEKOBase::FEKOFarFieldFileClass* farfieldfile = new FEKOBase::FEKOFarFieldFileClass();
farfieldfile->parseFarFieldFile(fileName); farfieldfile->parseFarFieldFile(fileName);
if (farfieldfile->dataBlockList.count() == 0) { if (farfieldfile->dataBlockList.count() == 0) {
QMessageBox::warning(nullptr, u8"警告", u8"ffe文件解析失败请检查文件格式是否正确"); QMessageBox::warning(nullptr, u8"警告", u8"ffe文件解析失败请检查文件格式是否正确");
} }
this->ui.lineEdit_thetaPoints->setText(QString::number( farfieldfile->dataBlockList[0].thetaSamples)); this->ui.lineEdit_thetaPoints->setText(QString::number( farfieldfile->dataBlockList[0].thetaSamples));
this->ui.lineEdit_phiPoints->setText(QString::number(farfieldfile->dataBlockList[0].phiSamples)); this->ui.lineEdit_phiPoints->setText(QString::number(farfieldfile->dataBlockList[0].phiSamples));

View File

@ -1,4 +1,4 @@
#include "QtWidgetsClass_ISAR.h" #include "QtWidgetsClass_ISAR.h"
@ -36,7 +36,7 @@ QtWidgetsClass_ISAR::~QtWidgetsClass_ISAR()
void QtWidgetsClass_ISAR::on_pushButton_OK_clicked() { void QtWidgetsClass_ISAR::on_pushButton_OK_clicked() {
//根据OKClick参数,结合控件,获取参数 //根据OKClick参数,结合控件,获取参数
double startAngle = this->ui.lineEdit_startAzAngle->text().toDouble(); double startAngle = this->ui.lineEdit_startAzAngle->text().toDouble();
double endAngle = this->ui.lineEdit_EndAzAngle->text().toDouble(); double endAngle = this->ui.lineEdit_EndAzAngle->text().toDouble();

View File

@ -1,4 +1,4 @@
#include "QtWidgetsClass_Scan.h" #include "QtWidgetsClass_Scan.h"
void QtWidgetsClass_Scan::FEKOSimulationDataparamsChanged_slots() void QtWidgetsClass_Scan::FEKOSimulationDataparamsChanged_slots()
@ -52,7 +52,7 @@ QtWidgetsClass_Scan::~QtWidgetsClass_Scan()
void QtWidgetsClass_Scan::on_pushButton_OK_clicked() { void QtWidgetsClass_Scan::on_pushButton_OK_clicked() {
//参考void QtWidgetsClass_ISAR::on_pushButton_OK_clicked() 逻辑生成代码 //参考void QtWidgetsClass_ISAR::on_pushButton_OK_clicked() 逻辑生成代码
//void OKClick(double incAngle, double refRange, double startAzAngle, double endAzAngle, double start_x, double start_y, double start_z, double end_x, double end_y, double end_z, size_t prfcount); //void OKClick(double incAngle, double refRange, double startAzAngle, double endAzAngle, double start_x, double start_y, double start_z, double end_x, double end_y, double end_z, size_t prfcount);

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