QFlightInstruments

- Main Page
- Classes
- Files

- File List
- File Members

All Classes Files Functions Enumerations Enumerator Macros
qfi_PFD.h
Go to the documentation of this file.
1 /***************************************************************************/
48 #ifndef QFI_PFD_H
49 #define QFI_PFD_H
50
52
53 #include <QGraphicsView>
54 #include <QGraphicsSvgItem>
55
57
59 class qfi_PFD : public QGraphicsView
60 {
61 Q_OBJECT
62
63 public:
64
66 enum PressureUnit
67 {
68 STD = 0,
69 MB,
70 IN
71 };
72
74 explicit qfi_PFD( QWidget *parent = 0 );
75
77 ~qfi_PFD();
78
80 void reinit();
81
83 void update();
84
86 inline void setRoll( float roll )
87 {
88 m_adi->setRoll( roll );
89 }
90
92 inline void setPitch( float pitch )
93 {
94 m_adi->setPitch( pitch );
95 }
96
101 inline void setFlightPathMarker( float aoa, float sideslip, bool visible = true )
102 {
103 m_adi->setFlightPathMarker( aoa, sideslip, visible );
104 }
105
107 inline void setSlipSkid( float slipSkid )
108 {
109 m_adi->setSlipSkid( slipSkid );
110 }
111
115 inline void setTurnRate( float turnRate )
116 {
117 m_adi->setTurnRate( turnRate );
118 }
119
123 inline void setBarH( float barH, bool visible = true )
124 {
125 m_adi->setBarH( barH, visible );
126 }
127
131 inline void setBarV( float barV, bool visible = true )
132 {
133 m_adi->setBarV( barV, visible );
134 }
135
139 inline void setDotH( float dotH, bool visible = true )
140 {
141 m_adi->setDotH( dotH, visible );
142 }
143
147 inline void setDotV( float dotV, bool visible = true )
148 {
149 m_adi->setDotV( dotV, visible );
150 }
151
153 inline void setAltitude( float altitude )
154 {
155 m_alt->setAltitude( altitude );
156 }
157
161 inline void setPressure( float pressure, PressureUnit pressureUnit )
162 {
163 m_alt->setPressure( pressure, pressureUnit );
164 }
165
167 inline void setAirspeed( float airspeed )
168 {
169 m_asi->setAirspeed( airspeed );
170 }
171
173 inline void setMachNo( float machNo )
174 {
175 m_asi->setMachNo( machNo );
176 }
177
179 inline void setHeading( float heading )
180 {
181 m_hsi->setHeading( heading );
182 }
183
185 inline void setClimbRate( float climbRate )
186 {
187 m_vsi->setClimbRate( climbRate );
188 }
189
190 protected:
191
192 void resizeEvent( QResizeEvent *event );
193
194 private:
195
196 class ADI
197 {
198 public:
199
200 ADI( QGraphicsScene *scene );
201 void init( float scaleX, float scaleY );
202 void update( float scaleX, float scaleY );
203 void setRoll( float roll );
204 void setPitch( float pitch );
205 void setFlightPathMarker( float aoa, float sideslip, bool visible = true );
206 void setSlipSkid( float slipSkid );
207 void setTurnRate( float turnRate );
208 void setBarH( float barH, bool visible = true );
209 void setBarV( float barV, bool visible = true );
210 void setDotH( float dotH, bool visible = true );
211 void setDotV( float dotV, bool visible = true );
212
213 private:
214
215 QGraphicsScene *m_scene;
216
217 QGraphicsSvgItem *m_itemBack;
218 QGraphicsSvgItem *m_itemLadd;
219 QGraphicsSvgItem *m_itemRoll;
220 QGraphicsSvgItem *m_itemSlip;
221 QGraphicsSvgItem *m_itemTurn;
222 QGraphicsSvgItem *m_itemPath;
223 QGraphicsSvgItem *m_itemMark;
224 QGraphicsSvgItem *m_itemBarH;
225 QGraphicsSvgItem *m_itemBarV;
226 QGraphicsSvgItem *m_itemDotH;
227 QGraphicsSvgItem *m_itemDotV;
228 QGraphicsSvgItem *m_itemMask;
229 QGraphicsSvgItem *m_itemScaleH;
230 QGraphicsSvgItem *m_itemScaleV;
231
232 float m_roll;
233 float m_pitch;
234 float m_angleOfAttack;
235 float m_sideslipAngle;
236 float m_slipSkid;
237 float m_turnRate;
238 float m_barH;
239 float m_barV;
240 float m_dotH;
241 float m_dotV;
242
243 bool m_pathValid;
244
245 bool m_pathVisible;
246 bool m_barHVisible;
247 bool m_barVVisible;
248 bool m_dotHVisible;
249 bool m_dotVVisible;
250
251 float m_laddDeltaX_new;
252 float m_laddDeltaX_old;
253 float m_laddBackDeltaX_new;
254 float m_laddBackDeltaX_old;
255 float m_laddBackDeltaY_new;
256 float m_laddBackDeltaY_old;
257 float m_laddDeltaY_new;
258 float m_laddDeltaY_old;
259 float m_slipDeltaX_new;
260 float m_slipDeltaX_old;
261 float m_slipDeltaY_new;
262 float m_slipDeltaY_old;
263 float m_turnDeltaX_new;
264 float m_turnDeltaX_old;
265 float m_pathDeltaX_new;
266 float m_pathDeltaX_old;
267 float m_pathDeltaY_new;
268 float m_pathDeltaY_old;
269 float m_markDeltaX_new;
270 float m_markDeltaX_old;
271 float m_markDeltaY_new;
272 float m_markDeltaY_old;
273 float m_barHDeltaX_new;
274 float m_barHDeltaX_old;
275 float m_barVDeltaY_new;
276 float m_barVDeltaY_old;
277 float m_dotHDeltaX_new;
278 float m_dotHDeltaX_old;
279 float m_dotVDeltaY_new;
280 float m_dotVDeltaY_old;
281
282 float m_scaleX;
283 float m_scaleY;
284
285 const float m_originalPixPerDeg;
286 const float m_deltaLaddBack_max;
287 const float m_deltaLaddBack_min;
288 const float m_maxSlipDeflection;
289 const float m_maxTurnDeflection;
290 const float m_maxBarsDeflection;
291 const float m_maxDotsDeflection;
292
293 QPointF m_originalAdiCtr;
294 QPointF m_originalBackPos;
295 QPointF m_originalLaddPos;
296 QPointF m_originalRollPos;
297 QPointF m_originalSlipPos;
298 QPointF m_originalTurnPos;
299 QPointF m_originalPathPos;
300 QPointF m_originalBarHPos;
301 QPointF m_originalBarVPos;
302 QPointF m_originalDotHPos;
303 QPointF m_originalDotVPos;
304 QPointF m_originalScaleHPos;
305 QPointF m_originalScaleVPos;
306
307 const int m_backZ;
308 const int m_laddZ;
309 const int m_rollZ;
310 const int m_slipZ;
311 const int m_pathZ;
312 const int m_barsZ;
313 const int m_dotsZ;
314 const int m_scalesZ;
315 const int m_maskZ;
316 const int m_turnZ;
317
318 void reset();
319 void updateLadd( float delta, float sinRoll, float cosRoll );
320 void updateLaddBack( float delta, float sinRoll, float cosRoll );
321 void updateRoll();
322 void updateSlipSkid( float sinRoll, float cosRoll );
323 void updateTurnRate();
324 void updateFlightPath();
325 void updateBars();
326 void updateDots();
327 };
328
329 class ALT
330 {
331 public:
332
333 ALT( QGraphicsScene *scene );
334 void init( float scaleX, float scaleY );
335 void update( float scaleX, float scaleY );
336 void setAltitude( float altitude );
337 void setPressure( float pressure, int pressureUnit );
338
339 private:
340
341 QGraphicsScene *m_scene;
342
343 QGraphicsSvgItem *m_itemBack;
344 QGraphicsSvgItem *m_itemScale1;
345 QGraphicsSvgItem *m_itemScale2;
346 QGraphicsTextItem *m_itemLabel1;
347 QGraphicsTextItem *m_itemLabel2;
348 QGraphicsTextItem *m_itemLabel3;
349 QGraphicsSvgItem *m_itemGround;
350 QGraphicsSvgItem *m_itemFrame;
351 QGraphicsTextItem *m_itemAltitude;
352 QGraphicsTextItem *m_itemPressure;
353
354 QColor m_frameTextColor;
355 QColor m_pressTextColor;
356 QColor m_labelsColor;
357
358 QFont m_frameTextFont;
359 QFont m_labelsFont;
360
361 float m_altitude;
362 float m_pressure;
363
364 int m_pressureUnit;
365
366 float m_scale1DeltaY_new;
367 float m_scale1DeltaY_old;
368 float m_scale2DeltaY_new;
369 float m_scale2DeltaY_old;
370 float m_groundDeltaY_new;
371 float m_groundDeltaY_old;
372 float m_labelsDeltaY_new;
373 float m_labelsDeltaY_old;
374
375 float m_scaleX;
376 float m_scaleY;
377
378 const float m_originalPixPerAlt;
379 const float m_originalScaleHeight;
380 const float m_originalLabelsX;
381 const float m_originalLabel1Y;
382 const float m_originalLabel2Y;
383 const float m_originalLabel3Y;
384
385 QPointF m_originalBackPos;
386 QPointF m_originalScale1Pos;
387 QPointF m_originalScale2Pos;
388 QPointF m_originalGroundPos;
389 QPointF m_originalFramePos;
390 QPointF m_originalAltitudeCtr;
391 QPointF m_originalPressureCtr;
392
393 const int m_backZ;
394 const int m_scaleZ;
395 const int m_labelsZ;
396 const int m_groundZ;
397 const int m_frameZ;
398 const int m_frameTextZ;
399
400 void reset();
401 void updateAltitude();
402 void updatePressure();
403 void updateScale();
404 void updateScaleLabels();
405 };
406
407 class ASI
408 {
409 public:
410
411 ASI( QGraphicsScene *scene );
412 void init( float scaleX, float scaleY );
413 void update( float scaleX, float scaleY );
414 void setAirspeed( float airspeed );
415 void setMachNo( float machNo );
416
417 private:
418
419 QGraphicsScene *m_scene;
420
421 QGraphicsSvgItem *m_itemBack;
422 QGraphicsSvgItem *m_itemScale1;
423 QGraphicsSvgItem *m_itemScale2;
424 QGraphicsTextItem *m_itemLabel1;
425 QGraphicsTextItem *m_itemLabel2;
426 QGraphicsTextItem *m_itemLabel3;
427 QGraphicsTextItem *m_itemLabel4;
428 QGraphicsTextItem *m_itemLabel5;
429 QGraphicsTextItem *m_itemLabel6;
430 QGraphicsTextItem *m_itemLabel7;
431 QGraphicsSvgItem *m_itemFrame;
432 QGraphicsTextItem *m_itemAirspeed;
433 QGraphicsTextItem *m_itemMachNo;
434
435 QColor m_frameTextColor;
436 QColor m_labelsColor;
437
438 QFont m_frameTextFont;
439 QFont m_labelsFont;
440
441 float m_airspeed;
442 float m_machNo;
443
444 float m_scale1DeltaY_new;
445 float m_scale1DeltaY_old;
446 float m_scale2DeltaY_new;
447 float m_scale2DeltaY_old;
448 float m_labelsDeltaY_new;
449 float m_labelsDeltaY_old;
450
451 float m_scaleX;
452 float m_scaleY;
453
454 const float m_originalPixPerSpd;
455 const float m_originalScaleHeight;
456 const float m_originalLabelsX;
457 const float m_originalLabel1Y;
458 const float m_originalLabel2Y;
459 const float m_originalLabel3Y;
460 const float m_originalLabel4Y;
461 const float m_originalLabel5Y;
462 const float m_originalLabel6Y;
463 const float m_originalLabel7Y;
464
465 QPointF m_originalBackPos;
466 QPointF m_originalScale1Pos;
467 QPointF m_originalScale2Pos;
468 QPointF m_originalFramePos;
469 QPointF m_originalAirspeedCtr;
470 QPointF m_originalMachNoCtr;
471
472 const int m_backZ;
473 const int m_scaleZ;
474 const int m_labelsZ;
475 const int m_frameZ;
476 const int m_frameTextZ;
477
478 void reset();
479 void updateAirspeed();
480 void updateScale();
481 void updateScaleLabels();
482 };
483
484 class HSI
485 {
486 public:
487
488 HSI( QGraphicsScene *scene );
489 void init( float scaleX, float scaleY );
490 void update( float scaleX, float scaleY );
491 void setHeading( float heading );
492
493 private:
494
495 QGraphicsScene *m_scene;
496
497 QGraphicsSvgItem *m_itemBack;
498 QGraphicsSvgItem *m_itemFace;
499 QGraphicsSvgItem *m_itemMarks;
500 QGraphicsTextItem *m_itemFrameText;
501
502 QColor m_frameTextColor;
503
504 QFont m_frameTextFont;
505
506 float m_heading;
507
508 float m_scaleX;
509 float m_scaleY;
510
511 QPointF m_originalHsiCtr;
512 QPointF m_originalBackPos;
513 QPointF m_originalFacePos;
514 QPointF m_originalMarksPos;
515 QPointF m_originalFrameTextCtr;
516
517 const int m_backZ;
518 const int m_faceZ;
519 const int m_marksZ;
520 const int m_frameTextZ;
521
522 void reset();
523 void updateHeading();
524 };
525
526 class VSI
527 {
528 public:
529
530 VSI( QGraphicsScene *scene );
531 void init( float scaleX, float scaleY );
532 void update( float scaleX, float scaleY );
533 void setClimbRate( float climbRate );
534
535 private:
536
537 QGraphicsScene *m_scene;
538
539 QGraphicsSvgItem *m_itemScale;
540 QGraphicsSvgItem *m_itemArrow;
541
542 float m_climbRate;
543
544 float m_arrowDeltaY_new;
545 float m_arrowDeltaY_old;
546
547 float m_scaleX;
548 float m_scaleY;
549
550 const float m_originalMarkeHeight;
551 const float m_originalPixPerSpd1;
552 const float m_originalPixPerSpd2;
553 const float m_originalPixPerSpd4;
554
555 QPointF m_originalScalePos;
556 QPointF m_originalArrowPos;
557
558 const int m_scaleZ;
559 const int m_arrowZ;
560
561 void reset();
562 void updateVSI();
563 };
564
565 QGraphicsScene *m_scene;
566
567 ADI *m_adi;
568 ALT *m_alt;
569 ASI *m_asi;
570 HSI *m_hsi;
571 VSI *m_vsi;
572
573 QGraphicsSvgItem *m_itemBack;
574 QGraphicsSvgItem *m_itemMask;
575
576 float m_scaleX;
577 float m_scaleY;
578
579 const int m_originalHeight;
580 const int m_originalWidth;
581
582 const int m_backZ;
583 const int m_maskZ;
584
585 void init();
586 void reset();
587 void updateView();
588 };
589
591
592 #endif // QFI_PFD_H
qfi_PFD::setFlightPathMarker
void setFlightPathMarker(float aoa, float sideslip, bool visible=true)
Definition: qfi_PFD.h:101
qfi_PFD::resizeEvent
void resizeEvent(QResizeEvent *event)
Definition: qfi_PFD.cpp:151
qfi_PFD::~qfi_PFD
~qfi_PFD()
Definition: qfi_PFD.cpp:112
qfi_PFD::setAltitude
void setAltitude(float altitude)
Definition: qfi_PFD.h:153
qfi_PFD::setPitch
void setPitch(float pitch)
Definition: qfi_PFD.h:92
qfi_PFD::reinit
void reinit()
Definition: qfi_PFD.cpp:132
qfi_PFD
Definition: qfi_PFD.h:59
qfi_PFD::setBarH
void setBarH(float barH, bool visible=true)
Definition: qfi_PFD.h:123
qfi_PFD::setRoll
void setRoll(float roll)
Definition: qfi_PFD.h:86
qfi_PFD::MB
milibars
Definition: qfi_PFD.h:69
qfi_PFD::setDotH
void setDotH(float dotH, bool visible=true)
Definition: qfi_PFD.h:139
qfi_PFD::setTurnRate
void setTurnRate(float turnRate)
Definition: qfi_PFD.h:115
qfi_PFD::setPressure
void setPressure(float pressure, PressureUnit pressureUnit)
Definition: qfi_PFD.h:161
qfi_PFD::setAirspeed
void setAirspeed(float airspeed)
Definition: qfi_PFD.h:167
qfi_PFD::setClimbRate
void setClimbRate(float climbRate)
Definition: qfi_PFD.h:185
qfi_PFD::setHeading
void setHeading(float heading)
Definition: qfi_PFD.h:179
qfi_PFD::setMachNo
void setMachNo(float machNo)
Definition: qfi_PFD.h:173
qfi_PFD::update
void update()
Definition: qfi_PFD.cpp:144
qfi_PFD::setBarV
void setBarV(float barV, bool visible=true)
Definition: qfi_PFD.h:131
qfi_PFD::STD
standard (displays STD instead of numerical value)
Definition: qfi_PFD.h:68
qfi_PFD::PressureUnit
PressureUnit
Definition: qfi_PFD.h:66
qfi_PFD::setDotV
void setDotV(float dotV, bool visible=true)
Definition: qfi_PFD.h:147
qfi_PFD::IN
inches of mercury
Definition: qfi_PFD.h:70
qfi_PFD::qfi_PFD
qfi_PFD(QWidget *parent=0)
Definition: qfi_PFD.cpp:71
qfi_PFD::setSlipSkid
void setSlipSkid(float slipSkid)
Definition: qfi_PFD.h:107