Engauge Digitizer 2
Loading...
Searching...
No Matches
GridInitializer.h
Go to the documentation of this file.
1#ifndef GRID_INITIALIZER_H
2#define GRID_INITIALIZER_H
3
5#include <QRectF>
6
8class QSize;
9
10class Transformation;
11
14{
15 public:
18
20 int computeCount (bool linearAxis,
21 double start,
22 double stop,
23 double step) const;
24
26 double computeStart (bool linearAxis,
27 double stop,
28 double step,
29 int count) const;
30
32 double computeStep (bool linearAxis,
33 double start,
34 double stop,
35 int count) const;
36
38 double computeStop (bool linearAxis,
39 double start,
40 double step,
41 int count) const;
42
46 DocumentModelGridDisplay initializeWithNarrowCoverage (const QPointF &boundingRectGraphMin,
47 const QPointF &boundingRectGraphMax,
48 const DocumentModelCoords &modelCoords) const;
49
56 DocumentModelGridDisplay initializeWithWidePolarCoverage (const QPointF &boundingRectGraphMin,
57 const QPointF &boundingRectGraphMax,
58 const DocumentModelCoords &modelCoords,
59 const Transformation &transformation,
60 const QSize &imageSize) const;
61
63 int valuePower (double value) const;
64
65 private:
66
67 // Given the min and max values on an axis, this method picks start, delta and stop
68 // values that nicely bound the low and high values. Key in algorithm is to minimize
69 // number of significant digits in start, delta and stop
70 void axisScale (double xMin,
71 double xMax,
72 bool linearAxis,
73 double &xStart,
74 double &xStop,
75 double &xDelta,
76 int &count) const;
77
78 void overridePolarCoordinateSettings (const DocumentModelCoords &modelCoords,
79 const Transformation &transformation,
80 DocumentModelGridDisplay &modelGridDisplay,
81 const QSize &imageSize) const; // Adjust grid lines for polar coordinates
82 double roundOffToPower (double arg,
83 int roundOffPower) const;
84
85 const QRectF m_boundingRectGraph;
86};
87
88#endif // GRID_INITIALIZER_H
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
int valuePower(double value) const
Compute power of 10 for input value, rounding down to nearest integer solution of value>=10**solution...
double computeStep(bool linearAxis, double start, double stop, int count) const
Compute axis scale step from the other axis parameters.
double computeStart(bool linearAxis, double stop, double step, int count) const
Compute axis scale start from the other axis parameters.
int computeCount(bool linearAxis, double start, double stop, double step) const
Compute axis scale count from the other axis parameters.
GridInitializer()
Single constructor.
DocumentModelGridDisplay initializeWithNarrowCoverage(const QPointF &boundingRectGraphMin, const QPointF &boundingRectGraphMax, const DocumentModelCoords &modelCoords) const
Initialize given the boundaries of the graph coordinates.
DocumentModelGridDisplay initializeWithWidePolarCoverage(const QPointF &boundingRectGraphMin, const QPointF &boundingRectGraphMax, const DocumentModelCoords &modelCoords, const Transformation &transformation, const QSize &imageSize) const
Initialize given the boundaries of the graph coordinates, and then extra processing for polar coordin...
double computeStop(bool linearAxis, double start, double step, int count) const
Compute axis scale stop from the other axis parameters.
Affine transformation between screen and graph coordinates, based on digitized axis points.