Engauge Digitizer  2
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. More...
 
QPointF boundingRectGraphMin (bool &isEmpty) const
 Graph coordinate bounding rectangle's (xmin,ymin) corner. More...
 
QPointF boundingRectGraphMax (bool &isEmpty) const
 Graph coordinate bounding rectangle's (xmax,ymax) corner. More...
 
QRectF boundingRectScreen (bool &isEmpty) const
 Screen coordinate bounding rectangle. More...
 
CallbackSearchReturn callback (const QString &curveName, const Point &point)
 Callback method. More...
 

Detailed Description

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

Definition at line 19 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 }

◆ 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 }

The documentation for this class was generated from the following files:
Point::isXOnly
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition: Point.cpp:286
AXIS_CURVE_NAME
const QString AXIS_CURVE_NAME
Point::posScreen
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
Point::posGraph
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:395
Transformation::transformScreenToRawGraph
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Definition: Transformation.cpp:453
CALLBACK_SEARCH_RETURN_CONTINUE
Continue normal execution of the search.
Definition: CallbackSearchReturn.h:21
DOCUMENT_AXES_POINTS_REQUIRED_4
Definition: DocumentAxesPointsRequired.h:14