Engauge Digitizer  2
Public Member Functions | List of all members
CallbackDocumentHash Class Reference

Callback for DocumentHash value for a Document. More...

#include <CallbackDocumentHash.h>

Collaboration diagram for CallbackDocumentHash:
Collaboration graph

Public Member Functions

 CallbackDocumentHash (DocumentAxesPointsRequired documentAxesPointsRequired)
 Single constructor. More...
 
virtual ~CallbackDocumentHash ()
 
CallbackSearchReturn callback (const QString &curveName, const Point &point)
 Callback method. More...
 
DocumentHash hash () const
 Computed hash value. More...
 

Detailed Description

Callback for DocumentHash value for a Document.

Definition at line 19 of file CallbackDocumentHash.h.

Constructor & Destructor Documentation

◆ CallbackDocumentHash()

CallbackDocumentHash::CallbackDocumentHash ( DocumentAxesPointsRequired  documentAxesPointsRequired)

Single constructor.

Definition at line 15 of file CallbackDocumentHash.cpp.

15  :
16  m_documentAxesPointsRequired (documentAxesPointsRequired),
17  m_documentHash (QCryptographicHash::Md5)
18 {
19 }

◆ ~CallbackDocumentHash()

CallbackDocumentHash::~CallbackDocumentHash ( )
virtual

Definition at line 21 of file CallbackDocumentHash.cpp.

22 {
23 }

Member Function Documentation

◆ callback()

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

Callback method.

Definition at line 25 of file CallbackDocumentHash.cpp.

27 {
28  // LOG4CPP_DEBUG_S is below
29 
30  // Capture all important information about the point into the hash. A single string representing all of the point's details is
31  // created, which can be logged, and then that string is added to the hash
32 
33  QString details;
34 
35  details += curveName.toLatin1();
36  details += " " + point.identifier ();
37  details += " " + QPointFToString (point.posScreen());
38 
39  if (point.hasOrdinal ()) {
40  details += " " + QString::number (point.ordinal ());
41  }
42 
43  if (point.isAxisPoint()) {
44 
45  switch (m_documentAxesPointsRequired) {
47  // Axis point has same value for both coordinates so we chose one coordinate
48  details += " " + QString::number (point.posGraph().x());
49  break;
50 
52  // Axis point has two coordinates
53  details += " " + QPointFToString (point.posGraph());
54  break;
55 
57  // Axis point has one coordinate
58  if (point.isXOnly()) {
59 
60  details += " " + QString::number (point.posGraph().x());
61 
62  } else {
63 
64  details += " " + QString::number (point.posGraph().y());
65 
66  }
67  break;
68  }
69  }
70 
71  LOG4CPP_DEBUG_S ((*mainCat)) << "CallbackDocumentHash::callback details=" << details.toLatin1().data();
72 
73  // Add details to hash
74  m_documentHash.addData (details.toLatin1());
75 
77 }
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition: Point.cpp:286
bool isAxisPoint() const
True if point is an axis point. This is used only for sanity checks.
Definition: Point.cpp:281
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
Definition: Point.cpp:386
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
Continue normal execution of the search.
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
bool hasOrdinal() const
True if ordinal is defined.
Definition: Point.cpp:258
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:395
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ hash()

DocumentHash CallbackDocumentHash::hash ( ) const

Computed hash value.

Definition at line 79 of file CallbackDocumentHash.cpp.

80 {
81  return m_documentHash.result ();
82 }

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