Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CallbackBoundingRects Class Reference

Callback for computing the bounding rectangles of the screen and graph coordinates of the points in the Document. More...

#include <CallbackBoundingRects.h>

Collaboration diagram for CallbackBoundingRects:
Collaboration graph

Public Member Functions

 CallbackBoundingRects (DocumentAxesPointsRequired documentAxesPointsRequired, const Transformation &transformation)
 Single constructor.
 
QPointF boundingRectGraphMin (bool &isEmpty) const
 Graph coordinate bounding rectangle's (xmin,ymin) corner.
 
QPointF boundingRectGraphMax (bool &isEmpty) const
 Graph coordinate bounding rectangle's (xmax,ymax) corner.
 
QRectF boundingRectScreen (bool &isEmpty) const
 Screen coordinate bounding rectangle.
 
CallbackSearchReturn callback (const QString &curveName, const Point &point)
 Callback method.
 

Detailed Description

Callback for computing the bounding rectangles of the screen and graph coordinates of the points in the Document.

Definition at line 20 of file CallbackBoundingRects.h.

Constructor & Destructor Documentation

◆ CallbackBoundingRects()

CallbackBoundingRects::CallbackBoundingRects ( DocumentAxesPointsRequired documentAxesPointsRequired,
const Transformation & transformation )

Single constructor.

Definition at line 15 of file CallbackBoundingRects.cpp.

16 :
17 m_documentAxesPointsRequired (documentAxesPointsRequired),
18 m_isEmptyGraphX (true),
19 m_isEmptyGraphY (true),
20 m_isEmptyScreenX (true),
21 m_isEmptyScreenY (true),
22 m_transformation (transformation)
23{
24}

Member Function Documentation

◆ boundingRectGraphMax()

QPointF CallbackBoundingRects::boundingRectGraphMax ( bool & isEmpty) const

Graph coordinate bounding rectangle's (xmax,ymax) corner.

QRectF is not returned since it rounds off the smaller coordinates to zero when large dynamic ranges appear, and those zeros break the log scale algorithm

Definition at line 26 of file CallbackBoundingRects.cpp.

27{
28 // Need both X and Y before results are useful
29 isEmpty = m_isEmptyGraphX || m_isEmptyGraphY;
30
31 return m_boundingRectGraphMax;
32}
const int INNER_RADIUS_MIN

◆ boundingRectGraphMin()

QPointF CallbackBoundingRects::boundingRectGraphMin ( bool & isEmpty) const

Graph coordinate bounding rectangle's (xmin,ymin) corner.

QRectF is not returned since it rounds off the smaller coordinates to zero when large dynamic ranges appear, and those zeros break the log scale algorithm

Definition at line 34 of file CallbackBoundingRects.cpp.

35{
36 // Need both X and Y before results are useful
37 isEmpty = m_isEmptyGraphX || m_isEmptyGraphY;
38
39 return m_boundingRectGraphMin;
40}

◆ boundingRectScreen()

QRectF CallbackBoundingRects::boundingRectScreen ( bool & isEmpty) const

Screen coordinate bounding rectangle.

Definition at line 42 of file CallbackBoundingRects.cpp.

43{
44 // Need both X and Y before results are useful
45 isEmpty = m_isEmptyScreenX || m_isEmptyScreenY;
46
47 return QRectF (m_boundingRectScreenMin,
48 m_boundingRectScreenMax).normalized();
49}

◆ callback()

CallbackSearchReturn CallbackBoundingRects::callback ( const QString & curveName,
const Point & point )

Callback method.

Definition at line 51 of file CallbackBoundingRects.cpp.

53{
54 QPointF posGraph;
55 bool haveGraphX = true, haveGraphY = true;
56 if (curveName == AXIS_CURVE_NAME) {
57 posGraph = point.posGraph(); // Axis point has graph coordinates
58
59 haveGraphX = (m_documentAxesPointsRequired != DOCUMENT_AXES_POINTS_REQUIRED_4) || point.isXOnly();
60 haveGraphY = (m_documentAxesPointsRequired != DOCUMENT_AXES_POINTS_REQUIRED_4) || !point.isXOnly();
61
62 } else {
63 m_transformation.transformScreenToRawGraph (point.posScreen(),
64 posGraph); // Curve point has undefined graph coordinates, but they can be calculated
65 }
66
67 if (haveGraphX) {
68 mergeCoordinateX (posGraph,
69 m_boundingRectGraphMin,
70 m_boundingRectGraphMax,
71 m_isEmptyGraphX);
72 }
73 if (haveGraphY) {
74 mergeCoordinateY (posGraph,
75 m_boundingRectGraphMin,
76 m_boundingRectGraphMax,
77 m_isEmptyGraphY);
78 }
79 mergeCoordinateX (point.posScreen(),
80 m_boundingRectScreenMin,
81 m_boundingRectScreenMax,
82 m_isEmptyScreenX);
83 mergeCoordinateY (point.posScreen(),
84 m_boundingRectScreenMin,
85 m_boundingRectScreenMax,
86 m_isEmptyScreenY);
87
89}
const QString AXIS_CURVE_NAME
@ CALLBACK_SEARCH_RETURN_CONTINUE
Continue normal execution of the search.
@ DOCUMENT_AXES_POINTS_REQUIRED_4
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition Point.cpp:395
QPointF posScreen() const
Accessor for screen position.
Definition Point.cpp:404
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition Point.cpp:286
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

The documentation for this class was generated from the following files: