Qt Virtual Chart Table (QVCT)
CVesselPointDevice.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 <QDomElement> // QtXml module
24 #include <QPainter>
25 #include <QPointF>
26 #include <QXmlStreamWriter>
27 
28 // QVCT
29 #include "QVCTRuntime.hpp"
30 #include "devices/CDevice.hpp"
34 
35 
36 //------------------------------------------------------------------------------
37 // CONSTRUCTORS / DESTRUCTOR
38 //------------------------------------------------------------------------------
39 
40 CVesselPointDevice::CVesselPointDevice( const QString& _rqsName, const QString& _rqsSourceName, bool _bDynamic )
41  : COverlayItem( COverlayObject::SUBITEM2, _rqsName )
42  , CDeviceDataFix( _rqsSourceName )
43  , bDynamic( _bDynamic )
44  , poDevice( 0 )
45  , bSynchronizePosition( false )
46  , bSynchronizeElevation( false )
47  , bSynchronizeTime( false )
48  , bSynchronizeGroundBearing( false )
49  , bSynchronizeGroundSpeed( false )
50  , bSynchronizeGroundSpeedVertical( false )
51  , bSynchronizeApparentBearing( false )
52  , bSynchronizeApparentSpeed( false )
53  , bSynchronizeApparentSpeedVertical( false )
54  , bSynchronizeText( false )
55 {
56  QTreeWidgetItem::setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
57  QTreeWidgetItem::setText( CVesselOverlay::NAME, getName() );
58 }
59 
60 
61 //------------------------------------------------------------------------------
62 // METHODS: COverlayObject (implement/override)
63 //------------------------------------------------------------------------------
64 
66 {
71 }
72 
74 {
75  CVesselPointDeviceEditView* __poVesselPointDeviceEditView = new CVesselPointDeviceEditView( this );
76  if( __poVesselPointDeviceEditView->exec() == QDialog::Accepted ) showDetail();
77  delete __poVesselPointDeviceEditView;
78 }
79 
80 
81 //------------------------------------------------------------------------------
82 // METHODS
83 //------------------------------------------------------------------------------
84 
85 //
86 // SLOTS
87 //
88 
89 void CVesselPointDevice::slotDestroyed( QObject* _pqObject )
90 {
91  if( !_pqObject || (QObject*)poDevice != _pqObject ) return;
93 }
94 
95 void CVesselPointDevice::slotDataFix( const CDeviceDataFix& _roDeviceDataFix )
96 {
97  syncDataFix( _roDeviceDataFix );
98 }
99 
100 void CVesselPointDevice::slotDataSkyView( const CDeviceDataSkyView& _roDeviceDataSkyView )
101 {
102  if( !CDeviceDataFix::getSourceName().isEmpty()
103  && CDeviceDataFix::getSourceName() != _roDeviceDataSkyView.getSourceName() ) return;
104  if( _roDeviceDataSkyView.CDeviceDataDop::operator==( CDeviceDataDop::UNDEFINED ) ) return;
105  CDeviceDataFix::setDop( _roDeviceDataSkyView );
106  emit signalRefreshContent();
107 }
108 
109 //
110 // SETTERS
111 //
112 
113 void CVesselPointDevice::setSynchronized( bool _bSynchronizePosition, bool _bSynchronizeElevation, bool _bSynchronizeTime,
114  bool _bSynchronizeGroundBearing, bool _bSynchronizeGroundSpeed, bool _bSynchronizeGroundSpeedVertical,
115  bool _bSynchronizeApparentBearing, bool _bSynchronizeApparentSpeed, bool _bSynchronizeApparentSpeedVertical,
116  bool _bSynchronizeText )
117 {
118  bSynchronizePosition = _bSynchronizePosition;
119  bSynchronizeElevation = _bSynchronizeElevation;
120  bSynchronizeTime = _bSynchronizeTime;
121  bSynchronizeGroundBearing = _bSynchronizeGroundBearing;
122  bSynchronizeGroundSpeed = _bSynchronizeGroundSpeed;
123  bSynchronizeGroundSpeedVertical = _bSynchronizeGroundSpeedVertical;
124  bSynchronizeApparentBearing = _bSynchronizeApparentBearing;
125  bSynchronizeApparentSpeed = _bSynchronizeApparentSpeed;
126  bSynchronizeApparentSpeedVertical = _bSynchronizeApparentSpeedVertical;
127  bSynchronizeText = _bSynchronizeText;
128 }
129 
130 //
131 // OTHER
132 //
133 
135 {
136  if( poDevice ) return true;
137  CDeviceOverlay* __poDeviceOverlay = QVCTRuntime::useDeviceOverlay();
138  CDevice* __poDevice = __poDeviceOverlay->pickDevice( COverlayObject::getName() );
139  if( !__poDevice ) return false;
140  poDevice = __poDevice;
141  QObject::connect( poDevice, SIGNAL( destroyed(QObject*) ), this, SLOT( slotDestroyed(QObject*) ) );
142  QObject::connect( poDevice, SIGNAL( signalDataFix(const CDeviceDataFix&) ), this, SLOT( slotDataFix(const CDeviceDataFix&) ) );
143  QObject::connect( poDevice, SIGNAL( signalDataSkyView(const CDeviceDataSkyView&) ), this, SLOT( slotDataSkyView(const CDeviceDataSkyView&) ) );
144  return true;
145 }
146 
148 {
149  if( !poDevice ) return;
150  QObject::disconnect( poDevice, 0, this, 0 );
151  poDevice = 0;
152 }
153 
154 void CVesselPointDevice::syncDataFix( const CDeviceDataFix& _roDeviceDataFix )
155 {
156  if( !CDeviceDataFix::getSourceName().isEmpty()
157  && CDeviceDataFix::getSourceName() != _roDeviceDataFix.getSourceName() ) return;
158 
159  // Copy fix data
160  CDeviceDataFix::setFix( _roDeviceDataFix );
161 
162  // Retrieve data
163  CSettings* __poSettings = QVCTRuntime::useSettings();
164  CVesselPoint* __poVesselPoint = (CVesselPoint*)QTreeWidgetItem::parent();
165  // ... system time
166  double __fdSystemTime = microtime();
167  // ... device time
169  double __fdTimeDelta = __fdTime != CDataTime::UNDEFINED_TIME && __poVesselPoint->getTime() != CDataTime::UNDEFINED_TIME
170  ? __fdTime - __poVesselPoint->getTime() : CDataTime::UNDEFINED_TIME;
171  // ... position
174  // ... elevation
176  // ... ground course
180  // ... apparent course
184  // ... errors
185  double __fdErrorTime = CDeviceDataFix::getErrorTime();
186  double __fdErrorHorizontal = CDeviceDataFix::getErrorHorizontal();
187  double __fdErrorVertical = CDeviceDataFix::getErrorVertical();
188  double __fdErrorBearing = CDeviceDataFix::getErrorBearing();
189  double __fdErrorSpeed = CDeviceDataFix::getErrorSpeed();
190  double __fdErrorSpeedVertical = CDeviceDataFix::getErrorSpeedVertical();
191  // ... additional textual data string
192  QString __qsText = bSynchronizeText ? CDeviceDataFix::getText() : "";
193 
194  // Synchronize data
195  // NOTE: We synchronize position/time data last, in order to use those to compute position/time-derived ground course data if required
196  // NOTE: For the same reason, we process ground speed before ground bearing
197  bool __bVesselSynchronized = false;
198 
199  // ... horizontal ground speed
201  {
202  if( __fdGroundSpeed == CDataCourse::UNDEFINED_SPEED
205  && __fdLongitude != CDataPosition::UNDEFINED_LONGITUDE
206  && __fdLatitude != CDataPosition::UNDEFINED_LATITUDE
207  && __poVesselPoint->getLongitude() != CDataPosition::UNDEFINED_LONGITUDE
208  && __poVesselPoint->getLatitude() != CDataPosition::UNDEFINED_LATITUDE
209  && __fdTimeDelta != CDataTime::UNDEFINED_TIME
210  && __fdTimeDelta > 0.1 )
211  {
212  // ... compute position/time-derived value
213  __fdGroundSpeed = CDataPosition::distanceRL( *__poVesselPoint, *this ) / __fdTimeDelta;
214  }
215  if( __fdGroundSpeed != CDataCourse::UNDEFINED_SPEED )
216  {
217  if( __fdErrorSpeed == CDataCourseValidity::UNDEFINED_VALUE
219  && __fdErrorHorizontal != CDataPositionValidity::UNDEFINED_VALUE
221  && __fdErrorTime != CDataTimeValidity::UNDEFINED_VALUE
222  && __poVesselPoint->getErrorTime() != CDataTimeValidity::UNDEFINED_VALUE
223  && __fdTimeDelta != CDataTime::UNDEFINED_TIME
224  && __fdTimeDelta > 0.1 )
225  {
226  // ... compute elevation/time-derived value
227  // NOTE: Let's assume that device errors remain in the same direction over a short time.
228  // Thus, instead of using the maximum accumulated error for each value, let's use a
229  // "diminished" maxmimum error (factor 1/10) AND the error delta between the previous
230  // and the current point.
231  __fdErrorSpeed =
232  ( ( __fdErrorHorizontal + __poVesselPoint->getErrorPosition() ) / 10.0 + fabs( __fdErrorHorizontal - __poVesselPoint->getErrorPosition() ) ) / __fdTimeDelta
233  * ( 1.0 + ( ( __fdErrorTime + __poVesselPoint->getErrorTime() ) / 10.0 + fabs( __fdErrorTime - __poVesselPoint->getErrorTime() ) ) / __fdTimeDelta );
234  }
235  __poVesselPoint->GroundCourse.setSpeed( __fdGroundSpeed );
236  __poVesselPoint->GroundCourseValidity.setValiditySpeed( __fdSystemTime, __fdErrorSpeed,
237  fabs( __fdGroundSpeed ) < __poSettings->getMinValueSpeed() );
238  __bVesselSynchronized = true;
239  }
240  }
241 
242  // ... vertical ground speed
244  {
245  if( __fdGroundSpeedVertical == CDataCourse::UNDEFINED_SPEED
248  && __fdElevation != CDataPosition::UNDEFINED_ELEVATION
249  && __poVesselPoint->getElevation() != CDataPosition::UNDEFINED_ELEVATION
250  && __fdTimeDelta != CDataTime::UNDEFINED_TIME
251  && __fdTimeDelta > 0.1 )
252  {
253  // ... compute elevation/time-derived value
254  __fdGroundSpeedVertical = ( __fdElevation - __poVesselPoint->getElevation() ) / __fdTimeDelta;
255  }
256  if( __fdGroundSpeedVertical != CDataCourse::UNDEFINED_SPEED )
257  {
258  if( __fdErrorSpeedVertical == CDataCourseValidity::UNDEFINED_VALUE
260  && __fdErrorVertical != CDataPositionValidity::UNDEFINED_VALUE
262  && __fdErrorTime != CDataTimeValidity::UNDEFINED_VALUE
263  && __poVesselPoint->getErrorTime() != CDataTimeValidity::UNDEFINED_VALUE
264  && __fdTimeDelta != CDataTime::UNDEFINED_TIME
265  && __fdTimeDelta > 0.1 )
266  {
267  // ... compute elevation/time-derived value
268  // NOTE: Let's assume that device errors remain in the same direction over a short time.
269  // Thus, instead of using the maximum accumulated error for each value, let's use a
270  // "diminished" maximum error (factor 1/10) AND the error delta between the previous
271  // and the current point.
272  __fdErrorSpeedVertical =
273  ( ( __fdErrorVertical + __poVesselPoint->getErrorElevation() ) / 10.0 + fabs( __fdErrorVertical - __poVesselPoint->getErrorElevation() ) ) / __fdTimeDelta
274  * ( 1.0 + ( ( __fdErrorTime + __poVesselPoint->getErrorTime() ) / 10.0 + fabs( __fdErrorTime - __poVesselPoint->getErrorTime() ) ) / __fdTimeDelta );
275  }
276  __poVesselPoint->GroundCourse.setSpeedVertical( __fdGroundSpeedVertical );
277  __poVesselPoint->GroundCourseValidity.setValiditySpeedVertical( __fdSystemTime, __fdErrorSpeedVertical,
278  fabs( __fdGroundSpeedVertical ) < __poSettings->getMinValueSpeedVertical() );
279  __bVesselSynchronized = true;
280  }
281  }
282 
283  // ... ground bearing
285  && ( !bSynchronizeGroundSpeed || __fdGroundSpeed != CDataCourse::UNDEFINED_SPEED ) )
286  {
287  if( __fdGroundBearing == CDataCourse::UNDEFINED_BEARING
290  && __fdLongitude != CDataPosition::UNDEFINED_LONGITUDE
291  && __fdLatitude != CDataPosition::UNDEFINED_LATITUDE
292  && __poVesselPoint->getLongitude() != CDataPosition::UNDEFINED_LONGITUDE
293  && __poVesselPoint->getLatitude() != CDataPosition::UNDEFINED_LATITUDE )
294  {
295  // ... compute position-derived value
296  __fdGroundBearing = CDataPosition::bearingRL( *__poVesselPoint, *this );
297  }
298  if( __fdGroundBearing != CDataCourse::UNDEFINED_BEARING )
299  {
300  if( __fdErrorBearing == CDataCourseValidity::UNDEFINED_VALUE
302  && __fdLongitude != CDataPosition::UNDEFINED_LONGITUDE
303  && __fdLatitude != CDataPosition::UNDEFINED_LATITUDE
304  && __poVesselPoint->getLongitude() != CDataPosition::UNDEFINED_LONGITUDE
305  && __poVesselPoint->getLatitude() != CDataPosition::UNDEFINED_LATITUDE
306  && __fdErrorHorizontal != CDataPositionValidity::UNDEFINED_VALUE
308  {
309  // ... compute position/time-derived value
310  // NOTE: Let's assume that device errors remain in the same direction over a short time.
311  // Thus, instead of using the maximum accumulated error for each value, let's use a
312  // "diminished" maximum error (factor 1/10) AND the error delta between the previous
313  // and the current point.
314  double __fdDistance = CDataPosition::distanceRL( *__poVesselPoint, *this );
315  if( __fdDistance > 1.0 )
316  {
317  __fdErrorBearing =
318  atan( ( ( __fdErrorHorizontal + __poVesselPoint->getErrorPosition() ) / 10.0 + fabs( __fdErrorHorizontal - __poVesselPoint->getErrorPosition() ) ) / __fdDistance )
319  * QVCT::RAD2DEG;
320  }
321  }
322  __poVesselPoint->GroundCourse.setBearing( __fdGroundBearing );
323  __poVesselPoint->GroundCourseValidity.setValidityBearing( __fdSystemTime, __fdErrorBearing,
325  ? fabs( __fdGroundSpeed ) < __poSettings->getMinValueSpeed() : false );
326  __bVesselSynchronized = true;
327  }
328  }
329 
330  // ... apparent bearing
331  if( __fdApparentBearing != CDataCourse::UNDEFINED_BEARING
332  && ( !bSynchronizeApparentSpeed || __fdApparentSpeed != CDataCourse::UNDEFINED_SPEED ) )
333  {
334  __poVesselPoint->ApparentCourse.setBearing( __fdApparentBearing );
335  __poVesselPoint->ApparentCourseValidity.setValidityBearing( __fdSystemTime, __fdErrorBearing,
337  ? fabs( __fdApparentSpeed ) < __poSettings->getMinValueSpeed() : false );
338  __bVesselSynchronized = true;
339  }
340 
341  // ... horizontal apparent speed
342  if( __fdApparentSpeed != CDataCourse::UNDEFINED_SPEED )
343  {
344  __poVesselPoint->ApparentCourse.setSpeed( __fdApparentSpeed );
345  __poVesselPoint->ApparentCourseValidity.setValiditySpeed( __fdSystemTime, __fdErrorSpeed,
346  fabs( __fdApparentSpeed ) < __poSettings->getMinValueSpeed() );
347  __bVesselSynchronized = true;
348  }
349 
350  // ... vertical apparent speed
351  if( __fdApparentSpeedVertical != CDataCourse::UNDEFINED_SPEED )
352  {
353  __poVesselPoint->ApparentCourse.setSpeedVertical( __fdApparentSpeedVertical );
354  __poVesselPoint->ApparentCourseValidity.setValiditySpeedVertical( __fdSystemTime, __fdErrorSpeedVertical,
355  fabs( __fdApparentSpeedVertical ) < __poSettings->getMinValueSpeedVertical() );
356  __bVesselSynchronized = true;
357  }
358 
359  // ... position
360  if( __fdLongitude != CDataPosition::UNDEFINED_LONGITUDE
361  && __fdLatitude != CDataPosition::UNDEFINED_LATITUDE )
362  {
363  __bVesselSynchronized = true;
364  __poVesselPoint->setPosition( __fdLongitude, __fdLatitude );
365  __poVesselPoint->setValidityPosition( __fdSystemTime, __fdErrorHorizontal );
366  __poVesselPoint->setFixType( CDeviceDataFix::getType() );
369  }
370 
371  // ... elevation
372  if( __fdElevation != CDataPosition::UNDEFINED_ELEVATION )
373  {
374  __poVesselPoint->setElevation( __fdElevation );
375  __poVesselPoint->setValidityElevation( __fdSystemTime, __fdErrorVertical );
376  __poVesselPoint->setDopVertical( CDeviceDataDop::getDopVertical() );
377  __bVesselSynchronized = true;
378  }
379 
380  // ... time
381  if( __fdTime != CDataTime::UNDEFINED_TIME )
382  {
383  __poVesselPoint->setTime( __fdTime );
384  __poVesselPoint->setValidityTime( __fdSystemTime, __fdErrorTime );
385  __bVesselSynchronized = true;
386  }
387 
388  // ... additional text data
389  if( !__qsText.isEmpty() )
390  {
391  __poVesselPoint->setComment( __qsText );
392  __bVesselSynchronized = true;
393  }
394 
395  // ... [end]
396  if( __bVesselSynchronized )
397  {
398  __poVesselPoint->onDeviceDataFix();
399  if( !__poVesselPoint->isDynamic() )
401  }
402  emit signalRefreshContent();
403 }
404 
405 void CVesselPointDevice::parseQVCT( const QDomElement& _rqDomElement )
406 {
407  bSynchronizePosition = _rqDomElement.attribute( "synch_position", "0" ).toInt();
408  bSynchronizeElevation = _rqDomElement.attribute( "synch_elevation", "0" ).toInt();
409  bSynchronizeTime = _rqDomElement.attribute( "synch_time", "0" ).toInt();
410  bSynchronizeGroundBearing = _rqDomElement.attribute( "synch_ground_bearing", "0" ).toInt();
411  bSynchronizeGroundSpeed = _rqDomElement.attribute( "synch_ground_speed", "0" ).toInt();
412  bSynchronizeGroundSpeedVertical = _rqDomElement.attribute( "synch_ground_speed_vertical", "0" ).toInt();
413  bSynchronizeApparentBearing = _rqDomElement.attribute( "synch_apparent_bearing", "0" ).toInt();
414  bSynchronizeApparentSpeed = _rqDomElement.attribute( "synch_apparent_speed", "0" ).toInt();
415  bSynchronizeApparentSpeedVertical = _rqDomElement.attribute( "synch_apparent_speed_vertical", "0" ).toInt();
416 }
417 
418 void CVesselPointDevice::dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const
419 {
420 
421  // Data
422  _rqXmlStreamWriter.writeStartElement( "Device" );
423  // ... name
424  if( !getName().isEmpty() ) _rqXmlStreamWriter.writeAttribute( "name", getName() );
425  // ... source name
426  if( !getSourceName().isEmpty() ) _rqXmlStreamWriter.writeAttribute( "source", getSourceName() );
427  // ... synchronization flags
428  _rqXmlStreamWriter.writeAttribute( "synch_position", bSynchronizePosition ? "1" : "0" );
429  _rqXmlStreamWriter.writeAttribute( "synch_elevation", bSynchronizeElevation ? "1" : "0" );
430  _rqXmlStreamWriter.writeAttribute( "synch_time", bSynchronizeTime ? "1" : "0" );
431  _rqXmlStreamWriter.writeAttribute( "synch_ground_bearing", bSynchronizeGroundBearing ? "1" : "0" );
432  _rqXmlStreamWriter.writeAttribute( "synch_ground_speed", bSynchronizeGroundSpeed ? "1" : "0" );
433  _rqXmlStreamWriter.writeAttribute( "synch_ground_speed_vertical", bSynchronizeGroundSpeedVertical ? "1" : "0" );
434  _rqXmlStreamWriter.writeAttribute( "synch_apparent_bearing", bSynchronizeApparentBearing ? "1" : "0" );
435  _rqXmlStreamWriter.writeAttribute( "synch_apparent_speed", bSynchronizeApparentSpeed ? "1" : "0" );
436  _rqXmlStreamWriter.writeAttribute( "synch_apparent_speed_vertical", bSynchronizeApparentSpeedVertical ? "1" : "0" );
437  // ... [end]
438  _rqXmlStreamWriter.writeEndElement(); // Device
439 }
void setProjectModified()
Sets the status of the project to modified (data have changed and need saving)
CDataCourse ApparentCourse
Apparent course.
CDataCourse GroundCourse
Ground course.
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.
void setBearing(double _fdBearing)
Sets this course's bearing, in degrees.
Definition: CDataCourse.hpp:96
double getSpeedVertical() const
Returns this course's vertical speed, in meters per second.
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.
double getSpeed() const
Returns this course's horizontal speed, in meters per second.
void setValidityElevation(double _fdTimeLastElevation, double _fdErrorElevation, bool _bInvalidElevation=false)
Sets the elevation's validity parameters.
double getErrorElevation() const
Returns the elevation's error, in seconds.
double getErrorPosition() const
Returns the position's error, in seconds.
void setValidityPosition(double _fdTimeLastPosition, double _fdErrorPosition, bool _bInvalidPosition=false)
Sets the position's validity parameters.
double getLongitude() const
Returns this position's longitude, in degrees.
static constexpr double UNDEFINED_LATITUDE
Specific value for an undefined latitude.
double getElevation() const
Returns this position's elevation, in meters.
static double bearingRL(const CDataPosition &_roPosition1, const CDataPosition &_roPosition2)
Returns the rhumb-line (constant) bearing between two points, in degrees.
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 constexpr double UNDEFINED_LONGITUDE
Specific value for an undefined longitude.
void setElevation(double _fdElevation)
Sets the elevation, in meters.
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
static constexpr double UNDEFINED_ELEVATION
Specific value for an undefined elevation.
double getErrorTime() const
Returns the time's error, in seconds.
void setValidityTime(double _fdTimeLastTime, double _fdErrorTime, bool _bInvalidTime=false)
Sets the time's validity parameters.
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
void setDop(const CDeviceDataDop &_roDeviceDataDop)
Sets (copy) the Dilution-of-Precision (HDOP, VDOP, TDOP) values from other DOP data.
static const CDeviceDataDop UNDEFINED
Specific value for undefined DOP data.
double getDopHorizontal() const
Returns the horizontal position Dilution-of-Precision (HDOP)
double getDopVertical() const
Returns the vertical position Dilution-of-Precision (VDOP)
Fix data [source,time,position,course,DOPs,...].
double getErrorTime() const
Returns the time error, in seconds.
double getErrorVertical() const
Returns the vertical position error, in meters.
void setFix(const CDeviceDataFix &_roDeviceDataFix, bool _bCopyTime=true, bool _bCopyPosition=true, bool _bCopyCourse=true, bool _bCopyDop=true)
Sets (copy) the fix data from another instance.
QString getText() const
Returns the additional textual data string.
int getType() const
Returns the fix type.
bool isCourseFromPosition() const
Returns whether position is used to compute course.
double getErrorSpeed() const
Returns the horizontal speed error, in meters per second.
double getErrorHorizontal() const
Returns the horizontal position error, in meters.
double getErrorBearing() const
Returns the bearing error, in degrees.
double getErrorSpeedVertical() const
Returns the vertical speed error, in meters per second.
int getSourcesUsed() const
Returns the used sources count (most likely satellites)
Sky view data (satellites details)
QString getSourceName() const
Returns the source name.
[UI] Device overlay container
CDevice * pickDevice(const QString &_rqsName)
Returns the device matching the given name (0 if none is found)
Generic navigation device (GPS, speedometer, compass, etc.)
Definition: CDevice.hpp:43
void switchView(EView eView)
Displays the requested container/item details (switching to the appropriate widget)
@ VESSEL_POINT_DEVICE
Vessel point's device.
Generic overlay item.
@ 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.
[UI] Container for the application's settings
Definition: CSettings.hpp:51
double getMinValueSpeedVertical()
[MinValue] Returns the minimum (absolute) vertical speed, in meters per second
Definition: CSettings.hpp:383
double getMinValueSpeed()
[MinValue] Returns the minimum (absolute) horizontal speed, in meters per second
Definition: CSettings.hpp:381
@ NAME
Vessel name.
virtual void refreshContent()
Refreshes the content of the underlying widget.
[UI] Vessel point's (item) edit view
bool bSynchronizeElevation
[Flag] Use this device/source to synchronize the vessel's elevation
void slotDestroyed(QObject *_pqObject)
Slot to handle object destruction.
void syncDataFix(const CDeviceDataFix &_roDeviceDataFix)
Synchronizes fix data (sent by device)
bool bSynchronizePosition
[Flag] Use this device/source to synchronize the vessel's position
virtual void showDetail()
Displays this object's details (in the appropriate widget/view)
void setSynchronized(bool _bSynchronizePosition, bool _bSynchronizeElevation, bool _bSynchronizeTime, bool _bSynchronizeGroundBearing, bool _bSynchronizeGroundSpeed, bool _bSynchronizeGroundSpeedVertical, bool _bSynchronizeApparentBearing, bool _bSynchronizeApparentSpeed, bool _bSynchronizeApparentSpeedVertical, bool _bSynchronizeText)
Sets the synchronizazion flags.
void slotDataSkyView(const CDeviceDataSkyView &_roDeviceDataSkyView)
Slot to handle sky view data (sent by device)
bool bSynchronizeGroundSpeed
[Flag] Use this device/source to synchronize the vessel's ground horizontal speed
CVesselPointDevice(const QString &_rqsName, const QString &_rqsSourceName, bool _bDynamic=false)
CDevice * poDevice
Corresponding device's pointer.
bool bSynchronizeApparentSpeedVertical
[Flag] Use this device/source to synchronize the vessel's apparent vertical speed
void slotDataFix(const CDeviceDataFix &_roDeviceDataFix)
Slot to handle fix data (sent by device)
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves this object's content from the given QVCT source (file)
void disconnectDevice()
Disconnects from the actual device.
bool connectDevice()
Connects to the actual device.
bool bSynchronizeTime
[Flag] Use this device/source to synchronize the vessel's time
bool bSynchronizeApparentSpeed
[Flag] Use this device/source to synchronize the vessel's apparent horizontal speed
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores this object's content to the given QVCT destination (file)
virtual void showEdit()
Displays this object's edit widget/view.
bool bSynchronizeGroundBearing
[Flag] Use this device/source to synchronize the vessel's ground bearing
bool bSynchronizeApparentBearing
[Flag] Use this device/source to synchronize the vessel's apparent bearing
bool bSynchronizeText
[Flag] Use this device/source to synchronize the vessel's additional textual data string
void signalRefreshContent()
Signal emitted when views should refresh this object's corresponding content.
bool bSynchronizeGroundSpeedVertical
[Flag] Use this device/source to synchronize the vessel's ground vertical speed
[UI] Vessel overlay point (item) / vessel
bool isDynamic()
Returns whether the vessel is dynamically generated.
void onDeviceDataFix()
Handled changes triggered by child devices.
void setDopHorizontal(double _fdDopHorizontal)
Sets this vessel point's horizontal Dilution-of-Precision (HDOP)
void setComment(const QString &_rqsComment)
Sets this vessel's comment.
void setDopVertical(double _fdDopVertical)
Sets this vessel point's vertical Dilution-of-Precision (VDOP)
void setFixType(int _eFixType)
Sets this vessel point's fix type.
void setSatelliteCount(int _iSatelliteCount)
Sets this vessel point's satellite count.
static CVesselPointDeviceDetailView * useVesselPointDeviceDetailView()
static COverlayDetailView * useOverlayDetailView()
static CDeviceOverlay * useDeviceOverlay()
static COverlayListView * useOverlayListView()
static CChartTable * useChartTable()
static CSettings * useSettings()
static constexpr double RAD2DEG
Definition: QVCT.hpp:47
double microtime()
Returns the system time with microseconds resolution, in seconds.
Definition: main.cpp:30