Qt Virtual Chart Table (QVCT)
CUnitPosition Class Reference

Geographical position unit (D,DM,DMS,RAD,GRAD) rendering/parsing class. More...

#include <units/CUnitPosition.hpp>

Public Types

enum  EUnit {
  DMS , DM , DEG , RAD ,
  GRAD , UNDEFINED
}
 Format/unit ID. More...
 
enum  EType { LONGITUDE , LATITUDE }
 Position coordinate type ID. More...
 

Static Public Member Functions

static const QMap< EUnit, QString > & symbols ()
 Returns the list of supported human-readable format/unit symbols. More...
 
static QString toSymbol (EUnit _eUnit)
 Returns the human-readable symbol corresponding to the given format/unit ID. More...
 
static EUnit fromSymbol (const QString &_rqsSymbol)
 Returns the format/unit ID corresponding to the given human-readable symbol. More...
 
static const QMap< EUnit, QString > & codes ()
 Returns the list of supported machine-friendly format/unit codes. More...
 
static QString toCode (EUnit _eUnit)
 Returns the machine-friendly code corresponding to the given format/unit ID. More...
 
static EUnit fromCode (const QString &_rqsCode)
 Returns the format/unit ID corresponding to the given machine-friendly code. More...
 
static QString toString (double _fdValue, EType _eType, EUnit _eUnit, int _iPrecision=0)
 Returns the formatted represention of the given value, using the specified format/unit and decimal precision. More...
 
static QString toString (double _fdValue, EType _eType)
 Returns the formatted represention of the given value, using the application settings. More...
 
static double fromString (const QString &_rqString, bool *_pbOK=0)
 Returns the numeric value corresponding (parsed) from the string. More...
 

Static Private Attributes

static const CUnitPositionSymbols oUnitPositionSymbols
 Container for supported human-readable format/unit symbols. More...
 
static const CUnitPositionCodes oUnitPositionCodes
 Container for supported machine-friendly format/unit codes. More...
 

Detailed Description

Geographical position unit (D,DM,DMS,RAD,GRAD) rendering/parsing class.

This class allows to render/parse geographical positions according to the various supported (and user specified) formats/units.

Author
Cedric Dufour http://cedric.dufour.name

Definition at line 37 of file CUnitPosition.hpp.

Member Enumeration Documentation

◆ EUnit

Format/unit ID.

Enumerator
DMS 

degrees, minutes, seconds

DM 

degrees, minutes

DEG 

degrees

RAD 

radians

GRAD 

grads

UNDEFINED 

undefined format/unit

Definition at line 46 of file CUnitPosition.hpp.

◆ EType

Position coordinate type ID.

Enumerator
LONGITUDE 
LATITUDE 

Definition at line 55 of file CUnitPosition.hpp.

Member Function Documentation

◆ symbols()

const QMap< CUnitPosition::EUnit, QString > & CUnitPosition::symbols ( )
static

Returns the list of supported human-readable format/unit symbols.

Definition at line 39 of file CUnitPosition.cpp.

◆ toSymbol()

QString CUnitPosition::toSymbol ( CUnitPosition::EUnit  _eUnit)
static

Returns the human-readable symbol corresponding to the given format/unit ID.

Definition at line 44 of file CUnitPosition.cpp.

◆ fromSymbol()

CUnitPosition::EUnit CUnitPosition::fromSymbol ( const QString &  _rqsSymbol)
static

Returns the format/unit ID corresponding to the given human-readable symbol.

Definition at line 49 of file CUnitPosition.cpp.

◆ codes()

const QMap< CUnitPosition::EUnit, QString > & CUnitPosition::codes ( )
static

Returns the list of supported machine-friendly format/unit codes.

Definition at line 54 of file CUnitPosition.cpp.

◆ toCode()

QString CUnitPosition::toCode ( CUnitPosition::EUnit  _eUnit)
static

Returns the machine-friendly code corresponding to the given format/unit ID.

Definition at line 59 of file CUnitPosition.cpp.

◆ fromCode()

CUnitPosition::EUnit CUnitPosition::fromCode ( const QString &  _rqsCode)
static

Returns the format/unit ID corresponding to the given machine-friendly code.

Definition at line 64 of file CUnitPosition.cpp.

◆ toString() [1/2]

QString CUnitPosition::toString ( double  _fdValue,
EType  _eType,
CUnitPosition::EUnit  _eUnit,
int  _iPrecision = 0 
)
static

Returns the formatted represention of the given value, using the specified format/unit and decimal precision.

Definition at line 69 of file CUnitPosition.cpp.

◆ toString() [2/2]

QString CUnitPosition::toString ( double  _fdValue,
EType  _eType 
)
static

Returns the formatted represention of the given value, using the application settings.

Definition at line 118 of file CUnitPosition.cpp.

◆ fromString()

double CUnitPosition::fromString ( const QString &  _rqString,
bool *  _pbOK = 0 
)
static

Returns the numeric value corresponding (parsed) from the string.

This methods will attempt to automatically detect the used format/unit. If the format/unit can not be determined, it will default to the (optionally) specified format/unit). The success of the parsing may be retrieved using the (optionally) supplied boolean flag.

Parameters
[in]_rqStringFormatted represention of the value
[out]_pbOKParsing success status

Definition at line 124 of file CUnitPosition.cpp.

Member Data Documentation

◆ oUnitPositionSymbols

const CUnitPositionSymbols CUnitPosition::oUnitPositionSymbols
staticprivate

Container for supported human-readable format/unit symbols.

Definition at line 62 of file CUnitPosition.hpp.

◆ oUnitPositionCodes

const CUnitPositionCodes CUnitPosition::oUnitPositionCodes
staticprivate

Container for supported machine-friendly format/unit codes.

Definition at line 64 of file CUnitPosition.hpp.


The documentation for this class was generated from the following files: