1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 22:01:45 -05:00
sdrangel/plugins/channelmimo/doa2/doa2compass.h

179 lines
5.7 KiB
C
Raw Normal View History

2022-05-27 04:59:25 -04:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2022 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_DOA2COMPASS_H
#define INCLUDE_DOA2COMPASS_H
#include <QWidget>
class DOA2Compass : public QWidget
{
Q_OBJECT
public:
DOA2Compass(QWidget *parent = nullptr);
~DOA2Compass();
///
/// \brief Set all data (yaw, alt, height)
///
2022-05-27 08:02:52 -04:00
/// \param azPos - forward (positive angles side relative to antennas direction) azimuth (in degrees)
/// \param azNeg - reverse (negatve angles side relative to antennas direction) azimuth (in degrees)
/// \param azAnt - antennas azimuth from 1 (connected to stream 0) to 2 (connected to stream 1)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
void setData(double azPos, double azNeg, double azAnt) {
m_azPos = azPos;
m_azNeg = azNeg;
m_azAnt = azAnt;
2022-05-27 04:59:25 -04:00
2022-05-27 08:02:52 -04:00
if( m_azPos < 0 ) m_azPos = 360 + m_azPos;
if( m_azPos > 360 ) m_azPos = m_azPos - 360;
if( m_azNeg < 0 ) m_azNeg = 360 + m_azNeg;
if( m_azNeg > 360 ) m_azNeg = m_azNeg - 360;
if( azAnt < 0 ) azAnt = 360 + azAnt;
if( azAnt > 360 ) azAnt = azAnt - 360;
2022-05-27 04:59:25 -04:00
emit canvasReplot();
}
///
2022-05-27 08:02:52 -04:00
/// \brief Set forward azimoth (in degree)
/// \param val - forward azimoth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
void setAzPos(double val)
{
m_azPos = val;
if( m_azPos < 0 ) m_azPos = 360 + m_azPos;
if( m_azPos > 360 ) m_azPos = m_azPos - 360;
2022-05-27 04:59:25 -04:00
emit canvasReplot();
}
///
2022-05-27 08:02:52 -04:00
/// \brief Set reverse azimoth (in degree)
/// \param val - reverse azimoth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
void setAzNeg(double val)
{
m_azNeg = val;
if( m_azNeg < 0 ) m_azNeg = 360 + m_azNeg;
if( m_azNeg > 360 ) m_azNeg = m_azNeg - 360;
2022-05-27 04:59:25 -04:00
emit canvasReplot();
}
///
2022-05-27 08:02:52 -04:00
/// \brief Set antennas azimoth (in degree)
/// \param val - antennas azimoth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
void setAzAnt(double val)
{
m_azAnt = val;
if( m_azAnt < 0 ) m_azAnt = 360 + m_azAnt;
if( m_azAnt > 360 ) m_azAnt = m_azAnt - 360;
2022-05-27 04:59:25 -04:00
emit canvasReplot();
}
2022-05-27 23:48:49 -04:00
///
/// \brief Set half blind angle (in degree)
/// \param val - half blind angle (in degree)
///
void setBlindAngle(double val)
{
m_blindAngle = val;
if( m_blindAngle < 0 ) m_blindAngle = 360 + m_blindAngle;
if( m_blindAngle > 360 ) m_blindAngle = m_blindAngle - 360;
emit canvasReplot();
}
2022-05-28 14:15:07 -04:00
///
/// \brief Set blind scector color
/// \param val - blind sector color
///
void setBlindColor(const QColor& color)
{
m_blindColor = color;
emit canvasReplot();
}
///
/// \brief Draw border along blind angle
/// \param drawLegend - true to draw border along blind angle
///
void setBlindAngleBorder(bool value)
{
m_blindAngleBorder = value;
emit canvasReplot();
}
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
/// \brief Draw legend in the center of the compass
/// \param drawLegend - true to draw legend else false
///
void drawLegend(bool drawLegend)
{
m_drawLegend = drawLegend;
emit canvasReplot();
}
///
/// \brief Get forward azimuth
/// \return forward azimuth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
double getAzPos() const {return m_azPos; }
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
/// \brief Get reverse azimuth
/// \return reverse azimuth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
double getAzNeg() const {return m_azNeg; }
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
/// \brief Get antennas azimuth
/// \return antennas azimuth (in degree)
2022-05-27 04:59:25 -04:00
///
2022-05-27 08:02:52 -04:00
double getAzAnt() const {return m_azAnt; }
2022-05-27 04:59:25 -04:00
signals:
void canvasReplot(void);
protected slots:
void canvasReplot_slot(void);
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
protected:
int m_sizeMin, m_sizeMax; ///< widget min/max size (in pixel)
int m_size, m_offset; ///< widget size and offset size
2022-05-27 08:02:52 -04:00
bool m_drawLegend; ///< draw legend in the center
2022-05-27 04:59:25 -04:00
2022-05-27 08:02:52 -04:00
double m_azPos; ///< forward (+) azimuth (in degree)
double m_azNeg; ///< reverse (-) azimuth (in degree)
double m_azAnt; ///< antennas azimuth from 1 (connected to stream 0) to 2 (connected to stream 1)
2022-05-27 23:48:49 -04:00
double m_blindAngle; //!< half the angle around antenna direction where DOA cannot be processed (when baseline distance exceeds half wavelength)
2022-05-28 14:15:07 -04:00
QColor m_blindColor;
bool m_blindAngleBorder;
2022-05-27 04:59:25 -04:00
};
#endif // INCLUDE_DOA2COMPASS_H