mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 12:06:57 +08:00
First version of CRadarComponent
This commit is contained in:
committed by
Mat Sutcliffe
parent
e0d04e7b92
commit
4273eb4260
79
src/blackgui/components/radarcomponent.h
Normal file
79
src/blackgui/components/radarcomponent.h
Normal file
@@ -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 <QGraphicsScene>
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
#include <QTimer>
|
||||
|
||||
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::CRadarComponent> 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
|
||||
Reference in New Issue
Block a user