From d982760ddf6181fdcfcea4afeb57a7a655d0cffd Mon Sep 17 00:00:00 2001
From: chenzenghui <3045316072@qq.com>
Date: Tue, 27 May 2025 23:02:24 +0800
Subject: [PATCH] BaseCommonLibrary
---
.gitmodules | 3 +
BaseCommonLibrary | 1 +
BaseCommonLibrary/BaseCommonLibrary.qtvscr | 429 ----
BaseCommonLibrary/BaseCommonLibrary.vcxproj | 324 ---
.../BaseCommonLibrary.vcxproj.filters | 139 --
.../BaseTool/BaseConstVariable.h | 388 ---
BaseCommonLibrary/BaseTool/BaseTool.cpp | 775 ------
BaseCommonLibrary/BaseTool/BaseTool.h | 226 --
BaseCommonLibrary/BaseTool/EchoDataFormat.cpp | 822 -------
BaseCommonLibrary/BaseTool/EchoDataFormat.h | 225 --
BaseCommonLibrary/BaseTool/FileOperator.cpp | 322 ---
BaseCommonLibrary/BaseTool/FileOperator.h | 64 -
BaseCommonLibrary/BaseTool/GeoOperator.cpp | 511 ----
BaseCommonLibrary/BaseTool/GeoOperator.h | 150 --
.../BaseTool/ImageOperatorBase.cpp | 1793 --------------
.../BaseTool/ImageOperatorBase.h | 631 -----
BaseCommonLibrary/BaseTool/LogInfoCls.cpp | 233 --
BaseCommonLibrary/BaseTool/LogInfoCls.h | 103 -
.../BaseTool/MergeRasterOperator.cpp | 488 ----
.../BaseTool/PrintMsgToQDebug.cpp | 36 -
BaseCommonLibrary/BaseTool/PrintMsgToQDebug.h | 16 -
.../BaseTool/QToolProcessBarDialog.cpp | 24 -
.../BaseTool/QToolProcessBarDialog.h | 23 -
.../BaseTool/QToolProcessBarDialog.ui | 73 -
BaseCommonLibrary/BaseTool/RasterToolBase.cpp | 276 ---
BaseCommonLibrary/BaseTool/RasterToolBase.h | 96 -
.../BaseTool/SARSimulationImageL1.cpp | 1001 --------
.../BaseTool/SARSimulationImageL1.h | 218 --
.../BaseTool/ShowProessAbstract.cpp | 18 -
.../BaseTool/TestImageOperator.cpp | 146 --
.../BaseTool/gdalImageComplexOperator.cpp | 547 -----
.../BaseTool/gdalImageOperator.cpp | 1530 ------------
BaseCommonLibrary/BaseTool/stdafx.cpp | 1 -
BaseCommonLibrary/BaseTool/stdafx.h | 0
BaseCommonLibrary/ImageOperatorFuntion.cpp | 2154 -----------------
BaseCommonLibrary/ShowProessAbstract.h | 15 -
.../ToolAbstract/QToolAbstract.cpp | 41 -
.../ToolAbstract/QToolAbstract.h | 40 -
BaseCommonLibrary/dllmain.cpp | 19 -
BaseCommonLibrary/framework.h | 5 -
BaseCommonLibrary/pch.cpp | 5 -
BaseCommonLibrary/pch.h | 13 -
42 files changed, 4 insertions(+), 13920 deletions(-)
create mode 100644 .gitmodules
create mode 160000 BaseCommonLibrary
delete mode 100644 BaseCommonLibrary/BaseCommonLibrary.qtvscr
delete mode 100644 BaseCommonLibrary/BaseCommonLibrary.vcxproj
delete mode 100644 BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters
delete mode 100644 BaseCommonLibrary/BaseTool/BaseConstVariable.h
delete mode 100644 BaseCommonLibrary/BaseTool/BaseTool.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/BaseTool.h
delete mode 100644 BaseCommonLibrary/BaseTool/EchoDataFormat.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/EchoDataFormat.h
delete mode 100644 BaseCommonLibrary/BaseTool/FileOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/FileOperator.h
delete mode 100644 BaseCommonLibrary/BaseTool/GeoOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/GeoOperator.h
delete mode 100644 BaseCommonLibrary/BaseTool/ImageOperatorBase.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/ImageOperatorBase.h
delete mode 100644 BaseCommonLibrary/BaseTool/LogInfoCls.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/LogInfoCls.h
delete mode 100644 BaseCommonLibrary/BaseTool/MergeRasterOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/PrintMsgToQDebug.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/PrintMsgToQDebug.h
delete mode 100644 BaseCommonLibrary/BaseTool/QToolProcessBarDialog.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/QToolProcessBarDialog.h
delete mode 100644 BaseCommonLibrary/BaseTool/QToolProcessBarDialog.ui
delete mode 100644 BaseCommonLibrary/BaseTool/RasterToolBase.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/RasterToolBase.h
delete mode 100644 BaseCommonLibrary/BaseTool/SARSimulationImageL1.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/SARSimulationImageL1.h
delete mode 100644 BaseCommonLibrary/BaseTool/ShowProessAbstract.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/TestImageOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/gdalImageComplexOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/gdalImageOperator.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/stdafx.cpp
delete mode 100644 BaseCommonLibrary/BaseTool/stdafx.h
delete mode 100644 BaseCommonLibrary/ImageOperatorFuntion.cpp
delete mode 100644 BaseCommonLibrary/ShowProessAbstract.h
delete mode 100644 BaseCommonLibrary/ToolAbstract/QToolAbstract.cpp
delete mode 100644 BaseCommonLibrary/ToolAbstract/QToolAbstract.h
delete mode 100644 BaseCommonLibrary/dllmain.cpp
delete mode 100644 BaseCommonLibrary/framework.h
delete mode 100644 BaseCommonLibrary/pch.cpp
delete mode 100644 BaseCommonLibrary/pch.h
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..c5b0117
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "BaseCommonLibrary"]
+ path = BaseCommonLibrary
+ url = http://172.16.0.12:5000/LAMPSARToolSoftware/BaseCommonLibrary.git
diff --git a/BaseCommonLibrary b/BaseCommonLibrary
new file mode 160000
index 0000000..668e038
--- /dev/null
+++ b/BaseCommonLibrary
@@ -0,0 +1 @@
+Subproject commit 668e038ae7f781627b758eadf21db19e7da9d1a7
diff --git a/BaseCommonLibrary/BaseCommonLibrary.qtvscr b/BaseCommonLibrary/BaseCommonLibrary.qtvscr
deleted file mode 100644
index 718b3df..0000000
--- a/BaseCommonLibrary/BaseCommonLibrary.qtvscr
+++ /dev/null
@@ -1,429 +0,0 @@
-
-
-
-
-
- Qt Visual Studio Tools
-
-
- Project Format Conversion
-
-
- Report generated on 2025-02-02 17:23:02
-
-
-
-
- Files
-
-
-
-
- [Before]
- [After]
-
- [Diff before/after]
-
-
- [Diff before/current]
-
-
- [Diff after/current]
-
-
-
-
-
-
- Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true]]>
-
-
-
-
-
-
-
-
-
-
-
-
- true]]>
-
-
-
-
-
-
-
-
-
-
-
-
- true]]>
-
-
-
-
-
-
-
-
-
-
-
-
- true]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- QtVS_v304]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(MSBuildProjectDirectory)\QtMsBuild]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
-
-
-
diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj b/BaseCommonLibrary/BaseCommonLibrary.vcxproj
deleted file mode 100644
index 002db1e..0000000
--- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj
+++ /dev/null
@@ -1,324 +0,0 @@
-
-
-
-
- Debug
- ARM
-
-
- Debug
- Win32
-
-
- Release
- ARM
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 17.0
- Win32Proj
- {872ecd6f-30e3-4a1b-b17c-15e87d373ff6}
- BaseCommonLibrary
- 10.0
- QtVS_v304
- $(MSBuildProjectDirectory)\QtMsBuild
-
-
-
- DynamicLibrary
- true
- v143
- Unicode
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
- DynamicLibrary
- true
- v143
- Unicode
-
-
- DynamicLibrary
- true
- v143
- Unicode
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
- DynamicLibrary
- false
- v143
- true
- Unicode
-
-
-
-
- core;gui;widgets
-
-
- core;gui;widgets
-
-
- core;gui;widgets
-
-
- core;gui;widgets
-
-
- core;xml;sql;opengl;gui;svg;xmlpatterns;widgets;location;positioning;openglextensions;charts
- false
- tools_qt5
-
-
- core;xml;sql;opengl;gui;svg;xmlpatterns;widgets;location;positioning;openglextensions;charts
- false
- tools_qt5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ./BaseTool;$(IncludePath)
- true
- true
-
-
- ./BaseTool;$(IncludePath)
- true
- true
-
-
-
- Level3
- true
- WIN32;_DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- Use
- pch.h
- true
-
-
- Windows
- true
- false
-
-
-
-
- Level3
- true
- true
- true
- WIN32;NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- Use
- pch.h
- true
-
-
- Windows
- true
- true
- true
- false
-
-
-
-
- Level3
- true
- _DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- NotUsing
- pch.h
- true
-
-
- Windows
- true
- false
-
-
-
-
- Level3
- true
- _DEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- NotUsing
- pch.h
- true
-
-
- Windows
- true
- false
-
-
-
-
- Level3
- true
- true
- true
- NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;BASECONSTVARIABLE_API;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions)
- true
- NotUsing
- pch.h
- true
- true
- NoExtensions
- true
- stdcpp14
- stdc11
- true
- false
- MaxSpeed
-
-
- Windows
- true
- true
- DebugFull
- false
-
-
- true
- compute_82,sm_82
-
-
-
-
- Level3
- true
- true
- true
- NDEBUG;BASECOMMONLIBRARY_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;BASECONSTVARIABLE_API;_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING;%(PreprocessorDefinitions)
- true
- NotUsing
- pch.h
- true
- true
- StreamingSIMDExtensions2
- true
- stdcpp14
- stdc11
-
-
- Windows
- true
- true
- DebugFull
- false
-
-
- true
- compute_82,sm_82
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Create
- Create
- Create
- Create
- Create
- Create
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters b/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters
deleted file mode 100644
index 74f915b..0000000
--- a/BaseCommonLibrary/BaseCommonLibrary.vcxproj.filters
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
- {bf5c3550-65f6-4dad-9908-26690551ffad}
-
-
- {4233f4e2-0d0f-4cf9-8722-367d80339b2c}
-
-
-
-
- 头文件
-
-
- 头文件
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
-
-
- 源文件
-
-
- 源文件
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- ToolAbstract
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
- BaseTool
-
-
-
-
- ToolAbstract
-
-
- BaseTool
-
-
-
-
- BaseTool
-
-
-
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/BaseConstVariable.h b/BaseCommonLibrary/BaseTool/BaseConstVariable.h
deleted file mode 100644
index a67b9d5..0000000
--- a/BaseCommonLibrary/BaseTool/BaseConstVariable.h
+++ /dev/null
@@ -1,388 +0,0 @@
-#pragma once
-
-#ifndef BASECONSTVARIABLE_H
-#define BASECONSTVARIABLE_H
-//#define EIGEN_USE_MKL_ALL
-//#define EIGEN_NO_DEBUG
-
-
-
-#ifdef BASECONSTVARIABLE_API
-#define BASECONSTVARIABLEAPI __declspec(dllexport)
-#else
-#define BASECONSTVARIABLEAPI __declspec(dllimport)
-#endif
-
-
-
-/** 定义常见文件格式*********/
-#define ENVI_FILE_FORMAT_FILTER u8"ALL File(*.*);;ENVI Bin(*.bin);;ENVI Data(*.dat);;ENVI Data(*.data);;tiff影像(*.tif);;tiff影像(*.tiff)"
-#define XML_FILE_FORMAT_FILTER u8"ALL File(*.*);;XML File(*.xml);;tiff影像(*.tiff)"
-
-
-//
-//#define EIGEN_USE_BLAS
-//#define EIGEN_USE_LAPACK
-//#define EIGEN_VECTORIZE_SSE2
-
-//#define DEBUGSHOWDIALOG
-
-#define __CUDANVCC___ // 定义CUDA函数
-
-#define __PRFDEBUG__
-//#define __PRFDEBUG_PRFINF__
-//#define __ECHOTIMEDEBUG__
-
-#define __TBPIMAGEDEBUG__
-
-//#include
-#include
-#include
-#include
-#include
-
-/** 打印时间 ***************************************************************/
-inline char* get_cur_time() {
- static char s[20];
- time_t t;
- struct tm* ltime;
- time(&t);
- ltime = localtime(&t);
- strftime(s, 20, "%Y-%m-%d %H:%M:%S", ltime);
- return s;
-}
-
-#define PRINT(fmt, ...) printf("%s " fmt, get_cur_time(), ##__VA_ARGS__);
-
-
-
-
-#define MATPLOTDRAWIMAGE
-
-
-#define r2d 180/3.141592653589793238462643383279
-#define d2r 3.141592653589793238462643383279/180
-#define LIGHTSPEED 299792458
-#define PRECISIONTOLERANCE 1e-6
-#define Radians2Degrees(Radians) Radians*PI_180
-#define Degrees2Radians(Degrees) Degrees*T180_PI
-#define EARTHWE 0.000072292115
-#define PI 3.141592653589793238462643383279
-
-#define WGS84_A 6378137.0 // 长半轴 (m)
-#define WGS84_F (1.0/298.257223563)
-#define WGS84_B (WGS84_A*(1-WGS84_F)) // 短半轴 (m)
-
-
-#define earthRoute 0.000072292115
-#define Memory1GB 1073741824
-#define Memory1MB 1048576
-#define Memory1KB 1024
-
-const std::complex imagI(0, 1);
-
-
-const double epsilon = 0.000000000000001;
-const double pi = 3.14159265358979323846;
-
-
-const double a = 6378137.0; //椭球长半轴
-const double ae = 6378137.0; //椭球长半轴
-const double ee = 0.0818191910428;// 第一偏心率
-const double f_inverse = 298.257223563; //扁率倒数
-const double b = a - a / f_inverse;
-const double eSquare = (a * a - b * b) / (a * a);
-const double e = sqrt(eSquare);
-const double earth_Re = 6378136.49;
-const double earth_Rp = (1 - 1 / f_inverse) * earth_Re;
-const double earth_We = 0.000072292115;
-
-/*********************************************** openMap参数 ********************************************************************/
-static long Paral_num_thread = 14;
-
-
-/*********************************************** 基础枚举 ********************************************************************/
-
-enum POLARTYPEENUM { // 极化类型
- POLARHH,
- POLARHV,
- POLARVH,
- POLARVV,
- POLARUNKOWN
-};
-
-
-enum SIGMATYPE {
- DBVALUE,
- AMPVALUE,
- INTENSITYVALUE,
- LINEARVALUE
-};
-
-
-/*********************************************** 基础结构体区域 ********************************************************************/
-
-///
-/// 地理坐标点
-///
-struct Landpoint // 点 SAR影像的像素坐标;
-{
- double lon; // 经度x lon pixel_col
- double lat; // 纬度y lat pixel_row
- double ati; // 高程z ati pixel_time
-};
-
-struct Point2 {
- double x = 0;
- double y = 0;
-};
-
-
-struct Point3 {
- double x = 0;
- double y = 0;
- double z = 0;
- void setX(double ix) { x = ix; }
- void setY(double iy) { y = iy; }
- void setZ(double iz) { z = iz; }
-};
-
-struct Point_3d {
- double x;
- double y;
- double z;
-};
-
-
-
-struct DemBox {
- double min_lon;
- double max_lon;
- double min_lat;
- double max_lat;
-};
-
-struct Vector3 {
- double x, y, z;
-};
-
-
-struct Vector3_single {
- float x, y, z;
-};
-
-
-/*********************************************** FEKO仿真参数 ********************************************************************/
-extern "C" struct SatellitePos {
- double time;
- double Px ;
- double Py ;
- double Pz ;
- double Vx ;
- double Vy ;
- double Vz ;
-};
-
-
-extern "C" struct SatelliteAntPos {
- double time; // 0
- double Px;
- double Py;
- double Pz;
- double Vx;
- double Vy;
- double Vz; //7
- double AntDirectX;
- double AntDirectY;
- double AntDirectZ;
- double AVx;
- double AVy;
- double AVz;//13
- double ZeroAntDiectX;
- double ZeroAntDiectY;
- double ZeroAntDiectZ;
- double lon;
- double lat;
- double ati; // 19
-};
-
-
-extern "C" struct PatternImageDesc {
- long phinum;
- long thetanum;
- double startTheta;
- double startPhi;
- double dtheta;
- double dphi;
-};
-
-
-struct CUDA_AntSate_PtrList {
- long PRF_len = 0;
- double* h_antpx = nullptr, * d_antpx = nullptr;
- double* h_antpy = nullptr, * d_antpy = nullptr;
- double* h_antpz = nullptr, * d_antpz = nullptr;
- double* h_antvx = nullptr, * d_antvx = nullptr;
- double* h_antvy = nullptr, * d_antvy = nullptr;
- double* h_antvz = nullptr, * d_antvz = nullptr;
- double* h_antdirectx = nullptr, * d_antdirectx = nullptr;
- double* h_antdirecty = nullptr, * d_antdirecty = nullptr;
- double* h_antdirectz = nullptr, * d_antdirectz = nullptr;
- double* h_antXaxisX = nullptr, * d_antXaxisX = nullptr;
- double* h_antXaxisY = nullptr, * d_antXaxisY = nullptr;
- double* h_antXaxisZ = nullptr, * d_antXaxisZ = nullptr;
- double* h_antYaxisX = nullptr, * d_antYaxisX = nullptr;
- double* h_antYaxisY = nullptr, * d_antYaxisY = nullptr;
- double* h_antYaxisZ = nullptr, * d_antYaxisZ = nullptr;
- double* h_antZaxisX = nullptr, * d_antZaxisX = nullptr;
- double* h_antZaxisY = nullptr, * d_antZaxisY = nullptr;
- double* h_antZaxisZ = nullptr, * d_antZaxisZ = nullptr;
-};
-
-/*********************************************** 卫星轨道坐标 ********************************************************************/
-
-
-///
-/// 轨道节点,坐标系统为WGS84
-///
-struct SatelliteOribtNode {
- double time;
-
- double Px;// 位置
- double Py;
- double Pz;
-
- double Vx;// 速度
- double Vy;
- double Vz;
-
- double AVx; // 加速度
- double AVy;
- double AVz;
-
- double AntXaxisX; // X天线指向,对应翻滚角等参数
- double AntXaxisY; //
- double AntXaxisZ; //
-
- double AntYaxisX; // Y天线指向,对应翻滚角等参数
- double AntYaxisY; //
- double AntYaxisZ; //
-
- double AntZaxisX; // Z天线指向,对应翻滚角等参数
- double AntZaxisY; //
- double AntZaxisZ; //
-
-
- double AntDirecX; // 天线指向,对应翻滚角等参数
- double AntDirecY;
- double AntDirecZ;
-
- double zeroDopplerDirectX; // 0 多普勒方向
- double zeroDopplerDirectY;
- double zeroDopplerDirectZ;
-
- double beamAngle; // 波位角
- double AzAngle;// 摆动角
-
-
-};
-
-
-struct SatelliteAntDirect {
- double Xst; // 地面-->卫星矢量
- double Yst;
- double Zst;
- double Vxs; // 卫星速度
- double Vys;
- double Vzs;
-
- double Xant; // 天线坐标系下的 矢量坐标
- double Yant;
- double Zant;
-
- double Norm;
-
- double ThetaAnt; // 天线坐标系下的 theta 坐标系
- double PhiAnt;
-};
-
-
-
-struct RadiationPatternGainPoint {
- double theta;
- double phi;
- double GainValue;
-};
-
-
-
-
-/*********************************************** 指针回收区域 ********************************************************************/
-
-inline void delArrPtr(void* p)
-{
- if (nullptr == p || NULL == p) {
- return;
- }
- delete[] p;
- p = nullptr;
-};
-
-inline void delPointer(void* p)
-{
- if (nullptr == p || NULL == p) {
- return;
- }
- delete p;
- p = nullptr;
-};
-
-inline void PrintTime() {
- time_t current_time;
- time(¤t_time);
- printf("Current timestamp in seconds: %ld\n", (long)current_time);
-};
-
-/** 计算分块 ******************************************************************/
-
-inline long getBlockRows(long sizeMB, long cols, long sizeMeta, long maxRows) {
- long rownum = (round(Memory1MB * 1.0 / sizeMeta / cols * sizeMB) + cols - 1);
- rownum = rownum < 0 ? 1 : rownum;
- rownum = rownum < maxRows ? rownum : maxRows;
- return rownum;
-};
-
-
-inline long nextpow2(long n) {
- long en = ceil(log2(n));
- return pow(2, en);
-};
-
-inline void releaseVoidArray(void* a)
-{
- free(a);
- a = NULL;
-};
-
-
-
-inline double converSigma2amp(double inSig, SIGMATYPE sigtype) {
- switch (sigtype)
- {
- case DBVALUE:
- return pow(10, inSig / 20);
- break;
- case AMPVALUE:
- return inSig;
- break;
- case INTENSITYVALUE:
- return pow(10, inSig / 10);
- break;
- default:
- return inSig;
- break;
- }
-}
-
-
-#endif
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/BaseTool.cpp b/BaseCommonLibrary/BaseTool/BaseTool.cpp
deleted file mode 100644
index 5ea4ed0..0000000
--- a/BaseCommonLibrary/BaseTool/BaseTool.cpp
+++ /dev/null
@@ -1,775 +0,0 @@
-#include "stdafx.h"
-//#define EIGEN_USE_BLAS
-#define EIGEN_VECTORIZE_SSE4_2
-//#include
-
-#include
-#include
-#include
-#include
-////#include
-
-#include
-#include
-#include < io.h >
-#include < stdio.h >
-#include < stdlib.h >
-#include
-#include
-#include
-//#include
-#include //#include "ogrsf_frmts.h"
-
-#include
-#include
-#include "GeoOperator.h"
-
-#include
-#include
-#include "baseTool.h"
-
-#include // 多项式拟合
-#include /* 提供了 gammaq 函数 */
-#include /* 提供了向量结构*/
-#include
-#include
-#include
-
-#include // 包含SSE指令集头文件
-#include // 包含SSE2指令集头文件
-#include // 包含OpenMP头文件
-#include
-#include
-#include
-#include
-
-QString longDoubleToQStringScientific(long double value) {
- std::ostringstream stream;
-
- // 设置流的精度为35位有效数字,并使用科学计数法
- stream << std::scientific << std::setprecision(35) << value;
-
- // 将标准字符串转换为 QString
- return QString::fromStdString(stream.str());
-}
-
-QString getCurrentTimeString() {
- struct tm ConversionTime;
- std::time_t t = std::time(NULL);
- char mbstr[100];
- _localtime64_s(&ConversionTime, &t);
- std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime);
- QString strTime = mbstr;
- return strTime;
-}
-
-QString getCurrentShortTimeString() {
- struct tm ConversionTime;
- std::time_t t = std::time(NULL);
- char mbstr[100];
- _localtime64_s(&ConversionTime, &t);
- std::strftime(mbstr, sizeof(mbstr), "%Y-%m-%d %H:%M:%S", &ConversionTime);
- QString strTime = mbstr;
- return strTime;
-}
-
-std::vector splitString(const QString& str, char delimiter)
-{
- QStringList tokens = str.split(delimiter);
- return convertQStringListToStdVector(tokens);
-}
-
-
-std::complex Cubic_Convolution_interpolation(double u, double v, Eigen::MatrixX> img)
-{
- if (img.rows() != 4 || img.cols() != 4) {
- throw std::exception("the size of img's block is not right");
- }
- // 斤拷锟斤拷模锟斤拷
- Eigen::MatrixX> wrc(1, 4);// 使锟斤拷 complex 斤拷锟斤拷要原斤拷为锟剿伙拷取值
- Eigen::MatrixX> wcr(4, 1);//
- for (int i = 0; i < 4; i++) {
- wrc(0, i) = Cubic_kernel_weight(u + 1 - i); // u+1,u,u-1,u-2
- wcr(i, 0) = Cubic_kernel_weight(v + 1 - i);
- }
-
- Eigen::MatrixX> interValue = wrc * img * wcr;
- return interValue(0, 0);
-}
-
-std::complex Cubic_kernel_weight(double s)
-{
- s = abs(s);
- if (s <= 1) {
- return std::complex(1.5 * s * s * s - 2.5 * s * s + 1, 0);
- }
- else if (s <= 2) {
- return std::complex(-0.5 * s * s * s + 2.5 * s * s - 4 * s + 2, 0);
- }
- else {
- return std::complex(0, 0);
- }
-}
-
-///
-/// p11 p12 -- x
-/// p0(u,v)
-/// p21 p22
-/// |
-/// y
-/// p11(0,0)
-/// p21(0,1)
-/// P12(1,0)
-/// p22(1,1)
-///
-/// x,y,z
-/// x,y,z
-/// x,y,z
-/// x,y,z
-/// x,y,z
-///
-double Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12, Landpoint p22)
-{
- return p11.ati * (1 - p0.lon) * (1 - p0.lat) +
- p12.ati * p0.lon * (1 - p0.lat) +
- p21.ati * (1 - p0.lon) * p0.lat +
- p22.ati * p0.lon * p0.lat;
-}
-
-
-
-bool onSegment(Point3 Pi, Point3 Pj, Point3 Q)
-{
- if ((Q.x - Pi.x) * (Pj.y - Pi.y) == (Pj.x - Pi.x) * (Q.y - Pi.y) //叉乘
- //保证Q点坐标在pi,pj之间
- && std::min(Pi.x, Pj.x) <= Q.x && Q.x <= std::max(Pi.x, Pj.x)
- && std::min(Pi.y, Pj.y) <= Q.y && Q.y <= std::max(Pi.y, Pj.y))
- return true;
- else
- return false;
-}
-
-Point3 invBilinear(Point3 p, Point3 a, Point3 b, Point3 c, Point3 d)
-{
- Point3 res;
-
- Point3 e = b - a;
- Point3 f = d - a;
- Point3 g = a - b + c - d;
- Point3 h = p - a;
-
- double k2 = cross2d(g, f);
- double k1 = cross2d(e, f) + cross2d(h, g);
- double k0 = cross2d(h, e);
- double u, v;
- // if edges are parallel, this is a linear equation
- if (abs(k2) < 0.001)
- {
- v = -k0 / k1;
- u = (h.x - f.x * v) / (e.x + g.x * v);
- p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
- return p;
- }
- // otherwise, it's a quadratic
- else
- {
- float w = k1 * k1 - 4.0 * k0 * k2;
- if (w < 0.0) {
- // 可能在边界上
- if (onSegment(a, b, p)) {
- Point3 tt = b - a;
- Point3 ttpa = p - a;
- double scater = ttpa / tt;
- if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
- p.z = a.z + scater * tt.z;
- return p;
- }
- else if (onSegment(b, c, p)) {
- Point3 tt = c - b;
- Point3 ttpa = p - b;
- double scater = ttpa / tt;
- if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
- p.z = b.z + scater * tt.z;
- return p;
- }
- else if (onSegment(c, d, p)) {
- Point3 tt = d - c;
- Point3 ttpa = p - c;
- double scater = ttpa / tt;
- if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
- p.z = c.z + scater * tt.z;
- return p;
- }
- else if (onSegment(d, a, p)) {
- Point3 tt = a - d;
- Point3 ttpa = p - d;
- double scater = ttpa / tt;
- if (scater < 0 || scater>1) { return { -9999,-9999,-9999 }; }
- p.z = d.z + scater * tt.z;
- return p;
- }
-
- return { -9999,-9999,-9999 };
- }
- else {
- w = sqrt(w);
-
- float ik2 = 0.5 / k2;
- float v = (-k1 - w) * ik2;
- float u = (h.x - f.x * v) / (e.x + g.x * v);
-
- if (u < 0.0 || u>1.0 || v < 0.0 || v>1.0)
- {
- v = (-k1 + w) * ik2;
- u = (h.x - f.x * v) / (e.x + g.x * v);
- }
- p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
- return p;
- }
- }
- p.z = a.z + (b.z - a.z) * u + (d.z - a.z) * v + (a.z - b.z + c.z - d.z) * u * v;
- return p;
-}
-
-double sind(double degree)
-{
- return sin(degree * d2r);
-}
-
-double cosd(double d)
-{
- return cos(d * d2r);
-}
-
-
-std::string Convert(float Num)
-{
- std::ostringstream oss;
- oss << Num;
- std::string str(oss.str());
- return str;
-}
-
-QString JoinPath(const QString& path, const QString& filename)
-{
- QDir dir(path);
-
- // Ensure the path ends with the appropriate separator
- if (!QDir::isAbsolutePath(path))
- dir.makeAbsolute();
-
- return dir.filePath(filename);
-}
-std::vector convertQStringListToStdVector(const QStringList& qStringList)
-{
- std::vector stdVector;
-
- for (const QString& str : qStringList) {
- stdVector.push_back(str);
- }
-
- return stdVector;
-};
-
-
-ErrorCode polyfit(const double* x, const double* y, int xyLength, int poly_n, std::vector& out_factor, double& out_chisq) {
- /*
- * x:自变量,视差
- * y:因变量,距离
- * xyLength: x、y长度
- * poly_n:拟合的阶次
- * out_factor:拟合的系数结果,从0阶到poly_n阶的系数
- * out_chisq:拟合曲线与数据点的优值函数最小值 ,χ2 检验
- */
-
- gsl_matrix* XX = gsl_matrix_alloc(xyLength, poly_n + 1);
- gsl_vector* c = gsl_vector_alloc(poly_n + 1);
- gsl_matrix* cov = gsl_matrix_alloc(poly_n + 1, poly_n + 1);
- gsl_vector* vY = gsl_vector_alloc(xyLength);
-
- for (size_t i = 0; i < xyLength; i++)
- {
- gsl_matrix_set(XX, i, 0, 1.0);
- gsl_vector_set(vY, i, y[i]);
- for (int j = 1; j <= poly_n; j++)
- {
- gsl_matrix_set(XX, i, j, pow(x[i], j));
- }
- }
- gsl_multifit_linear_workspace* workspace = gsl_multifit_linear_alloc(xyLength, poly_n + 1);
- int r = gsl_multifit_linear(XX, vY, c, cov, &out_chisq, workspace);
- gsl_multifit_linear_free(workspace);
- out_factor.resize(c->size, 0);
- for (size_t i = 0; i < c->size; ++i)
- {
- out_factor[i] = gsl_vector_get(c, i);
- }
-
- gsl_vector_free(vY);
- gsl_matrix_free(XX);
- gsl_matrix_free(cov);
- gsl_vector_free(c);
-
- return GSLState2ErrorCode(r);
-}
-
-Point3 crossProduct(const Point3& a, const Point3& b)
-{
- return Point3{
- a.y * b.z - a.z * b.y, // C_x
- a.z * b.x - a.x * b.z, // C_y
- a.x * b.y - a.y * b.x // C_z
- };
-}
-
-
-
-
-// 计算绕任意轴旋转的旋转矩阵
-Eigen::Matrix3d rotationMatrix(const Eigen::Vector3d& axis, double angle) {
- // 确保旋转轴是单位向量
- Eigen::Vector3d u = axis.normalized();
-
- double cos_theta = cos(angle);
- double sin_theta = sin(angle);
-
- // 计算旋转矩阵
- Eigen::Matrix3d R;
- R <<
- cos_theta + u.x() * u.x() * (1 - cos_theta), u.x()* u.y()* (1 - cos_theta) - u.z() * sin_theta, u.x()* u.z()* (1 - cos_theta) + u.y() * sin_theta,
- u.y()* u.x()* (1 - cos_theta) + u.z() * sin_theta, cos_theta + u.y() * u.y() * (1 - cos_theta), u.y()* u.z()* (1 - cos_theta) - u.x() * sin_theta,
- u.z()* u.x()* (1 - cos_theta) - u.y() * sin_theta, u.z()* u.y()* (1 - cos_theta) + u.x() * sin_theta, cos_theta + u.z() * u.z() * (1 - cos_theta);
-
- return R;
-}
-
-
-
-
-
-long double convertToMilliseconds(const std::string& dateTimeStr) {
- // 定义日期时间字符串
- std::string dateTimeString = dateTimeStr;
- // 使用 Boost.Date_Time 解析日期时间字符串
- boost::posix_time::ptime dateTime = boost::posix_time::time_from_string(dateTimeString);
-
- // 将 ptime 转换为自 epoch (1970年1月1日) 以来的毫秒数
- boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1));
- boost::posix_time::time_duration duration = dateTime - epoch;
- long double milliseconds = duration.total_milliseconds() / 1000.0;
- return milliseconds;
-
-}
-
-long FindValueInStdVector(std::vector& list, double& findv)
-{
- if (list.size() == 0) {
- return -1;
- }
- else if (list.size() == 1) {
- if (abs(list[0] - findv) < 1e-9) {
- return 0;
- }
- else {
- return -1;
- }
- }
- else {}
-
- if (abs(list[0] - findv) < 1e-9) {
- return 0;
- }
- else if (abs(list[list.size() - 1] - findv) < 1e-9) {
- return list.size() - 1;
- }
- else if (list[0] > findv) {
- return -1;
- }
- else if (list[list.size() - 1] < findv) {
- return -1;
- }
- else {}
-
-
-
- long low = 0;
- long high = list.size() - 1;
- while (low <= high) {
- long mid = (low + high) / 2;
- if (abs(list[mid] - findv) < 1e-9) {
- return mid;
- }
- else if (list[mid] < findv) {
- low = mid + 1;
- }
- else if (list[mid] > findv) {
- high = mid - 1;
- }
- else {}
- }
- return -1;
-}
-
-long InsertValueInStdVector(std::vector& list, double insertValue, bool repeatValueInsert)
-{
- if (list.size() == 0) {
- list.insert(list.begin(), insertValue);
- return 0;
- }
- else if (list.size() == 1) {
- if (std::abs(list[0] - insertValue) < PRECISIONTOLERANCE) {
- if (repeatValueInsert) {
- list.push_back(insertValue);
- return 1;
- }
- else {
- return -1;
- }
- }
- else if (insertValue > list[0]) {
- list.push_back(insertValue);
- return 1;
- }
- else if (insertValue < list[0]) {
- list.push_back(insertValue);
- return 0;
- }
- }
- else {
- long low = 0;
- long high = list.size() - 1;
- long mid = -1;
- // 处理边界
- if (list[high] <= insertValue)
- {
- if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE) {
- if (repeatValueInsert) {
- list.push_back(insertValue);
- }
- else {}
- }
- else {
- list.push_back(insertValue);
- }
- return list.size() - 1;
- }
-
- if (list[low] >= insertValue) {
-
- if (std::abs(list[low] - insertValue) < PRECISIONTOLERANCE) {
- if (repeatValueInsert) {
- list.insert(list.begin(), insertValue);
- }
- else {}
- }
- else {
- list.insert(list.begin(), insertValue);
- }
- return 0;
- }
- // low 1) {
- mid = (low + high) / 2;
- if (std::abs(list[mid] - insertValue) < PRECISIONTOLERANCE) {
- if (repeatValueInsert) {
- list.insert(list.begin() + mid, insertValue);
- }
- return mid;
- }
- else if (insertValue < list[mid]) {
- high = mid;
- }
- else if (list[mid] < insertValue) {
- low = mid;
- }
-
- }
- if (list[low] <= insertValue && insertValue <= list[high])
- {
-
- if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE) {
- if (repeatValueInsert) {
- list.insert(list.begin() + high, insertValue);
- }
- else {}
- }
- else {
- list.insert(list.begin() + high, insertValue);
- }
- return low;
- }
- else {
- return -1;
- }
- }
- return -1;
-}
-
-long FindValueInStdVectorLast(std::vector& list, double& insertValue)
-{
- if (list.size() == 0 || list.size() == 1) {
- return -1;
- }
- else {
- long low = 0;
- long high = list.size() - 1;
- long mid = -1;
- // 处理边界
- if (list[high]+ PRECISIONTOLERANCE < insertValue)
- {
- return -1;
- }
- else if (std::abs(list[high] - insertValue) < PRECISIONTOLERANCE)
- {
- return high;
- }
- else if (list[low] > insertValue) {
- return -1;
- }
- else if (std::abs(list[low] - insertValue) < PRECISIONTOLERANCE) {
- return low;
- }
- else {}
- // low 1) {
- mid = (low + high) / 2;
- if (insertValue < list[mid]) {
- high = mid;
- }
- else if (list[mid] < insertValue) {
- low = mid;
- }
- else {// insertValue==list[mid] , list[mid]===insertValue
- return mid;//
- }
- }
- if (list[low] <= insertValue && insertValue <= list[high])
- {
- return low;
- }
- else {
- return -1;
- }
- }
- return -1;
-}
-
-
-ErrorCode polynomial_fit(const std::vector& x, const std::vector& y, int degree, std::vector& out_factor, double& out_chisq) {
- int xyLength = x.size();
- double* xdata = new double[xyLength];
- double* ydata = new double[xyLength];
- for (long i = 0; i < xyLength; i++) {
- xdata[i] = x[i];
- ydata[i] = y[i];
- }
- ErrorCode state = polyfit(xdata, ydata, xyLength, degree, out_factor, out_chisq);
-
- delete[] xdata;
- delete[] ydata; // 释放内存
- return state;
-}
-
-QVector SatellitePos2SatelliteAntPos(QVector poses)
-{
- QVector antposes(poses.count());
- for (long i = 0; i < poses.count(); i++) {
- antposes[i].time = poses[i].time;
- antposes[i].Px = poses[i].Px;
- antposes[i].Py = poses[i].Py;
- antposes[i].Pz = poses[i].Pz;
- antposes[i].Vx = poses[i].Vx;
- antposes[i].Vy = poses[i].Vy;
- antposes[i].Vz = poses[i].Vz;
- }
- return antposes;
-}
-
-QVector SatelliteAntPos2SatellitePos(QVector poses)
-{
- QVector antposes(poses.count());
- for (long i = 0; i < poses.count(); i++) {
- antposes[i].time = poses[i].time;
- antposes[i].Px = poses[i].Px;
- antposes[i].Py = poses[i].Py;
- antposes[i].Pz = poses[i].Pz;
- antposes[i].Vx = poses[i].Vx;
- antposes[i].Vy = poses[i].Vy;
- antposes[i].Vz = poses[i].Vz;
- }
- return antposes;
-}
-
-
-QString getDebugDataPath(QString filename)
-{
- QString folderName = "debugdata";
- QString appDir = QCoreApplication::applicationDirPath();
- QString folderpath = JoinPath(appDir, folderName);
- if (!QDir(folderpath).exists()) {
- QDir(appDir).mkdir(folderName);
- }
- QString datapath = JoinPath(folderpath, filename);
- QFile datafile(datapath);
- if (datafile.exists()) {
- datafile.remove();
- }
- return datapath;
-}
-
-
-std::vector split(const std::string& str, char delimiter) {
- std::vector tokens;
- std::string token;
- std::istringstream tokenStream(str);
-
- while (std::getline(tokenStream, token, delimiter)) {
- tokens.push_back(token);
- }
-
- return tokens;
-}
-
-
-Eigen::VectorXd linspace(double start, double stop, int num) {
- Eigen::VectorXd result(num);
-
- double step = (stop - start) / (num - 1); // 计算步长
- for (int i = 0; i < num; ++i) {
- result[i] = start + i * step; // 生成等间距数值
- }
-
- return result;
-}
-
-void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount) {
- __m128d zero = _mm_setzero_pd();
-
-#pragma omp parallel for
- for (long i = 0; i < rowcount; ++i) {
- for (long j = 0; j < colcount; j += 2) { // 每次处理2个double
- if (j + 2 <= colcount) {
- __m128d src = _mm_loadu_pd(&data[i * colcount + j]);
- _mm_storeu_pd(&mat(i, j), src);
- }
- else {
- // 处理剩余部分
- for (long k = j; k < colcount; ++k) {
- mat(i, k) = data[i * colcount + k];
- }
- }
- }
- }
-}
-
-void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount) {
- __m128 zero = _mm_setzero_ps();
-
-#pragma omp parallel for
- for (long i = 0; i < rowcount; ++i) {
- for (long j = 0; j < colcount; j += 4) { // 每次处理4个float
- if (j + 4 <= colcount) {
- __m128 src = _mm_loadu_ps(&data[i * colcount + j]);
- _mm_storeu_ps(&mat(i, j), src);
- }
- else {
- // 处理剩余部分
- for (long k = j; k < colcount; ++k) {
- mat(i, k) = data[i * colcount + k];
- }
- }
- }
- }
-}
-
-Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg)
-{
- Eigen::MatrixXd sigma = Eigen::MatrixXd::Zero(eta_deg.rows(), eta_deg.cols());
- for (long i = 0; i < sigma.rows(); i++) {
- for (long j = 0; j < sigma.cols(); j++) {
- sigma(i,j) = calculate_MuhlemanSigma(eta_deg(i, j));
- }
- }
- return sigma;
-}
-
-Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0)
-{
- Eigen::MatrixXd sigma = Eigen::MatrixXd::Zero(sigma0.rows(), sigma0.cols());
- for (long i = 0; i < sigma.rows(); i++) {
- for (long j = 0; j < sigma.cols(); j++) {
- sigma(i, j) =std::pow(10.0, sigma0(i,j)/20.0);
- }
- }
- return sigma;
-}
-
-
-
-QDateTime parseCustomDateTime(const QString& dateTimeStr) {
- // 手动解析日期时间字符串
- int year = dateTimeStr.left(4).toInt();
- int month = dateTimeStr.mid(5, 2).toInt();
- int day = dateTimeStr.mid(8, 2).toInt();
- int hour = dateTimeStr.mid(11, 2).toInt();
- int minute = dateTimeStr.mid(14, 2).toInt();
- int second = dateTimeStr.mid(17, 2).toInt();
- int msec = dateTimeStr.mid(20, 6).toInt(); // 只取毫秒的前三位,因为QDateTime支持到毫秒
-
- // 创建 QDate 和 QTime 对象
- QDate date(year, month, day);
- QTime time(hour, minute, second, msec ); // 转换为微秒,但QTime只支持毫秒精度
-
- // 构造 QDateTime 对象
- QDateTime result(date, time);
-
- return result;
-}
-
-
-bool isLeapYear(int year) {
- return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
-}
-
-int daysInMonth(int year, int month) {
- if (month == 2) return isLeapYear(year) ? 29 : 28;
- else if (month == 4 || month == 6 || month == 9 || month == 11) return 30;
- else return 31;
-}
-
-
-TimestampMicroseconds parseAndConvert( std::string dateTimeStr) {
- // 解析年、月、日、时、分、秒和微秒
- int year = std::stoi(dateTimeStr.substr(0, 4));
- int month = std::stoi(dateTimeStr.substr(5, 2));
- int day = std::stoi(dateTimeStr.substr(8, 2));
- int hour = std::stoi(dateTimeStr.substr(11, 2));
- int minute = std::stoi(dateTimeStr.substr(14, 2));
- int second = std::stoi(dateTimeStr.substr(17, 2));
- int microsec = std::stoi(dateTimeStr.substr(20, 6));
-
- // 计算从1970年至目标年份前一年的总天数
- long long totalDays = 0;
- for (int y = 1970; y < year; ++y) {
- totalDays += isLeapYear(y) ? 366 : 365;
- }
-
- // 加上目标年份从1月到上一个月的天数
- for (int m = 1; m < month; ++m) {
- totalDays += daysInMonth(year, m);
- }
-
- // 加上本月的天数
- totalDays += day - 1;
-
- // 转换为总秒数,再加上小时、分钟、秒
- long long totalSeconds = totalDays * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
-
- // 转换为毫秒和微秒
- long long msecsSinceEpoch = totalSeconds * 1000 + microsec / 1000;
- int microseconds = microsec % 1000;
-
- return { msecsSinceEpoch, microseconds };
-}
-
-
diff --git a/BaseCommonLibrary/BaseTool/BaseTool.h b/BaseCommonLibrary/BaseTool/BaseTool.h
deleted file mode 100644
index 6ad57ff..0000000
--- a/BaseCommonLibrary/BaseTool/BaseTool.h
+++ /dev/null
@@ -1,226 +0,0 @@
-#pragma once
-#ifndef BASETOOL_H
-#define BASETOOL_H
-#include "BaseConstVariable.h"
-
-///
-/// 基本类、基本函数
-///
-
-
-// //#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "GeoOperator.h"
-#include
-#include
-#include
-#include
-#include "LogInfoCls.h"
-#include
-#include
-#include
-#include
-#include
-#include
-
-///////////////////////////////////// 基础数学函数 /////////////////////////////////////////////////////////////
-
-
-QString longDoubleToQStringScientific(long double value);
-
-///////////////////////////////////// 运行时间打印 /////////////////////////////////////////////////////////////
-
-
-QString BASECONSTVARIABLEAPI getCurrentTimeString();
-QString BASECONSTVARIABLEAPI getCurrentShortTimeString();
-
-std::vector BASECONSTVARIABLEAPI splitString(const QString& str, char delimiter);
-std::vector BASECONSTVARIABLEAPI convertQStringListToStdVector(const QStringList& qStringList);
-/////////////////////////////// 基本图像类 结束
-/////////////////////////////////////////////////////////////
-
-std::string BASECONSTVARIABLEAPI Convert(float Num);
-QString BASECONSTVARIABLEAPI JoinPath(const QString& path, const QString& filename);
-
-////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
-
-////////////////////////////// 坐标部分基本方法 //////////////////////////////////////////
-
-////////////////////////////// 插值 ////////////////////////////////////////////
-
-std::complex BASECONSTVARIABLEAPI Cubic_Convolution_interpolation(double u, double v,
- Eigen::MatrixX> img);
-
-std::complex BASECONSTVARIABLEAPI Cubic_kernel_weight(double s);
-
-double BASECONSTVARIABLEAPI Bilinear_interpolation(Landpoint p0, Landpoint p11, Landpoint p21, Landpoint p12,Landpoint p22);
-
-bool BASECONSTVARIABLEAPI onSegment(Point3 Pi, Point3 Pj, Point3 Q);
-
-Point3 BASECONSTVARIABLEAPI invBilinear(Point3 p, Point3 a, Point3 b, Point3 c, Point3 d);
-
-//
-// WGS84 到J2000 坐标系的变换
-// 参考网址:https://blog.csdn.net/hit5067/article/details/116894616
-// 资料网址:http://celestrak.org/spacedata/
-// 参数文件:
-// a. Earth Orientation Parameter 文件: http://celestrak.org/spacedata/EOP-Last5Years.csv
-// b. Space Weather Data 文件: http://celestrak.org/spacedata/SW-Last5Years.csv
-// 备注:上述文件是自2017年-五年内
-/**
-在wgs84 坐标系转到J2000 坐标系 主要 涉及到坐标的相互转换。一般给定的WGS坐标为 给定时刻的 t ,BLH
-转换步骤:
-step 1: WGS 84 转换到协议地球坐标系
-step 2: 协议地球坐标系 转换为瞬时地球坐标系
-step 3: 瞬时地球坐标系 转换为 瞬时真天球坐标系
-step 4: 瞬时真天球坐标系 转到瞬时平天球 坐标系
-step 5: 瞬时平天球坐标系转换为协议天球坐标系(J2000)
-**/
-
-double BASECONSTVARIABLEAPI sind(double degree);
-
-double BASECONSTVARIABLEAPI cosd(double d);
-
-// 插值
-ErrorCode BASECONSTVARIABLEAPI polyfit(const double* x, const double* y, int xyLength, int poly_n, std::vector& out_factor, double& out_chisq);
-
-// 叉乘
-Point3 BASECONSTVARIABLEAPI crossProduct(const Point3& a, const Point3& b);
-
-Eigen::Matrix3d BASECONSTVARIABLEAPI rotationMatrix(const Eigen::Vector3d& axis, double angle);
-
-long double BASECONSTVARIABLEAPI convertToMilliseconds(const std::string& dateTimeStr);
-
-QDateTime BASECONSTVARIABLEAPI parseCustomDateTime(const QString& dateTimeStr);
-///
-/// list 应该是按照从小到大的顺序排好
-///
-///
-///
-///
-long BASECONSTVARIABLEAPI FindValueInStdVector(std::vector& list,double& findv);
-
-long BASECONSTVARIABLEAPI InsertValueInStdVector(std::vector& list, double insertValue, bool repeatValueInsert = false);
-
-long BASECONSTVARIABLEAPI FindValueInStdVectorLast(std::vector& list, double& findv);
-
-ErrorCode BASECONSTVARIABLEAPI polynomial_fit(const std::vector& x, const std::vector& y, int degree, std::vector& out_factor, double& out_chisq);
-
-QVector BASECONSTVARIABLEAPI SatellitePos2SatelliteAntPos(QVector poses);
-
-QVector BASECONSTVARIABLEAPI SatelliteAntPos2SatellitePos(QVector poses);
-
-QString BASECONSTVARIABLEAPI getDebugDataPath(QString filename);
-std::vector BASECONSTVARIABLEAPI split(const std::string& str, char delimiter);
-Eigen::VectorXd BASECONSTVARIABLEAPI linspace(double start, double stop, int num);
-
-
-/** 内存赋值 ***********************************************************************************************************/
-void initializeMatrixWithSSE2(Eigen::MatrixXd& mat, const double* data, long rowcount, long colcount);
-void initializeMatrixWithSSE2(Eigen::MatrixXf& mat, const float* data, long rowcount, long colcount);
-
-Eigen::MatrixXd BASECONSTVARIABLEAPI MuhlemanSigmaArray(Eigen::MatrixXd& eta_deg);
-Eigen::MatrixXd BASECONSTVARIABLEAPI dB2Amp(Eigen::MatrixXd& sigma0);
-
-
-struct TimestampMicroseconds {
- boost::int64_t msecsSinceEpoch; // 自1970-01-01T00:00:00 UTC以来的毫秒数
- int microseconds; // 额外的微秒(精确到微秒)
-};
-
-
-bool BASECONSTVARIABLEAPI isLeapYear(int year);
-int BASECONSTVARIABLEAPI daysInMonth(int year, int month);
-
-TimestampMicroseconds BASECONSTVARIABLEAPI parseAndConvert( std::string dateTimeStr);
-
-
-/** 模板函数类 ***********************************************************************************************************/
-
-inline double calculate_MuhlemanSigma(double eta_deg) {
- const double eta_rad = eta_deg * M_PI / 180.0; // 角度转弧度
-
- const double cos_eta = std::cos(eta_rad);
- const double sin_eta = std::sin(eta_rad);
-
- const double denominator = sin_eta + 0.1 * cos_eta;
-
- return (0.0133 * cos_eta) / std::pow(denominator, 3);
-};
-
-
-
-template
-inline void memsetInitArray(std::shared_ptr ptr, long arrcount, T ti) {
- for (long i = 0; i < arrcount; i++) {
- ptr.get()[i] = ti;
- }
-};
-
-template
-inline void memcpyArray(std::shared_ptr srct, std::shared_ptr dest, long arrcount) {
- for (long i = 0; i < arrcount; i++) {
- dest.get()[i] = srct.get()[i];
- }
-};
-
-
-template
-inline void minValueInArr(T* ptr, long arrcount, T& minvalue) {
-
- if (arrcount == 0)return;
-
- minvalue = ptr[0];
- for (long i = 0; i < arrcount; i++) {
- if (minvalue > ptr[i]) {
- minvalue = ptr[i];
- }
- }
-};
-
-template
-inline void maxValueInArr(T* ptr, long arrcount, T& maxvalue) {
-
- if (arrcount == 0)return;
-
- maxvalue = ptr[0];
- for (long i = 0; i < arrcount; i++) {
- if (maxvalue < ptr[i]) {
- maxvalue = ptr[i];
- }
- }
-};
-
-
-
-/** 常用SAR工具 ***********************************************************************************************************/
-
-
-template
-inline T complexAbs(std::complex ccdata) {
- return T(sqrt(pow(ccdata.real(), 2) + pow(ccdata.imag(), 2)));
-};
-
-template
-inline void complex2dB(std::complex* ccdata, T* outdata, long long count) {
-
- for (long long i = 0; i < count; i++) {
- outdata[i] = 20 * log10(complexAbs(ccdata[i]));
- }
-
-};
-
-
-
-#endif
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp b/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp
deleted file mode 100644
index bc50ed5..0000000
--- a/BaseCommonLibrary/BaseTool/EchoDataFormat.cpp
+++ /dev/null
@@ -1,822 +0,0 @@
-#include "stdafx.h"
-#include "EchoDataFormat.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "ImageOperatorBase.h"
-
-
-std::shared_ptr CreatePluseAntPosArr(long pluseCount)
-{
- return std::shared_ptr(new PluseAntPos[pluseCount],delArrPtr);
-}
-
-long getPluseDataSize(PluseData& pluseData)
-{
- long datasize = sizeof(long) + sizeof(double) + sizeof(double) * 6 + sizeof(long);// PRFId,time,px-vz,pluseCount
- datasize = datasize + pluseData.plusePoints * sizeof(double) * 2; // ݿ
- return datasize;
-}
-
-ErrorCode getPluseDataFromBuffer(char* buffer, PluseData & data)
-{
- long seekid = 0;
- std::memcpy(&data.id, buffer + seekid, sizeof(data.id)); seekid += sizeof(data.id);
- std::memcpy(&data.time, buffer + seekid, sizeof(data.time)); seekid += sizeof(data.time);
- std::memcpy(&data.Px, buffer + seekid, sizeof(data.Px)); seekid += sizeof(data.Px);
- std::memcpy(&data.Py, buffer + seekid, sizeof(data.Py)); seekid += sizeof(data.Py);
- std::memcpy(&data.Pz, buffer + seekid, sizeof(data.Pz)); seekid += sizeof(data.Pz);
- std::memcpy(&data.Vx, buffer + seekid, sizeof(data.Vx)); seekid += sizeof(data.Vx);
- std::memcpy(&data.Vy, buffer + seekid, sizeof(data.Vy)); seekid += sizeof(data.Vy);
- std::memcpy(&data.Vz, buffer + seekid, sizeof(data.Vz)); seekid += sizeof(data.Vz);
- std::memcpy(&data.plusePoints, buffer + seekid, sizeof(data.plusePoints)); seekid += sizeof(data.plusePoints);
-
- Eigen::MatrixXd echoData_real = Eigen::MatrixXd::Zero(1, data.plusePoints);
- Eigen::MatrixXd echoData_imag = Eigen::MatrixXd::Zero(1, data.plusePoints);
- std::memcpy(echoData_real.data(), buffer + seekid, sizeof(data.plusePoints)); seekid += data.plusePoints * sizeof(double);
- std::memcpy(echoData_imag.data(), buffer + seekid, sizeof(data.plusePoints));
-
- std::shared_ptr echoData = std::make_shared(1, data.plusePoints);
- echoData->real() = echoData_real.array();
- echoData->imag() = echoData_imag.array();
- return ErrorCode::SUCCESS;
-}
-
-std::shared_ptr CreatePluseDataArr(long pluseCount)
-{
- return std::shared_ptr(new PluseData[pluseCount],delArrPtr);
-}
-
-std::shared_ptr> CreateEchoData(long plusePoints)
-{
- return std::shared_ptr>(new std::complex[plusePoints],delArrPtr);
-}
-
-EchoL0Dataset::EchoL0Dataset()
-{
- this->folder="";
- this->filename="";
- this->xmlname="";
- this->GPSPointFilename="";
- this->echoDataFilename="";
- this->xmlFilePath="";
- this->GPSPointFilePath="";
- this->echoDataFilePath="";
- this->simulationTaskName = "";
-
- this->PluseCount = 0;
- this->PlusePoints = 0;
- this->NearRange = 0;
- this->FarRange = 0;
- this->centerFreq = 0;
- this->Fs = 0;
-
- this->folder.clear();
- this->filename.clear();
- this->xmlname.clear();
- this->GPSPointFilename.clear();
- this->echoDataFilename.clear();
- this->xmlFilePath.clear();
- this->GPSPointFilePath.clear();
- this->echoDataFilePath.clear();
- this->simulationTaskName.clear();
-
-}
-
-EchoL0Dataset::~EchoL0Dataset()
-{
-}
-
-ErrorCode EchoL0Dataset::OpenOrNew(QString folder, QString filename, long PluseCount, long PlusePoints)
-{
- qDebug() << "--------------Echo Data OpenOrNew ---------------------------------------";
- qDebug() << "Folder: " << folder;
- qDebug() << "Filename: " << filename;
- QDir dir(folder);
- if (dir.exists() == false)
- {
- dir.mkpath(folder);
- }
- else {}
-
- if (dir.exists() == false) {
- return ErrorCode::FOLDER_NOT_EXIST;
- }
- else {}
- QString filePath = dir.filePath(filename); // ļ·
-
- this->folder = folder;
- this->filename = filename;
- this->simulationTaskName = filename;
-
- this->xmlname=filename+".xml";
- this->GPSPointFilename=filename+".gpspos.data";
- this->echoDataFilename = filename + ".L0echo.data";
-
- this->xmlFilePath = dir.filePath(this->xmlname);
- this->GPSPointFilePath = dir.filePath(this->GPSPointFilename);
- this->echoDataFilePath = dir.filePath(this->echoDataFilename);
-
- this->PluseCount = PluseCount;
- this->PlusePoints = PlusePoints;
-
-
- //
- if (QFile(this->xmlFilePath).exists())
- {
- this->loadFromXml();
- }
- else
- {
- this->saveToXml();
- }
-
- if (QFile(this->GPSPointFilePath).exists() == false) {
- // ļ
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- GDALAllRegister();
- CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
-
- GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
- GDALDataset* poDstDS=(poDriver->Create(this->GPSPointFilePath.toUtf8().constData(), 19, PluseCount, 1, GDT_Float64, NULL));
- GDALFlushCache((GDALDatasetH)poDstDS);
- GDALClose(poDstDS);
- //poDstDS.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
-
- }
-
- if (QFile(this->echoDataFilePath).exists() == false) {
-
- // ļ
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- GDALAllRegister();
- CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
-
- GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("ENVI");
- GDALDataset* poDstDS = (poDriver->Create(this->echoDataFilePath.toUtf8().constData(), PlusePoints, PluseCount, 1, GDT_CFloat64, NULL));
- GDALFlushCache((GDALDatasetH)poDstDS);
- GDALClose(poDstDS);
- //poDstDS.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
-
- }
-
-
-
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode EchoL0Dataset::Open(QString xmlfilepath)
-{
- QFileInfo fileInfo(xmlfilepath);
- QString fileName = fileInfo.fileName(); // ȡļ
- QString fileSuffix = fileInfo.suffix(); // ȡ
- QString fileNameWithoutSuffix = fileInfo.baseName(); // ȡļ
- QString directoryPath = fileInfo.path(); // ȡļ·
- if (fileSuffix.toLower() == "xml" || fileSuffix.toLower() == ".xml") {
- return this->Open(directoryPath,fileNameWithoutSuffix);
- }
- else {
- return ErrorCode::ECHO_L0DATA_XMLNAMEERROR;
- }
-
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode EchoL0Dataset::Open(QString folder, QString filename)
-{
- QDir dir(folder);
- if (dir.exists() == false)
- {
- return ErrorCode::FOLDER_NOT_EXIST;
- }
- else {}
-
- if (dir.exists() == false) {
- return ErrorCode::FOLDER_NOT_EXIST;
- }
- else {}
- QString filePath = dir.filePath(filename); // ļ·
-
- this->folder = folder;
- this->filename = filename;
- this->simulationTaskName = filename;
-
- this->xmlname = filename + ".xml";
- this->GPSPointFilename = filename + ".gpspos.data";
- this->echoDataFilename = filename + ".L0echo.data";
-
- this->xmlFilePath = dir.filePath(this->xmlname);
- this->GPSPointFilePath = dir.filePath(this->GPSPointFilename);
- this->echoDataFilePath = dir.filePath(this->echoDataFilename);
-
- this->PluseCount = PluseCount;
- this->PlusePoints = PlusePoints;
-
- //
- if (QFile(this->xmlFilePath).exists())
- {
- this->loadFromXml();
- }
- else
- {
- return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR;
- }
- return ErrorCode::SUCCESS;
-}
-
-QString EchoL0Dataset::getxmlName()
-{
- return xmlname;
-}
-
-QString EchoL0Dataset::getGPSPointFilename()
-{
- return GPSPointFilename;
-}
-
-QString EchoL0Dataset::getEchoDataFilename()
-{
- return GPSPointFilePath;
-}
-
-QString EchoL0Dataset::getGPSPointFilePath()
-{
- return this->GPSPointFilePath;
-}
-
-QString EchoL0Dataset::getEchoDataFilePath()
-{
- return this->echoDataFilePath;
-}
-
-void EchoL0Dataset::initEchoArr(std::complex init0)
-{
- long blockline = Memory1MB / 8 / 2 / this->PlusePoints * 8000;
-
- long start = 0;
- for (start = 0; start < this->PluseCount; start = start + blockline) {
- long templine = start + blockline < this->PluseCount ? blockline : this->PluseCount - start;
- std::shared_ptr> echotemp = this->getEchoArr(start, templine);
- for (long i = 0; i < templine; i++) {
- for (long j = 0; j < this->PlusePoints; j++) {
- echotemp.get()[i * this->PlusePoints + j] = init0;
- }
- }
- this->saveEchoArr(echotemp, start, templine);
- qDebug() << "echo init col : " << start << "\t-\t" << start + templine << "\t/\t" << this->PluseCount;
- }
-}
-
-// Getter Setter ʵ
-long EchoL0Dataset::getPluseCount() { return this->PluseCount; }
-void EchoL0Dataset::setPluseCount(long pulseCount) { this->PluseCount = pulseCount; }
-
-long EchoL0Dataset::getPlusePoints() { return this->PlusePoints; }
-void EchoL0Dataset::setPlusePoints(long pulsePoints) { this->PlusePoints = pulsePoints; }
-
-
-double EchoL0Dataset::getNearRange() { return this->NearRange; }
-void EchoL0Dataset::setNearRange(double nearRange) { this->NearRange = nearRange; }
-
-double EchoL0Dataset::getFarRange() { return this->FarRange; }
-void EchoL0Dataset::setFarRange(double farRange) { this->FarRange = farRange; }
-
-double EchoL0Dataset::getCenterFreq() { return this->centerFreq; }
-void EchoL0Dataset::setCenterFreq(double freq) { this->centerFreq = freq; }
-
-double EchoL0Dataset::getFs() { return this->Fs; }
-void EchoL0Dataset::setFs(double samplingFreq) { this->Fs = samplingFreq; }
-
-QString EchoL0Dataset::getSimulationTaskName() { return this->simulationTaskName; }
-void EchoL0Dataset::setSimulationTaskName(const QString& taskName) { this->simulationTaskName = taskName; }
-
-double EchoL0Dataset::getCenterAngle()
-{
- return this->CenterAngle;
-}
-
-void EchoL0Dataset::setCenterAngle(double angle)
-{
- this->CenterAngle = angle;
-}
-
-QString EchoL0Dataset::getLookSide()
-{
- return this->LookSide;
-}
-
-void EchoL0Dataset::setLookSide(QString lookside)
-{
- this->LookSide = lookside;
-}
-
-double EchoL0Dataset::getBandwidth()
-{
- return this->bandwidth;
-}
-
-void EchoL0Dataset::setBandwidth(double Inbandwidth)
-{
- this->bandwidth = Inbandwidth;
-}
-
-SatelliteAntPos EchoL0Dataset::getSatelliteAntPos(long prf_id)
-{
- std::shared_ptr antpos = this->getAntPos();
- SatelliteAntPos prfpos{};
- prfpos.time = antpos.get()[prf_id *19 + 0];
- prfpos.Px = antpos.get()[prf_id *19 + 1];
- prfpos.Py = antpos.get()[prf_id *19 + 2];
- prfpos.Pz = antpos.get()[prf_id *19 + 3];
- prfpos.Vx = antpos.get()[prf_id *19 + 4];
- prfpos.Vy = antpos.get()[prf_id *19 + 5];
- prfpos.Vz = antpos.get()[prf_id *19 + 6];
- prfpos.AntDirectX = antpos.get()[prf_id *19 + 7];
- prfpos.AntDirectY = antpos.get()[prf_id *19 + 8];
- prfpos.AntDirectZ = antpos.get()[prf_id *19 + 9];
- prfpos.AVx = antpos.get()[prf_id *19 + 10];
- prfpos.AVy = antpos.get()[prf_id *19 + 11];
- prfpos.AVz =antpos.get()[prf_id *19 + 12];
- prfpos.ZeroAntDiectX = antpos.get()[prf_id *19 + 13];
- prfpos.ZeroAntDiectY = antpos.get()[prf_id *19 + 14];
- prfpos.ZeroAntDiectZ = antpos.get()[prf_id *19 + 15];
- prfpos.lon =antpos.get()[prf_id *19 + 16];
- prfpos.lat =antpos.get()[prf_id *19 + 17];
- prfpos.ati =antpos.get()[prf_id *19 + 18];
- return prfpos;
-}
-
-void EchoL0Dataset::setRefPhaseRange(double refRange)
-{
- this->refPhaseRange = refRange;
-}
-
-double EchoL0Dataset::getRefPhaseRange()
-{
- return this->refPhaseRange;
-}
-
-// ӡϢʵ
-void EchoL0Dataset::printInfo() {
- qDebug() << "Simulation Task Name: " << this->simulationTaskName ;
- qDebug() << "Pulse Count: " << this->PluseCount ;
- qDebug() << "Pulse Points: " << this->PlusePoints;
- qDebug() << "Near Range: " << this->NearRange ;
- qDebug() << "Far Range: " << this->FarRange;
- qDebug() << "Center Frequency: " << this->centerFreq ;
- qDebug() << "Sampling Frequency: " << this->Fs ;
- qDebug() << "Band width: " << this->bandwidth ;
-}
-
-// xmlļд
-void EchoL0Dataset::saveToXml() {
-
- QString filePath = this->xmlFilePath;
-
- QFile file(filePath);
- if (!file.open(QIODevice::WriteOnly)) {
- qWarning() << "Cannot open file for writing:" << filePath;
- return;
- }
-
- QXmlStreamWriter xmlWriter(&file);
- xmlWriter.setAutoFormatting(true);
- xmlWriter.writeStartDocument();
- xmlWriter.writeStartElement("SimulationConfig");
-
- xmlWriter.writeTextElement("PluseCount", QString::number(this->PluseCount));
- xmlWriter.writeTextElement("BandWidth", QString::number(this->bandwidth));
- xmlWriter.writeTextElement("PlusePoints", QString::number(this->PlusePoints));
- xmlWriter.writeTextElement("NearRange", QString::number(this->NearRange));
- xmlWriter.writeTextElement("FarRange", QString::number(this->FarRange));
- xmlWriter.writeTextElement("CenterFreq", QString::number(this->centerFreq));
- xmlWriter.writeTextElement("Fs", QString::number(this->Fs));
- xmlWriter.writeTextElement("CenterAngle", QString::number(this->CenterAngle));
- xmlWriter.writeTextElement("LookSide", this->LookSide);
- xmlWriter.writeTextElement("SimulationTaskName", this->simulationTaskName);
- xmlWriter.writeTextElement("Filename", this->filename);
- xmlWriter.writeTextElement("Xmlname", this->xmlname);
- xmlWriter.writeTextElement("GPSPointFilename", this->GPSPointFilename);
- xmlWriter.writeTextElement("EchoDataFilename", this->echoDataFilename);
- xmlWriter.writeTextElement("refPhaseRange", QString::number(this->refPhaseRange));
-
- xmlWriter.writeEndElement(); // SimulationConfig
- xmlWriter.writeEndDocument();
-
- file.close();
-}
-
-ErrorCode EchoL0Dataset::loadFromXml() {
- QString filePath = this->xmlFilePath;
- QFile file(filePath);
- if (!file.open(QIODevice::ReadOnly)) {
- qWarning() << "Cannot open file for reading:" << filePath;
- return ErrorCode::FILEOPENFAIL;
- }
-
-
- bool PluseCountflag = false;
- bool PlusePointsflag = false;
- bool NearRangeflag = false;
- bool FarRangeflag = false;
- bool CenterFreqflag = false;
- bool Fsflag = false;
-
-
- QXmlStreamReader xmlReader(&file);
- while (!xmlReader.atEnd() && !xmlReader.hasError()) {
- xmlReader.readNext();
-
- if (xmlReader.isStartElement()) {
- QString elementName = xmlReader.name().toString();
- if (elementName == "BandWidth") {
- this->bandwidth = xmlReader.readElementText().toDouble();
- }
- else if (elementName == "PluseCount") {
- this->PluseCount = xmlReader.readElementText().toLong();
- }
- else if (elementName == "PlusePoints") {
- this->PlusePoints = xmlReader.readElementText().toLong();
- PlusePointsflag = true;
- }
- else if (elementName == "NearRange") {
- this->NearRange = xmlReader.readElementText().toDouble();
- NearRangeflag = true;
- }
- else if (elementName == "FarRange") {
- this->FarRange = xmlReader.readElementText().toDouble();
- FarRangeflag = true;
- }
- else if (elementName == "CenterFreq") {
- this->centerFreq = xmlReader.readElementText().toDouble();
- CenterFreqflag = true;
- }
- else if (elementName == "Fs") {
- this->Fs = xmlReader.readElementText().toDouble();
- Fsflag = true;
- }
- else if (elementName == "refPhaseRange") {
- this->refPhaseRange = xmlReader.readElementText().toDouble();
- Fsflag = true;
- }
- else if (elementName == "SimulationTaskName") {
- this->simulationTaskName = xmlReader.readElementText();
- }
- else if (elementName == "Filename") {
- this->filename = xmlReader.readElementText();
- }
- else if (elementName == "Xmlname") {
- this->xmlname = xmlReader.readElementText();
- }
- else if (elementName == "GPSPointFilename") {
- this->GPSPointFilename = xmlReader.readElementText();
- }
- else if (elementName == "EchoDataFilename") {
- this->echoDataFilename = xmlReader.readElementText();
- }
- else if (elementName == "CenterAngle") {
- this->CenterAngle = xmlReader.readElementText().toDouble();
- }
- else if (elementName == "LookSide") {
- this->LookSide = xmlReader.readElementText();
- }
- }
- }
-
- if (xmlReader.hasError()) {
- qWarning() << "XML error:" << xmlReader.errorString();
- file.close();
- return ErrorCode::ECHO_L0DATA_XMLFILENOTOPEN;
- }
-
- if (!(PlusePointsflag && PlusePointsflag && FarRangeflag && NearRangeflag && CenterFreqflag && Fsflag)) {
- file.close();
- return ErrorCode::ECHO_L0DATA_XMLFILENOTOPEN;
- }
-
- file.close();
-
- return ErrorCode::SUCCESS;
-}
-
-std::shared_ptr EchoL0Dataset::getAntPosVelc()
-{
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- long prfcount = this->PluseCount;
- std::shared_ptr antposlist= SatelliteAntPosOperator::readAntPosFile(this->GPSPointFilePath, prfcount);
-
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return antposlist;
-}
-
-std::shared_ptr EchoL0Dataset::getAntPos()
-{
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- // ȡļ
- std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_ReadOnly);
-
- GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
- GDALRasterBand* demBand = rasterDataset->GetRasterBand(1);
-
- long width = rasterDataset->GetRasterXSize();
- long height = rasterDataset->GetRasterYSize();
- long band_num = rasterDataset->GetRasterCount();
-
- std::shared_ptr temp = nullptr;
-
- if (gdal_datatype == GDT_Float64) {
- temp=std::shared_ptr(new double[this->PluseCount * 19],delArrPtr);
- demBand->RasterIO(GF_Read, 0, 0, 19, this->PluseCount, temp.get(), 19, this->PluseCount, gdal_datatype, 0, 0);
- }
- else {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR)) ;
- }
- rasterDataset.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return temp;
-}
-
-std::shared_ptr> EchoL0Dataset::getEchoArr(long startPRF, long& PRFLen)
-{
- if (!(startPRF < this->PluseCount)) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE))<PluseCount;
- return nullptr;
- }
- else {}
-
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- std::shared_ptr rasterDataset = OpenDataset(this->echoDataFilePath, GDALAccess::GA_ReadOnly);
-
-
- GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
- GDALRasterBand* poBand = rasterDataset->GetRasterBand(1);
- if (NULL==poBand||nullptr == poBand) {
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- return nullptr;
- }
- else {}
- long width = rasterDataset->GetRasterXSize();
- long height = rasterDataset->GetRasterYSize();
- long band_num = rasterDataset->GetRasterCount();
-
- PRFLen = (PRFLen + startPRF) < height ? PRFLen : height - startPRF;
-
- std::shared_ptr> temp = nullptr;
- if (height != this->PluseCount || width != this->PlusePoints) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- }
- else {
- if (gdal_datatype == GDT_CFloat64) {
- temp= std::shared_ptr>(new std::complex[PRFLen * width ], delArrPtr);
- poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat64, 0, 0);
- GDALFlushCache((GDALDatasetH)rasterDataset.get());
- }
- else {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- }
- }
-
- rasterDataset.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return temp;
-}
-
-
-std::vector> EchoL0Dataset::getEchoArrVector(long startPRF, long& PRFLen) {
- if (!(startPRF < this->PluseCount)) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE)) << startPRF << " " << this->PluseCount;
- return std::vector>(0);
- }
- else {}
-
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- std::shared_ptr rasterDataset = OpenDataset(this->echoDataFilePath, GDALAccess::GA_ReadOnly);
-
-
- GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
- GDALRasterBand* poBand = rasterDataset->GetRasterBand(1);
- if (NULL == poBand || nullptr == poBand) {
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- return std::vector>(0);
- }
- else {}
- long width = rasterDataset->GetRasterXSize();
- long height = rasterDataset->GetRasterYSize();
- long band_num = rasterDataset->GetRasterCount();
-
- PRFLen = (PRFLen + startPRF) < height ? PRFLen : height - startPRF;
-
- std::vector> tempArr(size_t(PRFLen) * width);
- if (height != this->PluseCount || width != this->PlusePoints) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- }
- else {
- if (gdal_datatype == GDT_CFloat64) {
- std::shared_ptr> temp(new std::complex[PRFLen * width], delArrPtr);
- poBand->RasterIO(GF_Read, 0, startPRF, width, PRFLen, temp.get(), width, PRFLen, GDT_CFloat64, 0, 0);
- GDALFlushCache((GDALDatasetH)rasterDataset.get());
-
-
- for (long i = 0; i < PRFLen; i++){
- for (long j = 0; j < width; j++){
- tempArr[i * width + j] = temp.get()[i * width + j];
- }
- }
-
- }
- else {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- }
- }
-
- rasterDataset.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return tempArr;
-}
-
-
-std::shared_ptr> EchoL0Dataset::getEchoArr()
-{
- return this->getEchoArr(0,this->PluseCount);
-}
-
-ErrorCode EchoL0Dataset::saveAntPos(std::shared_ptr ptr)
-{
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- // ȡļ
- std::shared_ptr rasterDataset = OpenDataset(this->GPSPointFilePath, GDALAccess::GA_Update);
-
- GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
- GDALRasterBand* demBand = rasterDataset->GetRasterBand(1);
-
- long width = rasterDataset->GetRasterXSize();
- long height = rasterDataset->GetRasterYSize();
- long band_num = rasterDataset->GetRasterCount();
-
- if (gdal_datatype == GDT_Float64) {
- demBand->RasterIO(GF_Write, 0, 0, 19, this->PluseCount, ptr.get(), 19, this->PluseCount, gdal_datatype, 0, 0);
- }
- else {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR));
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return ErrorCode::ECHO_L0DATA_GPSFILEFORMATERROR;
- }
- rasterDataset.reset();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return ErrorCode::SUCCESS;
-}
-
-ErrorCode EchoL0Dataset::saveEchoArr(std::shared_ptr> echoPtr, long startPRF, long PRFLen)
-{
- if (!(startPRF < this->PluseCount)) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE));
- return ErrorCode::ECHO_L0DATA_PRFIDXOUTRANGE;
- }
- else {}
-
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
-
- GDALAllRegister();
- CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "YES");
- GDALDataset* rasterDataset = (GDALDataset*)(GDALOpen(this->echoDataFilePath.toUtf8().constData(), GDALAccess::GA_Update));
-
- GDALDataType gdal_datatype = rasterDataset->GetRasterBand(1)->GetRasterDataType();
- GDALRasterBand* poBand = rasterDataset->GetRasterBand(1);
- if (NULL == poBand || nullptr == poBand) {
- omp_lock_t lock;
- omp_init_lock(&lock);
- omp_set_lock(&lock);
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR;
- }
- else {}
- long width = rasterDataset->GetRasterXSize();
- long height = rasterDataset->GetRasterYSize();
- long band_num = rasterDataset->GetRasterCount();
-
- if (height != this->PluseCount || width != this->PlusePoints) {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
- return ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR;
- }
- else {
- if (gdal_datatype == GDT_CFloat64) {
- poBand->RasterIO(GF_Write, 0, startPRF, width, PRFLen, echoPtr.get(), width, PRFLen, GDT_CFloat64, 0, 0);
- GDALFlushCache((GDALDatasetH)rasterDataset);
- }
- else {
- qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::ECHO_L0DATA_ECHOFILEFORMATERROR));
- }
- }
- GDALClose(rasterDataset);
- rasterDataset = nullptr;
- GDALDestroy();
- omp_unset_lock(&lock); //
- omp_destroy_lock(&lock); //
-
- return ErrorCode::SUCCESS;
-}
-
-std::shared_ptr SatelliteAntPosOperator::readAntPosFile(QString filepath, long& count)
-{
- gdalImage antimg(filepath);
- long rowcount = count;
- long colcount = 19;
- std::shared_ptr antlist = readDataArr(antimg, 0, 0, rowcount, colcount, 1, GDALREADARRCOPYMETHOD::VARIABLEMETHOD);
- std::shared_ptr antpos(new SatelliteAntPos[rowcount], delArrPtr);
- for (long i = 0; i < rowcount; i++) {
- antpos.get()[i].time = antlist.get()[i * 19 + 0];
- antpos.get()[i].Px = antlist.get()[i * 19 + 1];
- antpos.get()[i].Py = antlist.get()[i * 19 + 2];
- antpos.get()[i].Pz = antlist.get()[i * 19 + 3];
- antpos.get()[i].Vx = antlist.get()[i * 19 + 4];
- antpos.get()[i].Vy = antlist.get()[i * 19 + 5];
- antpos.get()[i].Vz = antlist.get()[i * 19 + 6]; //7
- antpos.get()[i].AntDirectX = antlist.get()[i * 19 + 7];
- antpos.get()[i].AntDirectY = antlist.get()[i * 19 + 8];
- antpos.get()[i].AntDirectZ = antlist.get()[i * 19 + 9];
- antpos.get()[i].AVx = antlist.get()[i * 19 + 10];
- antpos.get()[i].AVy = antlist.get()[i * 19 + 11];
- antpos.get()[i].AVz = antlist.get()[i * 19 + 12];
- antpos.get()[i].ZeroAntDiectX = antlist.get()[i * 19 + 13];
- antpos.get()[i].ZeroAntDiectY = antlist.get()[i * 19 + 14];
- antpos.get()[i].ZeroAntDiectZ = antlist.get()[i * 19 + 15];
- antpos.get()[i].lon = antlist.get()[i * 19 + 16];
- antpos.get()[i].lat = antlist.get()[i * 19 + 17];
- antpos.get()[i].ati = antlist.get()[i * 19 + 18]; // 19
- }
- return antpos;
-}
-
-void SatelliteAntPosOperator::writeAntPosFile(QString filepath, std::shared_ptr data, const long count)
-{
- gdalImage antimg=CreategdalImageDouble(filepath,count,19,1,true,true);
- long rowcount = count;
- long colcount = 19;
- std::shared_ptr antpos(new double[rowcount*19], delArrPtr);
- for (long i = 0; i < colcount; i++) {
- antpos.get()[i * 19 + 1] = data.get()[i].time;
- antpos.get()[i * 19 + 2] = data.get()[i].Px;
- antpos.get()[i * 19 + 3] = data.get()[i].Py;
- antpos.get()[i * 19 + 4] = data.get()[i].Pz;
- antpos.get()[i * 19 + 5] = data.get()[i].Vx;
- antpos.get()[i * 19 + 6] = data.get()[i].Vy;
- antpos.get()[i * 19 + 7] = data.get()[i].Vz;
- antpos.get()[i * 19 + 8] = data.get()[i].AntDirectX;
- antpos.get()[i * 19 + 9] = data.get()[i].AntDirectY;
- antpos.get()[i * 19 + 10] = data.get()[i].AntDirectZ;
- antpos.get()[i * 19 + 11] = data.get()[i].AVx;
- antpos.get()[i * 19 + 12] = data.get()[i].AVy;
- antpos.get()[i * 19 + 13] = data.get()[i].AVz;
- antpos.get()[i * 19 + 14] = data.get()[i].ZeroAntDiectX;
- antpos.get()[i * 19 + 15] = data.get()[i].ZeroAntDiectY;
- antpos.get()[i * 19 + 16] = data.get()[i].ZeroAntDiectZ;
- antpos.get()[i * 19 + 17] = data.get()[i].lon;
- antpos.get()[i * 19 + 18] = data.get()[i].lat;
- antpos.get()[i * 19 + 19] = data.get()[i].ati;
- }
- antimg.saveImage(antpos, 0,0,rowcount, colcount, 1);
-
- return ;
-
-
-
-}
diff --git a/BaseCommonLibrary/BaseTool/EchoDataFormat.h b/BaseCommonLibrary/BaseTool/EchoDataFormat.h
deleted file mode 100644
index ec2f685..0000000
--- a/BaseCommonLibrary/BaseTool/EchoDataFormat.h
+++ /dev/null
@@ -1,225 +0,0 @@
-#pragma once
-/*****************************************************************//**
- * \file EchoDataFormat.h
- * \brief 洢еĸƷݸʽҪزݸʽݿ
- *
- * \author 30453
- * \date October 2024
- *********************************************************************/
-
-
-#include "BaseConstVariable.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-#include "BaseTool.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include // for CPLMalloc()
-
-//========================================================================
-// زʽ
-// file type:
-// PRFCOUNT
-// PRFPOINT
-// nearRange
-// farRange
-// PRF1,time,Px,Py,Pz,Vx,Vy,Vz
-// PRF2,time,Px,Py,Pz,Vx,Vy,Vz
-// ------------------ ļ --------------------------------------
-// PRF1,time,Px,Py,Pz,Vx,Vy,Vz,PRFPOINT,RealData,imagData
-// PRF2,time,Px,Py,Pz,Vx,Vy,Vz,PRFPOINT,RealData,imagData
-// --------------------------------------------------------------
-// עBp˳ֻǹעλãĬϰĽ˳֯
-//========================================================================
-
-// õĻزļʽ
-
-///
-/// ز--
-///
-struct PluseData {
- long id; // PRF id
- double time;// ʱ
- double Px; //
- double Py;
- double Pz;
- double Vx; // ٶ
- double Vy;
- double Vz;
- long plusePoints; //
- std::shared_ptr> echoData; // ز
-};
-
-long BASECONSTVARIABLEAPI getPluseDataSize(PluseData& pluseData);
-ErrorCode BASECONSTVARIABLEAPI getPluseDataFromBuffer(char* buffer, PluseData& data);
-std::shared_ptr BASECONSTVARIABLEAPI CreatePluseDataArr(long pluseCount);
-std::shared_ptr> BASECONSTVARIABLEAPI CreateEchoData(long plusePoints);
-
-
-
-///
-/// ̬
-///
-struct PluseAntPos {
- long id; // PRF id
- double time;// ʱ
- double Px; //
- double Py;
- double Pz;
- double Vx; // ٶ
- double Vy;
- double Vz;
-};
-std::shared_ptr BASECONSTVARIABLEAPI CreatePluseAntPosArr(long pluseCount);
-
-
-class BASECONSTVARIABLEAPI SatelliteAntPosOperator {
-public:
- static std::shared_ptr readAntPosFile(QString filepath,long& count);
- static void writeAntPosFile(QString filepath, std::shared_ptr< SatelliteAntPos> data,const long count);
-
-
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// L0
-class BASECONSTVARIABLEAPI EchoL0Dataset {
-
-public:
- EchoL0Dataset();
- ~EchoL0Dataset();
-
-
-public:
- ErrorCode OpenOrNew(QString folder, QString filename,long PluseCount,long PlusePoints);
- ErrorCode Open(QString xmlfilepath);
- ErrorCode Open(QString folder, QString filename);
- QString getxmlName();
- QString getGPSPointFilename();
- QString getEchoDataFilename();
- QString getGPSPointFilePath();
- QString getEchoDataFilePath();
- void initEchoArr(std::complex init0);
-
-
-private: // Ʒ
- QString folder;
- QString filename;
- QString xmlname;
- QString GPSPointFilename;
- QString echoDataFilename;
- //
- QString xmlFilePath;
- QString GPSPointFilePath;
- QString echoDataFilePath;
-
-
-
-public: // ļ
- // Getter Setter
- long getPluseCount() ;
- void setPluseCount(long pulseCount);
-
- long getPlusePoints() ;
- void setPlusePoints(long pulsePoints);
-
- double getNearRange() ;
- void setNearRange(double nearRange);
-
- double getFarRange() ;
- void setFarRange(double farRange);
-
- double getCenterFreq() ;
- void setCenterFreq(double freq);
-
- double getFs() ;
- void setFs(double samplingFreq);
-
- QString getSimulationTaskName() ;
- void setSimulationTaskName(const QString& taskName);
-
- double getCenterAngle();
- void setCenterAngle(double angle);
-
- QString getLookSide();
- void setLookSide(QString lookside);
-
- double getBandwidth();
- void setBandwidth(double Inbandwidth);
-
- SatelliteAntPos getSatelliteAntPos(long plusePRFID);
-
- void setRefPhaseRange(double refRange);
- double getRefPhaseRange();
- // ӡϢijԱ
- void printInfo() ;
-
-private: // ز
- long PluseCount;
- long PlusePoints;
- double NearRange;
- double FarRange;
- double centerFreq; // Ƶ
- double Fs; // ЧƵ
- QString simulationTaskName;
-
- double CenterAngle;
- QString LookSide;
- double refPhaseRange;
- double bandwidth;
-
-public: // д XML ĺ
- void saveToXml();
- ErrorCode loadFromXml();
-
-public:
- // ȡļ
- std::shared_ptr< SatelliteAntPos> getAntPosVelc();
- std::shared_ptr getAntPos();
- std::shared_ptr> getEchoArr(long startPRF, long& PRFLen);
- std::shared_ptr> getEchoArr();
- std::vector> getEchoArrVector(long startPRF, long& PRFLen);
- //ļ
- ErrorCode saveAntPos(std::shared_ptr ptr); // עΣգдǰǷȷ
- ErrorCode saveEchoArr(std::shared_ptr> echoPtr, long startPRF, long PRFLen);
-
-};
-
-
-
-
diff --git a/BaseCommonLibrary/BaseTool/FileOperator.cpp b/BaseCommonLibrary/BaseTool/FileOperator.cpp
deleted file mode 100644
index 1d543cc..0000000
--- a/BaseCommonLibrary/BaseTool/FileOperator.cpp
+++ /dev/null
@@ -1,322 +0,0 @@
-#include "stdafx.h"
-#include "FileOperator.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-
-
-QString addMaskToFileName(const QString& filePath,QString _zzname) {
- // 获取文件路径和文件名
- QFileInfo fileInfo(filePath);
-
- // 获取文件名和扩展名
- QString baseName = fileInfo.baseName(); // 不包含扩展名的文件名
- QString extension = fileInfo.suffix(); // 文件扩展名(例如 ".txt", ".jpg")
-
- // 拼接新的文件名
- QString newFileName = baseName + _zzname; // 在文件名中增加 "_mask"
- if (!extension.isEmpty()) {
- newFileName += "." + extension; // 如果有扩展名,添加扩展名
- }
-
- // 返回新的文件路径
- QString newFilePath = fileInfo.path() + "/" + newFileName;
- return newFilePath;
-}
-
-
-std::vector getFilelist(const QString& folderpath, const QString& filenameExtension, int (*logfun)(QString logtext, int value))
-{
- QString filenameExtensionStr = filenameExtension;
- filenameExtensionStr = filenameExtensionStr.remove(0, 1);
- std::vector filenames(0);
- if (isExists(folderpath) && isDirectory(folderpath)) {
- QDir directory(folderpath);
- if (directory.exists() && directory.isReadable()) {
- QFileInfoList fileList = directory.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
- for (const QFileInfo& fileInfo : fileList) {
-// qDebug() << fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")";
- if (filenameExtensionStr == u8"*" || filenameExtensionStr == fileInfo.suffix()) {
- filenames.push_back(fileInfo.filePath());
- }
- if (logfun) {
- logfun(fileInfo.filePath() + "\nExtension: (" + filenameExtensionStr + ", " + fileInfo.suffix() + ")", 4);
- }
- }
- }
- else {
- qWarning() << "Folder does not exist or is not readable: " << folderpath;
- }
- return filenames;
- }
- else {
- return std::vector(0);
- }
-
-}
-
-QString getParantFolderNameFromPath(const QString& path)
-{
- QDir directory(path);
- directory.cdUp();
- QString parentPath = directory.absolutePath();
- return directory.dirName();
-}
-
-QString getParantFromPath(const QString& path)
-{
- //qDebug() << path;
- QDir directory(path);
- directory.cdUp();
- QString parentPath = directory.absolutePath();
- //qDebug() << parentPath;
- return parentPath;
-}
-
-QString getFileNameFromPath(const QString& path)
-{
- QFileInfo fileInfo(path);
- return fileInfo.fileName();
-}
-
-QString getFileNameWidthoutExtend(QString path)
-{
- QFileInfo fileInfo(path);
- QString fileNameWithoutExtension = fileInfo.completeBaseName(); // 获取无后缀文件名
- qDebug() << u8"File name without extension: " << fileNameWithoutExtension;
- return fileNameWithoutExtension;
-}
-
-QString BASECONSTVARIABLEAPI getFileExtension(QString path)
-{
- QFileInfo fileInfo(path);
- QString fileExtension = fileInfo.suffix(); // 获取无后缀文件名
- return fileExtension;
-}
-
-bool isDirectory(const QString& path)
-{
- QFileInfo fileinfo(path);
- return fileinfo.isDir();
-}
-
-bool isExists(const QString& path)
-{
- QFileInfo fileinfo(path);
- return fileinfo.exists();
-}
-
-bool isFile(const QString& path)
-{
- QFileInfo fileinfo(path);
- return fileinfo.isFile();
-}
-
-int write_binfile(char* filepath, char* data, size_t data_len)
-{
- FILE* pd = fopen(filepath, "w");
- if (NULL == pd) {
- return 2;
- }
- //数据块首地址: "&a",元素大小: "sizeof(unsigned __int8)", 元素个数: "10", 文件指针:"pd"
- fwrite(data, sizeof(char), data_len, pd);
- fclose(pd);
- return -1;
-}
-
- char* read_textfile(char* text_path, int* length)
-{
- char* data = NULL;
- FILE* fp1 = fopen(text_path, "r");
- if (fp1 == NULL) {
- return NULL;
- }
- else {}
- // 读取文件
- fseek(fp1, 0, SEEK_END);
- int data_length = ftell(fp1);
- data = (char*)malloc((data_length + 1) * sizeof(char));
- rewind(fp1);
- if (data_length == fread(data, sizeof(char), data_length, fp1)) {
- data[data_length] = '\0'; // 文件尾
- }
- else {
- free(data);
- fclose(fp1);
- return NULL;
- }
- fclose(fp1);
- *length = data_length + 1;
- return data;
-}
-
-bool exists_test(const QString& name)
-{
- return isExists(name);
-}
-
-size_t fsize(FILE* fp)
-{
- size_t n;
- fpos_t fpos; // 当前位置
- fgetpos(fp, &fpos); // 获取当前位置
- fseek(fp, 0, SEEK_END);
- n = ftell(fp);
- fsetpos(fp, &fpos); // 恢复之前的位置
- return n;
-}
-
-
-void removeFile(const QString& filePath)
-{
- QFile file(filePath);
-
- if (file.exists()) {
- if (file.remove()) {
- qDebug() << "File removed successfully: " << filePath;
- }
- else {
- qWarning() << "Failed to remove file: " << filePath;
- }
- }
- else {
- qDebug() << "File does not exist: " << filePath;
- }
-}
-
-unsigned long convertToULong(const QString& input) {
- bool ok; // Used to check if the conversion was successful
- unsigned long result = input.toULong(&ok);
-
- if (!ok) {
- qWarning() << "Conversion to unsigned long failed for input: " << input;
- }
-
- return result;
-}
-
-void copyFile(const QString& sourcePath, const QString& destinationPath) {
- QFile sourceFile(sourcePath);
- QFile destinationFile(destinationPath);
- qDebug() << QString("copy file ready !! from ") + sourcePath+" to "+destinationPath ;
- if (sourceFile.exists()) {
- if (sourceFile.copy(destinationPath)) {
- qDebug() << QString("copy file sucessfully !! from ") + sourcePath+" to "+destinationPath ;
- // 复制成功
- //QMessageBox::information(nullptr, u8"成功", u8"文件复制成功");
- }
- else {
- // 复制失败
- if(sourceFile.exists()){
- QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("The file already exists !!"));
- }
- else{
- QMessageBox::critical(nullptr, QObject::tr("error"), QObject::tr("file copy error"));
- }
- }
- }
- else {
- // 源文件不存在
- QMessageBox::warning(nullptr, QObject::tr("warning"), QObject::tr("Source file not found"));
- }
-}
-
-
-
-
-bool copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath) {
- // 检查源文件是否存在
- if (!QFile::exists(sourceFilePath)) {
- qDebug() << "Source file does not exist:" << sourceFilePath;
- return false;
- }
-
- // 如果目标文件存在,则删除它
- if (QFile::exists(destinationFilePath)) {
- if (!QFile::remove(destinationFilePath)) {
- qDebug() << "Failed to remove existing destination file:" << destinationFilePath;
- return false;
- }
- }
-
- // 复制文件
- if (!QFile::copy(sourceFilePath, destinationFilePath)) {
- qDebug() << "Failed to copy file from" << sourceFilePath << "to" << destinationFilePath;
- return false;
- }
-
- qDebug() << "File copied successfully from" << sourceFilePath << "to" << destinationFilePath;
- return true;
-}
-
-
-bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath, QString outGzFolderPath)
-{
- // tar -zxvf 压缩包路径 文件或目录路径
- QProcess process;
- // 同步执行(阻塞当前线程)
- QString cmdstr = QString("tar -zxvf %1 -C %2").arg(inTargzPath).arg(outGzFolderPath);
- process.execute("cmd.exe", QStringList() << "/c" << cmdstr); // "/c" 表示执行后关闭 CMD
- process.waitForFinished(); // 等待执行完成
- // 获取输出
- QString output = QString::fromLocal8Bit(process.readAllStandardOutput());
- QString error = QString::fromLocal8Bit(process.readAllStandardError());
- qDebug() << "Output:" << output;
- qDebug() << "Error:" << error;
- return true;
-}
-
-bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist)
-{
- QDir outDir(inpath);
- if (outDir.exists()) {
- if (isremoveExist) {
- outDir.removeRecursively();
- }
- else {
- return true;
- }
- }
- QDir().mkpath(inpath);
- return true;
-}
-
-QFileInfoList findFilePath(const QString& strFilePath, const QString& strNameFilters)
-{
- QFileInfoList fileList;
- if (strFilePath.isEmpty() || strNameFilters.isEmpty())
- {
- return fileList;
- }
-
- QDir dir;
- QStringList filters;
- filters << strNameFilters;
- dir.setPath(strFilePath);
- dir.setNameFilters(filters);
- QDirIterator iter(dir, QDirIterator::Subdirectories);
- while (iter.hasNext())
- {
- iter.next();
- QFileInfo info = iter.fileInfo();
- if (info.isFile())
- {
- fileList.append(info);
- }
- }
- return fileList;
-}//blog.csdn.net/sinat_33419023/article/details/106105037
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/FileOperator.h b/BaseCommonLibrary/BaseTool/FileOperator.h
deleted file mode 100644
index 8d197b6..0000000
--- a/BaseCommonLibrary/BaseTool/FileOperator.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#pragma once
-
-#ifndef FILEOPERATOR_H
-#define FILEOPERATOR_H
-#include "BaseConstVariable.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-bool BASECONSTVARIABLEAPI isDirectory(const QString& path);
-bool BASECONSTVARIABLEAPI isExists(const QString& path);
-bool BASECONSTVARIABLEAPI isFile(const QString& path);
-void BASECONSTVARIABLEAPI removeFile(const QString& filePath);
-unsigned long BASECONSTVARIABLEAPI convertToULong(const QString& input);
-///
-/// 获取文件(绝对路径)
-///
-///
-///
-///
-std::vector BASECONSTVARIABLEAPI getFilelist(const QString& folderpath, const QString& FilenameExtension = ".*", int (*logfun)(QString logtext, int value) = nullptr);
-
-QString BASECONSTVARIABLEAPI getParantFolderNameFromPath(const QString& path);
-
-QString BASECONSTVARIABLEAPI getFileNameFromPath(const QString& path);
-
-QString BASECONSTVARIABLEAPI getFileNameWidthoutExtend(QString path);
-
-QString BASECONSTVARIABLEAPI getFileExtension(QString path);
-
-int BASECONSTVARIABLEAPI write_binfile(char* filepath, char* data, size_t data_len);
-
-char* read_textfile(char* text_path, int* length);
-
-bool BASECONSTVARIABLEAPI exists_test(const QString& name);
-
-size_t BASECONSTVARIABLEAPI fsize(FILE* fp);
-
-QString BASECONSTVARIABLEAPI getParantFromPath(const QString& path);
-void BASECONSTVARIABLEAPI copyFile(const QString& sourcePath, const QString& destinationPath);
-QString BASECONSTVARIABLEAPI addMaskToFileName(const QString& filePath, QString _zzname);
-// QT FileOperator
-
-bool BASECONSTVARIABLEAPI copyAndReplaceFile(const QString& sourceFilePath, const QString& destinationFilePath);
-
-// 压缩包文件解压
-bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath,QString outGzFolderPath);
-bool BASECONSTVARIABLEAPI createNewFolerPath(QString inpath, bool isremoveExist = false);
-
-QFileInfoList BASECONSTVARIABLEAPI findFilePath(const QString& dirPath, const QString& pattern);
-
-#endif
\ No newline at end of file
diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.cpp b/BaseCommonLibrary/BaseTool/GeoOperator.cpp
deleted file mode 100644
index 33f585b..0000000
--- a/BaseCommonLibrary/BaseTool/GeoOperator.cpp
+++ /dev/null
@@ -1,511 +0,0 @@
-#include "stdafx.h"
-#include "GeoOperator.h"
-#include
-#include
-#include
-#include
-////#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-//#include
-#include //#include "ogrsf_frmts.h"
-#include
-#include
-#include "GeoOperator.h"
-#include // OGRSpatialReference ڿռοת
-#include // GDALWarp
-#include
-
-
-Landpoint operator +(const Landpoint& p1, const Landpoint& p2)
-{
- return Landpoint{ p1.lon + p2.lon,p1.lat + p2.lat,p1.ati + p2.ati };
-}
-
-Landpoint operator -(const Landpoint& p1, const Landpoint& p2)
-{
- return Landpoint{ p1.lon - p2.lon,p1.lat - p2.lat,p1.ati - p2.ati };
-}
-
-bool operator ==(const Landpoint& p1, const Landpoint& p2)
-{
- return p1.lat == p2.lat && p1.lon == p2.lon && p1.ati == p2.ati;
-}
-
-
-
-Landpoint operator *(const Landpoint& p, double scale)
-{
- return Landpoint{
- p.lon * scale,
- p.lat * scale,
- p.ati * scale
- };
-}
-
-
-Landpoint LLA2XYZ(const Landpoint& LLA) {
- double L = LLA.lon * d2r;
- double B = LLA.lat * d2r;
- double H = LLA.ati;
-
- double sinB = sin(B);
- double cosB = cos(B);
-
- //double N = a / sqrt(1 - e * e * sin(B) * sin(B));
- double N = a / sqrt(1 - eSquare * sinB * sinB);
- Landpoint result = { 0,0,0 };
- result.lon = (N + H) * cosB * cos(L);
- result.lat = (N + H) * cosB * sin(L);
- //result.z = (N * (1 - e * e) + H) * sin(B);
- result.ati = (N * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + H) * sinB;
- return result;
-}
-
-void LLA2XYZ(const Landpoint& LLA, Point3& XYZ)
-{
- double L = LLA.lon * d2r;
- double B = LLA.lat * d2r;
- double H = LLA.ati;
-
- double sinB = sin(B);
- double cosB = cos(B);
-
- //double N = a / sqrt(1 - e * e * sin(B) * sin(B));
- double N = a / sqrt(1 - eSquare * sinB * sinB);
- Landpoint result = { 0,0,0 };
- XYZ.x = (N + H) * cosB * cos(L);
- XYZ.y = (N + H) * cosB * sin(L);
- //result.z = (N * (1 - e * e) + H) * sin(B);
- XYZ.z = (N * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + H) * sinB;
-
-}
-
-
-Eigen::MatrixXd LLA2XYZ(Eigen::MatrixXd landpoint)
-{
- landpoint.col(0) = landpoint.col(0).array() * d2r; // lon
- landpoint.col(1) = landpoint.col(1).array() * d2r; // lat
-
- Eigen::MatrixXd sinB = (landpoint.col(1).array().sin());//lat
- Eigen::MatrixXd cosB = (landpoint.col(1).array().cos());//lat
-
- Eigen::MatrixXd N = a / ((1 - sinB.array().pow(2) * eSquare).array().sqrt());
- Eigen::MatrixXd result(landpoint.rows(), 3);
-
- result.col(0) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::cos(landpoint.col(0).array()).array(); //x
- result.col(1) = (N.array() + landpoint.col(2).array()) * cosB.array() * Eigen::sin(landpoint.col(0).array()).array(); //y
-
- result.col(2) = (N.array() * (1 - 1 / f_inverse) * (1 - 1 / f_inverse) + landpoint.col(2).array()) * sinB.array(); //z
-
- return result;
-}
-
-
-Landpoint XYZ2LLA(const Landpoint& XYZ) {
- double tmpX = XYZ.lon;//
- double temY = XYZ.lat;//
- double temZ = XYZ.ati;
-
- double curB = 0;
- double N = 0;
- double sqrtTempXY = sqrt(tmpX * tmpX + temY * temY);
- double calB = atan2(temZ, sqrtTempXY);
- int counter = 0;
- double sinCurB = 0;
- while (abs(curB - calB) * r2d > epsilon && counter < 25)
- {
- curB = calB;
- sinCurB = sin(curB);
- N = a / sqrt(1 - eSquare * sinCurB * sinCurB);
- calB = atan2(temZ + N * eSquare * sinCurB, sqrtTempXY);
- counter++;
- }
-
- Landpoint result = { 0,0,0 };
- result.lon = atan2(temY, tmpX) * r2d;
- result.lat = curB * r2d;
- result.ati = temZ / sinCurB - N * (1 - eSquare);
- return result;
-}
-
-
-
-void XYZ2BLH_FixedHeight(double x, double y, double z,double ati, Landpoint& point) {
- const double a = 6378137.0; // WGS84
- const double f = 1.0 / 298.257223563;
- const double e2 = 2 * f - f * f; // һƫƽ
-
- // 㾭L ()
- const double L_rad = std::atan2(y, x);
- point.lon = L_rad * 180.0 / M_PI; // תΪ
-
- const double p = std::sqrt(x * x + y * y);
- const double H = ati; // ʹ֪߶
-
- // ʼγȹ㣨֪߶H
- double B_rad = std::atan2(z, p * (1 - e2 * (a / (a + H))));
-
- // γB̶H
- for (int i = 0; i < 10; ++i) { // ֪Hʱ
- const double sin_B = std::sin(B_rad);
- const double N = a / std::sqrt(1 - e2 * sin_B * sin_B);
- const double delta = e2 * N / (N + H); // ߶ȹ̶ʱ
-
- const double B_new = std::atan2(z, p * (1 - delta));
-
- if (std::abs(B_new - B_rad) < 1e-9) {
- B_rad = B_new;
- break;
- }
- B_rad = B_new;
- }
-
- point.lat = B_rad * 180.0 / M_PI; // ת
-
- // ȷΧ [-180, 180]
- point.lon = std::fmod(point.lon + 360.0, 360.0);
- if (point.lon > 180.0) point.lon -= 360.0;
- point.ati = ati;
-}
-
-
-double getAngle(const Landpoint& a, const Landpoint& b)
-{
- double c = dot(a, b) / (getlength(a) * getlength(b));
- if (a.lon * b.lat - a.lat * b.lon >= 0) {
- return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
- }
- else {
- return 360 - acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
- }
-}
-
-double dot(const Landpoint& p1, const Landpoint& p2)
-{
- return p1.lat * p2.lat + p1.lon * p2.lon + p1.ati * p2.ati;
-}
-
-double getlength(const Landpoint& p1) {
-
- return sqrt(dot(p1, p1));
-}
-
-Landpoint crossProduct(const Landpoint& a, const Landpoint& b) {
- return Landpoint{
- a.lat * b.ati - a.ati * b.lat,//x
- a.ati * b.lon - a.lon * b.ati,//y
- a.lon * b.lat - a.lat * b.lon//z
- };
-}
-
-float cross2d(Point3 a, Point3 b)
-{
- return a.x * b.y - a.y * b.x;
-}
-
-Point3 operator -(Point3 a, Point3 b)
-{
- return Point3{ a.x - b.x, a.y - b.y, a.z - b.z };
-}
-
-Point3 operator +(Point3 a, Point3 b)
-{
- return Point3{ a.x + b.x, a.y + b.y, a.z + b.z };
-}
-
-double operator /(Point3 a, Point3 b)
-{
- return sqrt(pow(a.x, 2) + pow(a.y, 2)) / sqrt(pow(b.x, 2) + pow(b.y, 2));
-}
-
-double BASECONSTVARIABLEAPI getPixelSpacingInDegree(double pixelSpacingInMeter)
-{
- return pixelSpacingInMeter / WGS84_A * r2d;
-
-}
-
-double BASECONSTVARIABLEAPI getPixelSpacingInMeter(double pixelSpacingInDegree)
-{
- return pixelSpacingInDegree * WGS84_A * r2d;
-}
-
-
-Landpoint getSlopeVector(const Landpoint& p0, const Landpoint& p1, const Landpoint& p2, const Landpoint& p3, const Landpoint& p4,bool inLBH) {
- Landpoint n0, n1, n2, n3, n4;
- if (inLBH) {
- n0 = LLA2XYZ(p0);
- n1 = LLA2XYZ(p1);
- n2 = LLA2XYZ(p2);
- n3 = LLA2XYZ(p3);
- n4 = LLA2XYZ(p4);
- }
- else {
- n0 = p0;
- n1 = p1;
- n2 = p2;
- n3 = p3;
- n4 = p4;
- }
-
- Landpoint n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0;
- // ��n01��������
- 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
- 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
- //qDebug() << a2 << "\t" << a3 << "\t" << a4 << endl;
- a2 = 360 - a2;
- a3 = 360 - a3;
- a4 = 360 - a4;
- Landpoint N, W, S, E;
- N = n01;
- if (a2 >= a3 && a2 >= a4) {
- W = n02;
- if (a3 >= a4) {
- S = n03;
- E = n04;
- }
- else {
- S = n04;
- E = n03;
- }
- }
- else if (a3 >= a2 && a3 >= a4) {
- W = n03;
- if (a2 >= a4) {
- S = n02;
- E = n04;
- }
- else {
- S = n04;
- E = n02;
- }
- }
- else if (a4 >= a2 && a4 >= a3)
- {
- W = n04;
- if (a2 >= a3) {
- S = n02;
- E = n03;
- }
- else {
- S = n03;
- E = n02;
- }
- }
- return (crossProduct(N, W) + crossProduct(W, S) + crossProduct(S, E) + crossProduct(E, N)) * 0.25;
-}
-
-
-
-double distance(const Vector3D& p1, const Vector3D& p2)
-{
- double dx = p1.x - p2.x;
- double dy = p1.y - p2.y;
- double dz = p1.z - p2.z;
- return std::sqrt(dx * dx + dy * dy + dz * dz);
-}
-
-double pointToLineDistance(const Vector3D& point, const Vector3D& linePoint, const Vector3D& lineDirection)
-{
- Vector3D pointToLine = { point.x - linePoint.x, point.y - linePoint.y, point.z - linePoint.z };
-
- // 计算点到直线的投影点的位?
- 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);
-
- // 计算投影?
- Vector3D projection = { linePoint.x + t * lineDirection.x, linePoint.y + t * lineDirection.y, linePoint.z + t * lineDirection.z };
-
- // 计算点到直线的距?
- return distance(point, projection);
-}
-
-Vector3D operator+(const Vector3D& p1, const Vector3D& p2)
-{
- return Vector3D{ p1.x + p2.x,p1.y + p2.y,p1.z + p2.z };
-}
-
-Vector3D operator-(const Vector3D& p1, const Vector3D& p2)
-{
- return Vector3D{ p1.x - p2.x,p1.y - p2.y,p1.z - p2.z };
-}
-
-bool operator==(const Vector3D& p1, const Vector3D& p2)
-{
- return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z;
-}
-
-Vector3D operator*(const Vector3D& p, double scale)
-{
- return Vector3D{
- p.x * scale,
- p.y * scale,
- p.z * scale
- };
-}
-
-Vector3D operator*(double scale, const Vector3D& p)
-{
- return Vector3D{
- p.x * scale,
- p.y * scale,
- p.z * scale
- };
-}
-
-double getAngle(const Vector3D& a, const Vector3D& b)
-{
- double c = dot(a, b) / (getlength(a) * getlength(b));
- if (a.x * b.y - a.y * b.x >= 0) {
- return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
- }
- else {
- return 360 - acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
- }
-}
-
-double getCosAngle(const Vector3D& a, const Vector3D& b)
-{
- double c = dot(a, b) / (getlength(a) * getlength(b));
- return acos(c > 1 ? 1 : c < -1 ? -1 : c) * r2d;
-}
-
-double dot(const Vector3D& p1, const Vector3D& p2)
-{
- return p1.y * p2.y + p1.x * p2.x + p1.z * p2.z;
-}
-
-double getlength(const Vector3D& p1)
-{
- return std::sqrt(std::pow(p1.x, 2) + std::pow(p1.y, 2) + std::pow(p1.z, 2));
-}
-
-Vector3D crossProduct(const Vector3D& a, const Vector3D& b)
-{
- return Vector3D{
- a.y * b.z - a.z * b.y,//x
- a.z * b.x - a.x * b.z,//y
- a.x * b.y - a.y * b.x//z
- };
-}
-
-
-///
-/// n1
-/// n4 n0 n2
-/// n3
-///
-Vector3D getSlopeVector(const Vector3D& n0, const Vector3D& n1, const Vector3D& n2, const Vector3D& n3, const Vector3D& n4)
-{
- Vector3D n01 = n1 - n0, n02 = n2 - n0, n03 = n3 - n0, n04 = n4 - n0;
- return (crossProduct(n01, n04) + crossProduct(n04, n03) + crossProduct(n03, n02) + crossProduct(n02, n01)) * 0.25;
-}
-
-
-SphericalCoordinates cartesianToSpherical(const CartesianCoordinates& cartesian)
-{
- SphericalCoordinates spherical;
-
- spherical.r = std::sqrt(cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z);
- spherical.theta = std::acos(cartesian.z / spherical.r);
- spherical.phi = std::atan2(cartesian.y, cartesian.x);
-
- return spherical;
-}
-
-CartesianCoordinates sphericalToCartesian(const SphericalCoordinates& spherical)
-{
- CartesianCoordinates cartesian;
-
- cartesian.x = spherical.r * std::sin(spherical.theta) * std::cos(spherical.phi);
- cartesian.y = spherical.r * std::sin(spherical.theta) * std::sin(spherical.phi);
- cartesian.z = spherical.r * std::cos(spherical.theta);
-
- return cartesian;
-}
-
-
-double getlocalIncAngle(Landpoint& satepoint, Landpoint& landpoint, Landpoint& slopeVector) {
- Landpoint Rsc = satepoint - landpoint; // AB=B-A
- //double R = getlength(Rsc);
- //qDebug() << R << endl;
- double angle = getAngle(Rsc, slopeVector);
- if (angle >= 180) {
- return 360 - angle;
- }
- else {
- return angle;
- }
-}
-
-
-double getlocalIncAngle(Vector3D& satepoint, Vector3D& landpoint, Vector3D& slopeVector){
- Vector3D Rsc = satepoint - landpoint; // AB=B-A
- //double R = getlength(Rsc);
- //qDebug() << R << endl;
- double angle = getAngle(Rsc, slopeVector);
- if (angle >= 180) {
- return 360 - angle;
- }
- else {
- return angle;
- }
-}
-
-bool BASECONSTVARIABLEAPI ConvertResolutionToDegrees(int sourceEPSG, double resolutionMeters, double refLon, double refLat, double& degreePerPixelX, double& degreePerPixelY){
- // ʼԴϵƽͶӰĿϵWGS84 γȣ
- OGRSpatialReference sourceSRS, targetSRS;
- sourceSRS.importFromEPSG(sourceEPSG); // Դϵȷ EPSG
- targetSRS.importFromEPSG(4326); // ĿΪ WGS84 γ
-
- // תγ -> ƽ
- OGRCoordinateTransformation* toPlane = OGRCreateCoordinateTransformation(&targetSRS, &sourceSRS);
- if (!toPlane) return false;
-
- // ο㾭γתΪƽ
- double x = refLon, y = refLat;
- if (!toPlane->Transform(1, &x, &y)) {
- OGRCoordinateTransformation::DestroyCT(toPlane);
- return false;
- }
-
- // תƽ -> γ
- OGRCoordinateTransformation* toGeo = OGRCreateCoordinateTransformation(&sourceSRS, &targetSRS);
- if (!toGeo) {
- OGRCoordinateTransformation::DestroyCT(toPlane);
- return false;
- }
-
- // 㶫ֱʣȱ仯
- double eastX = x + resolutionMeters, eastY = y;
- double eastLon = eastX, eastLat = eastY;
- if (!toGeo->Transform(1, &eastLon, &eastLat)) {
- OGRCoordinateTransformation::DestroyCT(toPlane);
- OGRCoordinateTransformation::DestroyCT(toGeo);
- return false;
- }
- degreePerPixelX = (eastLon - refLon) / resolutionMeters; // ȷÿӦ
-
- // 㱱ֱʣγȱ仯
- double northX = x, northY = y + resolutionMeters;
- double northLon = northX, northLat = northY;
- if (!toGeo->Transform(1, &northLon, &northLat)) {
- OGRCoordinateTransformation::DestroyCT(toPlane);
- OGRCoordinateTransformation::DestroyCT(toGeo);
- return false;
- }
- degreePerPixelY = (northLat - refLat) / resolutionMeters; // γȷÿӦ
-
- // ͷԴ
- OGRCoordinateTransformation::DestroyCT(toPlane);
- OGRCoordinateTransformation::DestroyCT(toGeo);
- return true;
-}
diff --git a/BaseCommonLibrary/BaseTool/GeoOperator.h b/BaseCommonLibrary/BaseTool/GeoOperator.h
deleted file mode 100644
index bd0125d..0000000
--- a/BaseCommonLibrary/BaseTool/GeoOperator.h
+++ /dev/null
@@ -1,150 +0,0 @@
-#pragma once
-
-
-#ifndef _GEOOPERATOR_H
-#define _GEOOPERATOR_H
-
-#include "BaseConstVariable.h"
-#include
-#include
-#include