BaseCommonLibrary/BaseTool/EchoDataFormat.h

226 lines
5.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
/*****************************************************************//**
* \file EchoDataFormat.h
* \brief 存储仿真过程中的各级产品数据格式,主要包含回波数据格式、仿真参数数据库
*
* \author 30453
* \date October 2024
*********************************************************************/
#include "BaseConstVariable.h"
#include <complex>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include <omp.h>
#include <memory>
#include <vector>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <QString>
#include "BaseTool.h"
#include <iostream>
#include <fstream>
#include <complex>
#include <gdal.h>
#include <gdal_priv.h>
#include <gdalwarper.h>
#include <string>
#include <memory>
#include <QString>
#include <cpl_conv.h> // 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并不关心脉冲的顺序只是关注脉冲的坐标位置默认按照脉冲的解析顺序进行组织
//========================================================================
// 成像用的回波脉冲文件格式
/// <summary>
/// 回波数据--废弃
/// </summary>
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<std::complex<double>> echoData; // 回波数据
};
long BASECONSTVARIABLEAPI getPluseDataSize(PluseData& pluseData);
ErrorCode BASECONSTVARIABLEAPI getPluseDataFromBuffer(char* buffer, PluseData& data);
std::shared_ptr<PluseData> BASECONSTVARIABLEAPI CreatePluseDataArr(long pluseCount);
std::shared_ptr<std::complex<double>> BASECONSTVARIABLEAPI CreateEchoData(long plusePoints);
/// <summary>
/// 姿态数据
/// </summary>
struct PluseAntPos {
long id; // PRF id
double time;// 时间
double Px; // 坐标
double Py;
double Pz;
double Vx; // 速度
double Vy;
double Vz;
};
std::shared_ptr<PluseAntPos> BASECONSTVARIABLEAPI CreatePluseAntPosArr(long pluseCount);
class BASECONSTVARIABLEAPI SatelliteAntPosOperator {
public:
static std::shared_ptr<SatelliteAntPos> 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<double> 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();
// 打印信息的成员函数
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<double> getAntPos();
std::shared_ptr<std::complex<double>> getEchoArr(long startPRF, long& PRFLen);
std::shared_ptr<std::complex<double>> getEchoArr();
std::vector<std::complex<double>> getEchoArrVector(long startPRF, long& PRFLen);
//保存文件
ErrorCode saveAntPos(std::shared_ptr<double> ptr); // 注意这个方法很危险,请写入前检查数据是否正确
ErrorCode saveEchoArr(std::shared_ptr<std::complex<double>> echoPtr, long startPRF, long PRFLen);
};