1 #include "FormatCoordsUnitsStrategyAbstractBase.h"
4 #include "Transformation.h"
11 double valueUnformattedOther,
15 LOG4CPP_DEBUG_S ((*mainCat)) <<
"FormatCoordsUnitsStrategyAbstractBase::precisionDigitsForRawNumber";
17 const double PIXEL_SHIFT = 1;
23 posGraph = QPointF (valueUnformatted,
24 valueUnformattedOther);
28 posGraph = QPointF (valueUnformattedOther,
33 QPointF posScreen, posScreenShifted, posGraphShifted;
38 posScreenShifted = posScreen + QPointF (PIXEL_SHIFT, PIXEL_SHIFT);
43 double xResolutionPerPixel = (posGraphShifted.x() - posGraph.x()) / PIXEL_SHIFT;
44 double yResolutionPerPixel = (posGraphShifted.y() - posGraph.y()) / PIXEL_SHIFT;
45 double resolutionPerPixel = (isXTheta ? xResolutionPerPixel : yResolutionPerPixel);
48 int powerValue = qFloor (qLn (qAbs (valueUnformatted)) / qLn (10.0));
49 int powerResolution = qFloor (qLn (qAbs (resolutionPerPixel)) / qLn (10.0));
51 int numberDigitsForResolution = powerValue - powerResolution + 1;
53 return numberDigitsForResolution + 1;