7 #include "CallbackBoundingRects.h"
9 #include "DocumentModelCoords.h"
10 #include "DocumentModelGridDisplay.h"
11 #include "DocumentModelGridRemoval.h"
12 #include "GridLineLimiter.h"
13 #include "MainWindowModel.h"
15 #include "Transformation.h"
17 const int DEFAULT_MAXIMUM_GRID_LINES = 25;
23 QRectF GridLineLimiter::documentBounds (
const Document &document,
29 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
35 QRectF boundingRectGraph = ftor.boundingRectGraph(isEmpty);
37 return boundingRectGraph;
48 startX = modelGrid.
startX();
49 double stopX = modelGrid.
stopX();
50 stepX = modelGrid.
stepX();
55 bool needNewStep = (stepX <= 0);
57 double count = 1.0 + (stopX - startX) / stepX;
74 QRectF boundingRectGraph = documentBounds (document,
78 startX = boundingRectGraph.left ();
81 bool needNewStep = (stepX <= 1);
83 double count = 1.0 + (qLn (stopX) - qLn (startX)) / qLn (stepX);
90 stepX = qExp ((qLn (stopX) - qLn (startX)) / (modelMainWindow.
maximumGridLines() - 1));
104 startY = modelGrid.
startY();
105 double stopY = modelGrid.
stopY();
106 stepY = modelGrid.
stepY();
111 bool needNewStep = (stepY <= 0);
113 double count = 1.0 + (stopY - startY) / stepY;
130 QRectF boundingRectGraph = documentBounds (document,
134 startY = boundingRectGraph.top ();
137 bool needNewStep = (stepY <= 1);
139 double count = 1.0 + (qLn (stopY) - qLn (startY)) / qLn (stepY);
146 stepY = qExp ((qLn (stopY) - qLn (startY)) / (modelMainWindow.
maximumGridLines() - 1));
double stopX() const
Get method for x grid line upper bound (inclusive).
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
double stepX() const
Get method for x grid line increment.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
double startX() const
Get method for x grid line lower bound (inclusive).
int maximumGridLines() const
Maximum number of grid lines.
void limitForXTheta(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startX, double &stepX) const
Limit step value for x/theta coordinate. This is a noop if the maximum grid line limit in MainWindowM...
GridLineLimiter()
Single constructor.
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
Model for DlgSettingsMainWindow.
Model for DlgSettingsCoords and CmdSettingsCoords.
Storage of one imported image and the data attached to that image.
double stopY() const
Get method for y grid line upper bound (inclusive).
double startY() const
Get method for y grid line lower bound (inclusive).
void limitForYRadius(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startY, double &stepY) const
Limit step value for y/range coordinate. This is a noop if the maximum grid line limit in MainWindowM...
double stepY() const
Get method for y grid line increment.
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...