Qt Virtual Chart Table (QVCT)
CDeviceDataFix.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 // QT
20 #include <QString>
21 
22 // QVCT
24 
25 
26 //------------------------------------------------------------------------------
27 // CONSTANTS / STATIC
28 //------------------------------------------------------------------------------
29 
30 QString CDeviceDataFix::getTypeString( int _eType )
31 {
32  if( _eType == FIX_NONE ) return "none";
33  if( _eType & FIX_DGPS )
34  {
35  if( _eType & FIX_3D ) return "3D / DGPS";
36  if( _eType & FIX_2D ) return "2D / DGPS";
37  }
38  if( _eType & FIX_3D ) return "3D";
39  if( _eType & FIX_2D ) return "2D";
40  return "";
41 }
42 
43 
44 //------------------------------------------------------------------------------
45 // CONSTRUCTORS / DESTRUCTOR
46 //------------------------------------------------------------------------------
47 
48 CDeviceDataFix::CDeviceDataFix( const QString& _rqsSourceName, int _eType, double _fdTime )
49  : CDeviceDataSource( _rqsSourceName )
50  , CDataTime()
51  , CDataPosition()
52  , CDataCourse()
53  , CDeviceDataDop()
54  , eType( _eType )
55  , iSourcesSeen( 0 )
56  , iSourcesUsed( 0 )
57  , fdErrorTime( CDataValidity::UNDEFINED_VALUE )
58  , fdErrorHorizontal( CDataValidity::UNDEFINED_VALUE )
59  , fdErrorVertical( CDataValidity::UNDEFINED_VALUE )
60  , fdErrorBearing( CDataValidity::UNDEFINED_VALUE )
61  , fdErrorSpeed( CDataValidity::UNDEFINED_VALUE )
62  , fdErrorSpeedVertical( CDataValidity::UNDEFINED_VALUE )
63  , qsText()
64  , bCourseFromPosition( true )
65 {}
66 
67 
68 //------------------------------------------------------------------------------
69 // METHODS
70 //------------------------------------------------------------------------------
71 
72 void CDeviceDataFix::setFix( const CDeviceDataFix& _roDeviceDataFix, bool _bCopyTime, bool _bCopyPosition, bool _bCopyCourse, bool _bCopyDop )
73 {
74  if( _bCopyTime ) CDataTime::setTime( _roDeviceDataFix );
75  if( _bCopyPosition ) CDataPosition::setPosition( _roDeviceDataFix );
76  if( _bCopyCourse ) CDataCourse::setCourse( _roDeviceDataFix );
77  if( _bCopyDop ) CDeviceDataDop::setDop( _roDeviceDataFix );
78  eType = _roDeviceDataFix.eType;
79  iSourcesSeen = _roDeviceDataFix.iSourcesSeen;
80  iSourcesUsed = _roDeviceDataFix.iSourcesUsed;
81  fdErrorHorizontal = _roDeviceDataFix.fdErrorHorizontal;
82  fdErrorVertical = _roDeviceDataFix.fdErrorVertical;
83  fdErrorTime = _roDeviceDataFix.fdErrorTime;
84  fdErrorBearing = _roDeviceDataFix.fdErrorBearing;
85  fdErrorSpeed = _roDeviceDataFix.fdErrorSpeed;
86  fdErrorSpeedVertical = _roDeviceDataFix.fdErrorSpeedVertical;
87  qsText = _roDeviceDataFix.qsText;
88  bCourseFromPosition = _roDeviceDataFix.bCourseFromPosition;
89 }
90 
92 {
93  return getTypeString( eType );
94 }
(Geographical) Course data [bearing, horizontal/vertical speeds]
Definition: CDataCourse.hpp:34
void setCourse(double _fdBearing, double _fdSpeed, double _fdSpeedVertical=UNDEFINED_SPEED)
Sets course values.
Definition: CDataCourse.cpp:72
(Geographical) Position data [long,lat,elev]
void setPosition(double _fdLongitude, double _fdLatitude, double _fdElevation=UNDEFINED_ELEVATION)
Sets new coordinates.
Time data.
Definition: CDataTime.hpp:36
void setTime(double _fdTime)
Sets the time, in seconds from Unix epoch.
Definition: CDataTime.cpp:60
Generic data validity management class.
Dilution-of-Precision (DOP) data.
void setDop(const CDeviceDataDop &_roDeviceDataDop)
Sets (copy) the Dilution-of-Precision (HDOP, VDOP, TDOP) values from other DOP data.
Fix data [source,time,position,course,DOPs,...].
int eType
Fix type.
QString getTypeString() const
Returns the fix type as a human-friendly string.
double fdErrorSpeedVertical
Vertical speed error, in meters per second.
CDeviceDataFix(const QString &_rqsSourceName, int _eType=FIX_UNDEFINED, double _fdTime=CDataValidity::UNDEFINED_VALUE)
double fdErrorTime
Time error, in seconds.
int iSourcesSeen
Seen sources count (most likely satellites)
double fdErrorBearing
Bearing error, in degrees.
QString qsText
Additional textual data string.
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.
bool bCourseFromPosition
Use position to compute course.
int iSourcesUsed
Used sources count (most likely satellites)
double fdErrorVertical
Vertical position error, in meters.
double fdErrorHorizontal
Horizontal position error, in meters.
double fdErrorSpeed
Horizontal speed error, in meters per second.
Data source details [name,type].