Qt Virtual Chart Table (QVCT)
CVesselPoint.cpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 // C/C++
20 #include <cmath>
21 
22 // QT
23 #include <QDateTime>
24 #include <QDomElement> // QtXml module
25 #include <QPainter>
26 #include <QPointF>
27 #include <QXmlStreamWriter>
28 
29 // QVCT
30 #include "QVCTRuntime.hpp"
31 #include "charts/CChart.hpp"
40 
41 
42 //------------------------------------------------------------------------------
43 // CONSTRUCTORS / DESTRUCTOR
44 //------------------------------------------------------------------------------
45 
46 CVesselPoint::CVesselPoint( const QString& _rqsName, bool _bDynamic )
47  : COverlayCourse( _rqsName )
50  , bDynamic( _bDynamic )
51  , qsType()
52  , qsDescription()
53  , qsComment()
54  , qsSymbol()
55  , qsUrl()
56  , eFixType( CDeviceDataFix::FIX_UNDEFINED )
57  , iSatelliteCount( 0 )
58  , fdDopHorizontal( CDeviceDataDop::UNDEFINED_VALUE )
59  , fdDopVertical( CDeviceDataDop::UNDEFINED_VALUE )
60  , iTrackRecordRate( 1 )
61  , bTrackRecord(false )
62  , fdTrackRecordTimeLast( -9999.0 )
63  , fdTrackRecordBearingLast( CDataCourse::UNDEFINED_BEARING )
64 {
65  QTreeWidgetItem::setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled );
66  QTreeWidgetItem::setText( CVesselOverlay::NAME, qsName );
67  QTreeWidgetItem::setCheckState( CVesselOverlay::VISIBLE, Qt::Checked );
68  QTreeWidgetItem::setCheckState( CVesselOverlay::SELECT, Qt::Unchecked );
69 }
70 
71 CVesselPoint::CVesselPoint( const QString& _rqsName, const CDataPosition& _roDataPosition )
72  : COverlayCourse( _rqsName, _roDataPosition )
75  , bDynamic( false )
76  , qsType()
77  , qsDescription()
78  , qsComment()
79  , qsSymbol()
80  , qsUrl()
81 {
82  QTreeWidgetItem::setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled );
83  QTreeWidgetItem::setText( CVesselOverlay::NAME, qsName );
84  QTreeWidgetItem::setCheckState( CVesselOverlay::VISIBLE, Qt::Checked );
85  QTreeWidgetItem::setCheckState( CVesselOverlay::SELECT, Qt::Unchecked );
86 }
87 
89 {
90  QTreeWidgetItem* __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
91  while( __pqTreeWidgetItem )
92  {
93  delete (CVesselPointDevice*)__pqTreeWidgetItem;
94  __pqTreeWidgetItem = QTreeWidgetItem::takeChild( 0 );
95  }
96 }
97 
98 //------------------------------------------------------------------------------
99 // METHODS: COverlayObject (implement/override)
100 //------------------------------------------------------------------------------
101 
102 void CVesselPoint::serialize( QDataStream& _rqDataStream ) const
103 {
104  COverlayCourse::serialize( _rqDataStream );
105  _rqDataStream << qsType << qsDescription << qsComment << qsSymbol << qsUrl;
106 }
107 
108 void CVesselPoint::unserialize( QDataStream& _rqDataStream )
109 {
110  COverlayCourse::unserialize( _rqDataStream );
111  _rqDataStream >> qsType >> qsDescription >> qsComment >> qsSymbol >> qsUrl;
112  QTreeWidgetItem::setText( CVesselOverlay::NAME, qsName );
113 }
114 
115 void CVesselPoint::draw( const CChart* _poChart, QPainter* _pqPainter )
116 {
117  // Constant drawing resources
118  static const QPointF __qPointFSymbol(-32,-32);
119  static const QSize __qSizeSymbol(32,32);
120 
121  // Draw
122  if( CDataPosition::operator==( CDataPosition::UNDEFINED ) || !bVisible
123  || !_poChart->getDrawArea().contains( _poChart->toDrawPosition( *this ).toPoint() ) ) return;
124 
125  // ... course vector
126  double __fdGroundSpeed = CDataCourseGA::GroundCourse.getSpeed();
127  if( __fdGroundSpeed != CDataCourse::UNDEFINED_SPEED && __fdGroundSpeed >= QVCTRuntime::useSettings()->getMinValueSpeed() )
128  COverlayCourse::drawVector( _poChart, _pqPainter, this );
129 
130  // ... position marker
131  COverlayObject* __poOverlayObjectSelected = QVCTRuntime::useChartTable()->getOverlayObjectSelected();
132  COverlayCourse::drawMarker( _poChart, _pqPainter, this, __poOverlayObjectSelected == this || __poOverlayObjectSelected == QTreeWidgetItem::parent() );
133  if( QVCTRuntime::useSettings()->isVisibleSymbols() ) COverlayPoint::drawSymbol( _poChart, _pqPainter, qsSymbol );
134 
135  // ... object tag
136  double __fdGroundBearing = CDataCourseGA::GroundCourse.getBearing();
137  if( __fdGroundBearing == CDataCourse::UNDEFINED_SPEED ) __fdGroundBearing = 0;
138  COverlayCourse::drawTag( _poChart, _pqPainter, __fdGroundBearing < 180.0 ? COverlayPoint::TAG_LEFT : COverlayPoint::TAG_RIGHT, this, this );
139 }
140 
142 {
148 }
149 
151 {
152  CVesselPointEditView* __poVesselPointEditView = new CVesselPointEditView( this );
153  if( __poVesselPointEditView->exec() == QDialog::Accepted )
154  {
155  showDetail();
158  }
159  delete __poVesselPointEditView;
160 }
161 
162 
163 //------------------------------------------------------------------------------
164 // METHODS: COverlayPoint (implement/override)
165 //------------------------------------------------------------------------------
166 
167 bool CVesselPoint::matchScrPosition( const CChart* _poChart, const QPointF& _rqPointFScrPosition ) const
168 {
169  if( CDataPosition::operator==( CDataPosition::UNDEFINED ) || !bVisible
170  || !_poChart->getDrawArea().contains( _poChart->toDrawPosition( *this ).toPoint() ) ) return false;
171  return COverlayCourse::matchScrPosition( _poChart, _rqPointFScrPosition );
172 }
173 
174 
175  //------------------------------------------------------------------------------
176  // METHODS: COverlayVisibility (override)
177  //------------------------------------------------------------------------------
178 
180 {
181  double __fdGroundSpeed = CDataCourseGA::GroundCourse.getSpeed();
183  && __fdGroundSpeed >= QVCTRuntime::useSettings()->getMinValueSpeed(),
184  QVCTRuntime::useChartTable()->getVesselPointSynchronize() == this
185  && QVCTRuntime::usePointerOverlay()->usePointerTarget()->CDataPosition::operator!=( CDataPosition::UNDEFINED ) );
186 }
187 
188 
189 //------------------------------------------------------------------------------
190 // METHODS
191 //------------------------------------------------------------------------------
192 
193 //
194 // GETTERS
195 //
196 
198 {
199  int __iCount = QTreeWidgetItem::childCount();
200  if( !__iCount ) return false;
201  for( int __i = 0; __i < __iCount; __i++ )
202  if( !((CVesselPointDevice*)QTreeWidgetItem::child( __i ))->isDeviceConnected() ) return false;
203  return true;
204 }
205 
206 //
207 // SETTERS
208 //
209 
211 {
212  QTreeWidgetItem::setCheckState( CVesselOverlay::SELECT, QTreeWidgetItem::checkState( CVesselOverlay::SELECT ) == Qt::Unchecked ? Qt::Checked : Qt::Unchecked );
213 }
214 
215 bool CVesselPoint::setTrackRecord( bool _bTrackRecord )
216 {
217  if( _bTrackRecord == bTrackRecord ) return bTrackRecord;
218  if( _bTrackRecord )
219  {
221  if( !__poTrackContainer )
222  {
223  qCritical( "ERROR[%s]: Failed to create new track for recording", Q_FUNC_INFO );
224  return false;
225  }
226  CTrackSubContainer* __poTrackSubContainer = __poTrackContainer->addSubContainer();
227  if( !__poTrackSubContainer )
228  {
229  qCritical( "ERROR[%s]: Failed to create new segment for recording", Q_FUNC_INFO );
230  return false;
231  }
232  }
233  bTrackRecord = _bTrackRecord;
235  return bTrackRecord;
236 }
237 
238 //
239 // OTHER
240 //
241 
243 {
244  if( !bDynamic ) return;
245  int __iCount = QTreeWidgetItem::childCount();
246  for( int __i = 0; __i < __iCount; __i++ )
247  ((CVesselPointDevice*)QTreeWidgetItem::child( __i ))->connectDevice();
248 }
249 
251 {
252  int __iCount = QTreeWidgetItem::childCount();
253  for( int __i = 0; __i < __iCount; __i++ )
254  ((CVesselPointDevice*)QTreeWidgetItem::child( __i ))->disconnectDevice();
255 }
256 
258 {
259  bool __bUpdateChart = false;
260 
261  // Synchronize chart center position
262  if( this->CDataPosition::operator!=( CDataPosition::UNDEFINED )
263  && QVCTRuntime::useChartTable()->getVesselPointSynchronize() == this )
264  {
266  CPointerOverlay* __poPointerOverlay = QVCTRuntime::usePointerOverlay();
267  if( __poPointerOverlay->usePointerTarget()->CDataPosition::operator!=( CDataPosition::UNDEFINED ) )
268  {
269  __poPointerOverlay->forceRedraw();
270  __bUpdateChart = true;
271  }
272  }
273 
274  // Track recording
275  double __fdSystemTime = microtime();
276  if( bTrackRecord
277  && CDataPosition::operator!=( CDataPosition::UNDEFINED )
278  && CDataTime::operator!=( CDataTime::UNDEFINED )
279  && __fdSystemTime - fdTrackRecordTimeLast >= (double)iTrackRecordRate )
280  {
281  CSettings* __poSettings = QVCTRuntime::useSettings();
282 
283  do // error-catching loop
284  {
285  // ... retrieve current track
287 
288  // ... check distance and bearing delta
289  bool __bSkipBearing = false;
292  {
293  double __fdDeltaBearing = fabs( CDataCourseGA::GroundCourse.getBearing() - fdTrackRecordBearingLast );
294  if( __fdDeltaBearing > 180.0 ) __fdDeltaBearing = 360.0 - __fdDeltaBearing;
295  if( __fdDeltaBearing < __poSettings->getMinValueBearing() ) __bSkipBearing = true;
296  }
297  bool __bSkipDistance = false;
298  CTrackPoint* __poTrackPointLast = __poTrackSubContainer->getLastPoint();
299  if( __poTrackPointLast
300  && CDataPosition::distanceRL( *__poTrackPointLast, *this ) < __poSettings->getMinValuePosition() ) __bSkipDistance = true;
301  if( __bSkipBearing && __bSkipDistance ) break;
302 
303  // ... add new point
304  QString __qsName;
306  if( __qsName.isEmpty() ) __qsName = __poTrackSubContainer->newChildName( tr("Point"), 3, true );
307  CTrackPoint* __poTrackPoint = __poTrackSubContainer->addPoint( __qsName, *this );
308  __poTrackPoint->setTime( CDataTime::getTime() );
310  __poTrackPoint->setSatelliteCount( iSatelliteCount );
311  __poTrackPoint->setDopHorizontal( fdDopHorizontal );
312  __poTrackPoint->setDopVertical( fdDopVertical );
317  __bUpdateChart = true;
318 
319  // ... update track recording time
320  fdTrackRecordTimeLast = __fdSystemTime;
321  }
322  while( false ); // error-catching loop
323  }
324 
325  // Redraw
327  // NOTE: Vessel detail view and chart overlays are automatically refreshed by CMainWindow::slotTimerRefreshContent()
328  if( __bUpdateChart ) QVCTRuntime::useChartTable()->updateChart();
329 }
330 
331 void CVesselPoint::parseQVCT( const QDomElement& _rqDomElement )
332 {
333  // ... visibility
334  COverlayVisibility::setVisibility( _rqDomElement.attribute( "visibility", "3" ).toInt() );
335  QTreeWidgetItem::setCheckState( CVesselOverlay::VISIBLE, bVisible ? Qt::Checked : Qt::Unchecked );
336  // ... position
337  if( _rqDomElement.hasAttribute( "longitude" ) && _rqDomElement.hasAttribute( "longitude" ) )
338  {
339  CDataPosition::setPosition( _rqDomElement.attribute( "longitude" ).toDouble(),
340  _rqDomElement.attribute( "latitude" ).toDouble(),
341  _rqDomElement.attribute( "elevation", QString::number( CDataPosition::UNDEFINED_ELEVATION, 'f' ) ).toDouble() );
342  }
343  QString __qsTime = _rqDomElement.attribute( "time" );
344  if( !__qsTime.isEmpty() )
345  {
346  CDataTime::setTime( QDateTime::fromString( __qsTime, Qt::ISODate ).toTime_t() );
347  }
348 
349  // ... info
350  qsType = _rqDomElement.attribute( "type" );
351  qsSymbol = _rqDomElement.attribute( "symbol" );
352  qsUrl = _rqDomElement.attribute( "url" );
353  qsDescription = _rqDomElement.firstChildElement( "Description" ).text();
354  qsComment = _rqDomElement.firstChildElement( "Comment" ).text();
355 
356  // ... course
357  QDomElement __qDomElementCourse = _rqDomElement.firstChildElement( "Course" );
358  if( !__qDomElementCourse.isNull() )
359  {
360  QDomElement __qDomElement = __qDomElementCourse.firstChildElement( "Ground" );
361  if( !__qDomElement.isNull() )
362  {
363  CDataCourseGA::GroundCourse.setBearing( __qDomElement.attribute( "bearing", QString::number( CDataCourse::UNDEFINED_BEARING, 'f' ) ).toDouble() );
364  CDataCourseGA::GroundCourse.setSpeed( __qDomElement.attribute( "speed", QString::number( CDataCourse::UNDEFINED_SPEED, 'f' ) ).toDouble() );
365  CDataCourseGA::GroundCourse.setSpeedVertical( __qDomElement.attribute( "speed_vertical", QString::number( CDataCourse::UNDEFINED_SPEED, 'f' ) ).toDouble() );
366  }
367  __qDomElement = __qDomElementCourse.firstChildElement( "Apparent" );
368  if( !__qDomElement.isNull() )
369  {
370  CDataCourseGA::ApparentCourse.setBearing( __qDomElement.attribute( "bearing", QString::number( CDataCourse::UNDEFINED_BEARING, 'f' ) ).toDouble() );
371  CDataCourseGA::ApparentCourse.setSpeed( __qDomElement.attribute( "speed", QString::number( CDataCourse::UNDEFINED_SPEED, 'f' ) ).toDouble() );
372  CDataCourseGA::ApparentCourse.setSpeedVertical( __qDomElement.attribute( "speed_vertical", QString::number( CDataCourse::UNDEFINED_SPEED, 'f' ) ).toDouble() );
373  }
374  }
375 
376  // ... validity
386 
387  // ... devices
388  for( QDomElement __qDomElementDevice = _rqDomElement.firstChildElement( "Device" );
389  !__qDomElementDevice.isNull();
390  __qDomElementDevice = __qDomElementDevice.nextSiblingElement( "Device" ) )
391  {
392  QString __qsName = __qDomElementDevice.attribute( "name" );
393  QString __qsSourceName = __qDomElementDevice.attribute( "source" );
394  CVesselPointDevice* __poVesselPointDevice = new CVesselPointDevice( __qsName, __qsSourceName );
395  if( __poVesselPointDevice ) __poVesselPointDevice->parseQVCT( __qDomElementDevice );
396  QTreeWidgetItem::addChild( __poVesselPointDevice );
397  __poVesselPointDevice->connectDevice();
398  }
399 }
400 
401 void CVesselPoint::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const
402 {
403 
404  // Data
405  _rqXmlStreamWriter.writeStartElement( "Vessel" );
406  // ... name
407  if( !qsName.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", qsName );
408  // ... visibility
409  _rqXmlStreamWriter.writeAttribute( "visibility", QString::number( COverlayVisibility::getVisibility() ) );
410  // ... position
411  _rqXmlStreamWriter.writeAttribute( "longitude", QString::number( CDataPosition::getLongitude() ) );
412  _rqXmlStreamWriter.writeAttribute( "latitude", QString::number( CDataPosition::getLatitude() ) );
413  // ... elevation
415  _rqXmlStreamWriter.writeAttribute( "elevation", QString::number( CDataPosition::getElevation() ) );
416  // ... time
418 #if QT_VERSION < 0x040800
419  _rqXmlStreamWriter.writeAttribute( "time", QDateTime::fromTime_t( CDataTime::getTime() ).toUTC().toString( Qt::ISODate )+"Z" );
420 #else
421  _rqXmlStreamWriter.writeAttribute( "time", QDateTime::fromTime_t( CDataTime::getTime() ).toUTC().toString( Qt::ISODate ) );
422 #endif
423  // ... type
424  if( !qsType.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "type", qsType );
425  // ... symbol
426  if( !qsSymbol.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "symbol", qsSymbol );
427  // ... url
428  if( !qsUrl.isEmpty() ) _rqXmlStreamWriter.writeAttribute( "url", qsUrl );
429  // ... description
430  if( !qsDescription.isEmpty() )
431  {
432  _rqXmlStreamWriter.writeStartElement( "Description" );
433  _rqXmlStreamWriter.writeCDATA( qsDescription );
434  _rqXmlStreamWriter.writeEndElement(); // Description
435  }
436  // ... comment
437  if( !qsComment.isEmpty() )
438  {
439  _rqXmlStreamWriter.writeStartElement( "Comment" );
440  _rqXmlStreamWriter.writeCDATA( qsComment );
441  _rqXmlStreamWriter.writeEndElement(); // Comment
442  }
443  // ... course
445  {
446  _rqXmlStreamWriter.writeStartElement( "Course" );
448  {
449  _rqXmlStreamWriter.writeStartElement( "Ground" );
451  _rqXmlStreamWriter.writeAttribute( "bearing", QString::number( CDataCourseGA::GroundCourse.getBearing() ) );
453  _rqXmlStreamWriter.writeAttribute( "speed", QString::number( CDataCourseGA::GroundCourse.getSpeed() ) );
455  _rqXmlStreamWriter.writeAttribute( "speed_vertical", QString::number( CDataCourseGA::GroundCourse.getSpeedVertical() ) );
456  _rqXmlStreamWriter.writeEndElement(); // Ground
457  }
459  {
460  _rqXmlStreamWriter.writeStartElement( "Apparent" );
462  _rqXmlStreamWriter.writeAttribute( "bearing", QString::number( CDataCourseGA::ApparentCourse.getBearing() ) );
464  _rqXmlStreamWriter.writeAttribute( "speed", QString::number( CDataCourseGA::ApparentCourse.getSpeed() ) );
466  _rqXmlStreamWriter.writeAttribute( "speed_vertical", QString::number( CDataCourseGA::ApparentCourse.getSpeedVertical() ) );
467  _rqXmlStreamWriter.writeEndElement(); // Apparent
468  }
469  _rqXmlStreamWriter.writeEndElement(); // Course
470  }
471  // ... devices
472  int __iCount = QTreeWidgetItem::childCount();
473  for( int __i = 0; __i < __iCount; __i++ )
474  {
475  CVesselPointDevice* __poVesselPointDevice = (CVesselPointDevice*)QTreeWidgetItem::child( __i );
476  __poVesselPointDevice->dumpQVCT( _rqXmlStreamWriter );
477  }
478  // ... [end]
479  _rqXmlStreamWriter.writeEndElement(); // Vessel
480 }
void synchronizeVesselPoint()
Synchronize the reference chart (geographical) position with the designed vessel.
COverlayObject * getOverlayObjectSelected() const
Returns the currently selected overlay object.
void updateChart()
Update the (current) chart content (on screen)
void setOverlayObjectSelected(COverlayObject *_poOverlayObject)
Sets the currently selected overlay object.
[UI] Chart (view)
Definition: CChart.hpp:44
QRectF getDrawArea() const
Returns the viewport draw area.
Definition: CChart.hpp:127
QPointF toDrawPosition(const CDataPosition &_roGeoPosition) const
Converts the given (geographical) position [long,lat,elev] to chart draw point [px].
Definition: CChart.cpp:192
CDataCourse ApparentCourse
Apparent course.
CDataCourse GroundCourse
Ground course.
Ground and apparent geographical courses validity container.
CDataCourseValidity GroundCourseValidity
Ground course validity.
CDataCourseValidity ApparentCourseValidity
Apparent course validity.
void setValiditySpeed(double _fdTimeLastSpeed, double _fdErrorSpeed, bool _bInvalidSpeed=false)
Sets the horizontal speed's validity parameters.
void setValiditySpeedVertical(double _fdTimeLastSpeedVertical, double _fdErrorSpeedVertical, bool _bInvalidSpeedVertical=false)
Sets the vertical speed's validity parameters.
void setValidityBearing(double _fdTimeLastBearing, double _fdErrorBearing, bool _bInvalidBearing=false)
Sets the bearing's validity parameters.
(Geographical) Course data [bearing, horizontal/vertical speeds]
Definition: CDataCourse.hpp:34
void setBearing(double _fdBearing)
Sets this course's bearing, in degrees.
Definition: CDataCourse.hpp:96
void setSpeed(double _fdSpeed, double _fdSpeedVertical=UNDEFINED_SPEED)
Sets this course's horizontal speed, in meters per second.
static constexpr double UNDEFINED_BEARING
Specific value for an undefined bearing.
Definition: CDataCourse.hpp:42
static constexpr double UNDEFINED_SPEED
Specific value for an undefined speed.
Definition: CDataCourse.hpp:44
void setSpeedVertical(double _fdSpeedVertical)
Sets this course's vertical speed, in meters per second.
double getBearing() const
Returns this course's bearing, in degrees.
static const CDataCourse UNDEFINED
Specific value for an undefined course.
Definition: CDataCourse.hpp:46
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
Position data validity.
void setValidityElevation(double _fdTimeLastElevation, double _fdErrorElevation, bool _bInvalidElevation=false)
Sets the elevation's validity parameters.
void setValidityPosition(double _fdTimeLastPosition, double _fdErrorPosition, bool _bInvalidPosition=false)
Sets the position's validity parameters.
(Geographical) Position data [long,lat,elev]
double getLongitude() const
Returns this position's longitude, in degrees.
double getElevation() const
Returns this position's elevation, in meters.
static double distanceRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line distance between two points, in meters.
double getLatitude() const
Returns this position's latitude, in degrees.
static const CDataPosition UNDEFINED
Specific value for an undefined position.
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.
void setValidityTime(double _fdTimeLastTime, double _fdErrorTime, bool _bInvalidTime=false)
Sets the time's validity parameters.
static const CDataTime UNDEFINED
Specific value for an undefined time object.
Definition: CDataTime.hpp:46
void setTime(double _fdTime)
Sets the time, in seconds from Unix epoch.
Definition: CDataTime.cpp:60
double getTime() const
Returns this time's time, in seconds from Unix epoch.
Definition: CDataTime.hpp:89
static constexpr double UNDEFINED_TIME
Specific value for an undefined time.
Definition: CDataTime.hpp:44
static constexpr double UNDEFINED_VALUE
Dilution-of-Precision (DOP) data.
static const double UNDEFINED_VALUE
Specific value for an undefined component.
Fix data [source,time,position,course,DOPs,...].
QString getTypeString() const
Returns the fix type as a human-friendly string.
Generic overlay course.
virtual void drawVector(const CChart *_poChart, QPainter *_pqPainter, const CDataCourseValidityGA *_poDataCourseValidityGA=0)
Draws the course vectors (ground and apparent)
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual void drawMarker(const CChart *_poChart, QPainter *_pqPainter, const CDataPositionValidity *_poDataPositionValidity=0, bool _bSelected=false)
Draws the point (marker)
void switchView(EView eView)
Displays the requested container/item details (switching to the appropriate widget)
@ VESSEL_POINT
Vessel point.
@ VESSEL
Vessel overlay.
void switchView(EView eView)
Displays the requested overlay (switching to the appropriate tab)
void setOverlayObject(COverlayObject *_poOverlayObject)
Sets the overlay object to be displayed (and refreshes the underlying widget)
Generic overlay object.
QString getName() const
Returns this object's name.
QString newChildName(const QString &_rqsName, int _iZeroPrefix=0, bool _bForceSuffix=false) const
Returns a valid (non-duplicate) name for a new sibling of this object.
QString qsName
Object name.
virtual bool matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns whether this point matches the given screen position.
virtual void drawSymbol(const CChart *_poChart, QPainter *_pqPainter, const QString &_rqsSymbol)
Draws the symbol (user-defined)
virtual void drawTag(const CChart *_poChart, QPainter *_pqPainter, ETagPosition _eTagPosition=TAG_AUTO, const CDataTimeValidity *_poDataTimeValidity=0, const CDataPositionValidity *_poDataPositionValidity=0)
Draws the tag (name)
void setVisibility(int _iVisibilityCode)
Sets the global (coded) visibility status.
virtual void toggleVisibility(bool _bIncludeCourse, bool _bIncludeRouting)
Toggle the visibility status.
bool bVisible
Global (marker) visibility status.
int getVisibility() const
Returns the global (coded) visibility status.
void forceRedraw()
Forces this overlay's rendering (not matter its cache content)
Definition: COverlay.hpp:115
[UI] Pointer overlay
CPointerPoint * usePointerTarget()
Returns the pointer point corresponding to the target.
[UI] Container for the application's settings
Definition: CSettings.hpp:51
double getMinValuePosition()
[MinValue] Returns the minimum (absolute) position (delta), in meters
Definition: CSettings.hpp:377
[UI] Track overlay container
CTrackSubContainer * addSubContainer()
Add a new sub-container to this container.
CTrackContainer * pickContainer(const QString &_rqsName)
Returns a track (container) matching the given name.
CTrackSubContainer * pickSubContainer(const QString &_rqsName)
Returns the last/current segment (sub-container) of the track (container) matching the given name.
[UI] Track overlay point (item)
Definition: CTrackPoint.hpp:40
void setDopPositional(double _fdDopPositional)
Sets this track point's positional Dilution-of-Precision (PDOP)
void setSatelliteCount(int _iSatelliteCount)
Sets this track point's satellite count.
void setFixType(const QString &_rqsFixType)
Sets this track point's fix type.
void setDopVertical(double _fdDopVertical)
Sets this track point's vertical Dilution-of-Precision (VDOP)
void setDopHorizontal(double _fdDopHorizontal)
Sets this track point's horizontal Dilution-of-Precision (HDOP)
[UI] Track overlay sub-container
CTrackPoint * getLastPoint()
Returns the last track (item/point) from this sub-container (0 if none is found)
CTrackPoint * addPoint(const QString &_rqsName, const CDataPosition &_roDataPosition=CDataPosition::UNDEFINED)
Add a new track (item/point) to this sub-container.
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...
Definition: CUnitTime.cpp:79
@ NAME
Vessel name.
@ SELECT
Vessel selection status.
@ VISIBLE
Vessel visibility status.
virtual void refreshContent()
Refreshes the content of the underlying widget.
[UI] Vessel device
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
bool connectDevice()
Connects to the actual device.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
[UI] Vessel point's (item) edit view
int eFixType
Vessel point's fix type.
void toggleMultiSelected()
Toggles this vessel's selection status.
void disconnectDevice()
Disconnects all children devices.
double fdTrackRecordBearingLast
Vessel's track last recorded bearing.
bool isDeviceConnected() const
Returns whether this vessel's devices are all connected.
void onDeviceDataFix()
Handled changes triggered by child devices.
double fdTrackRecordTimeLast
Vessel's track last recording time.
virtual ~CVesselPoint()
double fdDopHorizontal
Vessel point's horizontal Dilution-of-Precision (HDOP)
virtual void unserialize(QDataStream &_rqDataStream)
Unserializes (restore) this object's data from binary format.
virtual bool matchScrPosition(const CChart *_poChart, const QPointF &_rqPointFScrPosition) const
Returns whether this point matches the given screen position.
bool bTrackRecord
Vessel's track recording status.
double fdDopVertical
Vessel point's vertical Dilution-of-Precision (VDOP)
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
int iTrackRecordRate
Vessel's track recording rate, in seconds.
virtual void toggleVisibility()
int iSatelliteCount
Vessel point's satellites count.
virtual void showEdit()
Displays this object's edit widget/view.
QString qsUrl
Vessel's URL.
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
QString qsComment
Vessel's comment.
QString qsType
Vessel's type.
void connectDevice()
Connects all children devices.
bool bDynamic
Dynamic flag (vessel automatically generated by a dynamic flotilla)
virtual void serialize(QDataStream &_rqDataStream) const
Serializes (store) this object's data to binary format.
bool setTrackRecord(bool _bTrackRecord)
Sets this vessel's track recording status.
CVesselPoint(const QString &_rqsName, bool _bDynamic=false)
QString qsDescription
Vessel's description.
virtual void draw(const CChart *_poChart, QPainter *_pqPainter)
Draws this object (itself or its content)
QString qsSymbol
Vessel's symbol.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
static COverlayDetailView * useOverlayDetailView()
static CVesselPointDetailView * useVesselPointDetailView()
static CPointerOverlay * usePointerOverlay()
static CVesselOverlay * useVesselOverlay()
static COverlayListView * useOverlayListView()
static CChartTable * useChartTable()
static CSettings * useSettings()
static CTrackOverlay * useTrackOverlay()
double microtime()
Returns the system time with microseconds resolution, in seconds.
Definition: main.cpp:30