Engauge Digitizer 2
Loading...
Searching...
No Matches
FormatCoordsUnitsStrategyPolarTheta Class Reference

Format conversions between unformatted and formatted for CoordUnitsStrategyPolarTheta. More...

#include <FormatCoordsUnitsStrategyPolarTheta.h>

Inheritance diagram for FormatCoordsUnitsStrategyPolarTheta:
Inheritance graph
Collaboration diagram for FormatCoordsUnitsStrategyPolarTheta:
Collaboration graph

Public Member Functions

 FormatCoordsUnitsStrategyPolarTheta ()
 Single constructor.
double formattedToUnformatted (const QString &string, const QLocale &locale, CoordUnitsPolarTheta coordUnits) const
 Convert formatted string to simple unformatted number.
QString unformattedToFormatted (double valueUnformatted, const QLocale &locale, CoordUnitsPolarTheta coordUnits, const DocumentModelGeneral &modelGeneral, const Transformation &transformation, double valueUnformattedOther) const
 Convert simple unformatted number to formatted string.
Public Member Functions inherited from FormatCoordsUnitsStrategyAbstractBase
 FormatCoordsUnitsStrategyAbstractBase ()
 Single constructor.

Additional Inherited Members

Protected Member Functions inherited from FormatCoordsUnitsStrategyAbstractBase
int precisionDigitsForRawNumber (double valueUnformatted, double valueUnformattedOther, bool isXTheta, const DocumentModelGeneral &modelGeneral, const Transformation &transformation) const
 Compute precision for outputting an unformatted value, consistent with the resolution at the point where that point lies.

Detailed Description

Format conversions between unformatted and formatted for CoordUnitsStrategyPolarTheta.

Definition at line 19 of file FormatCoordsUnitsStrategyPolarTheta.h.

Constructor & Destructor Documentation

◆ FormatCoordsUnitsStrategyPolarTheta()

FormatCoordsUnitsStrategyPolarTheta::FormatCoordsUnitsStrategyPolarTheta ( )

Single constructor.

Definition at line 14 of file FormatCoordsUnitsStrategyPolarTheta.cpp.

15{
16}

Member Function Documentation

◆ formattedToUnformatted()

double FormatCoordsUnitsStrategyPolarTheta::formattedToUnformatted ( const QString & string,
const QLocale & locale,
CoordUnitsPolarTheta coordUnits ) const

Convert formatted string to simple unformatted number.

Definition at line 18 of file FormatCoordsUnitsStrategyPolarTheta.cpp.

21{
22 //LOG4CPP_DEBUG_S ((*mainCat)) << "FormatCoordsUnitsStrategyPolarTheta::formattedToUnformatted";
23
24 double value;
25
26 switch (coordUnits) {
31 {
32 FormatDegreesMinutesSecondsPolarTheta format;
33 ENGAUGE_ASSERT (format.parseInput (string,
34 value) == QValidator::Acceptable);
35 }
36 break;
37
41 value = locale.toDouble (string);
42 break;
43
44 default:
45 LOG4CPP_ERROR_S ((*mainCat)) << "FormatCoordsUnitsStrategyPolarTheta::unformattedToFormattedStrategyPolarTheta";
46 ENGAUGE_ASSERT (false);
47 break;
48 }
49
50 return value;
51}
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
@ COORD_UNITS_POLAR_THETA_TURNS
@ COORD_UNITS_POLAR_THETA_RADIANS
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
@ COORD_UNITS_POLAR_THETA_DEGREES
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
@ COORD_UNITS_POLAR_THETA_GRADIANS
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
log4cpp::Category * mainCat
Definition Logger.cpp:14
QValidator::State parseInput(const QString &stringUntrimmed, double &value) const
Parse the input string into a number value.
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

◆ unformattedToFormatted()

QString FormatCoordsUnitsStrategyPolarTheta::unformattedToFormatted ( double valueUnformatted,
const QLocale & locale,
CoordUnitsPolarTheta coordUnits,
const DocumentModelGeneral & modelGeneral,
const Transformation & transformation,
double valueUnformattedOther ) const

Convert simple unformatted number to formatted string.

Definition at line 53 of file FormatCoordsUnitsStrategyPolarTheta.cpp.

59{
60 //LOG4CPP_DEBUG_S ((*mainCat)) << "FormatCoordsUnitsStrategyPolarTheta::unformattedToFormatted";
61
62 const char FORMAT ('g');
63 const bool IS_X_THETA = true;
64
65 QString valueFormatted;
66
67 switch (coordUnits) {
72 {
73 FormatDegreesMinutesSecondsPolarTheta format;
74 valueFormatted = format.formatOutput (coordUnits,
75 valueUnformatted,
77 }
78 break;
79
83 valueFormatted = locale.toString (valueUnformatted,
84 FORMAT,
85 precisionDigitsForRawNumber (valueUnformatted,
86 valueUnformattedOther,
88 modelGeneral,
89 transformation));
90 break;
91
92 default:
93 LOG4CPP_ERROR_S ((*mainCat)) << "FormatCoordsUnitsStrategyPolarTheta::unformattedToFormattedStrategyPolarTheta";
94 ENGAUGE_ASSERT (false);
95 break;
96 }
97
98 return valueFormatted;
99}
const bool IS_X_THETA
int precisionDigitsForRawNumber(double valueUnformatted, double valueUnformattedOther, bool isXTheta, const DocumentModelGeneral &modelGeneral, const Transformation &transformation) const
Compute precision for outputting an unformatted value, consistent with the resolution at the point wh...
QString formatOutput(CoordUnitsPolarTheta coordUnits, double value, bool isXTheta) const
Format the degrees/minutes/seconds value. Distinguishing x/theta versus y/radius is required for N/S/...

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