-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserAirspace.h
More file actions
216 lines (185 loc) · 6.21 KB
/
UserAirspace.h
File metadata and controls
216 lines (185 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// UserAirspace.h
#pragma once
#ifndef USERAIRSPACE_H
#define USERAIRSPACE_H
#include <QtCore\qglobal.h>
#include <QtCore\qvector.h>
#include <QtCore\qfile.h>
#include <QtCore\qtextstream.h>
#include <QtCore\qlist.h>
#include "Airspace.h"
/*
#ifdef USERAIRSPACE_LIB
# define USERAIRSPACE_EXPORT Q_DECL_EXPORT
#else
# define USERAIRSPACE_EXPORT Q_DECL_IMPORT
#endif
*/
/*!
UserAirspace parser library.
******* OPEN AIR (tm) TERRAIN and AIRSPACE DESCRIPTION LANGUAGE *************
* Version 1.0
* December 10, 1998
* Updated October 15, 1999
* Send comments to jerryp@winpilot.com
*
*
* AIRSPACE related record types:
* ==============================
*
* AC class ; class = Airspace Class, see below:
* R restricted
* Q danger
* P prohibited
* A Class A
* B Class B
* C Class C
* D Class D
* GP glider prohibited
* CTR CTR
* W Wave Window
*
*
* AN string ; string = Airspace Name
* AH string ; string = Airspace Ceiling
* AL string ; string = Airspace Floor
* AT coordinate ; coordinate = Coordinate of where to place a name label on the map (optional)
* ; NOTE: there can be multiple AT records for a single airspace segment
*
*
* TERRAIN related record types (WinPilot version 1.130 and newer):
* ==============================
*
* TO {string} ; Declares Terrain Open Polygon; string = name (optional)
* TC {string} ; Declares Terrain Closed Polygon; string = name (optional)
* SP style, width, red, green, blue ; Selects Pen to be used in drawing
* SB red, green, blue ; Selects Brush to be used in drawing
*
*
* Record types common to both TERRAIN and AIRSPACE
* =================================================
*
* V x=n ; Variable assignment.
* ; Currently the following variables are supported:
* ; D={+|-} sets direction for: DA and DB records
* ; '-' means counterclockwise direction; '+' is the default
* ; automatically reset to '+' at the begining of new airspace segment
* ; X=coordinate : sets the center for the following records: DA, DB, and DC
* ; W=number : sets the width of an airway in nm (NYI)
* ; Z=number : sets zoom level at which the element becomes visible (WP version 1.130 and newer)
*
* DP coordinate ; add polygon pointC
* DA radius, angleStart, angleEnd ; add an arc, angles in degrees, radius in nm (set center using V X=...)
* DB coordinate1, coordinate2 ; add an arc, from coordinate1 to coordinate2 (set center using V X=...)
* DC radius ; draw a circle (center taken from the previous V X=... record, radius in nm
* DY coordinate ; add a segment of an airway (NYI)
*/
//using namespace System;
namespace Updraft {
class /*USERAIRSPACE_EXPORT*/ UserAirspace
{
public :
/// UserAirspace class constructor code.
/// This takes the filename in Userirspace free format and parses
/// the data contained into private variables
UserAirspace::UserAirspace(QString fileName);
/// Returns the name of the AirSpace
inline QString UserAirspace::GetName(int i) {return allAirspaces[i].GetName();}
/// Returns the used airspaces count
inline size_t UserAirspace::size() { return allAirspaces.size(); }
/// UserAirspace destructor code here.
//UserAirspace::~UserAirspace();
private :
/// UserAirspace contains several airspaces.
QList<Airspace> allAirspaces;
/// Coordinates structure - e.g. 39:29.9 N -119:46.1 E.
struct Coordinate
{
bool valid; // validity flag
struct ECor{int min; float sec;};
ECor N;
ECor E;
};
/// Airspace class type.
/*! R restricted
* Q danger
* P prohibited
* A Class A
* B Class B
* C Class C
* D Class D
* GP glider prohibited
* CTR CTR
* W Wave Window */
/*enum AC { R, Q, P, A, B, C, D, GP, CTR, W };
/// Airspace Name.
/// Contains the name of the aispace.
/// Required.
QString AN;
/// Airspace Ceiling
/// Altitude ciling of the airspace in ft.
/// AH < AL
int AH;
/// Airspace Floor.
/// Altitude floor of the airspace in ft.
/// Use -10000 for SFC.
int AL;
/// Airspace name label coordinates.
/// List of coordinates, where to place the airspace name label on the map.
/// Optional.
QList<Coordinate> AT;
/// Terrain related variables \{
/// Terrain open polygon name
QString TO;
/// \}
/// Record type - terrain & airspace \{
/// Centre of the polygon/circle.
Coordinate X; //NA
/// Airway width in nm. -1 for not set.
int Wi;
/// Zoom level.
/// Sets the zoom level at which the airspace become visible.
float Z; // NA
/// Add polygon points
QList<Coordinate> DP;
/// Arc \{
/// Arc structures
struct ArcI
{
bool valid; // TODO : validity flag
unsigned int R; // radius in nm
Coordinate Centre; // centre of the arc
bool CW; // clockwise flag
unsigned int Start; // start of the arc in deg
unsigned int End; // end of the arc in deg
float Zoom; // zoom /TODO: float vs int
}
struct ArcII
{
bool valid; // TODO : check if necessary
Coordinate Centre; // centre of the arc
Coordinate Start; // Starting coord
Coordinate End; // Ending coord
bool CW; // direction
float Zoom; // zoom /TODO: float vs int
}
/// Arcs in airspace
QList<ArcI> DA;
QList<ArcII> DB;
/// \}
/// Circles in the airspace. \{
/// Circle structure
struct Circle
{
bool valid; // TODO : check if necessary
unsigned int R; // radius in nm
Coordinate Centre; // Centre of the circle in N E
float Zoom; // zoom /TODO: float vs int
}
/// Cisrcles in airspace
QList<Circle> DC;
/// \}
/// \}*/
};// UserAirspace
}// Updraft
#endif //USERAIRSPACE_H