Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
FormatCoordsUnitsStrategyAbstractBase Class Reference

Common methods for formatting strategies. More...

#include <FormatCoordsUnitsStrategyAbstractBase.h>

Inheritance diagram for FormatCoordsUnitsStrategyAbstractBase:
Inheritance graph
Collaboration diagram for FormatCoordsUnitsStrategyAbstractBase:
Collaboration graph

Public Member Functions

 FormatCoordsUnitsStrategyAbstractBase ()
 Single constructor.
 

Protected Member Functions

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

Common methods for formatting strategies.

Definition at line 14 of file FormatCoordsUnitsStrategyAbstractBase.h.

Constructor & Destructor Documentation

◆ FormatCoordsUnitsStrategyAbstractBase()

FormatCoordsUnitsStrategyAbstractBase::FormatCoordsUnitsStrategyAbstractBase ( )

Single constructor.

Definition at line 13 of file FormatCoordsUnitsStrategyAbstractBase.cpp.

14{
15}

Member Function Documentation

◆ precisionDigitsForRawNumber()

int FormatCoordsUnitsStrategyAbstractBase::precisionDigitsForRawNumber ( double valueUnformatted,
double valueUnformattedOther,
bool isXTheta,
const DocumentModelGeneral & modelGeneral,
const Transformation & transformation ) const
protected

Compute precision for outputting an unformatted value, consistent with the resolution at the point where that point lies.

This algorithm causes many digits to appear when a graph's dynamic range is relatively small (like -118.4 to -118.2 degrees in longitude), and fewer digits to appear when a graph's dynamic range is relatively large (like 0 to 100)

Definition at line 17 of file FormatCoordsUnitsStrategyAbstractBase.cpp.

22{
23 //LOG4CPP_DEBUG_S ((*mainCat)) << "FormatCoordsUnitsStrategyAbstractBase::precisionDigitsForRawNumber";
24
25 const double PIXEL_SHIFT = 1;
26 const int DEFAULT_PRECISION = 5; // Precision used before transformation is available. Equal or greater than x/y pixel counts
27
28 if (transformation.transformIsDefined()) {
29
30 // Measure the resolution if the point is moved some number of pixels in screen coordinates
31 QPointF posGraph;
32 if (isXTheta) {
33
34 posGraph = QPointF (valueUnformatted,
36
37 } else {
38
41
42 }
43
45
46 transformation.transformRawGraphToScreen (posGraph,
47 posScreen);
48
50
53
54 double xResolutionPerPixel = (posGraphShifted.x() - posGraph.x()) / PIXEL_SHIFT;
55 double yResolutionPerPixel = (posGraphShifted.y() - posGraph.y()) / PIXEL_SHIFT;
57
58 // Compute number of digits ahead of the decimal point (any single decimal place would work but the decimal point is easiest)
59 int powerValue = qFloor (qLn (qAbs (valueUnformatted)) / qLn (10.0));
61
63
64 return numberDigitsForResolution + 1; // Add one just to be safe
65
66 } else {
67
68 return DEFAULT_PRECISION;
69 }
70}
const int INNER_RADIUS_MIN
int extraPrecision() const
Get method for extra digits of precsion.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.

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