43 , bForceRedraw( true )
84 __qPainter.begin(
this );
85 __qPainter.setRenderHints( QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing );
102 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
103 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
104 QTransform __qTransform;
105 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
106 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
114 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
117 __qPainter.setWorldTransform( __qTransform );
118 int __iTicksLarge = 0, __iTicksSmall = 0, __iDigitsMax = 0;
121 case CUnitSpeed::M_S: __iTicksLarge = 7; __iTicksSmall = 35; __iDigitsMax = 150;
break;
122 case CUnitSpeed::KM_H: __iTicksLarge = 6; __iTicksSmall = 30; __iDigitsMax = 600;
break;
123 case CUnitSpeed::MI_H: __iTicksLarge = 7; __iTicksSmall = 35; __iDigitsMax = 350;
break;
124 case CUnitSpeed::KT: __iTicksLarge = 6; __iTicksSmall = 30; __iDigitsMax = 300;
break;
129 __qPen.setColor( Qt::white );
130 __qPen.setWidth( 10.0 );
131 __qPainter.setPen( __qPen );
132 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
133 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 495.0, 495.0 );
136 for(
int __i=0; __i<=__iTicksSmall; __i++ )
138 double __fdAngle = (double)__i *
QVCT::PI * 34.0 / 18.0 / __iTicksSmall;
139 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
140 __qPainter.drawLine( 450.0*__qPointFAngle, 480.0*__qPointFAngle );
144 __qFont.setPixelSize( 90.0 );
145 __qFont.setBold(
true );
146 __qPainter.setFont( __qFont );
148 QRectF __qRectFText( QPointF( -135.0, -45.0 ), QSizeF( 270.0, 90.0 ) );
149 for(
int __i=0; __i<=__iTicksLarge; __i++ )
151 double __fdAngle = (double)__i *
QVCT::PI * 34.0 / 18.0 / __iTicksLarge;
152 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
153 __qPainter.drawLine( 420.0*__qPointFAngle, 480.0*__qPointFAngle );
155 QPointF __qPointFAngleText( __qPointFAngle.x(), __qPointFAngle.y()*1.15 );
156 __qPainter.drawText( __qRectFText.translated( 300.0*__qPointFAngleText ), Qt::AlignCenter, QString::number( __i*__iDigitsMax/__iTicksLarge ) );
161 __qPen.setColor( Qt::lightGray );
162 __qPen.setWidth( 5.0 );
163 __qPainter.setPen( __qPen );
164 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
165 __qFont.setPixelSize( 50.0 );
166 __qFont.setBold(
false );
167 __qPainter.setFont( __qFont );
169 QRectF __qRectFText( QPointF( -200.0, -30.0 ), QSizeF( 400.0, 60.0 ) );
170 __qPainter.drawText( __qRectFText.translated( QPointF( 0, -150.0 ) ), Qt::AlignCenter,
CUnitSpeed::toSymbol( _eUnit ) );
171 __qPainter.drawText( __qRectFText.translated( QPointF( 0, +150.0 ) ), Qt::AlignCenter,
"GS" );
176 QRectF __qRectFFrame( QPointF( -150.0, -60.0 ), QSizeF( 300.0, 120.0 ) );
177 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
178 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, +515.0 ) ), 10.0, 10.0 );
179 __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, +540.0 ) ), Qt::AlignRight,
CUnitSpeed::toSymbol( _eUnit ) );
189 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
190 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
191 QTransform __qTransform;
192 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
193 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
200 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
203 __qPainter.setWorldTransform( __qTransform );
204 double __fdValueMax = 0;
215 __qPen.setColor( Qt::black );
216 __qPen.setWidth( 0 );
217 __qPainter.setPen( __qPen );
218 __qPainter.setBrush( QBrush( Qt::white ) );
219 double __fdSpeedLimited = __fdSpeedConverted;
220 if( __fdSpeedLimited > __fdValueMax ) __fdSpeedLimited = __fdValueMax;
221 __qPainter.rotate( __fdSpeedLimited/__fdValueMax * 340.0 );
223 static const QPointF __pqPointFPolygon[5] =
225 QPointF( -15.0, -10.0 ),
226 QPointF( -15.0, -370.0 ),
227 QPointF( 0.0, -400.0 ),
228 QPointF( +15.0, -370.0 ),
229 QPointF( +15.0, -10.0 ),
231 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
235 __qPainter.setWorldTransform( __qTransform );
236 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 40.0, 40.0 );
237 __qPainter.setBrush( QBrush( Qt::black ) );
238 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 30.0, 30.0 );
241 __qPen.setColor( Qt::white );
242 __qPen.setWidth( 0 );
243 __qPainter.setPen( __qPen );
244 __qFont.setPixelSize( 50.0 );
245 __qFont.setBold(
false );
247 __qPainter.setFont( __qFont );
249 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
250 QString __qsGS(
"n/a" );
257 default: __iPrecision = 0;
259 __qsGS = QString::number( __fdSpeedConverted,
'f', __iPrecision );
261 __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, +490.0 ) ), Qt::AlignCenter, __qsGS );
265 if( !_poVesselPoint )
267 __qPen.setColor( Qt::black );
268 __qPainter.setPen( __qPen );
269 __qPainter.setBrush( QBrush( Qt::red ) );
270 __qFont.setBold(
true );
271 __qFont.setItalic(
false );
272 __qPainter.setFont( __qFont );
273 QRectF __qRectFText( QPointF( -75.0, -30.0 ), QSizeF( 150.0, 60.0 ) );
274 __qPainter.drawRect( __qRectFText.translated( QPointF( +150.0, -50.0 ) ) );
275 __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.
(Geographical) Course data [bearing, horizontal/vertical speeds]
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
QPixmap qPixmapBufferBackground
Pixmap buffer used to render and cache the instrument's (static) background.
double fdSpeed
Speed at which the last rendering was achieved.
virtual void draw()
Draws the instrument (resets if the vessel is undefined)
void drawStatic(CUnitSpeed::EUnit _eUnit)
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache the instrument.
CUnitSpeed::EUnit eUnit
Unit for which the last rendering was achieved.
bool bForceRedraw
Forces the redraw of the instrument (not matter its cache content)
void drawDynamic(CUnitSpeed::EUnit _eUnit, const CVesselPoint *_poVesselPoint)
CInstrumentGASpeed(CVesselCockpit *_poVesselCockpit)
CVesselPoint * useVesselPoint()
Returns parent cockpit's associated vessel (0 if the vessel is undefined)
CUnitSpeed::EUnit getUnitSpeed()
[Unit] Returns the speed format/unit
Speed unit (m/s,km/h,mi/h,kt) rendering/parsing class.
static double toValue(double _fdValue, EUnit _eUnit)
Returns the converted value, using the specified format/unit.
static QString toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
@ KM_H
kilometers per hour [km/h]
@ MI_H
statute miles per hour [mi/h]
@ KT
nautical miles per hour (knots) [kt]
@ M_S
meters per second [m/s]
[UI] Generic vessel's cockpit view (window)
[UI] Vessel overlay point (item) / vessel
static CSettings * useSettings()
static constexpr double PI