Engauge Digitizer 2
Loading...
Searching...
No Matches
CallbackScaleBar.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2017 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "CallbackScaleBar.h"
8#include "Curve.h"
10#include "ExportAlignLinear.h"
11#include "ExportAlignLog.h"
14#include "Logger.h"
15#include "Point.h"
16
18 m_scaleBarLength (0)
19{
20}
21
23{
24 return m_axisCurvePointIdentifiers;
25}
26
28 const Point &point)
29{
30 LOG4CPP_DEBUG_S ((*mainCat)) << "CallbackScaleBar::callback"
31 << " curveName=" << curveName.toLatin1().data()
32 << " point=" << point.identifier().toLatin1().data();
33
34 if (curveName == AXIS_CURVE_NAME) {
35
36 bool isNonzeroX = (qAbs (point.posGraph ().x ()) > 0);
37 bool isNonzeroY = (qAbs (point.posGraph ().y ()) > 0);
38
39 if (isNonzeroX || isNonzeroY) {
40
41 m_scaleBarPointIdentifier = point.identifier ();
42 m_scaleBarLength = (isNonzeroX ?
43 point.posGraph ().x () :
44 point.posGraph ().y ());
45 }
46
47 m_axisCurvePointIdentifiers << point.identifier ();
48 }
49
51}
52
54{
55 return m_scaleBarLength;
56}
57
59{
60 LOG4CPP_INFO_S ((*mainCat)) << "CallbackScaleBar::scaleBarPointIdentifier";
61
62 return m_scaleBarPointIdentifier;
63}
const QString AXIS_CURVE_NAME
CallbackSearchReturn
Return values for search callback methods.
@ CALLBACK_SEARCH_RETURN_CONTINUE
Continue normal execution of the search.
log4cpp::Category * mainCat
Definition Logger.cpp:14
QString scaleBarPointIdentifier() const
Identified axis point.
CallbackScaleBar()
Single constructor.
double scaleBarLength() const
Length of scale bar.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
QStringList axisCurvePointIdentifiers() const
Points in axis curve.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition Point.cpp:395
QString identifier() const
Unique identifier for a specific Point.
Definition Point.cpp:268
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20