Rise
The Vieneo Province
Loading...
Searching...
No Matches
GpwsDisplay.h
Go to the documentation of this file.
1#pragma once
2#include "TerrainAwareness.h"
3
4// Pilot-guide display categories. Stipple density and the division of the
5// high-altitude Peaks green span are Rise rendering choices (not specified
6// numerically by the guide). The warning colors themselves are conventions.
7namespace GpwsDisplay
8{
9 struct Style { uint32_t color; unsigned density; }; // 0 solid, 1 sparse, 2 dense
10 inline float Reference(float altitude, float vertical)
11 { return altitude+(vertical < -.00508f ? vertical*30 : 0); }
12 inline Style Relative(float height, float altitude, float vertical, bool gear,
13 TerrainAwareness::Severity threat, bool known, float runway, bool ground,
14 bool peaks, float lowest, float highest, bool water = false)
15 {
17 if (!known) return {0xffb030b0,0};
18 if (threat == Severity::Warning) return {0xffff2020,0};
19 if (threat == Severity::Caution) return {0xffffff00,0};
20 if (std::fabs(height-runway) <= .12192f || (ground && height < altitude)) return {0xff000000,0};
21 const float reference = Reference(altitude,vertical), yellow = gear ? -.0762f : -.1524f;
22 if (peaks && water) return {0xff00d8ff,1};
23 if (peaks && lowest <= highest && highest < reference+yellow)
24 {
25 const float fraction = highest > lowest ? (height-lowest)/(highest-lowest) : 1;
26 return {0xff20d040,fraction >= 2.f/3 ? 0u : fraction >= 1.f/3 ? 2u : 1u};
27 }
28 const float relative = height-reference;
29 if (relative > .6096f) return {0xffff3030,2};
30 if (relative > .3048f) return {0xffffff00,2};
31 if (relative >= yellow) return {0xffffff00,1};
32 if (relative >= -.3048f) return {0xff20d040,2};
33 if (relative >= -.6096f) return {0xff20d040,1};
34 return {0xff000000,0};
35 }
36}
float Reference(float altitude, float vertical)
Definition GpwsDisplay.h:10
Style Relative(float height, float altitude, float vertical, bool gear, TerrainAwareness::Severity threat, bool known, float runway, bool ground, bool peaks, float lowest, float highest, bool water=false)
Definition GpwsDisplay.h:12