45 , bForceRedraw( true )
48 , fdBearingRadial( 0.0 )
59 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
60 QPointF __qPointFMouse = _pqMouseEvent->localPos();
62 QPointF __qPointFMouse = _pqMouseEvent->posF();
64 if( __qPointFMouse.x() < QWidget::size().width()/2 )
81 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
82 QPointF __qPointFMouse = _pqMouseEvent->localPos();
84 QPointF __qPointFMouse = _pqMouseEvent->posF();
86 if( __qPointFMouse.x() < QWidget::size().width()/2 )
134 __qPainter.begin(
this );
135 __qPainter.setRenderHints( QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing );
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 );
166 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
167 __qPainter.setWorldTransform( __qTransform );
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 );
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 );
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" );
211 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
212 __qPainter.setWorldTransform( __qTransform );
217 __qPen.setColor( Qt::white );
218 __qPen.setWidth( 10.0 );
219 __qPainter.setPen( __qPen );
220 for(
int __i=0; __i<72; __i++ )
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 );
228 __qFont.setPixelSize( 60.0 );
229 __qFont.setBold(
true );
230 __qPainter.setFont( __qFont );
232 QRectF __qRectFText( QPointF( -60.0, -30.0 ), QSizeF( 120.0, 60.0 ) );
233 for(
int __i=0; __i<36; __i++ )
235 __qPainter.drawLine( QPointF( 0.0, -440.0 ), QPointF( 0.0, -480.0 ) );
238 __qPainter.drawText( __qRectFText.translated( QPointF( 0.0, -400.0 ) ), Qt::AlignCenter, QString::number( __i ) );
240 __qPainter.rotate( 10.0 );
252 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
253 __qPainter.setWorldTransform( __qTransform );
258 __qPen.setColor( Qt::white );
259 __qPen.setWidth( 10.0 );
260 __qPainter.setPen( __qPen );
261 for(
int __i=-5; __i<=5; __i++ )
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 ) );
269 __qPen.setColor( Qt::black );
270 __qPen.setWidth( 0 );
271 __qPainter.setPen( __qPen );
272 __qPainter.setBrush( QColor( 255, 224, 0 ) );
274 static const QPointF __pqPointFPolygon[7] =
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 ),
284 __qPainter.drawConvexPolygon( __pqPointFPolygon, 7 );
286 __qPainter.drawRect( QRectF( QPointF( -10.0, +200.0 ), QPointF( +10.0, +350.0 ) ) );
296 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
299 __qPainter.setWorldTransform( __qTransform );
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 ) );
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++ )
316 static const QPointF __pqPointFPolygon[3] =
318 QPointF( -50.0, -480.0 ),
319 QPointF( 0.0, -430.0 ),
320 QPointF( +50.0, -480.0 ),
322 __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
323 __qPainter.rotate( 90.0 );
325 __qPainter.rotate( 45.0 );
326 for(
int __i=0; __i<4; __i++ )
328 static const QPointF __pqPointFPolygon[3] =
330 QPointF( -30.0, -480.0 ),
331 QPointF( 0.0, -450.0 ),
332 QPointF( +30.0, -480.0 ),
334 __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
335 __qPainter.rotate( 90.0 );
345 double __fdBearingTarget = __bTarget ?
CDataPosition::bearingRL( *_poVesselPoint, *_poPointerPoint ) : __fdBearingVessel;
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 );
361 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
366 __qPainter.setWorldTransform( __qTransformNonScaled );
367 __qPainter.rotate( -__fdBearingVessel );
371 __qPainter.setWorldTransform( __qTransformNonScaled );
372 __qPainter.rotate( __fdBearingTarget - __fdBearingVessel );
376 __qPainter.setWorldTransform( __qTransformScaled );
377 __qPainter.rotate( __fdBearingTarget - __fdBearingVessel );
378 double __fdBearingDeviation = 0.0;
379 if( _poVesselPoint && __bTarget )
382 if( __fdBearingDeviation <= -180.0 ) __fdBearingDeviation += 360;
383 else if( __fdBearingDeviation > 180.0 ) __fdBearingDeviation -= 360;
384 bool _bTargetTo =
true;
385 if( __fdBearingDeviation < -90.0 )
388 __fdBearingDeviation = -180.0 - __fdBearingDeviation;
390 if( __fdBearingDeviation > 90.0 )
393 __fdBearingDeviation = 180.0 - __fdBearingDeviation;
395 __qPen.setColor( Qt::black );
396 __qPen.setWidth( 0 );
397 __qPainter.setPen( __qPen );
398 __qPainter.setBrush( Qt::white );
399 QPointF __pqPointFPolygon[3] =
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 ),
405 __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
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 ) ) );
416 __qPainter.resetTransform();
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 );
427 static const QPointF __pqPointFPolygon[7] =
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 ),
437 __qPainter.drawConvexPolygon( __pqPointFPolygon, 7 );
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 );
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 )
460 double __fdSpeedCosine = __fdSpeed * cos( ( __fdBearingVessel - __fdBearingTarget ) *
QVCT::DEG2RAD );
461 if( __fdSpeedCosine <= 0 )
break;
462 double __fdDuration = __fdDistance / __fdSpeedCosine;
463 if( __fdDuration > 86400 )
break;
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 );
474 __qPainter.setFont( __qFont );
475 __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, +490.0 ) ), Qt::AlignCenter, __qsETE );
479 if( !_poVesselPoint )
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" );
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]
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
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.
double fdBearingRadial
Radial bearing.
virtual void draw()
Draws the instrument (resets if the vessel is undefined)
virtual void mouseReleaseEvent(QMouseEvent *_pqMouseEvent)
CVesselPoint * useVesselPoint()
Returns parent cockpit's associated vessel (0 if the vessel is undefined)
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
[UI] Pointer overlay point (item)
[UI] Container for the application's settings
CUnitDistance::EUnit getUnitDistance()
[Unit] Returns the distance format/unit
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
static constexpr double DEG2RAD