2023-05-16 14:58:12 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "kvedit.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QtMath>
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
ui->canvas->setLayout(new QHBoxLayout());
|
|
|
|
this->canvas = new MyCanvas();
|
|
|
|
ui->canvas->layout()->addWidget(this->canvas);
|
|
|
|
|
|
|
|
ui->valueTable->setLayout(new QHBoxLayout());
|
|
|
|
this->kvEdit = new KvEdit();
|
|
|
|
ui->valueTable->layout()->addWidget(this->kvEdit);
|
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() { delete ui; }
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_3_clicked() {
|
|
|
|
this->canvas->drawState(ToPaintState(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_5_clicked() {
|
|
|
|
auto vals = this->kvEdit->getValues();
|
|
|
|
|
|
|
|
int bn = static_cast<int>(qDegreesToRadians(
|
|
|
|
(vals.to_azimut - vals.from_azimut) / vals.step_azimut));
|
|
|
|
int en = static_cast<int>(
|
|
|
|
qDegreesToRadians((vals.to_angle - vals.from_angle) / vals.step_angle));
|
|
|
|
|
|
|
|
this->canvas->FDNMass.clear();
|
|
|
|
this->canvas->FDNMass.resize(bn, QVector<TColPoint>(en));
|
|
|
|
|
|
|
|
double bdn = qDegreesToRadians(vals.dn_azimut);
|
|
|
|
double edn = qDegreesToRadians(vals.dn_angle);
|
|
|
|
double emin = qDegreesToRadians(vals.from_azimut);
|
|
|
|
|
|
|
|
double es = qDegreesToRadians(vals.step_angle);
|
|
|
|
double bs = qDegreesToRadians(vals.step_azimut);
|
|
|
|
|
|
|
|
double maxA = std::numeric_limits<double>::min();
|
|
|
|
double minA = std::numeric_limits<double>::max();
|
|
|
|
|
|
|
|
double b = qDegreesToRadians(vals.from_azimut);
|
|
|
|
for (int i = 0; i < bn; ++i) {
|
|
|
|
double e = emin;
|
|
|
|
for (int j = 0; j < en; ++j) {
|
|
|
|
this->canvas->radar.GetAmplituds(b, e, bdn, edn);
|
|
|
|
this->canvas->FDNMass[i][j].x = qRadiansToDegrees(b);
|
|
|
|
this->canvas->FDNMass[i][j].y = qRadiansToDegrees(e);
|
|
|
|
double sumAmp = this->canvas->radar.GetSumAmp();
|
|
|
|
this->canvas->FDNMass[i][j].amp = qRadiansToDegrees(sumAmp);
|
|
|
|
if (maxA < sumAmp) {
|
|
|
|
maxA = sumAmp;
|
|
|
|
}
|
|
|
|
if (minA > sumAmp) {
|
|
|
|
minA = sumAmp;
|
|
|
|
}
|
|
|
|
e = e + es;
|
|
|
|
}
|
|
|
|
b = b + bs;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO DrawColorAsix
|
|
|
|
|
|
|
|
for (int i = 0; i < bn; ++i) {
|
|
|
|
for (int j = 0; j < en; ++j) {
|
2023-05-24 00:04:44 +00:00
|
|
|
this->canvas->FDNMass[i][j].col = QColor::fromHsvF(this->canvas->FDNMass[i][j].amp, 1, 1);
|
2023-05-16 14:58:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-17 23:08:48 +00:00
|
|
|
ToPaintState state(4);
|
2023-05-24 00:04:44 +00:00
|
|
|
state.axisX = vals.to_azimut;
|
|
|
|
state.axisY = vals.to_azimut;
|
2023-05-17 23:08:48 +00:00
|
|
|
|
|
|
|
this->canvas->drawState(state);
|
2023-05-16 14:58:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
|
|
{
|
|
|
|
this->canvas->drawState(ToPaintState(2));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_2_clicked()
|
|
|
|
{
|
2023-05-24 00:04:44 +00:00
|
|
|
ToPaintState state(3);
|
|
|
|
state.axisX=M_PI*2;
|
|
|
|
state.axisY=M_PI*2;
|
|
|
|
this->canvas->drawState(state);
|
2023-05-16 14:58:12 +00:00
|
|
|
}
|
|
|
|
|