为高轨20米准备,两行根数生成轨道节点

pull/13/head
陈增辉 2025-03-14 19:43:25 +08:00
parent 5254154c5c
commit 151d878e61
11 changed files with 435 additions and 7 deletions

View File

@ -130,6 +130,12 @@ std::vector<SatelliteAntPos> RunTle(libsgp4::Tle tle, double start, double end,
return resultpos;
}
SPG4TOOL_EXPORT std::vector<SatelliteAntPos> getGPSPoints(std::string line1, std::string line2, double start, double end, double inc, bool printfinfoflag)
{
libsgp4::Tle tle("GF3", line1, line2);
return RunTle( tle, start, end, inc, printfinfoflag);
}

View File

@ -2,16 +2,12 @@
#ifndef __SPG4FUNCTION__H__
#define __SPG4FUNCTION__H__
#include "SPG4Tool_global.h"
#include "Tle.h"
#include "SGP4.h"
#include "Observer.h"
#include "BaseConstVariable.h"
#include <vector>
//void RunTle(libsgp4::Tle tle, double start, double end, double inc);
SPG4TOOL_EXPORT std::vector<SatelliteAntPos> RunTle(libsgp4::Tle tle, double start, double end, double inc,bool printfinfoflag=false);
SPG4TOOL_EXPORT std::vector<SatelliteAntPos> getGPSPoints(std::string line1, std::string line2, double start, double end, double inc, bool printfinfoflag = false);
#endif

View File

@ -133,5 +133,8 @@
<ClInclude Include="SPG4Function.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SPG4Tool_global.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -12,6 +12,7 @@
#include "QConvertCoordinateSystemDialog.h"
#include "QResampleRefrenceRaster.h"
#include "QtLookTableCorrectOffsetDialog.h"
#include "QtCreateGPSPointsDialog.h"
GF3ImportDataToolButton::GF3ImportDataToolButton(QWidget* parent) :QToolAbstract(parent)
{
@ -113,6 +114,7 @@ void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWi
emit toolbox->addBoxToolItemSIGNAL(new QConvertCoordinateSystemToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QResampleRefrenceRasterToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QLookTableCorrectOffsetToolButton(toolbox));
emit toolbox->addBoxToolItemSIGNAL(new QCreateGPSPointsToolButton(toolbox));
}
QDEMResampleDialogToolButton::QDEMResampleDialogToolButton(QWidget* parent)
@ -197,4 +199,20 @@ void QLookTableCorrectOffsetToolButton::excute()
{
QtLookTableCorrectOffsetDialog* dialog = new QtLookTableCorrectOffsetDialog;
dialog->show();
}
QCreateGPSPointsToolButton::QCreateGPSPointsToolButton(QWidget* parent)
{
this->toolPath = QVector<QString>(0);
this->toolPath.push_back(u8"基础处理");
this->toolname = QString(u8"两行根数生成轨道节点");
}
QCreateGPSPointsToolButton::~QCreateGPSPointsToolButton()
{
}
void QCreateGPSPointsToolButton::excute()
{
QtCreateGPSPointsDialog* dialog = new QtCreateGPSPointsDialog;
dialog->show();
}

View File

@ -121,4 +121,15 @@ public slots:
class BASETOOLBOX_EXPORT QCreateGPSPointsToolButton : public QToolAbstract {
Q_OBJECT
public:
QCreateGPSPointsToolButton(QWidget* parent = nullptr);
~QCreateGPSPointsToolButton();
public slots:
virtual void excute() override;
};
extern "C" BASETOOLBOX_EXPORT void RegisterPreToolBox(LAMPMainWidget::RasterMainWidget* mainwindows, ToolBoxWidget* toolbox);

View File

