303 lines
7.9 KiB
C++
303 lines
7.9 KiB
C++
|
#include "stdafx.h"
|
|||
|
#include "BaseConstVariable.h"
|
|||
|
|
|||
|
#include "BaseTool.h"
|
|||
|
#include "SARSimulationTaskSetting.h"
|
|||
|
#include <QFile>
|
|||
|
#include <QDomDocument>
|
|||
|
#include <QDateTime>
|
|||
|
#include <QString>
|
|||
|
#include <QDebug>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
SatelliteOribtNode SARSimulationTaskSetting::getSatelliteOribtNode(double& timeFromStartTime, bool& antAzAngleFlag)
|
|||
|
{
|
|||
|
return this->OribtModel->getSatelliteOribtNode(timeFromStartTime, antAzAngleFlag);
|
|||
|
}
|
|||
|
|
|||
|
ErrorCode SARSimulationTaskSetting::getSatelliteOribtNode(double& timeFromStartTime, SatelliteOribtNode& node, bool& antAzAngleFlag)
|
|||
|
{
|
|||
|
return this->OribtModel->getSatelliteOribtNode(timeFromStartTime, node, antAzAngleFlag);
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setSatelliteOribtModel(std::shared_ptr < AbstractSatelliteOribtModel> model)
|
|||
|
{
|
|||
|
this->OribtModel = model;
|
|||
|
}
|
|||
|
|
|||
|
ErrorCode SARSimulationTaskSetting::getSatelliteAntDirectNormal(SatelliteOribtNode& Rs, Vector3D& Rt, SatelliteAntDirect& antNode)
|
|||
|
{
|
|||
|
return this->OribtModel->getSatelliteAntDirectNormal(Rs, Rt, antNode);
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setSARImageStartTime(long double imageStartTime)
|
|||
|
{
|
|||
|
this->imageStartTime = imageStartTime;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setSARImageEndTime(long double imageEndTime)
|
|||
|
{
|
|||
|
this->imageEndTime = imageEndTime;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getSARImageStartTime()
|
|||
|
{
|
|||
|
return this->imageStartTime;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getSARImageEndTime()
|
|||
|
{
|
|||
|
return this->imageEndTime;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getNearRange()
|
|||
|
{
|
|||
|
return this->NearRange;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setNearRange(double NearRange)
|
|||
|
{
|
|||
|
this->NearRange = NearRange;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getFarRange()
|
|||
|
{
|
|||
|
return this->FarRange;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setFarRange(double FarRange)
|
|||
|
{
|
|||
|
this->FarRange = FarRange;
|
|||
|
}
|
|||
|
|
|||
|
bool SARSimulationTaskSetting::getIsRightLook()
|
|||
|
{
|
|||
|
return this->isR;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setIsRightLook(bool isR)
|
|||
|
{
|
|||
|
this->isR = isR;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setCenterFreq(double Freq)
|
|||
|
{
|
|||
|
this->centerFreq = Freq;
|
|||
|
this->centerLamda = LIGHTSPEED / Freq;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getCenterFreq()
|
|||
|
{
|
|||
|
return this->centerFreq;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setCenterLamda(double Lamda)
|
|||
|
{
|
|||
|
this->centerFreq = LIGHTSPEED/Lamda;
|
|||
|
this->centerLamda = this->centerFreq;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getCenterLamda()
|
|||
|
{
|
|||
|
return this->centerLamda;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setBandWidth(double bandwidth)
|
|||
|
{
|
|||
|
this->bandWidth = bandwidth;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getBandWidth()
|
|||
|
{
|
|||
|
return this->bandWidth;
|
|||
|
}
|
|||
|
|
|||
|
POLARTYPEENUM SARSimulationTaskSetting::getPolarType()
|
|||
|
{
|
|||
|
return this->polarType;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setPolarType(POLARTYPEENUM type)
|
|||
|
{
|
|||
|
this->polarType = type;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getCenterLookAngle()
|
|||
|
{
|
|||
|
return this->centerLookAngle;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setCenterLookAngle(double angle)
|
|||
|
{
|
|||
|
this->centerLookAngle = angle;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setPRF(double prf)
|
|||
|
{
|
|||
|
this->PRF = prf;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getPRF()
|
|||
|
{
|
|||
|
return this->PRF;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getFs()
|
|||
|
{
|
|||
|
return this->Fs;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setFs(double Fs)
|
|||
|
{
|
|||
|
this->Fs = Fs;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setTransformRadiationPattern(std::shared_ptr<AbstractRadiationPattern> radiationPanttern)
|
|||
|
{
|
|||
|
this->TransformRadiationPattern = radiationPanttern;
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setReceiveRadiationPattern(std::shared_ptr<AbstractRadiationPattern> radiationPanttern)
|
|||
|
{
|
|||
|
this->ReceiveRadiationPattern = radiationPanttern;
|
|||
|
}
|
|||
|
|
|||
|
std::shared_ptr<AbstractRadiationPattern> SARSimulationTaskSetting::getTransformRadiationPattern()
|
|||
|
{
|
|||
|
return this->TransformRadiationPattern;
|
|||
|
}
|
|||
|
|
|||
|
std::shared_ptr<AbstractRadiationPattern> SARSimulationTaskSetting::getReceiveRadiationPattern()
|
|||
|
{
|
|||
|
return this->ReceiveRadiationPattern;
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getPt()
|
|||
|
{
|
|||
|
return this->OribtModel->getPt();
|
|||
|
}
|
|||
|
|
|||
|
double SARSimulationTaskSetting::getGri()
|
|||
|
{
|
|||
|
return this->OribtModel->getGri();
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setPt(double Pt)
|
|||
|
{
|
|||
|
this->OribtModel->setPt(Pt);
|
|||
|
}
|
|||
|
|
|||
|
void SARSimulationTaskSetting::setGri(double gri)
|
|||
|
{
|
|||
|
this->OribtModel->setGri(gri);
|
|||
|
}
|
|||
|
|
|||
|
std::shared_ptr<AbstractSARSatelliteModel> ReadSimulationSettingsXML(QString xmlPath)
|
|||
|
{
|
|||
|
QDomDocument doc;
|
|||
|
QFile file(xmlPath);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>XML<4D>ļ<EFBFBD>
|
|||
|
if (!file.open(QIODevice::ReadOnly)) {
|
|||
|
qWarning("Could not open XML file");
|
|||
|
return nullptr;
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>XML<4D><4C><EFBFBD><EFBFBD>
|
|||
|
if (!doc.setContent(&file)) {
|
|||
|
file.close();
|
|||
|
qWarning("Failed to parse XML file");
|
|||
|
return nullptr;
|
|||
|
}
|
|||
|
file.close();
|
|||
|
|
|||
|
// <20><>ȡ<EFBFBD><C8A1>Ԫ<EFBFBD><D4AA>
|
|||
|
QDomElement root = doc.documentElement();
|
|||
|
|
|||
|
// <20><>ȡ<EFBFBD><C8A1>Ϣ
|
|||
|
QDomElement satellite = root.firstChildElement("satellite");
|
|||
|
QDomElement taskSensor = root.firstChildElement("TaskSensor");
|
|||
|
|
|||
|
if (satellite.isNull() || taskSensor.isNull()) {
|
|||
|
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::XMLNOTFOUNDElEMENT));
|
|||
|
return nullptr;
|
|||
|
}
|
|||
|
else {}
|
|||
|
|
|||
|
|
|||
|
QDomElement imagingMode = taskSensor.firstChildElement("imagingMode");
|
|||
|
QDomElement radarCenterFrequency = taskSensor.firstChildElement("RadarCenterFrequency");
|
|||
|
QDomElement bandWidth = taskSensor.firstChildElement("bandWidth");
|
|||
|
QDomElement centerLookAngle = taskSensor.firstChildElement("centerLookAngle");
|
|||
|
QDomElement prf = taskSensor.firstChildElement("prf");
|
|||
|
QDomElement fs = taskSensor.firstChildElement("fs");
|
|||
|
QDomElement polar = taskSensor.firstChildElement("polar");
|
|||
|
QDomElement nearRange = taskSensor.firstChildElement("nearRange");
|
|||
|
QDomElement farRange = taskSensor.firstChildElement("farRange");
|
|||
|
QDomElement lookDirection = taskSensor.firstChildElement("lookDirection");
|
|||
|
if (imagingMode.isNull() || radarCenterFrequency.isNull() || bandWidth.isNull() || centerLookAngle.isNull() || prf.isNull() || fs.isNull() || polar.isNull() || nearRange.isNull() || farRange.isNull() )
|
|||
|
{
|
|||
|
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::XMLNOTFOUNDElEMENT));
|
|||
|
return nullptr;
|
|||
|
}
|
|||
|
else {}
|
|||
|
|
|||
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
QDomElement imagingTime = taskSensor.firstChildElement("imagingTime");
|
|||
|
|
|||
|
|
|||
|
QDomElement startTime = imagingTime.firstChildElement("start");
|
|||
|
QDomElement endTime = imagingTime.firstChildElement("end");
|
|||
|
|
|||
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD>
|
|||
|
//QDomElement dopplerParametersReferenceTime = taskSensor.firstChildElement("DopplerParametersReferenceTime");
|
|||
|
|
|||
|
if (imagingTime.isNull() || startTime.isNull() || endTime.isNull())
|
|||
|
{
|
|||
|
qDebug() << QString::fromStdString(errorCode2errInfo(ErrorCode::XMLNOTFOUNDElEMENT));
|
|||
|
return nullptr;
|
|||
|
|
|||
|
}
|
|||
|
else {}
|
|||
|
|
|||
|
std::shared_ptr<SARSimulationTaskSetting> taskSetting = std::make_shared<SARSimulationTaskSetting>();
|
|||
|
|
|||
|
double starttimestamp = convertToMilliseconds(startTime.text().trimmed().toStdString());
|
|||
|
double endtimestamp = convertToMilliseconds(endTime.text().trimmed().toStdString());
|
|||
|
|
|||
|
if (polar.text().toLower().contains("hh")) {
|
|||
|
taskSetting->setPolarType(POLARHH);
|
|||
|
}
|
|||
|
else if (polar.text().toLower().contains("hv")) {
|
|||
|
taskSetting->setPolarType(POLARHV);
|
|||
|
}
|
|||
|
else if (polar.text().toLower().contains("vh")) {
|
|||
|
taskSetting->setPolarType(POLARVH);
|
|||
|
}
|
|||
|
else if (polar.text().toLower().contains("vv")) {
|
|||
|
taskSetting->setPolarType(POLARVV);
|
|||
|
}
|
|||
|
else {}
|
|||
|
|
|||
|
bool isR = false;
|
|||
|
if (!lookDirection.isNull()) {
|
|||
|
qDebug() <<"lookDirection" << lookDirection.text();
|
|||
|
if (lookDirection.text().toUpper() == "R") {
|
|||
|
isR = true;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
taskSetting->setCenterLookAngle(centerLookAngle.text().toDouble());
|
|||
|
taskSetting->setSARImageStartTime(starttimestamp); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼʱ<CABC><CAB1>
|
|||
|
taskSetting->setSARImageEndTime(endtimestamp); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<D6B9><CAB1>
|
|||
|
taskSetting->setBandWidth(bandWidth.text().toDouble());
|
|||
|
taskSetting->setCenterFreq(radarCenterFrequency.text().toDouble()); // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|||
|
taskSetting->setPRF(prf.text().toDouble()); // PRF
|
|||
|
taskSetting->setFs(fs.text().toDouble()); //Fs
|
|||
|
taskSetting->setNearRange(nearRange.text().toDouble()); // NearRange
|
|||
|
taskSetting->setFarRange(farRange.text().toDouble()); // FarRange
|
|||
|
taskSetting->setIsRightLook(isR);
|
|||
|
return taskSetting;
|
|||
|
}
|