Engauge Digitizer  2
Public Member Functions | List of all members
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. More...
 
double formattedToUnformatted (const QString &string, const QLocale &locale, CoordUnitsPolarTheta coordUnits) const
 Convert formatted string to simple unformatted number. More...
 
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. More...
 
- Public Member Functions inherited from FormatCoordsUnitsStrategyAbstractBase
 FormatCoordsUnitsStrategyAbstractBase ()
 Single constructor. More...
 

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. More...
 

Detailed Description

Format conversions between unformatted and formatted for CoordUnitsStrategyPolarTheta.

Definition at line 18 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  {
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 }

◆ 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  {
74  valueFormatted = format.formatOutput (coordUnits,
75  valueUnformatted,
76  IS_X_THETA);
77  }
78  break;
79 
83  valueFormatted = locale.toString (valueUnformatted,
84  FORMAT,
85  precisionDigitsForRawNumber (valueUnformatted,
86  valueUnformattedOther,
87  IS_X_THETA,
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 }

The documentation for this class was generated from the following files:
COORD_UNITS_POLAR_THETA_TURNS
Definition: CoordUnitsPolarTheta.h:20
COORD_UNITS_POLAR_THETA_DEGREES
Definition: CoordUnitsPolarTheta.h:14
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
Definition: CoordUnitsPolarTheta.h:15
COORD_UNITS_POLAR_THETA_GRADIANS
Definition: CoordUnitsPolarTheta.h:18
LOG4CPP_ERROR_S
#define LOG4CPP_ERROR_S(logger)
Definition: convenience.h:12
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
Definition: CoordUnitsPolarTheta.h:16
FormatDegreesMinutesSecondsPolarTheta::formatOutput
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/...
Definition: FormatDegreesMinutesSecondsPolarTheta.cpp:20
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
COORD_UNITS_POLAR_THETA_RADIANS
Definition: CoordUnitsPolarTheta.h:19
FormatDegreesMinutesSecondsPolarTheta
Angular units according to CoordUnitsPolarTheta.
Definition: FormatDegreesMinutesSecondsPolarTheta.h:14
FormatDegreesMinutesSecondsBase::parseInput
QValidator::State parseInput(const QString &stringUntrimmed, double &value) const
Parse the input string into a number value.
Definition: FormatDegreesMinutesSecondsBase.cpp:86
COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
Definition: CoordUnitsPolarTheta.h:17
FormatCoordsUnitsStrategyAbstractBase::precisionDigitsForRawNumber
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...
Definition: FormatCoordsUnitsStrategyAbstractBase.cpp:16
IS_X_THETA
const bool IS_X_THETA
Definition: DlgEditPointAxis.cpp:36
ENGAUGE_ASSERT
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:19