43 , bForceRedraw( true )
46 , fdSW1TimeStarted( 0.0 )
47 , fdSW1TimeAccumulated( 0.0 )
48 , fdSW2TimeStarted( 0.0 )
49 , fdSW2TimeAccumulated( 0.0 )
60 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
61 QPointF __qPointFMouse = _pqMouseEvent->localPos();
63 QPointF __qPointFMouse = _pqMouseEvent->posF();
65 if( __qPointFMouse.x() < QWidget::size().width()/2 )
92 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
93 QPointF __qPointFMouse = _pqMouseEvent->localPos();
95 QPointF __qPointFMouse = _pqMouseEvent->posF();
97 if( __qPointFMouse.x() < QWidget::size().width()/2 )
118 double __fdTime = floor(
microtime() + 0.5 );
129 ||
eUnit != __eUnit )
143 __qPainter.begin(
this );
144 __qPainter.setRenderHints( QPainter::SmoothPixmapTransform | QPainter::Antialiasing | QPainter::TextAntialiasing );
161 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
162 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
163 QTransform __qTransform;
164 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
165 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
173 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
176 __qPainter.setWorldTransform( __qTransform );
179 __qPen.setColor( Qt::white );
180 __qPen.setWidth( 10.0 );
181 __qPainter.setPen( __qPen );
182 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
183 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 495.0, 495.0 );
186 for(
int __i=0; __i<60; __i++ )
188 double __fdAngle = (double)__i *
QVCT::PI / 30.0;
189 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
190 __qPainter.drawLine( 450.0*__qPointFAngle, 480.0*__qPointFAngle );
195 for(
int __i=1; __i<=12; __i++ )
197 double __fdAngle = (double)__i *
QVCT::PI / 6.0;
198 QPointF __qPointFAngle( sin( __fdAngle ), -cos( __fdAngle ) );
199 __qPainter.drawLine( 420.0*__qPointFAngle, 480.0*__qPointFAngle );
204 __qFont.setPixelSize( 90.0 );
205 __qFont.setBold(
true );
206 __qPainter.setFont( __qFont );
208 QRectF __qRectFText( QPointF( -90.0, -45.0 ), QSizeF( 180.0, 90.0 ) );
209 for(
int __i=1; __i<=12; __i++ )
211 double __fdAngle = (double)__i *
QVCT::PI / 6.0;
212 QPointF __qPointFAngle( sin( __fdAngle )*( __i<10 ? 1.05 : 1.0 ), -cos( __fdAngle )*1.05 );
213 __qPainter.drawText( __qRectFText.translated( 340.0*__qPointFAngle ), Qt::AlignCenter, QString::number( __i ) );
218 __qFont.setPixelSize( 50.0 );
219 __qFont.setBold(
false );
220 __qPainter.setFont( __qFont );
222 QRectF __qRectFText( QPointF( -50.0, -25.0 ), QSizeF( 100.0, 50.0 ) );
223 for(
int __i=1; __i<=12; __i++ )
225 double __fdAngle = (double)__i *
QVCT::PI / 6.0;
226 QPointF __qPointFAngle( sin( __fdAngle )*( __i<2 ? 1.05 : 1.0 ), -cos( __fdAngle )*1.05 );
227 __qPainter.drawText( __qRectFText.translated( 240.0*__qPointFAngle ), Qt::AlignCenter, QString::number( __i*5 ) );
232 __qPen.setColor( Qt::lightGray );
233 __qPen.setWidth( 5.0 );
234 __qPainter.setPen( __qPen );
235 __qPainter.setBrush( QBrush( QColor( 32, 32, 32, 255 ) ) );
236 __qFont.setPixelSize( 50.0 );
237 __qFont.setBold(
false );
238 __qPainter.setFont( __qFont );
240 QRectF __qRectFText( QPointF( -200.0, -30.0 ), QSizeF( 400.0, 60.0 ) );
241 __qPainter.drawText( __qRectFText.translated( QPointF( 0, -150.0 ) ), Qt::AlignCenter,
CUnitTimeZone::toSymbol( _eUnit ) );
242 __qPainter.drawText( __qRectFText.translated( QPointF( 0, +150.0 ) ), Qt::AlignCenter,
"TIME" );
247 QRectF __qRectFFrame( QPointF( -150.0, -60.0 ), QSizeF( 300.0, 120.0 ) );
248 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
249 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( -425.0, -515.0 ) ), 10.0, 10.0 );
250 __qPainter.drawText( __qRectFText.translated( QPointF( -440.0, -540.0 ) ), Qt::AlignLeft,
"SW1" );
251 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, -515.0 ) ), 10.0, 10.0 );
252 __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, -540.0 ) ), Qt::AlignRight,
"SW2" );
253 __qPainter.drawRoundedRect( __qRectFFrame.translated( QPointF( +425.0, +515.0 ) ), 10.0, 10.0 );
254 __qPainter.drawText( __qRectFText.translated( QPointF( +440.0, +540.0 ) ), Qt::AlignRight,
CUnitTimeZone::toSymbol( _eUnit ) );
263 QPointF __qPointFCenter = QPointF( QRectF( QWidget::rect() ).center() );
264 double __fdSizeFactor = ( QWidget::width() < QWidget::height() ? (double)QWidget::width() : (double)QWidget::height() ) / 1200.0;
265 QTransform __qTransform;
266 __qTransform.translate( __qPointFCenter.x(), __qPointFCenter.y() );
267 __qTransform.scale( __fdSizeFactor, __fdSizeFactor );
274 __qPainter.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing );
277 __qPainter.setWorldTransform( __qTransform );
280 __qPen.setColor( Qt::black );
281 __qPen.setWidth( 0 );
282 __qPainter.setPen( __qPen );
283 __qPainter.setBrush( QBrush( Qt::white ) );
284 __qPainter.rotate( __fdTimeConverted/120.0 );
286 static const QPointF __pqPointFPolygon[5] =
288 QPointF( -25.0, -10.0 ),
289 QPointF( -25.0, -250.0 ),
290 QPointF( 0.0, -300.0 ),
291 QPointF( +25.0, -250.0 ),
292 QPointF( +25.0, -10.0 ),
294 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
298 __qPainter.setWorldTransform( __qTransform );
299 __qPainter.rotate( __fdTimeConverted/10.0 );
301 static const QPointF __pqPointFPolygon[5] =
303 QPointF( -15.0, -10.0 ),
304 QPointF( -15.0, -370.0 ),
305 QPointF( 0.0, -400.0 ),
306 QPointF( +15.0, -370.0 ),
307 QPointF( +15.0, -10.0 ),
309 __qPainter.drawConvexPolygon( __pqPointFPolygon, 5 );
313 __qPen.setColor( QColor( 255, 128, 0 ) );
314 __qPen.setWidth( 10 );
315 __qPainter.setPen( __qPen );
316 __qPainter.setWorldTransform( __qTransform );
317 __qPainter.rotate( __fdTimeConverted*6.0 );
318 __qPainter.drawLine( QPointF( 0, 0), QPointF( 0, -460 ) );
321 __qPen.setColor( Qt::black );
322 __qPen.setWidth( 0 );
323 __qPainter.setPen( __qPen );
324 __qPainter.setWorldTransform( __qTransform );
325 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 40.0, 40.0 );
326 __qPainter.setBrush( QBrush( Qt::black ) );
327 __qPainter.drawEllipse( QPointF( 0.0, 0.0 ), 30.0, 30.0 );
330 __qPen.setColor( Qt::white );
331 __qPen.setWidth( 0 );
332 __qPainter.setPen( __qPen );
333 __qFont.setPixelSize( 50.0 );
334 __qFont.setBold(
false );
335 __qPainter.setFont( __qFont );
337 QRectF __qRectFText( QPointF( -125.0, -30.0 ), QSizeF( 250.0, 60.0 ) );
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)
double fdSW2TimeStarted
Stop-watch 2 last started time (stopped if 0)
double fdSW2TimeAccumulated
Stop-watch 2 accumulated time.
double fdSW1TimeAccumulated
Stop-watch 1 accumulated time.
QPixmap qPixmapBuffer
Pixmap buffer used to render and cache the instrument.
virtual void mouseReleaseEvent(QMouseEvent *_pqMouseEvent)
double fdSW1TimeStarted
Stop-watch 1 last started time (stopped if 0)
CUnitTimeZone::EUnit eUnit
Unit for which the last rendering was achieved.
void drawStatic(CUnitTimeZone::EUnit _eUnit)
bool bForceRedraw
Forces the redraw of the instrument (not matter its cache content)
void drawDynamic(CUnitTimeZone::EUnit _eUnit, double _fdTime)
CInstrumentGAChronograph(CVesselCockpit *_poVesselCockpit)
double fdTime
Time at which the last rendering was achieved.
virtual void mouseDoubleClickEvent(QMouseEvent *_pqMouseEvent)
CUnitTimeZone::EUnit getUnitTimeZone()
[Unit] Returns the timezone 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...
Time zone (UTC, local) selection class.
static QString toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
static QString toString(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static double toValue(double _fdValue, CUnitTimeZone::EUnit _eUnitTimeZone)
Returns the converted value, using the specified format/unit.
[UI] Generic vessel's cockpit view (window)
static CSettings * useSettings()
static constexpr double PI
double microtime()
Returns the system time with microseconds resolution, in seconds.