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 void GridLineLimiter::documentBounds (
const Document &document,
25 QPointF &boundingRectMin,
26 QPointF &boundingRectMax)
const 32 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
38 boundingRectMin = ftor.boundingRectGraphMin (isEmpty);
39 boundingRectMax = ftor.boundingRectGraphMax (isEmpty);
51 startX = modelGrid.
startX();
52 stopX = modelGrid.
stopX();
53 stepX = modelGrid.
stepX();
54 int countX = signed (modelGrid.
countX());
66 countX = qFloor (1.0 + (stopX - startX) / stepX);
81 QPointF boundingRectGraphMin, boundingRectGraphMax;
82 documentBounds (document,
85 boundingRectGraphMax);
88 startX = boundingRectGraphMin.x ();
96 countX = qFloor (1.0 + (qLn (stopX) - qLn (startX)) / qLn (stepX));
102 stopX = qExp (qLn (startX) + qLn (stepX) * (modelMainWindow.
maximumGridLines() - 1));
116 startY = modelGrid.
startY();
117 stopY = modelGrid.
stopY();
118 stepY = modelGrid.
stepY();
119 int countY = signed (modelGrid.
countY());
126 if (!needReduction) {
129 needReduction =
true;
131 countY = qFloor (1.0 + (stopY - startY) / stepY);
146 QPointF boundingRectGraphMin, boundingRectGraphMax;
147 documentBounds (document,
149 boundingRectGraphMin,
150 boundingRectGraphMax);
153 startY = boundingRectGraphMin.y ();
156 if (!needReduction) {
159 needReduction =
true;
161 countY = qFloor (1.0 + (qLn (stopY) - qLn (startY)) / qLn (stepY));
167 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.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
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.
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.