00001
00002
00003
00004
00005
00006
00007 #include "CallbackScaleBar.h"
00008 #include "Curve.h"
00009 #include "DocumentModelExportFormat.h"
00010 #include "ExportAlignLinear.h"
00011 #include "ExportAlignLog.h"
00012 #include "ExportLayoutFunctions.h"
00013 #include "ExportPointsSelectionFunctions.h"
00014 #include "Logger.h"
00015 #include "Point.h"
00016
00017 CallbackScaleBar::CallbackScaleBar() :
00018 m_scaleBarLength (0)
00019 {
00020 }
00021
00022 QStringList CallbackScaleBar::axisCurvePointIdentifiers () const
00023 {
00024 return m_axisCurvePointIdentifiers;
00025 }
00026
00027 CallbackSearchReturn CallbackScaleBar::callback (const QString &curveName,
00028 const Point &point)
00029 {
00030 LOG4CPP_DEBUG_S ((*mainCat)) << "CallbackScaleBar::callback"
00031 << " curveName=" << curveName.toLatin1().data()
00032 << " point=" << point.identifier().toLatin1().data();
00033
00034 if (curveName == AXIS_CURVE_NAME) {
00035
00036 bool isNonzeroX = (point.posGraph ().x () != 0);
00037 bool isNonzeroY = (point.posGraph ().y () != 0);
00038
00039 if (isNonzeroX || isNonzeroY) {
00040
00041 m_scaleBarPointIdentifier = point.identifier ();
00042 m_scaleBarLength = (isNonzeroX ?
00043 point.posGraph ().x () :
00044 point.posGraph ().y ());
00045 }
00046
00047 m_axisCurvePointIdentifiers << point.identifier ();
00048 }
00049
00050 return CALLBACK_SEARCH_RETURN_CONTINUE;
00051 }
00052
00053 double CallbackScaleBar::scaleBarLength () const
00054 {
00055 return m_scaleBarLength;
00056 }
00057
00058 QString CallbackScaleBar::scaleBarPointIdentifier () const
00059 {
00060 LOG4CPP_INFO_S ((*mainCat)) << "CallbackScaleBar::scaleBarPointIdentifier";
00061
00062 return m_scaleBarPointIdentifier;
00063 }