diff --git a/src/blackgui/components/maininfoareacomponent.cpp b/src/blackgui/components/maininfoareacomponent.cpp
index d6ec6e7a8..148d49b08 100644
--- a/src/blackgui/components/maininfoareacomponent.cpp
+++ b/src/blackgui/components/maininfoareacomponent.cpp
@@ -97,6 +97,11 @@ namespace BlackGui
return ui->comp_TextMessages;
}
+ CRadarComponent *CMainInfoAreaComponent::getRadarComponent()
+ {
+ return ui->comp_Radar;
+ }
+
void CMainInfoAreaComponent::displayLog()
{
ui->comp_Log->displayLog();
@@ -195,6 +200,7 @@ namespace BlackGui
case InfoAreaLog: return CIcons::appLog16();
case InfoAreaTextMessages: return CIcons::appTextMessages16();
case InfoAreaInterpolation: return CIcons::appInterpolation16();
+ case InfoAreaRadar: return CIcons::appRadar16();
default: return CIcons::empty();
}
}
diff --git a/src/blackgui/components/maininfoareacomponent.h b/src/blackgui/components/maininfoareacomponent.h
index 7fcbbeae4..465a2c801 100644
--- a/src/blackgui/components/maininfoareacomponent.h
+++ b/src/blackgui/components/maininfoareacomponent.h
@@ -34,6 +34,7 @@ namespace BlackGui
class CLogComponent;
class CMappingComponent;
class CInterpolationComponent;
+ class CRadarComponent;
class CSettingsComponent;
class CSimulatorComponent;
class CTextMessageComponent;
@@ -68,6 +69,7 @@ namespace BlackGui
InfoAreaInterpolation = 9,
InfoAreaSettings = 10,
InfoAreaLog = 11,
+ InfoAreaRadar = 12,
InfoAreaNone = -1
};
@@ -107,6 +109,9 @@ namespace BlackGui
//! Text messages
CTextMessageComponent *getTextMessageComponent();
+ //! Radar
+ CRadarComponent *getRadarComponent();
+
//! Display the log
void displayLog();
diff --git a/src/blackgui/components/maininfoareacomponent.ui b/src/blackgui/components/maininfoareacomponent.ui
index 393b609b5..6510109c3 100644
--- a/src/blackgui/components/maininfoareacomponent.ui
+++ b/src/blackgui/components/maininfoareacomponent.ui
@@ -791,6 +791,66 @@
+
+
+
+ 165
+ 66
+
+
+
+ Qt::TopDockWidgetArea
+
+
+ Radar
+
+
+ 4
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 2
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+
@@ -871,6 +931,12 @@
blackgui/components/interpolationcomponent.h
1
+
+ BlackGui::Components::CRadarComponent
+ QFrame
+ blackgui/components/radarcomponent.h
+ 1
+
diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp
index 30374076b..99a98c27a 100644
--- a/src/blackgui/components/mainkeypadareacomponent.cpp
+++ b/src/blackgui/components/mainkeypadareacomponent.cpp
@@ -49,6 +49,7 @@ namespace BlackGui
connect(ui->pb_MainLog, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainMappings, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainInterpolation, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
+ connect(ui->pb_MainRadar, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainSettings, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainSimulator, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
connect(ui->pb_MainTextMessages, &QPushButton::released, this, &CMainKeypadAreaComponent::buttonSelected);
@@ -202,6 +203,7 @@ namespace BlackGui
if (button == ui->pb_MainLog) return CMainInfoAreaComponent::InfoAreaLog;
if (button == ui->pb_MainMappings) return CMainInfoAreaComponent::InfoAreaMapping;
if (button == ui->pb_MainInterpolation) return CMainInfoAreaComponent::InfoAreaInterpolation;
+ if (button == ui->pb_MainRadar) return CMainInfoAreaComponent::InfoAreaRadar;
if (button == ui->pb_MainSettings) return CMainInfoAreaComponent::InfoAreaSettings;
if (button == ui->pb_MainSimulator) return CMainInfoAreaComponent::InfoAreaSimulator;
if (button == ui->pb_MainTextMessages) return CMainInfoAreaComponent::InfoAreaTextMessages;
@@ -221,6 +223,7 @@ namespace BlackGui
case CMainInfoAreaComponent::InfoAreaLog: return ui->pb_MainLog;
case CMainInfoAreaComponent::InfoAreaMapping: return ui->pb_MainMappings;
case CMainInfoAreaComponent::InfoAreaInterpolation: return ui->pb_MainInterpolation;
+ case CMainInfoAreaComponent::InfoAreaRadar: return ui->pb_MainRadar;
case CMainInfoAreaComponent::InfoAreaSettings: return ui->pb_MainSettings;
case CMainInfoAreaComponent::InfoAreaSimulator: return ui->pb_MainSimulator;
case CMainInfoAreaComponent::InfoAreaTextMessages: return ui->pb_MainTextMessages;
@@ -240,6 +243,7 @@ namespace BlackGui
ui->pb_MainLog->setChecked(false);
ui->pb_MainMappings->setChecked(false);
ui->pb_MainInterpolation->setChecked(false);
+ ui->pb_MainRadar->setChecked(false);
ui->pb_MainSettings->setChecked(false);
ui->pb_MainSimulator->setChecked(false);
ui->pb_MainTextMessages->setChecked(false);
diff --git a/src/blackgui/components/mainkeypadareacomponent.ui b/src/blackgui/components/mainkeypadareacomponent.ui
index 61a5f2278..9d32cb001 100644
--- a/src/blackgui/components/mainkeypadareacomponent.ui
+++ b/src/blackgui/components/mainkeypadareacomponent.ui
@@ -6,8 +6,8 @@
0
0
- 410
- 122
+ 473
+ 144
@@ -364,9 +364,9 @@
-
-
+
- false
+ true
@@ -375,7 +375,10 @@
-
+ Radar
+
+
+ true
@@ -427,7 +430,7 @@
pb_Opacity050
pb_Opacity100
pb_CockpitIdent
- pb_Empty
+ pb_MainRadar
pb_SoundMute
pb_SoundMaxVolume
diff --git a/src/blackgui/components/radarcomponent.cpp b/src/blackgui/components/radarcomponent.cpp
new file mode 100644
index 000000000..fb1f2a1d4
--- /dev/null
+++ b/src/blackgui/components/radarcomponent.cpp
@@ -0,0 +1,272 @@
+/* Copyright (C) 2019
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "ui_radarcomponent.h"
+#include "blackgui/guiapplication.h"
+#include "blackgui/infoarea.h"
+#include "blackgui/components/radarcomponent.h"
+#include "blackcore/context/contextnetwork.h"
+#include "blackmisc/simulation/simulatedaircraft.h"
+
+#include
+#include
+
+using namespace BlackMisc;
+using namespace BlackMisc::Aviation;
+using namespace BlackMisc::Simulation;
+using namespace BlackMisc::Geo;
+using namespace BlackMisc::PhysicalQuantities;
+using namespace BlackGui::Views;
+
+namespace BlackGui
+{
+ namespace Components
+ {
+ CRadarComponent::CRadarComponent(QWidget *parent) :
+ QFrame(parent),
+ ui(new Ui::CRadarComponent)
+ {
+ ui->setupUi(this);
+
+ ui->gv_RadarView->setScene(&m_scene);
+
+ ui->cb_RadarRange->addItem(QString::number(0.5) + " nm", 0.5);
+ for (qreal r = 1.0; r < 10; r += 1)
+ {
+ ui->cb_RadarRange->addItem(QString::number(r) + " nm", r);
+ }
+ for (qreal r = 10; r < 91; r += 10)
+ {
+ ui->cb_RadarRange->addItem(QString::number(r) + " nm", r);
+ }
+
+ ui->cb_RadarRange->setCurrentText(QString::number(m_range) + " nm");
+
+ connect(ui->gv_RadarView, &CRadarView::radarViewResized, this, &CRadarComponent::fitInView);
+ connect(ui->gv_RadarView, &CRadarView::zoomEvent, this, &CRadarComponent::changeRangeInSteps);
+ connect(&m_updateTimer, &QTimer::timeout, this, &CRadarComponent::refreshTargets);
+
+ connect(ui->cb_RadarRange, qOverload(&QComboBox::currentIndexChanged), this, &CRadarComponent::changeRangeFromUserSelection);
+ connect(ui->cb_Callsign, &QCheckBox::toggled, this, &CRadarComponent::refreshTargets);
+ connect(ui->cb_Heading, &QCheckBox::toggled, this, &CRadarComponent::refreshTargets);
+ connect(ui->cb_Altitude, &QCheckBox::toggled, this, &CRadarComponent::refreshTargets);
+ connect(ui->cb_GroundSpeed, &QCheckBox::toggled, this, &CRadarComponent::refreshTargets);
+ connect(ui->cb_Grid, &QCheckBox::toggled, this, &CRadarComponent::toggleGrid);
+
+ prepareScene();
+
+ m_updateTimer.start(5000);
+ }
+
+ CRadarComponent::~CRadarComponent()
+ { }
+
+ bool CRadarComponent::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
+ {
+ CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(parentDockableWidget);
+ const bool c = connect(this->getParentInfoArea(), &CInfoArea::changedInfoAreaTabBarIndex, this, &CRadarComponent::onInfoAreaTabBarChanged);
+ Q_ASSERT_X(c, Q_FUNC_INFO, "failed connect");
+ Q_ASSERT_X(parentDockableWidget, Q_FUNC_INFO, "missing parent");
+ return c && parentDockableWidget;
+ }
+
+ void CRadarComponent::prepareScene()
+ {
+ m_scene.addItem(&m_center);
+ m_scene.addItem(&m_macroGraticule);
+ m_scene.addItem(&m_microGraticule);
+ m_scene.addItem(&m_radials);
+ m_scene.addItem(&m_radarTargets);
+ m_radarTargetPen.setCosmetic(true);
+ addCenter();
+ addGraticules();
+ addRadials();
+ }
+
+ void CRadarComponent::addCenter()
+ {
+ QPen pen(Qt::white, 1);
+ pen.setCosmetic(true);
+ QGraphicsLineItem *li = new QGraphicsLineItem{QLineF(-5.0, 0.0, 5.0, 0.0), &m_center};
+ li->setFlags(QGraphicsItem::ItemIgnoresTransformations);
+ li->setPen(pen);
+
+ li = new QGraphicsLineItem(QLineF(0.0, -5.0, 0.0, 5.0), &m_center);
+ li->setFlags(QGraphicsItem::ItemIgnoresTransformations);
+ li->setPen(pen);
+ }
+
+ void CRadarComponent::addGraticules()
+ {
+ QPen pen(Qt::white, 1);
+ pen.setCosmetic(true);
+
+ // Macro graticule, drawn as full line at every 10 nm
+ for (qreal range = 10.0; range < 101.0; range += 10.0)
+ {
+ qreal x = -range;
+ qreal y = -range;
+ qreal width = 2.0 * range;
+ qreal height = 2.0 * range;
+ QGraphicsEllipseItem *circle = new QGraphicsEllipseItem(x, y, width, height, &m_macroGraticule);
+ circle->setPen(pen);
+ }
+ pen = QPen(Qt::gray, 1, Qt::DashLine);
+ pen.setCosmetic(true);
+
+ // Micro graticule, drawn as dash line at every 2.5 nm
+ for (qreal range = 2.5; range < 9.9; range += 2.5)
+ {
+ qreal x = -range;
+ qreal y = -range;
+ qreal width = 2.0 * range;
+ qreal height = 2.0 * range;
+ QGraphicsEllipseItem *circle = new QGraphicsEllipseItem(x, y, width, height, &m_microGraticule);
+ circle->setPen(pen);
+ }
+ }
+
+ void CRadarComponent::addRadials()
+ {
+ QPen pen(Qt::gray, 1, Qt::DashDotDotLine);
+ pen.setCosmetic(true);
+
+ for (qreal angle = 0.0; angle < 359.0; angle += 30.0)
+ {
+ const QLineF line(0.0, 0.0, 100.0 * qCos(qDegreesToRadians(angle)), -100.0 * qSin(qDegreesToRadians(angle)));
+ QGraphicsLineItem *li = new QGraphicsLineItem(line, &m_radials);
+ li->setPen(pen);
+ }
+ }
+
+ void CRadarComponent::refreshTargets()
+ {
+ if (!sGui || sGui->isShuttingDown()) { return; }
+
+ qDeleteAll(m_radarTargets.childItems());
+
+ if (sGui->getIContextNetwork()->isConnected())
+ {
+ if (isVisibleWidget())
+ {
+ const CSimulatedAircraftList aircraft = sGui->getIContextNetwork()->getAircraftInRange();
+ for (const CSimulatedAircraft &sa : aircraft)
+ {
+ double distanceNM = sa.getRelativeDistance().value(CLengthUnit::NM());
+ double bearingRad = sa.getRelativeBearing().value(CAngleUnit::rad());
+ int groundSpeedKts = sa.getGroundSpeed().valueInteger(CSpeedUnit::kts());
+
+ QPointF position(distanceNM * qSin(bearingRad), -distanceNM * qCos(bearingRad));
+
+ QGraphicsEllipseItem *dot = new QGraphicsEllipseItem(-2.0, -2.0, 4.0, 4.0, &m_radarTargets);
+ dot->setPos(position);
+ dot->setPen(m_radarTargetPen);
+ dot->setBrush(m_radarTargetPen.color());
+ dot->setFlags(QGraphicsItem::ItemIgnoresTransformations);
+
+ QGraphicsTextItem *tag = new QGraphicsTextItem(&m_radarTargets);
+ QString tagText;
+ if (ui->cb_Callsign->isChecked())
+ {
+ tagText += sa.getCallsignAsString() % QStringLiteral("\n");
+ }
+ if (ui->cb_Altitude->isChecked())
+ {
+ int flightLeveL = sa.getAltitude().valueInteger(CLengthUnit::ft()) / 100;
+ tagText += "FL" % QString("%1").arg(flightLeveL, 3, 10, QChar('0'));
+ }
+ if (ui->cb_GroundSpeed->isChecked())
+ {
+ if (! tagText.isEmpty()) tagText += QStringLiteral(" ");
+
+ tagText += QString::number(groundSpeedKts) % " kt";
+ }
+
+ tag->setPlainText(tagText);
+ tag->setPos(position);
+ tag->setDefaultTextColor(Qt::green);
+ tag->setFlags(QGraphicsItem::ItemIgnoresTransformations);
+
+ if (ui->cb_Heading->isChecked() && groundSpeedKts > 3.0)
+ {
+ double headingRad = sa.getHeading().value(CAngleUnit::rad());
+ QPen pen(Qt::green, 1);
+ pen.setCosmetic(true);
+ QGraphicsLineItem *li = new QGraphicsLineItem(QLineF(0.0, 0.0, 20.0 * qSin(headingRad), -20.0 * qCos(headingRad)), dot);
+ li->setFlags(QGraphicsItem::ItemIgnoresTransformations);
+ li->setPen(pen);
+ }
+ }
+ }
+ }
+ }
+
+ void CRadarComponent::toggleGrid(bool checked)
+ {
+ m_macroGraticule.setVisible(checked);
+ m_microGraticule.setVisible(checked);
+ m_radials.setVisible(checked);
+ }
+
+ void CRadarComponent::fitInView()
+ {
+ ui->gv_RadarView->fitInView(-m_range, -m_range, 2.0 * m_range, 2.0 * m_range, Qt::KeepAspectRatio);
+ }
+
+ void CRadarComponent::changeRangeInSteps(bool zoomIn)
+ {
+ qreal direction = zoomIn ? 1.0 : -1.0;
+ double factor = 10.0;
+ if (m_range < 10.0 || (qFuzzyCompare(m_range, 10.0) && zoomIn))
+ {
+ factor = 1.0;
+ }
+
+ if (m_range < 1.0 || (qFuzzyCompare(m_range, 1.0) && zoomIn))
+ {
+ factor = 0.5;
+ }
+
+ m_range = m_range - direction * factor;
+ m_range = qMin(90.0, qMax(0.5, m_range));
+ ui->cb_RadarRange->setCurrentText(QString::number(m_range) + " nm");
+ fitInView();
+ }
+
+ void CRadarComponent::changeRangeFromUserSelection(int index)
+ {
+ double range = ui->cb_RadarRange->itemData(index).toDouble();
+ if (! qFuzzyCompare(m_range, range))
+ {
+ m_range = range;
+ fitInView();
+ }
+ }
+
+ void CRadarComponent::onInfoAreaTabBarChanged(int index)
+ {
+ Q_UNUSED(index);
+
+ // ignore in those cases
+ if (!this->isVisibleWidget()) return;
+ if (this->isParentDockWidgetFloating()) return;
+ if (!sGui->getIContextNetwork()->isConnected()) return;
+
+ // here I know I am the selected widget, update, but keep GUI responsive (hence I use a timer)
+ QPointer myself(this);
+ QTimer::singleShot(1000, this, [ = ]
+ {
+ if (!myself) { return; }
+ myself->refreshTargets();
+ });
+
+ }
+
+ }
+} // namespace
diff --git a/src/blackgui/components/radarcomponent.h b/src/blackgui/components/radarcomponent.h
new file mode 100644
index 000000000..816268cd8
--- /dev/null
+++ b/src/blackgui/components/radarcomponent.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 2019
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_RADARCOMPONENT_H
+#define BLACKGUI_RADARCOMPONENT_H
+
+#include "blackgui/blackguiexport.h"
+#include "blackgui/components/enablefordockwidgetinfoarea.h"
+
+#include
+#include
+#include
+#include
+#include
+
+namespace Ui { class CRadarComponent; }
+namespace BlackGui
+{
+ namespace Components
+ {
+ //! GUI displaying a radar like view with aircrafts nearby
+ class BLACKGUI_EXPORT CRadarComponent :
+ public QFrame,
+ public CEnableForDockWidgetInfoArea
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ explicit CRadarComponent(QWidget *parent = nullptr);
+
+ //! Destructor
+ virtual ~CRadarComponent() override;
+
+ //! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
+ virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override;
+
+ private:
+ void prepareScene();
+ void addCenter();
+ void addGraticules();
+ void addRadials();
+
+ void refreshTargets();
+
+ void toggleGrid(bool checked);
+
+ void fitInView();
+ void changeRangeInSteps(bool zoomIn);
+ void changeRangeFromUserSelection(int index);
+
+ //! Info area tab bar has changed
+ void onInfoAreaTabBarChanged(int index);
+
+ QScopedPointer ui;
+ QGraphicsScene m_scene;
+ QGraphicsItemGroup m_radarTargets;
+ QGraphicsItemGroup m_center;
+ QGraphicsItemGroup m_macroGraticule;
+ QGraphicsItemGroup m_microGraticule;
+ QGraphicsItemGroup m_radials;
+
+ QPen m_radarTargetPen = { Qt::green, 1 };
+
+ qreal m_range = 10.0;
+
+ QTimer m_updateTimer;
+ };
+ } // ns
+} // ns
+#endif // guard
diff --git a/src/blackgui/components/radarcomponent.ui b/src/blackgui/components/radarcomponent.ui
new file mode 100644
index 000000000..d1af2d6a5
--- /dev/null
+++ b/src/blackgui/components/radarcomponent.ui
@@ -0,0 +1,142 @@
+
+
+ CRadarComponent
+
+
+
+ 0
+ 0
+ 305
+ 414
+
+
+
+ Log component
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ 0
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+ -
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
-
+
+
+ Callsign
+
+
+ true
+
+
+
+ -
+
+
+ Heading Bug
+
+
+ true
+
+
+
+ -
+
+
+ Altitude (FL)
+
+
+ true
+
+
+
+ -
+
+
+ Grid
+
+
+ true
+
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ Range
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ -
+
+
+ GroundSpeed
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+ BlackGui::Views::CRadarView
+ QGraphicsView
+ blackgui/views/radarview.h
+
+
+
+
+
diff --git a/src/blackgui/views/radarview.cpp b/src/blackgui/views/radarview.cpp
new file mode 100644
index 000000000..c95eaa6b8
--- /dev/null
+++ b/src/blackgui/views/radarview.cpp
@@ -0,0 +1,48 @@
+/* Copyright (C) 2019
+ * swift Project Community / Contributors
+ *
+ * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+#include "radarview.h"
+
+#include
+#include
+
+namespace BlackGui
+{
+ namespace Views
+ {
+ CRadarView::CRadarView(QWidget *parent)
+ : QGraphicsView(parent)
+ {
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setBackgroundBrush(Qt::black);
+ setRenderHint(QPainter::Antialiasing);
+ }
+
+ void CRadarView::resizeEvent(QResizeEvent *event)
+ {
+ emit radarViewResized();
+ QGraphicsView::resizeEvent(event);
+ }
+
+ void CRadarView::wheelEvent(QWheelEvent *event)
+ {
+ QPoint delta = event->angleDelta();
+ if (delta.y() > 0)
+ {
+ emit zoomEvent(true);
+ }
+ else
+ {
+ emit zoomEvent(false);
+ }
+ event->accept();
+ }
+ }
+}
diff --git a/src/blackgui/views/radarview.h b/src/blackgui/views/radarview.h
new file mode 100644
index 000000000..f892c73f3
--- /dev/null
+++ b/src/blackgui/views/radarview.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 2019
+ * swift project Community / Contributors
+ *
+ * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
+ * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
+ * including this file, may be copied, modified, propagated, or distributed except according to the terms
+ * contained in the LICENSE file.
+ */
+
+//! \file
+
+#ifndef BLACKGUI_RADARVIEW_H
+#define BLACKGUI_RADARVIEW_H
+
+#include "blackgui/blackguiexport.h"
+#include
+
+namespace BlackGui
+{
+ namespace Views
+ {
+ //! Radar view
+ class BLACKGUI_EXPORT CRadarView : public QGraphicsView
+ {
+ Q_OBJECT
+
+ public:
+ //! Constructor
+ CRadarView(QWidget *parent = nullptr);
+
+ signals:
+ //! Signal emitted when the view is resized
+ void radarViewResized();
+
+ //! Signal emitted when the user zoomed in our out
+ void zoomEvent(bool zoomIn);
+
+ public:
+
+ protected:
+ //! \copydoc QWidget::resizeEvent
+ virtual void resizeEvent(QResizeEvent *event) override;
+
+ //! \copydoc QWidget::wheelEvent
+ virtual void wheelEvent(QWheelEvent *event) override;
+ };
+ }
+}
+
+#endif // guard
diff --git a/src/blackmisc/blackmisc.qrc b/src/blackmisc/blackmisc.qrc
index 043f44e76..0c279a9bd 100644
--- a/src/blackmisc/blackmisc.qrc
+++ b/src/blackmisc/blackmisc.qrc
@@ -416,6 +416,7 @@
icons/diagona/icons/folders.png
icons/diagona/icons/blue-folder-search-result.png
icons/diagona/icons/folder-search-result.png
+ icons/diagona/icons/building.png
icons/own/app.jpg
diff --git a/src/blackmisc/iconlist.cpp b/src/blackmisc/iconlist.cpp
index fd3c41420..35603e58e 100644
--- a/src/blackmisc/iconlist.cpp
+++ b/src/blackmisc/iconlist.cpp
@@ -61,6 +61,7 @@ namespace BlackMisc
CIcon(CIcons::ApplicationSimulator, "simulator"),
CIcon(CIcons::ApplicationTextMessages, "text messages"),
CIcon(CIcons::ApplicationWeather, "weather"),
+ CIcon(CIcons::ApplicationRadar, "radar"),
CIcon(CIcons::AviationAtis, "ATIS"),
CIcon(CIcons::AviationAttitudeIndicator, "attitude indicator"),
CIcon(CIcons::AviationMetar, "METAR"),
@@ -190,6 +191,7 @@ namespace BlackMisc
CIcon(CIcons::StandardIconWarning16, "warning"),
CIcon(CIcons::StandardIconWeatherCloudy16, "cloudy"),
CIcon(CIcons::StandardIconWrench16, "wrench"),
+ CIcon(CIcons::StandardIconBuilding16, "building"),
CIcon(CIcons::Swift16, "swift"),
CIcon(CIcons::Swift24, "swift"),
CIcon(CIcons::Swift48, "swift"),
diff --git a/src/blackmisc/icons.cpp b/src/blackmisc/icons.cpp
index bc2227b4e..199759986 100644
--- a/src/blackmisc/icons.cpp
+++ b/src/blackmisc/icons.cpp
@@ -413,6 +413,12 @@ namespace BlackMisc
return pm;
}
+ const QPixmap &CIcons::building16()
+ {
+ static const QPixmap pm(":/diagona/icons/diagona/icons/building.png");
+ return pm;
+ }
+
const QPixmap &CIcons::filter16()
{
return tableSheet16();
@@ -820,7 +826,7 @@ namespace BlackMisc
const QPixmap &CIcons::appAtc16()
{
- return radar16();
+ return building16();
}
const QPixmap &CIcons::appAircraft16()
@@ -893,6 +899,11 @@ namespace BlackMisc
return databaseAdd16();
}
+ const QPixmap &CIcons::appRadar16()
+ {
+ return radar16();
+ }
+
const QPixmap &CIcons::roleC1()
{
static const QPixmap pm(":/vatsim/icons/vatsim/C1.png");
@@ -1126,6 +1137,7 @@ namespace BlackMisc
case ApplicationSimulator: return appSimulator16();
case ApplicationTextMessages: return appTextMessages16();
case ApplicationWeather: return appWeather16();
+ case ApplicationRadar: return appRadar16();
case AviationAtis: return atis();
case AviationAttitudeIndicator: return attitudeIndicator16();
case AviationMetar: return metar();
@@ -1254,6 +1266,7 @@ namespace BlackMisc
case StandardIconWarning16: return warning16();
case StandardIconWeatherCloudy16: return weatherCloudy16();
case StandardIconWrench16: return wrench16();
+ case StandardIconBuilding16: return building16();
case Swift1024: return swift1024();
case Swift128: return swift128();
case Swift16: return swift16();
diff --git a/src/blackmisc/icons.h b/src/blackmisc/icons.h
index 594006da3..a0130351a 100644
--- a/src/blackmisc/icons.h
+++ b/src/blackmisc/icons.h
@@ -56,6 +56,7 @@ namespace BlackMisc
ApplicationSimulator,
ApplicationTextMessages,
ApplicationWeather,
+ ApplicationRadar,
AviationAtis,
AviationAttitudeIndicator,
AviationMetar,
@@ -185,6 +186,7 @@ namespace BlackMisc
StandardIconWarning16,
StandardIconWeatherCloudy16,
StandardIconWrench16,
+ StandardIconBuilding16,
Swift16,
Swift24,
Swift48,
@@ -426,6 +428,9 @@ namespace BlackMisc
//! Cut
static const QPixmap &cut16();
+ //! Building
+ static const QPixmap &building16();
+
// --------------------------------------------------
// -- Database
// --------------------------------------------------
@@ -626,6 +631,9 @@ namespace BlackMisc
//! Stash
static const QPixmap &appDbStash16();
+ //! Radar
+ static const QPixmap &appRadar16();
+
// -------------------------------------------------------------
// Network and aviation
// -------------------------------------------------------------