@ -103,7 +103,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<IncludePath>..\..\BaseCommonLibrary;..\..\BaseCommonLibrary\BaseTool;..\..\BaseCommonLibrary\ToolAbstract;..\..\GPUBaseLib\GPUTool;.\BaseToolbox;..\..\RasterMainWidgetGUI\RasterMainWidget;..\..\RasterMainWidgetGUI;..\..\SPG4Tool;..\..\RasterProcessToolWidget;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\Toolbox\</OutDir>
<TargetName>PluginTool_$(ProjectName)</TargetName>
<CopyLocalProjectReference>true</CopyLocalProjectReference>
@ -205,6 +205,7 @@
<ClCompile Include="BaseToolbox\QOrthSlrRaster.cpp" />
<ClCompile Include="BaseToolbox\QRDOrthProcessClass.cpp" />
<ClCompile Include="BaseToolbox\QResampleRefrenceRaster.cpp" />
<ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp" />
<ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp" />
<ClCompile Include="BaseToolbox\SatelliteGF3xmlParser.cpp" />
<ClCompile Include="BaseToolbox\SateOrbit.cpp" />
@ -223,6 +224,7 @@
<QtMoc Include="BaseToolbox\QConvertCoordinateSystemDialog.h" />
<QtMoc Include="BaseToolbox\QResampleRefrenceRaster.h" />
<QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h" />
<QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h" />
<ClInclude Include="BaseToolbox\SatelliteGF3xmlParser.h" />
<ClInclude Include="BaseToolbox\SateOrbit.h" />
<ClInclude Include="BaseToolbox\simptsn.h" />
@ -242,6 +244,7 @@
<QtUic Include="BaseToolbox\QOrthSlrRaster.ui" />
<QtUic Include="BaseToolbox\QRDOrthProcessClass.ui" />
<QtUic Include="BaseToolbox\QResampleRefrenceRaster.ui" />
<QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui" />
<QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui" />
</ItemGroup>
<ItemGroup>
@ -257,6 +260,9 @@
<ProjectReference Include="..\..\RasterProcessToolWidget\RasterProcessTool.vcxproj">
<Project>{7ef67daa-dbc0-4b7f-80e8-11b4d2cb7ec2}</Project>
</ProjectReference>
<ProjectReference Include="..\..\SPG4Tool\SPG4Tool.vcxproj">
<Project>{80a5854f-6f80-4ec2-9f73-84e0f4db8d7e}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

View File

@ -103,6 +103,9 @@
<ClCompile Include="BaseToolbox\QtLookTableCorrectOffsetDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
<ClCompile Include="BaseToolbox\QtCreateGPSPointsDialog.cpp">
<Filter>BaseToolbox</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="BaseToolbox\DEMLLA2XYZTool.h">
@ -141,6 +144,9 @@
<QtMoc Include="BaseToolbox\QtLookTableCorrectOffsetDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
<QtMoc Include="BaseToolbox\QtCreateGPSPointsDialog.h">
<Filter>BaseToolbox</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<QtUic Include="BaseToolbox\DEMLLA2XYZTool.ui">
@ -176,5 +182,8 @@
<QtUic Include="BaseToolbox\QtLookTableCorrectOffsetDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
<QtUic Include="BaseToolbox\QtCreateGPSPointsDialog.ui">
<Filter>BaseToolbox</Filter>
</QtUic>
</ItemGroup>
</Project>

View File

