Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CallbackNextOrdinal.cpp
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2014 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 "CallbackNextOrdinal.h"
8 #include "Logger.h"
9 #include "Point.h"
10 #include <qmath.h>
11 
12 CallbackNextOrdinal::CallbackNextOrdinal(const QString &curveName) :
13  m_curveName (curveName),
14  m_maxOrdinalUsed (0)
15 {
16 }
17 
19  const Point &point)
20 {
21  if (curveName == m_curveName) {
22  if (point.ordinal() > m_maxOrdinalUsed) {
23  m_maxOrdinalUsed = point.ordinal();
24  }
25  }
26 
28 }
29 
31 {
32  int nextOrdinal = qFloor (m_maxOrdinalUsed) + 1;
33 
34  LOG4CPP_INFO_S ((*mainCat)) << "CallbackNextOrdinal::nextOrdinal"
35  << " ordinal=" << nextOrdinal;
36 
37  return nextOrdinal;
38 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
CallbackSearchReturn
Return values for search callback methods.
double nextOrdinal() const
Computed next ordinal.
Continue normal execution of the search.
CallbackNextOrdinal(const QString &curveName)
Single constructor.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
Definition: Point.cpp:386