00001
00002
00003
00004
00005
00006
00007 #include "CallbackDocumentHash.h"
00008 #include "EngaugeAssert.h"
00009 #include "Logger.h"
00010 #include "Point.h"
00011 #include <QCryptographicHash>
00012 #include "QtToString.h"
00013 #include "Transformation.h"
00014
00015 CallbackDocumentHash::CallbackDocumentHash(DocumentAxesPointsRequired documentAxesPointsRequired) :
00016 m_documentAxesPointsRequired (documentAxesPointsRequired),
00017 m_documentHash (QCryptographicHash::Md5)
00018 {
00019 }
00020
00021 CallbackSearchReturn CallbackDocumentHash::callback (const QString &curveName,
00022 const Point &point)
00023 {
00024
00025
00026
00027
00028
00029 QString details;
00030
00031 details += curveName.toLatin1();
00032 details += " " + point.identifier ();
00033 details += " " + QPointFToString (point.posScreen());
00034
00035 if (point.hasOrdinal ()) {
00036 details += " " + QString::number (point.ordinal ());
00037 }
00038
00039 if (point.isAxisPoint()) {
00040
00041 if (m_documentAxesPointsRequired == DOCUMENT_AXES_POINTS_REQUIRED_3) {
00042
00043
00044 if (point.isXOnly()) {
00045
00046 details += " " + QString::number (point.posGraph().x());
00047
00048 } else {
00049
00050 details += " " + QString::number (point.posGraph().y());
00051
00052 }
00053
00054 } else {
00055
00056
00057 details += " " + QPointFToString (point.posGraph());
00058
00059 }
00060 }
00061
00062 LOG4CPP_DEBUG_S ((*mainCat)) << "CallbackDocumentHash::callback details=" << details.toLatin1().data();
00063
00064
00065 m_documentHash.addData (details.toLatin1());
00066
00067 return CALLBACK_SEARCH_RETURN_CONTINUE;
00068 }
00069
00070 DocumentHash CallbackDocumentHash::hash () const
00071 {
00072 return m_documentHash.result ();
00073 }