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;
127 __qPen.setColor( Qt::white );
128 __qPen.setWidth( 10.0 );
129 __qPainter.setPen( __qPen );
130 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
131 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 495.0, 495.0 );
134 for(
int __i=-__iTicksSmall; __i<=__iTicksSmall; __i++ )
136 double __fdAngle = (double)__i *
QVCT::PI * 17.0 / 18.0 / __iTicksSmall;
137 QPointF __qPointFAngle( -cos( __fdAngle ), sin( __fdAngle ) );
138 __qPainter.drawLine( 450.0*__qPointFAngle, 480.0*__qPointFAngle );
142 __qFont.setPixelSize( 90.0 );
143 __qFont.setBold(
true );
144 __qPainter.setFont( __qFont );
146 QRectF __qRectFText( QPointF( -135.0, -45.0 ), QSizeF( 180.0, 90.0 ) );
147 for(
int __i=-__iTicksLarge; __i<=__iTicksLarge; __i++ )
149 double __fdAngle = (double)__i *
QVCT::PI * 17.0 / 18.0 / __iTicksLarge;
150 QPointF __qPointFAngle( -cos( __fdAngle ), -sin( __fdAngle ) );
151 __qPainter.drawLine( 420.0*__qPointFAngle, 480.0*__qPointFAngle );
152 __qPainter.drawText( __qRectFText.translated( 350.0*__qPointFAngle ), Qt::AlignVCenter|Qt::AlignRight, QString::number( __i*__iDigitsMax/__iTicksLarge ) );
157 __qPen.setColor( Qt::lightGray );
158 __qPen.setWidth( 5.0 );
159 __qPainter.setPen( __qPen );
160 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
161 __qFont.setPixelSize( 50.0 );
162 __qFont.setBold(
false );
163 __qPainter.setFont( __qFont );
165 QRectF __qRectFText( QPointF( -200.0, -30.0 ), QSizeF( 400.0, 60.0 ) );
172 __qPainter.drawText( __qRectFText.translated( QPointF( 0, +150.0 ) ), Qt::AlignCenter,
"VSI" );
177 QRectF __qRectFFrame( QPointF( -150.0, -60.0 ), QSizeF( 300.0, 120.0 ) );
178 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
179 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, +515.0 ) ), 10.0, 10.0 );
190 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
191 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
192 QTransform __qTransform;
193 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
194 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
201 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
204 __qPainter.setWorldTransform( __qTransform );
205 double __fdValueMax = 0;
214 __qPen.setColor( Qt::black );
215 __qPen.setWidth( 0 );
216 __qPainter.setPen( __qPen );
217 __qPainter.setBrush( QBrush( Qt::white ) );
218 __qPainter.rotate( -90.0 );
219 double __fdSpeedVerticalLimited = __fdSpeedVerticalConverted;
220 if( __fdSpeedVerticalLimited > __fdValueMax ) __fdSpeedVerticalLimited = __fdValueMax;
221 else if( __fdSpeedVerticalLimited < -__fdValueMax ) __fdSpeedVerticalLimited = -__fdValueMax;
222 __qPainter.rotate( __fdSpeedVerticalLimited/__fdValueMax * 170.0 );
224 static const QPointF __pqPointFPolygon[5] =
226 QPointF( -15.0, -10.0 ),
227 QPointF( -15.0, -370.0 ),
228 QPointF( 0.0, -400.0 ),
229 QPointF( +15.0, -370.0 ),
230 QPointF( +15.0, -10.0 ),
232 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
236 __qPainter.setWorldTransform( __qTransform );
237 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 40.0, 40.0 );
238 __qPainter.setBrush( QBrush( Qt::black ) );
239 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 30.0, 30.0 );
242 __qPen.setColor( Qt::white );
243 __qPen.setWidth( 0 );
244 __qPainter.setPen( __qPen );
245 __qFont.setPixelSize( 50.0 );
246 __qFont.setBold(
false );
248 __qPainter.setFont( __qFont );
250 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
251 QString __qsVS(
"n/a" );
258 default: __iPrecision = 0;
260 __qsVS = QString::number( __fdSpeedVerticalConverted,
'f', __iPrecision );
262 __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, +490.0 ) ), Qt::AlignCenter, __qsVS );
266 if( !_poVesselPoint )
268 __qPen.setColor( Qt::black );
269 __qPainter.setPen( __qPen );
270 __qPainter.setBrush( QBrush( Qt::red ) );
271 __qFont.setBold(
true );
272 __qFont.setItalic(
false );
273 __qPainter.setFont( __qFont );
274 QRectF __qRectFText( QPointF( -75.0, -30.0 ), QSizeF( 150.0, 60.0 ) );
275 __qPainter.drawRect( __qRectFText.translated( QPointF( +150.0, -50.0 ) ) );
276 __qPainter.drawText( __qRectFText.translated( QPointF( +150.0, -50.0 ) ), Qt::AlignCenter,
"OFF" );
CDataCourse GroundCourse
Ground course.
CDataCourseValidity GroundCourseValidity
Ground course validity.
bool isValidSpeedVertical() const
Returns the vertical speed's (global) validity status.
(Geographical) Course data [bearing, horizontal/vertical speeds]
double getSpeedVertical() const
Returns this course's vertical speed, in meters per second.
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
CUnitSpeedVertical::EUnit eUnit
Unit for which the last rendering was achieved.
bool bForceRedraw
Forces the redraw of the instrument (not matter its cache content)
double fdSpeedVertical
Vertical speed at which the last rendering was achieved.
QPixmap qPixmapBufferBackground
Pixmap buffer used to render and cache the instrument's (static) background.
virtual void draw()
Draws the instrument (resets if the vessel is undefined)
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache the instrument.
CInstrumentGASpeedVertical(CVesselCockpit *_poVesselCockpit)
void drawDynamic(CUnitSpeedVertical::EUnit _eUnit, const CVesselPoint *_poVesselPoint)
void drawStatic(CUnitSpeedVertical::EUnit _eUnit)
CVesselPoint * useVesselPoint()
Returns parent cockpit's associated vessel (0 if the vessel is undefined)
CUnitSpeedVertical::EUnit getUnitSpeedVertical()
[Unit] Returns the vertical speed format/unit
Vertical speed unit (m/s,ft/min) 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.
@ FT_MIN
feet per minut [ft/min]
@ 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