init
This commit is contained in:
commit
99f4ed4f0c
13 changed files with 1151 additions and 0 deletions
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
# C++ objects and libs
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.so
|
||||
*.so.*
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
object_script.*.Release
|
||||
object_script.*.Debug
|
||||
*_plugin_import.cpp
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
*.qmlc
|
||||
*.jsc
|
||||
Makefile*
|
||||
*build-*
|
||||
*.qm
|
||||
*.prl
|
||||
|
||||
# Qt unit tests
|
||||
target_wrapper.*
|
||||
|
||||
# QtCreator
|
||||
*.autosave
|
||||
|
||||
# QtCreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# QtCreator CMake
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# QtCreator 4.8< compilation database
|
||||
compile_commands.json
|
||||
|
||||
# QtCreator local machine specific files for imported projects
|
||||
*creator.user*
|
||||
|
||||
*_qmlcache.qrc
|
||||
|
||||
build/
|
||||
.qtc_clangd
|
||||
cmake_install.cmake
|
||||
qtbuild*
|
||||
CMakeFiles
|
||||
.qtc
|
||||
.qt
|
||||
.cmake
|
||||
qtcsettings.cmake
|
50
CMakeLists.txt
Normal file
50
CMakeLists.txt
Normal file
|
@ -0,0 +1,50 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(Aperture VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Charts Gui OpenGLWidgets OpenGL)
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
main.cpp
|
||||
mainwindow.h mainwindow.cpp
|
||||
mycanvas.h mycanvas.cpp
|
||||
RadarExt.h
|
||||
kvedit.h kvedit.cpp kvedit.ui
|
||||
mainwindow.ui
|
||||
)
|
||||
|
||||
qt_add_executable(Aperture
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(Aperture PRIVATE Qt6::Widgets)
|
||||
target_link_libraries(Aperture PRIVATE Qt6::Charts)
|
||||
target_link_libraries(Aperture PRIVATE Qt6::Gui)
|
||||
target_link_libraries(Aperture PRIVATE Qt6::OpenGLWidgets)
|
||||
target_link_libraries(Aperture PRIVATE Qt6::OpenGL)
|
||||
|
||||
|
||||
set_target_properties(Aperture PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
MACOSX_BUNDLE TRUE
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
install(TARGETS Aperture
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
|
||||
qt_finalize_executable(Aperture)
|
226
RadarExt.h
Normal file
226
RadarExt.h
Normal file
|
@ -0,0 +1,226 @@
|
|||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <math.h>
|
||||
#include <numbers>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#define M_Pi 3.14159265358979323846
|
||||
|
||||
const float PDBt[] = {
|
||||
1, 0.9996547, 0.9986309, 0.9969996, 0.9947753, 0.992019,
|
||||
0.9887693, 0.9850653, 0.9809683, 0.9765174, 0.971751, 0.9667184,
|
||||
0.9614573, 0.9560267, 0.9504516, 0.9447785, 0.9390528, 0.9333188,
|
||||
0.9275984, 0.9219344, 0.9163682, 0.9109405, 0.9056805, 0.9006271,
|
||||
0.8958081, 0.8912509, 0.8869824, 0.8829681, 0.8791338, 0.8754372,
|
||||
0.8718264, 0.8682404, 0.8646393, 0.860964, 0.8571661, 0.8531983,
|
||||
0.8490143, 0.8445687, 0.839808, 0.8346896, 0.8291822, 0.8232277,
|
||||
0.8168081, 0.8098694, 0.8023891, 0.7943282, 0.7856697, 0.7763812,
|
||||
0.7664432, 0.7558489, 0.7445777, 0.7326305, 0.7200042, 0.7066999,
|
||||
0.6927157, 0.6780707, 0.662781, 0.646867, 0.6303547, 0.6132747,
|
||||
0.5956622, 0.5774907, 0.5584638, 0.5382822, 0.5167018, 0.4935714,
|
||||
0.468808, 0.442405, 0.4144718, 0.3851855, 0.3548133, 0.3237017,
|
||||
0.2922504, 0.2609126, 0.2301495, 0.200431, 0.1721929, 0.1458194,
|
||||
0.121624, 0.09983687, 0.08058908, 0.06391948, 0.0497765, 0.03802762,
|
||||
0.02847982, 0.02089019, 0.01499667, 0.01053091, 0.007224957, 0.004837355,
|
||||
0.003162278};
|
||||
const float PDEp[] = {
|
||||
1, 0.9996316, 0.9985504, 0.9968045, 0.9944203, 0.9914481,
|
||||
0.9879273, 0.9838978, 0.9793998, 0.9744846, 0.9691924, 0.9635517,
|
||||
0.9576239, 0.9514369, 0.9450287, 0.9384475, 0.9317298, 0.9249111,
|
||||
0.9180366, 0.9111293, 0.9042219, 0.8973668, 0.890574, 0.8838936,
|
||||
0.8773442, 0.8709636, 0.8647489, 0.8585884, 0.8523442, 0.8458824,
|
||||
0.8390831, 0.8318213, 0.8239674, 0.8154268, 0.8060834, 0.7958478,
|
||||
0.7846211, 0.7723337, 0.758927, 0.7443291, 0.7285175, 0.7114592,
|
||||
0.6931624, 0.6736201, 0.6528674, 0.6309574, 0.607974, 0.5841374,
|
||||
0.5596867, 0.5348352, 0.5097944, 0.4847524, 0.4598857, 0.4353415,
|
||||
0.4112633, 0.3877663, 0.3649471, 0.3428861, 0.3216511, 0.3012902,
|
||||
0.2818383, 0.2632964, 0.2455697, 0.2285625, 0.2121999, 0.1964332,
|
||||
0.1812278, 0.1665692, 0.1524526, 0.1388895, 0.1258924, 0.1134879,
|
||||
0.101702, 0.09056489, 0.08010306, 0.07034202, 0.06130171, 0.05299528,
|
||||
0.04542796, 0.03859663, 0.03248846, 0.02707951, 0.02234502, 0.01824281,
|
||||
0.01473092, 0.0117601, 0.009273618, 0.007224957, 0.005558777, 0.004219005,
|
||||
0.003162278};
|
||||
|
||||
const double KDeg = 57.295779513;
|
||||
|
||||
struct TPoint3D {
|
||||
TPoint3D() {}
|
||||
TPoint3D(float x, float y, float z) : X(x), Y(y), Z(z) {}
|
||||
|
||||
float X = 0;
|
||||
float Y = 0;
|
||||
float Z = 0;
|
||||
};
|
||||
|
||||
struct TIzl {
|
||||
TIzl() {}
|
||||
TIzl(TPoint3D pos, float amp, float fase) : IzPos(pos), Amplitude(amp), Fase(fase) {}
|
||||
|
||||
TPoint3D IzPos = TPoint3D();
|
||||
float Amplitude = 0;
|
||||
float Fase = 0;
|
||||
};
|
||||
|
||||
class TRadar {
|
||||
|
||||
public:
|
||||
const double FZAntena = 0.7; // половина антены по оси Z в м
|
||||
const double FYAntena = 0.4; // половина антены по оси Y в м
|
||||
const double FZYA = FZAntena * FYAntena; // Вспомогательная величина характеризующая геометрию антены
|
||||
const double FLym = 0.03;
|
||||
const double FKLym = M_Pi * 2 / FLym;
|
||||
const double FStepZ = 0.017;
|
||||
const double FStepY = 0.023;
|
||||
const double FPowerValue = 0.75;
|
||||
const double FKof132 = 1.32;
|
||||
|
||||
std::vector<TIzl> FIzlArray;
|
||||
|
||||
std::complex<double> FSum, FAz, FUm;
|
||||
double FSumAmp, FAzAmp, FUmAmp;
|
||||
|
||||
double GetAmpOneIzl(float tet, float fi);
|
||||
TIzl GetIzl(int i);
|
||||
|
||||
void FillArrayIzl(); // FillArrayIzl1
|
||||
|
||||
TRadar();
|
||||
~TRadar();
|
||||
|
||||
void GetAmplituds(float tet, float fi, float offsetTet, float offsetFi);
|
||||
|
||||
std::vector<TIzl> Izls() const { return this->FIzlArray; }
|
||||
double GetSumAmp() const { return this->FSumAmp; }
|
||||
double GetAzAmp() const { return this->FAzAmp; }
|
||||
double GetUmAmp() const { return this->FUmAmp; }
|
||||
std::complex<double> GetSum() const { return this->FSum; }
|
||||
std::complex<double> GetAz() const { return this->FAz; }
|
||||
std::complex<double> GetUm() const { return this->FUm; }
|
||||
};
|
||||
|
||||
inline TRadar::TRadar() {
|
||||
this->FillArrayIzl();
|
||||
}
|
||||
|
||||
inline TRadar::~TRadar() {}
|
||||
|
||||
inline double frac(double t) { return t - floor(t); }
|
||||
|
||||
inline double TRadar::GetAmpOneIzl(float tet, float fi) {
|
||||
int i;
|
||||
std::complex<double> wc{};
|
||||
|
||||
wc.real(std::abs(tet * KDeg));
|
||||
i = std::trunc(wc.real());
|
||||
wc.real(PDBt[i] + frac(wc.real()) * (PDBt[i + 1] - PDBt[i]));
|
||||
|
||||
wc.imag(fi * KDeg);
|
||||
i = std::trunc(wc.imag());
|
||||
wc.imag(PDEp[i] + frac(wc.real()) * (PDEp[i + 1] - PDEp[i]));
|
||||
|
||||
return wc.real() * wc.imag();
|
||||
}
|
||||
|
||||
inline void TRadar::GetAmplituds(float tet, float fi, float offsetTet,
|
||||
float offsetFi) {
|
||||
double pda = GetAmpOneIzl(offsetTet, offsetFi);
|
||||
|
||||
tet = (std::sin(offsetTet) * std::cos(offsetFi) -
|
||||
std::sin(tet) * std::cos(fi)) *
|
||||
FKLym;
|
||||
fi = (std::sin(offsetFi) * std::sin(fi)) * FKLym;
|
||||
|
||||
std::complex<double> us[4]{};
|
||||
|
||||
int c;
|
||||
|
||||
for (int i = 0; i < FIzlArray.size(); i++) {
|
||||
auto Izl = FIzlArray[i];
|
||||
Izl.Fase = Izl.IzPos.Z * tet + Izl.IzPos.Y * fi;
|
||||
|
||||
c = i % 4;
|
||||
us[c].real(us[c].real() + Izl.Amplitude * std::cos(Izl.Fase));
|
||||
us[c].imag(us[c].imag() + Izl.Amplitude * std::sin(Izl.Fase));
|
||||
}
|
||||
|
||||
FSum.real((us[0].real() + us[1].real() + us[2].real() + us[3].real()) * pda);
|
||||
FSum.imag((us[0].imag() + us[1].imag() + us[2].imag() + us[3].imag()) * pda);
|
||||
|
||||
FAz.real((us[1].real() + us[2].real() + us[3].real() + us[0].real()) * pda);
|
||||
FAz.imag((us[1].imag() + us[2].imag() + us[3].imag() + us[0].imag()) * pda);
|
||||
|
||||
FUm.real((us[2].real() + us[3].real() + us[0].real() + us[1].real()) * pda);
|
||||
FUm.imag((us[2].imag() + us[3].imag() + us[0].imag() + us[1].imag()) * pda);
|
||||
|
||||
FSumAmp = std::abs(FSum);
|
||||
FAzAmp = std::abs(FAz);
|
||||
FUmAmp = std::abs(FUm);
|
||||
}
|
||||
|
||||
inline void TRadar::FillArrayIzl() {
|
||||
const int
|
||||
IzCountZ = 72, // Кол-во излучателей по оси Z ( Если предпологать, что антена прямоугольная )
|
||||
IzCountY = 35; // Кол-во излучателей по оси Y ( Если предпологать, что антена прямоугольная )
|
||||
const double
|
||||
OfZ =-FStepZ*0.5-35*FStepZ,
|
||||
OfY =-FStepY*0.25-17*FStepY;
|
||||
|
||||
std::vector<TIzl> U1, U2, U3, U4;
|
||||
|
||||
for (int i = 0; i < IzCountY-1; i++) {
|
||||
for (int j = 0; j < IzCountZ-1; j++) {
|
||||
float z = OfY+j*FStepZ;
|
||||
float y;
|
||||
if (j%2 == 0) {
|
||||
y = OfY+FStepY*i;
|
||||
} else {
|
||||
y = OfY+FStepY*(i+0.5);
|
||||
}
|
||||
|
||||
float r = 1;
|
||||
|
||||
if (z>0) {
|
||||
if (y>0) {
|
||||
U1.push_back(TIzl(TPoint3D(0, y, z), r, 0));
|
||||
} else {
|
||||
U4.push_back(TIzl(TPoint3D(0, y, z), r, 0));
|
||||
}
|
||||
} else {
|
||||
if (y>0) {
|
||||
U2.push_back(TIzl(TPoint3D(0, y, z), r, 0));
|
||||
} else {
|
||||
U3.push_back(TIzl(TPoint3D(0, y, z), r, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int maxLen = U1.size();
|
||||
if (U2.size()>maxLen) {
|
||||
maxLen = U2.size();
|
||||
}
|
||||
if (U3.size()>maxLen) {
|
||||
maxLen = U3.size();
|
||||
}
|
||||
if (U4.size()>maxLen) {
|
||||
maxLen = U4.size();
|
||||
}
|
||||
|
||||
U1.resize(maxLen, TIzl(TPoint3D(0, 0, 0), 0, 0));
|
||||
U2.resize(maxLen, TIzl(TPoint3D(0, 0, 0), 0, 0));
|
||||
U3.resize(maxLen, TIzl(TPoint3D(0, 0, 0), 0, 0));
|
||||
U4.resize(maxLen, TIzl(TPoint3D(0, 0, 0), 0, 0));
|
||||
|
||||
for (int i = 0; i < maxLen; i++) {
|
||||
this->FIzlArray.push_back(U1[i]);
|
||||
this->FIzlArray.push_back(U2[i]);
|
||||
this->FIzlArray.push_back(U3[i]);
|
||||
this->FIzlArray.push_back(U4[i]);
|
||||
}
|
||||
}
|
28
Readme
Normal file
28
Readme
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
|
||||
Lable1 = "Азимут"
|
||||
Lable2 = "Угол места"
|
||||
|
||||
Button1 = "Амплитудное распределение"
|
||||
Button2 = "Фазовое распределение"
|
||||
Button3 = "Положение излучателей"
|
||||
Button4 = "Время работы"
|
||||
Button5 = "Диаграмма направленности"
|
||||
|
||||
ValueListEditorExt1 = "
|
||||
Параметр Значение
|
||||
--------------------------------
|
||||
ДН Азимут = 0
|
||||
ДН Угол места = 0
|
||||
|
||||
От Азимут = -5
|
||||
До Азимут = 5
|
||||
Шаг Азимут = 0.05
|
||||
|
||||
От Угол места = -5
|
||||
До Угол места = 5
|
||||
Шаг Угол места = 0.05
|
||||
|
||||
Размер точки = 5
|
||||
"
|
||||
|
22
kvedit.cpp
Normal file
22
kvedit.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include "kvedit.h"
|
||||
#include "ui_kvedit.h"
|
||||
|
||||
KvEdit::KvEdit(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::kvEdit)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
KvEdit::~KvEdit()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
Values KvEdit::getValues()
|
||||
{
|
||||
return Values{ui->dn_azimut->value(), ui->dn_angle->value(),
|
||||
ui->from_angle->value(), ui->to_angle->value(), ui->step_angle->value(),
|
||||
ui->from_angle->value(), ui->to_azimut->value(), ui->step_azimut->value()};
|
||||
}
|
||||
|
30
kvedit.h
Normal file
30
kvedit.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef KVEDIT_H
|
||||
#define KVEDIT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
struct Values {
|
||||
double dn_azimut, dn_angle,
|
||||
from_angle, to_angle, step_angle,
|
||||
from_azimut, to_azimut, step_azimut;
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class kvEdit;
|
||||
}
|
||||
|
||||
class KvEdit : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KvEdit(QWidget *parent = nullptr);
|
||||
~KvEdit();
|
||||
|
||||
Values getValues();
|
||||
|
||||
private:
|
||||
Ui::kvEdit *ui;
|
||||
};
|
||||
|
||||
#endif // KVEDIT_H
|
273
kvedit.ui
Normal file
273
kvedit.ui
Normal file
|
@ -0,0 +1,273 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>kvEdit</class>
|
||||
<widget class="QWidget" name="kvEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>311</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>ДН Азимут</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="dn_azimut">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>ДН Угол места'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="dn_angle">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>От ( Азимут )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="from_azimut">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>-5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>До ( Азимут )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="to_azimut">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Шаг ( Азимут )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="step_azimut">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.050000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>От ( Угол места )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="from_angle">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>-5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>До ( Угол места )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="to_angle">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Шаг ( Угол места )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="step_angle">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.050000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Размер точки</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="point_size">
|
||||
<property name="minimum">
|
||||
<double>-1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000000000000042420637374017961984.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
10
main.cpp
Normal file
10
main.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
89
mainwindow.cpp
Normal file
89
mainwindow.cpp
Normal file
|
@ -0,0 +1,89 @@
|
|||
#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) {
|
||||
this->canvas->FDNMass[i][j].col = QColor(this->canvas->FDNMass[i][j].amp);
|
||||
}
|
||||
}
|
||||
|
||||
this->canvas->drawState(ToPaintState(4));
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
{
|
||||
this->canvas->drawState(ToPaintState(2));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_pushButton_2_clicked()
|
||||
{
|
||||
this->canvas->drawState(ToPaintState(3));
|
||||
}
|
||||
|
45
mainwindow.h
Normal file
45
mainwindow.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPainter>
|
||||
#include <QWidget>
|
||||
#include "mycanvas.h"
|
||||
#include "kvedit.h"
|
||||
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_2_clicked();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_5_clicked();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
MyCanvas *canvas;
|
||||
KvEdit *kvEdit;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // MAINWINDOW_H
|
155
mainwindow.ui
Normal file
155
mainwindow.ui
Normal file
|
@ -0,0 +1,155 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>902</width>
|
||||
<height>527</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>78</y>
|
||||
<width>54</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Азимут</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>114</y>
|
||||
<width>91</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Угол места</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>32</y>
|
||||
<width>185</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Амплитудное распределение</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>56</y>
|
||||
<width>185</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Положение излучателей</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>8</y>
|
||||
<width>185</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Фазовое распределение</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>185</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Диаграмма направленности</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="canvas" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>20</y>
|
||||
<width>531</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="valueTable" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>170</y>
|
||||
<width>311</width>
|
||||
<height>345</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
117
mycanvas.cpp
Normal file
117
mycanvas.cpp
Normal file
|
@ -0,0 +1,117 @@
|
|||
|
||||
#include "mycanvas.h"
|
||||
|
||||
MyCanvas::MyCanvas(QWidget *parent) : QChartView(new QChart(), parent) {
|
||||
chart()->setTitle("Фазовое распределение антенных решеток");
|
||||
chart()->legend()->hide();
|
||||
|
||||
QValueAxis *qAxisX = new QValueAxis();
|
||||
QValueAxis *qAxisY = new QValueAxis();
|
||||
qAxisX->setRange(-1, 1);
|
||||
qAxisY->setRange(-1, 1);
|
||||
chart()->addAxis(qAxisX, Qt::AlignLeft);
|
||||
chart()->addAxis(qAxisY, Qt::AlignBottom);
|
||||
}
|
||||
|
||||
void MyCanvas::drawState(ToPaintState state) {
|
||||
this->state = state;
|
||||
chart()->removeAllSeries();
|
||||
chart()->createDefaultAxes();
|
||||
|
||||
QScatterSeries *series1 = new QScatterSeries();
|
||||
series1->setMarkerSize(5);
|
||||
|
||||
switch (this->state.type) {
|
||||
case 1: // фазвовое распределение
|
||||
{
|
||||
series1->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
|
||||
|
||||
for (int i = 0; i < this->radar.FIzlArray.size(); i++) {
|
||||
int c = i % 4;
|
||||
|
||||
TIzl izls = radar.FIzlArray[i];
|
||||
// double x = izls.IzPos.Z - 0.0085;
|
||||
// double y = izls.IzPos.Y - 0.0115;
|
||||
// double x2 = izls.IzPos.Z + 0.0085;
|
||||
// double y2 = izls.IzPos.Y + 0.0115;
|
||||
|
||||
|
||||
// series1->setPen(QPen(QColor(63 * c, 255 - 63 * c, 163 * c)));
|
||||
*series1 << QPointF(izls.IzPos.Z, izls.IzPos.Y);
|
||||
}
|
||||
|
||||
chart()->addSeries(series1);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// IAmpIzls
|
||||
{
|
||||
series1->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
|
||||
//series1->setPen(QPen(QColor(izls.Amplitude)));
|
||||
|
||||
|
||||
for (int i = 0; i < this->radar.FIzlArray.size(); ++i) {
|
||||
TIzl izls = radar.FIzlArray[i];
|
||||
|
||||
QPoint point(izls.IzPos.Z, izls.IzPos.Y);
|
||||
series1->append(point);
|
||||
}
|
||||
chart()->addSeries(series1);
|
||||
|
||||
// for(int index= 0; index < series1->count(); index++){
|
||||
// QPointF p = chart()->mapToPosition(series1->at(index) , series1);
|
||||
// QGraphicsItem *it = this->itemAt(this->mapFromScene(p));
|
||||
// if(QGraphicsRectItem *rect = qgraphicsitem_cast<QGraphicsRectItem*>(it)){
|
||||
// QColor color = QColor(radar.FIzlArray[index].Amplitude);;
|
||||
// rect->setBrush(color);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
// FazIzls
|
||||
series1->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
|
||||
|
||||
for (int i = 0; i < this->radar.FIzlArray.size(); ++i) {
|
||||
TIzl izls = radar.FIzlArray[i];
|
||||
double faz = frac((izls.Fase * 0.5 / M_PI)) * 2 * M_PI;
|
||||
|
||||
// double x = izls.IzPos.Z - 0.008;
|
||||
// double y = izls.IzPos.Y - 0.011;
|
||||
// double x2 = izls.IzPos.Z + 0.008;
|
||||
// double y2 = izls.IzPos.Y + 0.011;
|
||||
|
||||
//series1->setPen(QPen(QColor(faz)));
|
||||
series1->append(QPointF(izls.IzPos.Z, izls.IzPos.Y));
|
||||
}
|
||||
|
||||
chart()->addSeries(series1);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
// DN
|
||||
|
||||
series1->setMarkerShape(QScatterSeries::MarkerShapeCircle);
|
||||
series1->setMarkerSize(20);
|
||||
|
||||
for (int i = 0; i < this->FDNMass.size(); ++i) {
|
||||
for (int j = 0; j < this->FDNMass[i].size(); ++j) {
|
||||
//series1->setPen(QPen(QColor(this->FDNMass[i][j].col)));
|
||||
double x =this->FDNMass[i][j].x,
|
||||
y = this->FDNMass[i][j].y;
|
||||
*series1 << QPointF(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
chart()->addSeries(series1);
|
||||
|
||||
|
||||
}
|
42
mycanvas.h
Normal file
42
mycanvas.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#ifndef MYCANVAS_H
|
||||
#define MYCANVAS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QScatterSeries>
|
||||
#include <QChart>
|
||||
#include <QChartView>
|
||||
#include <QValueAxis>
|
||||
|
||||
#include "RadarExt.h"
|
||||
|
||||
struct TColPoint
|
||||
{
|
||||
double x, y, amp;
|
||||
QColor col;
|
||||
};
|
||||
|
||||
class ToPaintState {
|
||||
public:
|
||||
ToPaintState() {}
|
||||
ToPaintState(int type) : type (type) {}
|
||||
|
||||
int type = 0;
|
||||
};
|
||||
|
||||
class MyCanvas : public QChartView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyCanvas(QWidget *parent = nullptr);
|
||||
TRadar radar = TRadar();
|
||||
QVector<QVector<TColPoint>> FDNMass;
|
||||
void drawState(ToPaintState);
|
||||
|
||||
private:
|
||||
ToPaintState state = ToPaintState();
|
||||
|
||||
};
|
||||
|
||||
#endif // MYCANVAS_H
|
Loading…
Reference in a new issue