@ -0,0 +1,136 @@
#include "QtCreateGPSPointsDialog.h"
#include "ui_QtCreateGPSPointsDialog.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QDateTime>
#include <QTime>
#include <QDate>
#include <fstream>
#include <QDebug>
#include "SPG4Function.h"
QtCreateGPSPointsDialog::QtCreateGPSPointsDialog(QWidget *parent)
: QDialog(parent),ui(new Ui::QtCreateGPSPointsDialogClass)
{
ui->setupUi(this);
// 控件绑定槽函数
connect(ui->LTESelectBtn, SIGNAL(clicked()), this, SLOT(onLTESelectBtnClicked()));
connect(ui->outGPSxmlSelectBtn, SIGNAL(clicked()), this, SLOT(onoutGPSxmlSelectBtnClicked()));
connect(ui->dialogBtn, SIGNAL(accepted()), this, SLOT(onaccepted()));
connect(ui->dialogBtn, SIGNAL(rejected()), this, SLOT(onrejected()));
}
QtCreateGPSPointsDialog::~QtCreateGPSPointsDialog()
{}
void QtCreateGPSPointsDialog::onLTESelectBtnClicked()
{
QString fileName = QFileDialog::getOpenFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"TLE File(*.TLE);;Txt File(*.txt);;All File(*,*)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->lineEditLTE->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QtCreateGPSPointsDialog::onoutGPSxmlSelectBtnClicked()
{
QString fileName = QFileDialog::getSaveFileName(
this, // 父窗口
tr(u8"选择影像文件"), // 标题
QString(), // 默认路径
tr(u8"xml Files (*.xml)") // 文件过滤器
);
// 如果用户选择了文件
if (!fileName.isEmpty()) {
this->ui->outGPSxmlSelectBtn->setText(fileName);
}
else {
QMessageBox::information(this, tr(u8"没有选择文件"), tr(u8"没有选择任何文件。"));
}
}
void QtCreateGPSPointsDialog::onaccepted()
{
QString inLTEPath = this->ui->lineEditLTE->text();
QString outGPSxmlPath = this->ui->outGPSxmlSelectBtn->text();
double start = this->ui->StartimedateTimeEdit->dateTime().toTime_t();
double end = this->ui->EndimedateTimeEdit->dateTime().toTime_t();
long gpsoint = this->ui->spinBoxGPSPoints->value();
qDebug() << "inLTEPath:" << inLTEPath;
qDebug() << "outGPSxmlPath:" << outGPSxmlPath;
qDebug() << "start:" << start << " str:" << this->ui->StartimedateTimeEdit->text();
qDebug() << "end:" << end << " str:" << this->ui->EndimedateTimeEdit->text();
qDebug() << "gpsoint:" << gpsoint;
// 读取TLE文件
std::ifstream ifs(inLTEPath.toLocal8Bit().constData());
if (!ifs.is_open()) {
QMessageBox::warning(this, tr(u8"提示"), tr(u8"open file failed!!"));
return;
}
// 读取TLE文件
std::string line;
std::string tle1, tle2;
while (std::getline(ifs, line)) {
if (line.find("1 ") != std::string::npos) {
tle1 = line;
}
else if (line.find("2 ") != std::string::npos) {
tle2 = line;
}
}
ifs.close();
std::vector<SatelliteAntPos> gpspoints = getGPSPoints(tle1, tle2, start, end, gpsoint, true);
// 计算GPS点
std::ofstream ofs(outGPSxmlPath.toLocal8Bit().constData());
if (!ofs.is_open()) {
QMessageBox::warning(this, tr(u8"提示"), tr(u8"open file failed!!"));
return;
}
ofs << "<root>\n<GPS>\n";
for (const auto& point : gpspoints) {
ofs << "<GPSParam>\n";
ofs << "<TimeStamp>" << QDateTime::fromTime_t(point.time).toString("yyyy-MM-dd HH:mm:ss.zzz").toStdString() << "</TimeStamp>\n";
ofs << "<xPosition>" << point.Px << "</xPosition>\n";
ofs << "<yPosition>" << point.Py << "</yPosition>\n";
ofs << "<zPosition>" << point.Pz << "</zPosition>\n";
ofs << "<xVelocity>" << point.Vx << "</xVelocity>\n";
ofs << "<yVelocity>" << point.Vy << "</yVelocity>\n";
ofs << "<zVelocity>" << point.Vz << "</zVelocity>\n";
ofs << "</GPSParam>\n";
}
ofs << "</GPS>\n</root>\n";
ofs.close();
QMessageBox::warning(this, tr(u8"提示"), tr(u8"completed!!"));
}
void QtCreateGPSPointsDialog::onrejected()
{
this->close();
}

View File

@ -0,0 +1,26 @@
#pragma once
#include "BaseConstVariable.h"
#include <QDialog>
namespace Ui {
class QtCreateGPSPointsDialogClass;
}
class QtCreateGPSPointsDialog : public QDialog
{
Q_OBJECT
public:
QtCreateGPSPointsDialog(QWidget *parent = nullptr);
~QtCreateGPSPointsDialog();
public slots:
void onLTESelectBtnClicked();
void onoutGPSxmlSelectBtnClicked();
void onaccepted();
void onrejected();
private:
Ui::QtCreateGPSPointsDialogClass* ui;
};

View File

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtCreateGPSPointsDialogClass</class>
<widget class="QDialog" name="QtCreateGPSPointsDialogClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>248</height>
</rect>
</property>
<property name="windowTitle">
<string>QtCreateGPSPointsDialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditLTE">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QDialogButtonBox" name="dialogBtn">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>参数</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>轨道起始时间</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QDateTimeEdit" name="EndimedateTimeEdit">
<property name="minimumSize">
<size>
<width>160</width>
<height>30</height>
</size>
</property>
<property name="displayFormat">
<string>yyyy/M/d H:mm:ss.zzz</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDateTimeEdit" name="StartimedateTimeEdit">
<property name="minimumSize">
<size>
<width>160</width>
<height>30</height>
</size>
</property>
<property name="currentSection">
<enum>QDateTimeEdit::YearSection</enum>
</property>
<property name="displayFormat">
<string>yyyy/M/d H:mm:ss.zzz</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>轨道结束时间</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>轨道节点数</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBoxGPSPoints">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>两行根数:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="LTESelectBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="outGPSxmlSelectBtn">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>GPS节点</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditoutGPSxml">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -8,7 +8,7 @@
QImageSARRFPC::QImageSARRFPC(QWidget *parent)
: QDialog(parent)
: QDialog(parent), ui(new Ui::QImageSARRFPCClass)
{
ui->setupUi(this);