Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
plan_position_indicator.h
Go to the documentation of this file.
1//
2// Copyright (c) 2023, DefenceX PTY LTD
3//
4// This file is part of the VivoeX project developed by DefenceX.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
13#ifndef HMICORE_WIDGETS_PLAN_POSITION_INDICATOR_H_
14#define HMICORE_WIDGETS_PLAN_POSITION_INDICATOR_H_
15
16#include <math.h>
17
18#include <cstdint>
19#include <map>
20#include <memory>
21#include <string>
22#include <unordered_map>
23
26
27namespace gva {
28
31 public:
33 struct ThreatType {
35 uint16_t bearing = 0;
37 uint16_t size = 0;
38 // The colour of the threat
39 uint32_t rgb_value = 0x00FF0000; // green
41 std::string label = "";
43 bool flashing = false;
45 bool dotted = false;
46 };
47
53 explicit WidgetPlanPositionIndicator(const RendererGva& renderer);
54
60 std::string GetWidgetName() const final { return "WidgetPlanPositionIndicator"; };
61
66 void Draw() final;
67
78 void DrawPPI(widget::ModeEnum mode, int32_t x, int32_t y, int16_t degrees, int16_t sight_azimuth,
79 int16_t weapon_azimuth) const;
80
86 void SetBearing(int16_t bearing) { bearing_ = bearing; }
87
94 void AddThreat(int16_t id, ThreatType threat);
95
101 void DeleteThreat(int16_t id);
102
107 void DeleteAllThreats();
108
114 void SetBearingSight(int16_t bearing_sight) { bearing_sight_ = bearing_sight; }
115
121 void SetWeaponAzimuth(int16_t weapon_azimuth) { weapon_azimuth_ = weapon_azimuth; }
122
128 int16_t GetBearing() const { return bearing_; }
129
135 int16_t GetBearingSight() const { return bearing_sight_; }
136
142 void SetMode(widget::ModeEnum mode) { mode_ = mode; }
143
144 private:
149 void DrawModern(int32_t x, int32_t y, int16_t degrees, int16_t sightAzimuth, int16_t weaponAzimuth, bool sight) const;
150
160 void DrawClassic(widget::ModeEnum mode, int32_t x, int32_t y, int16_t degrees, int16_t sight_azimuth,
161 int16_t weapon_azimuth) const;
162
170 void DrawSight(double_t radius, int16_t render_sight_azimuth, double_t angle) const;
171
176 void DrawThreats() const;
177
178 const double scale_ = 0.5;
179 int16_t radius_ = 100;
180 int16_t bearing_ = 0;
181 int16_t bearing_sight_ = 0;
182 int16_t weapon_azimuth_ = 10;
183 widget::ModeEnum mode_ = widget::ModeEnum::kPpiClassicTankWithSight;
184 std::unordered_map<int16_t, std::shared_ptr<ThreatType>> threats_;
185};
186
187} // namespace gva
188
189#endif // HMICORE_WIDGETS_PLAN_POSITION_INDICATOR_H_
Class definition of the GVA renderer.
Definition renderer_gva.h:29
Class defining the Plan Position Indicator.
Definition plan_position_indicator.h:30
void SetBearingSight(int16_t bearing_sight)
Set the Bearing Sight object.
Definition plan_position_indicator.h:114
bool flashing
Flash if true.
Definition plan_position_indicator.h:43
void Draw() final
The base overloaded Draw fuctions to draw this widget type.
Definition plan_position_indicator.cc:31
void SetBearing(int16_t bearing)
Set the Bearing object.
Definition plan_position_indicator.h:86
uint16_t size
The azimuth of the threat.
Definition plan_position_indicator.h:37
void DeleteThreat(int16_t id)
Delete a threat by ID.
Definition plan_position_indicator.cc:303
int16_t GetBearing() const
Get the Bearing object.
Definition plan_position_indicator.h:128
void SetWeaponAzimuth(int16_t weapon_azimuth)
Set the Weapon Azimuth attribute.
Definition plan_position_indicator.h:121
bool dotted
Dotted if true.
Definition plan_position_indicator.h:45
int16_t GetBearingSight() const
Get the Bearing Sight object.
Definition plan_position_indicator.h:135
void SetMode(widget::ModeEnum mode)
Set the Mode object.
Definition plan_position_indicator.h:142
std::string label
The label of the threat.
Definition plan_position_indicator.h:41
void DeleteAllThreats()
Delete all threats.
Definition plan_position_indicator.cc:305
void AddThreat(int16_t id, ThreatType threat)
Add a threat onto the PPI.
Definition plan_position_indicator.cc:299
uint16_t bearing
The threat bearing.
Definition plan_position_indicator.h:35
std::string GetWidgetName() const final
Get the Widget Name attribute.
Definition plan_position_indicator.h:60
void DrawPPI(widget::ModeEnum mode, int32_t x, int32_t y, int16_t degrees, int16_t sight_azimuth, int16_t weapon_azimuth) const
Draw the Plan Position Indicator.
Definition plan_position_indicator.cc:165
Threat structured data.
Definition plan_position_indicator.h:33
Class defining the base widget.
Definition widget.h:27
ModeEnum
The Plan Position Indicator modes, different visual styles.
Definition widget_types.h:64