43 , bForceRedraw( true )
59 double __fdElevation = __poVesselPoint ? __poVesselPoint->
getElevation() : 0.0;
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 );
120 __qPen.setColor( Qt::white );
121 __qPen.setWidth( 10.0 );
122 __qPainter.setPen( __qPen );
123 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
124 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 495.0, 495.0 );
127 for(
int __i=0; __i<50; __i++ )
129 double __fdAngle = (double)__i *
QVCT::PI / 25.0;
130 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
131 __qPainter.drawLine( 450.0*__qPointFAngle, 480.0*__qPointFAngle );
135 __qFont.setPixelSize( 120.0 );
136 __qFont.setBold(
true );
137 __qPainter.setFont( __qFont );
139 QRectF __qRectFText( QPointF( -60.0, -60.0 ), QSizeF( 120.0, 120.0 ) );
140 for(
int __i=0; __i<10; __i++ )
142 double __fdAngle = (double)__i *
QVCT::PI / 5.0;
143 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
144 __qPainter.drawLine( 420.0*__qPointFAngle, 480.0*__qPointFAngle );
145 __qPainter.drawText( __qRectFText.translated( 350.0*__qPointFAngle ), Qt::AlignCenter, QString::number( __i ) );
150 __qPen.setColor( Qt::lightGray );
151 __qPen.setWidth( 5.0 );
152 __qPainter.setPen( __qPen );
153 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
154 __qFont.setPixelSize( 50.0 );
155 __qFont.setBold(
false );
156 __qPainter.setFont( __qFont );
158 QRectF __qRectFText( QPointF( -200.0, -30.0 ), QSizeF( 400.0, 60.0 ) );
159 __qPainter.drawText( __qRectFText.translated( QPointF( 0, -150.0 ) ), Qt::AlignCenter,
CUnitElevation::toSymbol( _eUnit ) );
160 __qPainter.drawText( __qRectFText.translated( QPointF( 0, +150.0 ) ), Qt::AlignCenter,
"ALT" );
165 QRectF __qRectFFrame( QPointF( -150.0, -60.0 ), QSizeF( 300.0, 120.0 ) );
166 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
167 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, +515.0 ) ), 10.0, 10.0 );
168 __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, +540.0 ) ), Qt::AlignRight,
"ALT" );
174 double __fdElevation = _poVesselPoint ? _poVesselPoint->
getElevation() : 0.0;
178 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
179 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
180 QTransform __qTransform;
181 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
182 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
189 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
192 __qPainter.setWorldTransform( __qTransform );
195 __qPen.setColor( Qt::black );
196 __qPen.setWidth( 0 );
197 __qPainter.setPen( __qPen );
198 __qPainter.setBrush( QBrush( Qt::white ) );
199 __qPainter.rotate( __fdElevationConverted*0.0036 );
201 static const QPointF __pqPointFPolygon[3] =
203 QPointF( -60.0, -480.0 ),
204 QPointF( 0.0, -420.0 ),
205 QPointF( +60.0, -480.0 ),
207 __qPainter.drawConvexPolygon( __pqPointFPolygon, 3 );
211 __qPainter.setWorldTransform( __qTransform );
212 __qPainter.rotate( fmod( __fdElevationConverted, 10000.0 )*0.036 );
214 static const QPointF __pqPointFPolygon[5] =
216 QPointF( -25.0, -10.0 ),
217 QPointF( -35.0, -150.0 ),
218 QPointF( 0.0, -250.0 ),
219 QPointF( +35.0, -150.0 ),
220 QPointF( +25.0, -10.0 ),
222 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
226 __qPainter.setWorldTransform( __qTransform );
227 __qPainter.rotate( fmod( __fdElevationConverted, 1000.0 )*0.36 );
229 static const QPointF __pqPointFPolygon[5] =
231 QPointF( -15.0, -10.0 ),
232 QPointF( -15.0, -370.0 ),
233 QPointF( 0.0, -400.0 ),
234 QPointF( +15.0, -370.0 ),
235 QPointF( +15.0, -10.0 ),
237 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
241 __qPainter.setWorldTransform( __qTransform );
242 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 40.0, 40.0 );
243 __qPainter.setBrush( QBrush( Qt::black ) );
244 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 30.0, 30.0 );
247 __qPen.setColor( Qt::white );
248 __qPen.setWidth( 0 );
249 __qPainter.setPen( __qPen );
250 __qFont.setPixelSize( 50.0 );
251 __qFont.setBold(
false );
253 __qPainter.setFont( __qFont );
255 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
256 QString __qsALT(
"n/a" );
261 __qPainter.drawText( __qRectFText.translated( QPointF( +425.0, +490.0 ) ), Qt::AlignCenter, __qsALT );
265 __qPainter.setWorldTransform( __qTransform );
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" );
bool isValidElevation() const
Returns the elevation's (global) validity status.
(Geographical) Position data [long,lat,elev]
double getElevation() const
Returns this position's elevation, in meters.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.
bool bForceRedraw
Forces the redraw of the instrument (not matter its cache content)
virtual void draw()
Draws the instrument (resets if the vessel is undefined)
double fdElevation
Elevation at which the last rendering was achieved.
CUnitElevation::EUnit eUnit
Unit for which the last rendering was achieved.
void drawStatic(CUnitElevation::EUnit _eUnit)
QPixmap qPixmapBufferBackground
Pixmap buffer used to render and cache the instrument's (static) background.
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache the instrument.
CInstrumentGAAltimeter(CVesselCockpit *_poVesselCockpit)
void drawDynamic(CUnitElevation::EUnit _eUnit, const CVesselPoint *_poVesselPoint)
CVesselPoint * useVesselPoint()
Returns parent cockpit's associated vessel (0 if the vessel is undefined)
CUnitElevation::EUnit getUnitElevation()
[Unit] Returns the elevation format/unit
Elevation unit (m,ft) rendering/parsing class.
static double toValue(double _fdValue, EUnit _eUnit)
Returns the converted value, using the specified 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 toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
[UI] Generic vessel's cockpit view (window)
[UI] Vessel overlay point (item) / vessel
static CSettings * useSettings()
static constexpr double PI