Qt Virtual Chart Table (QVCT)
CInstrumentGAHorizontalSituation.cpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 // C/C++
20 #include <cmath>
21 
22 // QT
23 #include <QBrush>
24 #include <QDateTime>
25 #include <QFont>
26 #include <QPainter>
27 #include <QPointF>
28 #include <QPen>
29 #include <QPixmap>
30 #include <QSizeF>
31 #include <QWidget>
32 
33 // QVCT
34 #include "QVCTRuntime.hpp"
37 
38 
39 //------------------------------------------------------------------------------
40 // CONSTRUCTORS / DESTRUCTOR
41 //------------------------------------------------------------------------------
42 
44  : CInstrument( _poVesselCockpit )
45  , bForceRedraw( true )
46  , fdBearingVessel( CDataCourse::UNDEFINED_BEARING )
47  , oPositionTarget( CDataPosition::UNDEFINED )
48  , fdBearingRadial( 0.0 )
49 {
50 }
51 
52 
53 //------------------------------------------------------------------------------
54 // METHODS: QWidget (implement/override)
55 //------------------------------------------------------------------------------
56 
57 void CInstrumentGAHorizontalSituation::mouseReleaseEvent( QMouseEvent* _pqMouseEvent )
58 {
59 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
60  QPointF __qPointFMouse = _pqMouseEvent->localPos();
61 #else
62  QPointF __qPointFMouse = _pqMouseEvent->posF();
63 #endif
64  if( __qPointFMouse.x() < QWidget::size().width()/2 )
65  { // left-hand side
66  fdBearingRadial -= 1.0;
67  if( fdBearingRadial < 0.0 ) fdBearingRadial += 360.0;
68  }
69  else
70  { // right-hand side
71  fdBearingRadial += 1.0;
72  if( fdBearingRadial >= 360.0 ) fdBearingRadial -= 360.0;
73  }
74  bForceRedraw = true;
75  QWidget::update();
76 }
77 
79 {
80  // NOTE: don't forget that the widget also receives the two corresponding mouseReleaseEvents
81 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
82  QPointF __qPointFMouse = _pqMouseEvent->localPos();
83 #else
84  QPointF __qPointFMouse = _pqMouseEvent->posF();
85 #endif
86  if( __qPointFMouse.x() < QWidget::size().width()/2 )
87  { // left-hand side
88  fdBearingRadial -= 8.0;
89  if( fdBearingRadial < 0.0 ) fdBearingRadial += 360.0;
90  }
91  else
92  { // right-hand side
93  fdBearingRadial += 8.0;
94  if( fdBearingRadial >= 360.0 ) fdBearingRadial -= 360.0;
95  }
96  bForceRedraw = true;
97  QWidget::update();
98 }
99 
100 
101 //------------------------------------------------------------------------------
102 // METHODS: CInstrument (implement/override)
103 //------------------------------------------------------------------------------
104 
106 {
107  // Retrieve parameters and values
108  CVesselPoint* __poVesselPoint = CInstrument::useVesselPoint();
109  double __fdBearingVessel = __poVesselPoint ? __poVesselPoint->GroundCourse.getBearing() : 0.0;
111 
112  // Redraw pixmap only if required
113  if( bForceRedraw
114  || qPixmapBuffer.size() != QWidget::size()
115  || fdBearingVessel != __fdBearingVessel
116  || oPositionTarget != *__poPointerPoint )
117  {
118  // Draw resources
119  if( bForceRedraw
120  || qPixmapBufferBackground.size() != QWidget::size() )
121  {
122  drawStatic();
123  }
124  drawDynamic( __poVesselPoint, __poPointerPoint );
125 
126  // Update cache parameters and values
127  bForceRedraw = false;
128  fdBearingVessel = __fdBearingVessel;
129  oPositionTarget = *__poPointerPoint;
130  }
131 
132  // Draw pixmap
133  QPainter __qPainter;
134  __qPainter.begin( this );
135  __qPainter.setRenderHints( QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing );
136  __qPainter.drawPixmap( 0, 0, qPixmapBuffer );
137  __qPainter.end();
138 }
139 
140 
141 //------------------------------------------------------------------------------
142 // METHODS
143 //------------------------------------------------------------------------------
144 
145 //
146 // OTHER
147 //
148 
150 {
151  // Widget geometry
152  QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
153  double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
154  QTransform __qTransform;
155  __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
156  __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
157 
158  // BACKGROUND
159  {
160  // Painter and resources
161  if( qPixmapBufferBackground.size() != QWidget::size() ) qPixmapBufferBackground = QPixmap( QWidget::size() );
162  qPixmapBufferBackground.fill( Qt::transparent );
163  QPainter __qPainter( &qPixmapBufferBackground );
164  QPen __qPen;
165  QFont __qFont;
166  __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
167  __qPainter.setWorldTransform( __qTransform );
168 
169  // Draw
170 
171  // ... delimiting corona
172  __qPen.setColor( Qt::white );
173  __qPen.setWidth( 10.0 );
174  __qPainter.setPen( __qPen );
175  __qPainter.setBrush( QColor( 32, 32, 32, 255 ) );
176  __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 495.0, 495.0 );
177  __qPen.setColor( Qt::black );
178  __qPainter.setPen( __qPen );
179  __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 360.0, 360.0 );
180 
181  // ... data
182  __qPen.setColor( Qt::lightGray );
183  __qPen.setWidth( 5.0 );
184  __qPainter.setPen( __qPen );
185  __qPainter.setBrush( QColor( 32, 32, 32, 255 ) );
186  __qFont.setPixelSize( 50.0 );
187  __qFont.setBold( false );
188  __qPainter.setFont( __qFont );
189  {
190  QRectF __qRectFFrame( QPointF( -150.0, -60.0 ), QSizeF( 300.0, 120.0 ) );
191  QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
192  __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( -425.0, -515.0 ) ), 10.0, 10.0 );
193  __qPainter.drawText( __qRectFText.translated( QPointF( -440.0, -540.0 ) ), Qt::AlignLeft, "QDM/QDR" );
194  __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, -515.0 ) ), 10.0, 10.0 );
195  __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, -540.0 ) ), Qt::AlignRight, "TH" );
196  __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( -425.0, +515.0 ) ), 10.0, 10.0 );
197  __qPainter.drawText( __qRectFText.translated( QPointF( -440.0, +540.0 ) ), Qt::AlignLeft, "DIST" );
198  __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, +515.0 ) ), 10.0, 10.0 );
199  __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, +540.0 ) ), Qt::AlignRight, "ETE" );
200  }
201  } // BACKGROUND
202 
203  // BEARING
204  {
205  // Painter and resources
206  if( qPixmapBufferBearing.size() != QWidget::size() ) qPixmapBufferBearing = QPixmap( QWidget::size() );
207  qPixmapBufferBearing.fill( Qt::transparent );
208  QPainter __qPainter( &qPixmapBufferBearing );
209  QPen __qPen;
210  QFont __qFont;
211  __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
212  __qPainter.setWorldTransform( __qTransform );
213 
214  // Draw
215 
216  // ... small (5-degrees) ticks
217  __qPen.setColor( Qt::white );
218  __qPen.setWidth( 10.0 );
219  __qPainter.setPen( __qPen );
220  for( int __i=0; __i<72; __i++ )
221  {
222  double __fdAngle = (double)__i * QVCT::PI / 36.0;
223  QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
224  __qPainter.drawLine( 460.0*__qPointFAngle, 480.0*__qPointFAngle );
225  }
226 
227  // ... large (10-degrees) ticks and digits
228  __qFont.setPixelSize( 60.0 );
229  __qFont.setBold( true );
230  __qPainter.setFont( __qFont );
231  {
232  QRectF __qRectFText( QPointF( -60.0, -30.0 ), QSizeF( 120.0, 60.0 ) );
233  for( int __i=0; __i<36; __i++ )
234  {
235  __qPainter.drawLine( QPointF( 0.0, -440.0 ), QPointF( 0.0, -480.0 ) );
236  if( __i % 3 == 0 )
237  {
238  __qPainter.drawText( __qRectFText.translated( QPointF( 0.0, -400.0 ) ), Qt::AlignCenter, QString::number( __i ) );
239  }
240  __qPainter.rotate( 10.0 );
241  }
242  }
243  } // BEARING
244 
245  // TARGET
246  {
247  // Painter and resources
248  if( qPixmapBufferTarget.size() != QWidget::size() ) qPixmapBufferTarget = QPixmap( QWidget::size() );
249  qPixmapBufferTarget.fill( Qt::transparent );
250  QPainter __qPainter( &qPixmapBufferTarget );
251  QPen __qPen;
252  __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
253  __qPainter.setWorldTransform( __qTransform );
254 
255  // Draw
256 
257  // ... 2-degrees ticks
258  __qPen.setColor( Qt::white );
259  __qPen.setWidth( 10.0 );
260  __qPainter.setPen( __qPen );
261  for( int __i=-5; __i<=5; __i++ )
262  {
263  double __fdOffset = (double)__i*50.0;
264  __qPainter.drawEllipse( QPointF( __fdOffset, 0.0 ), 10.0, 10.0 );
265  __qPainter.drawLine( QPointF( __fdOffset, -20.0 ), QPointF( __fdOffset, +20.0 ) );
266  }
267 
268  // ... direction
269  __qPen.setColor( Qt::black );
270  __qPen.setWidth( 0 );
271  __qPainter.setPen( __qPen );
272  __qPainter.setBrush( QColor( 255, 224, 0 ) );
273  {
274  static const QPointF __pqPointFPolygon[7] =
275  {
276  QPointF( -10.0, -200.0 ),
277  QPointF( -10.0, -300.0 ),
278  QPointF( -40.0, -290.0 ),
279  QPointF( 0.0, -350.0 ),
280  QPointF( +40.0, -290.0 ),
281  QPointF( +10.0, -300.0 ),
282  QPointF( +10.0, -200.0 ),
283  };
284  __qPainter.drawConvexPolygon( __pqPointFPolygon, 7 );
285  }
286  __qPainter.drawRect( QRectF( QPointF( -10.0, +200.0 ), QPointF( +10.0, +350.0 ) ) );
287  } // TARGET
288 
289  // FOREGROUND
290  {
291  // Painter and resources
292  if( qPixmapBufferForeground.size() != QWidget::size() ) qPixmapBufferForeground = QPixmap( QWidget::size() );
293  qPixmapBufferForeground.fill( Qt::transparent );
294  QPainter __qPainter( &qPixmapBufferForeground );
295  QPen __qPen;
296  __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
297 
298  // Draw
299  __qPainter.setWorldTransform( __qTransform );
300 
301  // ... center mark
302  __qPen.setColor( QColor( 255, 128, 0 ) );
303  __qPen.setWidth( 15.0 );
304  __qPainter.setPen( __qPen );
305  __qPainter.drawLine( QPointF( 0.0, -50.0 ), QPointF( 0.0, 100.0 ) );
306  __qPainter.drawLine( QPointF( -75.0, 0.0 ), QPointF( +75.0, 0.0 ) );
307  __qPainter.drawLine( QPointF( -25.0, 75.0 ), QPointF( +25.0, 75.0 ) );
308 
309  // ... corona marks
310  __qPen.setColor( Qt::black );
311  __qPen.setWidth( 0 );
312  __qPainter.setPen( __qPen );
313  __qPainter.setBrush(QColor( 255, 128, 0 ) );
314  for( int __i=0; __i<4; __i++ )
315  {
316  static const QPointF __pqPointFPolygon[3] =
317  {
318  QPointF( -50.0, -480.0 ),
319  QPointF( 0.0, -430.0 ),
320  QPointF( +50.0, -480.0 ),
321  };
322  __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
323  __qPainter.rotate( 90.0 );
324  }
325  __qPainter.rotate( 45.0 );
326  for( int __i=0; __i<4; __i++ )
327  {
328  static const QPointF __pqPointFPolygon[3] =
329  {
330  QPointF( -30.0, -480.0 ),
331  QPointF( 0.0, -450.0 ),
332  QPointF( +30.0, -480.0 ),
333  };
334  __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
335  __qPainter.rotate( 90.0 );
336  }
337  } // FOREGROUND
338 
339 }
340 
341 void CInstrumentGAHorizontalSituation::drawDynamic( const CVesselPoint* _poVesselPoint, const CPointerPoint* _poPointerPoint )
342 {
343  double __fdBearingVessel = _poVesselPoint ? _poVesselPoint->GroundCourse.getBearing() : 0.0;
344  bool __bTarget = _poPointerPoint->CDataPosition::operator!=( CDataPosition::UNDEFINED );
345  double __fdBearingTarget = __bTarget ? CDataPosition::bearingRL( *_poVesselPoint, *_poPointerPoint ) : __fdBearingVessel;
346 
347  // Widget geometry
348  QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
349  double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
350  QTransform __qTransformNonScaled;
351  __qTransformNonScaled.translate( __qPointFCenter.x(), __qPointFCenter.y() );
352  QTransform __qTransformScaled;
353  __qTransformScaled.translate( __qPointFCenter.x(), __qPointFCenter.y() );
354  __qTransformScaled.scale( __fdSizeFactor, __fdSizeFactor );
355 
356  // Painter and resources
358  QPainter __qPainter( &qPixmapBuffer );
359  QPen __qPen;
360  QFont __qFont;
361  __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
362 
363  // Draw
364 
365  // ... bearing corona
366  __qPainter.setWorldTransform( __qTransformNonScaled );
367  __qPainter.rotate( -__fdBearingVessel );
368  __qPainter.drawPixmap( QPointF( -(double)qPixmapBufferBearing.width()/2.0, -(double)qPixmapBufferBearing.height()/2.0 ), qPixmapBufferBearing );
369 
370  // ... target indicator
371  __qPainter.setWorldTransform( __qTransformNonScaled );
372  __qPainter.rotate( __fdBearingTarget - __fdBearingVessel );
373  __qPainter.drawPixmap( QPointF( -(double)qPixmapBufferTarget.width()/2.0, -(double)qPixmapBufferTarget.height()/2.0 ), qPixmapBufferTarget );
374 
375  // ... radial deviation
376  __qPainter.setWorldTransform( __qTransformScaled );
377  __qPainter.rotate( __fdBearingTarget - __fdBearingVessel );
378  double __fdBearingDeviation = 0.0;
379  if( _poVesselPoint && __bTarget )
380  {
381  __fdBearingDeviation = __fdBearingTarget - fdBearingRadial;
382  if( __fdBearingDeviation <= -180.0 ) __fdBearingDeviation += 360;
383  else if( __fdBearingDeviation > 180.0 ) __fdBearingDeviation -= 360;
384  bool _bTargetTo = true;
385  if( __fdBearingDeviation < -90.0 )
386  {
387  _bTargetTo = false;
388  __fdBearingDeviation = -180.0 - __fdBearingDeviation;
389  }
390  if( __fdBearingDeviation > 90.0 )
391  {
392  _bTargetTo = false;
393  __fdBearingDeviation = 180.0 - __fdBearingDeviation;
394  }
395  __qPen.setColor( Qt::black );
396  __qPen.setWidth( 0 );
397  __qPainter.setPen( __qPen );
398  __qPainter.setBrush( Qt::white );
399  QPointF __pqPointFPolygon[3] =
400  {
401  QPointF( 50.0, _bTargetTo ? -50.0 : +50.0 ),
402  QPointF( 100.0, _bTargetTo ? -150.0 : +150.0 ),
403  QPointF( 150.0, _bTargetTo ? -50.0 : +50.0 ),
404  };
405  __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
406  }
407  if( __fdBearingDeviation > 13.0 ) __fdBearingDeviation = 13.0;
408  else if( __fdBearingDeviation < -13.0 ) __fdBearingDeviation = -13.0;
409  __qPen.setColor( Qt::black );
410  __qPen.setWidth( 0 );
411  __qPainter.setPen( __qPen );
412  __qPainter.setBrush( QColor( 255, 224, 0 ) );
413  __qPainter.drawRect( QRectF( QPointF( __fdBearingDeviation*25.0-10.0, -200.0 ), QPointF( __fdBearingDeviation*25.0+10.0, +200.0 ) ) );
414 
415  // ... foreground
416  __qPainter.resetTransform();
417  __qPainter.drawPixmap( 0, 0, qPixmapBufferForeground );
418 
419  // ... radial
420  __qPen.setColor( QColor( 255, 128, 0 ) );
421  __qPen.setWidth( 10.0 );
422  __qPainter.setPen( __qPen );
423  __qPainter.setBrush( Qt::transparent );
424  __qPainter.setWorldTransform( __qTransformScaled );
425  __qPainter.rotate( fdBearingRadial - __fdBearingVessel );
426  {
427  static const QPointF __pqPointFPolygon[7] =
428  {
429  QPointF( -75.0, -490.0 ),
430  QPointF( -75.0, -455.0 ),
431  QPointF( -35.0, -455.0 ),
432  QPointF( 0.0, -420.0 ),
433  QPointF( +35.0, -455.0 ),
434  QPointF( +75.0, -455.0 ),
435  QPointF( +75.0, -490.0 ),
436  };
437  __qPainter.drawConvexPolygon( __pqPointFPolygon, 7 );
438  }
439 
440  // ... data
441  __qPen.setColor( Qt::white );
442  __qPainter.setPen( __qPen );
443  __qFont.setPixelSize( 50.0 );
444  __qFont.setBold( false );
445  __qPainter.setFont( __qFont );
446  __qPainter.setWorldTransform( __qTransformScaled );
447  {
448  QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
449  QString __qsTH( "n/a" ), __qsDIST( "n/a" ), __qsETE( "n/a" );
450  if( _poVesselPoint && __bTarget )
451  {
452  CSettings* __poSettings = QVCTRuntime::useSettings();
453  double __fdDistance = CDataPosition::distanceRL( *_poVesselPoint, *_poPointerPoint );
454  __qsTH = CUnitBearing::toString( __fdBearingTarget, CUnitBearing::DEG, 0 );
455  __qsDIST = CUnitDistance::toString( __fdDistance, __poSettings->getUnitDistance(), 0 );
456  do // processing-breaking loop
457  {
458  double __fdSpeed = _poVesselPoint->GroundCourse.getSpeed();
459  if( __fdSpeed == CDataCourse::UNDEFINED_SPEED ) break;
460  double __fdSpeedCosine = __fdSpeed * cos( ( __fdBearingVessel - __fdBearingTarget ) * QVCT::DEG2RAD );
461  if( __fdSpeedCosine <= 0 ) break; // we can't get any ETE/ETA if we're moving away from the target (or not moving at all)
462  double __fdDuration = __fdDistance / __fdSpeedCosine;
463  if( __fdDuration > 86400 ) break; // if the ETE is more than 24 hours, let's assume it's not worth displaying it
464  __qsETE = CUnitTimeDelta::toString( __fdDuration, CUnitTimeDelta::HM, 0 );
465  }
466  while( false ); // processing-breaking loop
467  }
468  __qPainter.drawText( __qRectFText.translated( QPointF( -425.0, -490.0 ) ), Qt::AlignCenter, CUnitBearing::toString( fdBearingRadial, CUnitBearing::DEG, 0) );
469  __qFont.setItalic( !_poVesselPoint || !_poVesselPoint->isValidPosition() );
470  __qPainter.setFont( __qFont );
471  __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, -490.0 ) ), Qt::AlignCenter, __qsTH );
472  __qPainter.drawText( __qRectFText.translated( QPointF( -425.0, +490.0 ) ), Qt::AlignCenter, __qsDIST );
473  __qFont.setItalic( !_poVesselPoint || !_poVesselPoint->isValidPosition() || !_poVesselPoint->GroundCourseValidity.isValidBearing() || !_poVesselPoint->GroundCourseValidity.isValidSpeed() );
474  __qPainter.setFont( __qFont );
475  __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, +490.0 ) ), Qt::AlignCenter, __qsETE );
476  }
477 
478  // ... OFF flag
479  if( !_poVesselPoint )
480  {
481  __qPen.setColor( Qt::black );
482  __qPen.setWidth( 0 );
483  __qPainter.setPen( __qPen );
484  __qPainter.setBrush( QBrush( Qt::red ) );
485  __qFont.setBold( true );
486  __qFont.setItalic( false );
487  __qPainter.setFont( __qFont );
488  QRectF __qRectFText( QPointF( -75.0, -30.0 ), QSizeF( 150.0, 60.0 ) );
489  __qPainter.drawRect( __qRectFText.translated( QPointF( +150.0, -50.0 ) ) );
490  __qPainter.drawText( __qRectFText.translated( QPointF( +150.0, -50.0 ) ), Qt::AlignCenter, "OFF" );
491  }
492 }
CDataCourse GroundCourse
Ground course.
CDataCourseValidity GroundCourseValidity
Ground course validity.
bool isValidSpeed() const
Returns the horizontal speed's (global) validity status.
bool isValidBearing() const
Returns the bearing's (global) validity status.
(Geographical) Course data [bearing, horizontal/vertical speeds]
Definition: CDataCourse.hpp:34
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
Definition: CDataCourse.hpp:44
double getBearing() const
Returns this course's bearing, in degrees.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
bool isValidPosition() const
Returns the position's (global) validity status.
(Geographical) Position data [long,lat,elev]
static double bearingRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line (constant) bearing between two points, in degrees.
static double distanceRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line distance between two points, in meters.
static const CDataPosition UNDEFINED
Specific value for an undefined position.
QPixmap qPixmapBufferBackground
Pixmap buffer used to render and cache the instrument's (static) background.
QPixmap qPixmapBufferForeground
Pixmap buffer used to render and cache the instrument's (static) foreground.
CDataPosition oPositionTarget
Target (position) for which the last rendering was achieved.
CInstrumentGAHorizontalSituation(CVesselCockpit *_poVesselCockpit)
virtual void mouseDoubleClickEvent(QMouseEvent *_pqMouseEvent)
QPixmap qPixmapBufferBearing
Pixmap buffer used to render and cache the instrument's (static) bearing corona.
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache the instrument.
double fdBearingVessel
(Vessel) bearing at which the last rendering was achieved
void drawDynamic(const CVesselPoint *_poVesselPoint, const CPointerPoint *_poPointerPoint)
bool bForceRedraw
Forces the redraw of the instrument (not matter its cache content)
QPixmap qPixmapBufferTarget
Pixmap buffer used to render and cache the instrument's (static) target indicator.
virtual void draw()
Draws the instrument (resets if the vessel is undefined)
virtual void mouseReleaseEvent(QMouseEvent *_pqMouseEvent)
Generic instrument.
Definition: CInstrument.hpp:39
CVesselPoint * useVesselPoint()
Returns parent cockpit's associated vessel (0 if the vessel is undefined)
Definition: CInstrument.cpp:54
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
[UI] Pointer overlay point (item)
[UI] Container for the application's settings
Definition: CSettings.hpp:51
CUnitDistance::EUnit getUnitDistance()
[Unit] Returns the distance format/unit
Definition: CSettings.hpp:351
@ DEG
degrees
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
[UI] Generic vessel's cockpit view (window)
[UI] Vessel overlay point (item) / vessel
static CPointerOverlay * usePointerOverlay()
static CSettings * useSettings()
static constexpr double PI
Definition: QVCT.hpp:45
static constexpr double DEG2RAD
Definition: QVCT.hpp:46