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 = 100;
23 QRectF GridLineLimiter::documentBounds (
const Document &document,
29 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
37 return boundingRectGraph;
49 startX = modelGrid.
startX();
50 stopX = modelGrid.
stopX();
51 stepX = modelGrid.
stepX();
52 int countX = modelGrid.
countX();
64 countX = 1.0 + (stopX - startX) / stepX;
79 QRectF boundingRectGraph = documentBounds (document,
83 startX = boundingRectGraph.left ();
91 countX = 1.0 + (qLn (stopX) - qLn (startX)) / qLn (stepX);
97 stopX = qExp (qLn (startX) + qLn (stepX) * (modelMainWindow.
maximumGridLines() - 1));
111 startY = modelGrid.
startY();
112 stopY = modelGrid.
stopY();
113 stepY = modelGrid.
stepY();
114 int countY = modelGrid.
countY();
121 if (!needReduction) {
124 needReduction =
true;
126 countY = 1.0 + (stopY - startY) / stepY;
141 QRectF boundingRectGraph = documentBounds (document,
145 startY = boundingRectGraph.top ();
148 if (!needReduction) {
151 needReduction =
true;
153 countY = 1.0 + (qLn (stopY) - qLn (startY)) / qLn (stepY);
159 stopY = qExp (qLn (startY) + qLn (stepY) * (modelMainWindow.
maximumGridLines() - 1));
void limitForXTheta(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startX, double &stepX, double &stopX) const
Limit step value for x/theta coordinate. This is a noop if the maximum grid line limit in MainWindowM...
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
unsigned int countX() const
Get method for x grid line count.
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
unsigned int countY() const
Get method for y grid line count.
GridLineLimiter()
Single constructor.
Model for DlgSettingsMainWindow.
void limitForYRadius(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startY, double &stepY, double &stopY) const
Limit step value for y/range coordinate. This is a noop if the maximum grid line limit in MainWindowM...
int maximumGridLines() const
Maximum number of grid lines.
CoordScale coordScaleXTheta() const
Get method for linear/log scale on x/theta.
double stopY() const
Get method for y grid line upper bound (inclusive).
double stopX() const
Get method for x grid line upper bound (inclusive).
Model for DlgSettingsCoords and CmdSettingsCoords.
Storage of one imported image and the data attached to that image.
double startY() const
Get method for y grid line lower bound (inclusive).
CoordScale coordScaleYRadius() const
Get method for linear/log scale on y/radius.
QRectF boundingRectGraph(bool &isEmpty) const
Graph coordinate bounding rectangle.
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
double stepY() const
Get method for y grid line increment.
double startX() const
Get method for x grid line lower bound (inclusive).
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
double stepX() const
Get method for x grid line increment.