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

Class that represents one digitized point. The screen-to-graph coordinate transformation is always external to this class. More...

#include <Point.h>

Collaboration diagram for Point:
Collaboration graph

Public Member Functions

 Point ()
 Default constructor so this class can be used inside a container. More...
 
 Point (const QString &curveName, const QPointF &posScreen)
 Constructor for Checker temporary points, before real point gets added. More...
 
 Point (const QString &curveName, const QPointF &posScreen, const QPointF &posGraph, bool isXOnly)
 Constructor for temporary point used to pre-check transformation points, before real point gets added. More...
 
 Point (const QString &curveName, const QString &identifier, const QPointF &posScreen, const QPointF &posGraph, double ordinal, bool isXOnly)
 Constructor for axis points with identifier (after redo). The position, in screen coordinates, applies to the center of the Point. More...
 
 Point (const QString &curveName, const QPointF &posScreen, const QPointF &posGraph, double ordinal, bool isXOnly)
 Constructor for axis points without identifier (after redo). The position, in screen coordinates, applies to the center of the Point. More...
 
 Point (const QString &curveName, const QString &identifier, const QPointF &posScreen, double ordinal)
 Constructor for graph points with identifier (after redo) More...
 
 Point (const QString &curveName, const QPointF &posScreen, double ordinal)
 Constructor for graph points without identifier (after redo) More...
 
 Point (QXmlStreamReader &reader)
 Constructor when loading from serialized xml. More...
 
Pointoperator= (const Point &point)
 Assignment constructor. More...
 
 Point (const Point &point)
 Copy constructor. More...
 
bool hasOrdinal () const
 True if ordinal is defined. More...
 
bool hasPosGraph () const
 True if graph position is defined. More...
 
QString identifier () const
 Unique identifier for a specific Point. More...
 
bool isXOnly () const
 In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined. More...
 
bool isAxisPoint () const
 True if point is an axis point. This is used only for sanity checks. More...
 
double ordinal (ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
 Get method for ordinal. Skip check if copying one instance to another. More...
 
QPointF posGraph (ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
 Accessor for graph position. Skip check if copying one instance to another. More...
 
QPointF posScreen () const
 Accessor for screen position. More...
 
void printStream (QString indentation, QTextStream &str) const
 Debugging method that supports print method of this class and printStream method of some other class(es) More...
 
void saveXml (QXmlStreamWriter &writer) const
 Serialize to stream. More...
 
void setCurveName (const QString &curveName)
 Update the point identifer to match the specified curve name. More...
 
void setOrdinal (double ordinal)
 Set the ordinal used for ordering Points. More...
 
void setPosGraph (const QPointF &posGraph)
 Set method for position in graph coordinates. More...
 
void setPosScreen (const QPointF &posScreen)
 Set method for position in screen coordinates. More...
 

Static Public Member Functions

static QString curveNameFromPointIdentifier (const QString &pointIdentifier)
 Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierGenerator. More...
 
static unsigned int identifierIndex ()
 Return the current index for storage in case we need to reset it later while performing a Redo. More...
 
static void setIdentifierIndex (unsigned int identifierIndex)
 Reset the current index while performing a Redo. More...
 
static QString temporaryPointIdentifier ()
 Point identifier for temporary point that is used by DigitzeStateAxis. More...
 
static double UNDEFINED_ORDINAL ()
 Get method for undefined ordinal constant. More...
 

Detailed Description

Class that represents one digitized point. The screen-to-graph coordinate transformation is always external to this class.

Definition at line 25 of file Point.h.

Constructor & Destructor Documentation

◆ Point() [1/9]

Point::Point ( )

Default constructor so this class can be used inside a container.

Definition at line 29 of file Point.cpp.

30 {
31 }

◆ Point() [2/9]

Point::Point ( const QString &  curveName,
const QPointF &  posScreen 
)

Constructor for Checker temporary points, before real point gets added.

The position, in screen coordinates, applies to the center of the Point

Definition at line 33 of file Point.cpp.

34  :
35  m_isAxisPoint (curveName == AXIS_CURVE_NAME),
36  m_identifier (uniqueIdentifierGenerator(curveName)),
37  m_posScreen (posScreen),
38  m_hasPosGraph (false),
40  m_hasOrdinal (false),
41  m_ordinal (MISSING_ORDINAL_VALUE),
42  m_isXOnly (false)
43 {
44  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point"
45  << " curveName=" << curveName.toLatin1().data()
46  << " identifierGenerated=" << m_identifier.toLatin1().data()
47  << " posScreen=" << QPointFToString (posScreen).toLatin1().data();
48 
49  ENGAUGE_ASSERT (!curveName.isEmpty ());
50 }
const double MISSING_POSGRAPH_VALUE
Definition: Point.cpp:27
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
const double MISSING_ORDINAL_VALUE
Definition: Point.cpp:26
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [3/9]

Point::Point ( const QString &  curveName,
const QPointF &  posScreen,
const QPointF &  posGraph,
bool  isXOnly 
)

Constructor for temporary point used to pre-check transformation points, before real point gets added.

The position, in screen coordinates, applies to the center of the Point

Definition at line 52 of file Point.cpp.

55  :
56  m_isAxisPoint (true),
57  m_identifier (uniqueIdentifierGenerator(curveName)),
58  m_posScreen (posScreen),
59  m_hasPosGraph (true),
60  m_posGraph (posGraph),
61  m_hasOrdinal (false),
62  m_ordinal (MISSING_ORDINAL_VALUE),
63  m_isXOnly (isXOnly)
64 {
65  ENGAUGE_ASSERT (curveName == AXIS_CURVE_NAME ||
66  curveName == DUMMY_CURVE_NAME);
67 
68  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point"
69  << " curveName=" << curveName.toLatin1().data()
70  << " identifierGenerated=" << m_identifier.toLatin1().data()
71  << " posScreen=" << QPointFToString (posScreen).toLatin1().data()
72  << " posGraph=" << QPointFToString (posGraph).toLatin1().data()
73  << " isXOnly=" << (isXOnly ? "true" : "false");
74 
75  ENGAUGE_ASSERT (!curveName.isEmpty ());
76 }
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition: Point.cpp:286
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
const double MISSING_ORDINAL_VALUE
Definition: Point.cpp: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
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DUMMY_CURVE_NAME
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [4/9]

Point::Point ( const QString &  curveName,
const QString &  identifier,
const QPointF &  posScreen,
const QPointF &  posGraph,
double  ordinal,
bool  isXOnly 
)

Constructor for axis points with identifier (after redo). The position, in screen coordinates, applies to the center of the Point.

Definition at line 78 of file Point.cpp.

83  :
84  m_isAxisPoint (true),
85  m_identifier (identifier),
86  m_posScreen (posScreen),
87  m_hasPosGraph (true),
88  m_posGraph (posGraph),
89  m_hasOrdinal (true),
90  m_ordinal (ordinal),
91  m_isXOnly (isXOnly)
92 {
93  ENGAUGE_ASSERT (curveName == AXIS_CURVE_NAME);
94 
95  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point"
96  << " curveName=" << curveName.toLatin1().data()
97  << " identifier=" << m_identifier.toLatin1().data()
98  << " posScreen=" << QPointFToString (posScreen).toLatin1().data()
99  << " posGraph=" << QPointFToString (posGraph).toLatin1().data()
100  << " ordinal=" << ordinal
101  << " isXOnly=" << (isXOnly ? "true" : "false");
102 
103  ENGAUGE_ASSERT (!curveName.isEmpty ());
104 }
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition: Point.cpp:286
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
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:395
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [5/9]

Point::Point ( const QString &  curveName,
const QPointF &  posScreen,
const QPointF &  posGraph,
double  ordinal,
bool  isXOnly 
)

Constructor for axis points without identifier (after redo). The position, in screen coordinates, applies to the center of the Point.

Definition at line 106 of file Point.cpp.

110  :
111  m_isAxisPoint (true),
112  m_identifier (uniqueIdentifierGenerator(curveName)),
113  m_posScreen (posScreen),
114  m_hasPosGraph (true),
115  m_posGraph (posGraph),
116  m_hasOrdinal (true),
117  m_ordinal (ordinal),
118  m_isXOnly (isXOnly)
119 {
120  ENGAUGE_ASSERT (curveName == AXIS_CURVE_NAME);
121 
122  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point"
123  << " curveName=" << curveName.toLatin1().data()
124  << " identifierGenerated=" << m_identifier.toLatin1().data()
125  << " posScreen=" << QPointFToString (posScreen).toLatin1().data()
126  << " posGraph=" << QPointFToString (posGraph).toLatin1().data()
127  << " ordinal=" << ordinal
128  << " isXOnly=" << (isXOnly ? "true" : "false");
129 
130  ENGAUGE_ASSERT (!curveName.isEmpty ());
131 }
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.
Definition: Point.cpp:286
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
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:395
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [6/9]

Point::Point ( const QString &  curveName,
const QString &  identifier,
const QPointF &  posScreen,
double  ordinal 
)

Constructor for graph points with identifier (after redo)

Definition at line 133 of file Point.cpp.

136  :
137  m_isAxisPoint (false),
138  m_identifier (identifier),
139  m_posScreen (posScreen),
140  m_hasPosGraph (false),
142  m_hasOrdinal (true),
143  m_ordinal (ordinal),
144  m_isXOnly (false)
145 {
146  ENGAUGE_ASSERT (curveName != AXIS_CURVE_NAME);
147 
148  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point"
149  << " curveName=" << curveName.toLatin1().data()
150  << " identifier=" << identifier.toLatin1().data()
151  << " posScreen=" << QPointFToString (posScreen).toLatin1().data()
152  << " ordinal=" << ordinal;
153 
154  ENGAUGE_ASSERT (!curveName.isEmpty ());
155 }
const double MISSING_POSGRAPH_VALUE
Definition: Point.cpp:27
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
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [7/9]

Point::Point ( const QString &  curveName,
const QPointF &  posScreen,
double  ordinal 
)

Constructor for graph points without identifier (after redo)

Definition at line 157 of file Point.cpp.

159  :
160  m_isAxisPoint (false),
161  m_identifier (uniqueIdentifierGenerator(curveName)),
162  m_posScreen (posScreen),
163  m_hasPosGraph (false),
165  m_hasOrdinal (true),
166  m_ordinal (ordinal),
167  m_isXOnly (false)
168 {
169  ENGAUGE_ASSERT (curveName != AXIS_CURVE_NAME);
170 
171  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point(identifier,posScreen,posGraph,ordinal)"
172  << " identifierGenerated=" << m_identifier.toLatin1().data()
173  << " posScreen=" << QPointFToString (posScreen).toLatin1().data()
174  << " ordinal=" << ordinal;
175 }
const double MISSING_POSGRAPH_VALUE
Definition: Point.cpp:27
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
const QString AXIS_CURVE_NAME
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ Point() [8/9]

Point::Point ( QXmlStreamReader &  reader)

Constructor when loading from serialized xml.

Definition at line 177 of file Point.cpp.

178 {
179  loadXml(reader);
180 }

◆ Point() [9/9]

Point::Point ( const Point point)

Copy constructor.

Definition at line 182 of file Point.cpp.

183 {
184  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::Point(const Point &other)"
185  << " isAxisPoint=" << (other.isAxisPoint() ? "true" : "false")
186  << " identifier=" << other.identifier ().toLatin1().data()
187  << " posScreen=" << QPointFToString (other.posScreen ()).toLatin1().data()
188  << " hasPosGraph=" << (other.hasPosGraph() ? "true" : "false")
189  << " posGraph=" << QPointFToString (other.posGraph (SKIP_HAS_CHECK)).toLatin1().data()
190  << " hasOrdinal=" << (other.hasOrdinal() ? "true" : "false")
191  << " ordinal=" << other.ordinal (SKIP_HAS_CHECK)
192  << " isXOnly=" << other.isXOnly ();
193 
194  m_isAxisPoint = other.isAxisPoint ();
195  m_identifier = other.identifier ();
196  m_posScreen = other.posScreen ();
197  m_hasPosGraph = other.hasPosGraph ();
198  m_posGraph = other.posGraph (SKIP_HAS_CHECK);
199  m_hasOrdinal = other.hasOrdinal ();
200  m_ordinal = other.ordinal (SKIP_HAS_CHECK);
201  m_isXOnly = other.isXOnly ();
202 }
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

Member Function Documentation

◆ curveNameFromPointIdentifier()

QString Point::curveNameFromPointIdentifier ( const QString &  pointIdentifier)
static

Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierGenerator.

Definition at line 227 of file Point.cpp.

228 {
229  QStringList tokens;
230 
231  if (pointIdentifier.contains (POINT_IDENTIFIER_DELIMITER_SAFE)) {
232 
233  tokens = pointIdentifier.split (POINT_IDENTIFIER_DELIMITER_SAFE);
234 
235  } else {
236 
237  // Yes, this is a hack - underscores could have been inserted by user (in the curve name) and/or this source code,
238  // but there are many dig files laying around that have underscores so we need to support them
239  tokens = pointIdentifier.split (POINT_IDENTIFIER_DELIMITER_XML);
240 
241  }
242 
243  return tokens.value (0);
244 }
const QString POINT_IDENTIFIER_DELIMITER_XML("_")
const QString POINT_IDENTIFIER_DELIMITER_SAFE("\t")

◆ hasOrdinal()

bool Point::hasOrdinal ( ) const

True if ordinal is defined.

Definition at line 258 of file Point.cpp.

259 {
260  return m_hasOrdinal;
261 }

◆ hasPosGraph()

bool Point::hasPosGraph ( ) const

True if graph position is defined.

Definition at line 263 of file Point.cpp.

264 {
265  return m_hasPosGraph;
266 }

◆ identifier()

QString Point::identifier ( ) const

Unique identifier for a specific Point.

Definition at line 268 of file Point.cpp.

269 {
270  return m_identifier;
271 }

◆ identifierIndex()

unsigned int Point::identifierIndex ( )
static

Return the current index for storage in case we need to reset it later while performing a Redo.

Definition at line 273 of file Point.cpp.

274 {
275  LOG4CPP_INFO_S ((*mainCat)) << "Point::identifierIndex"
276  << " identifierIndex=" << m_identifierIndex;
277 
278  return m_identifierIndex;
279 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ isAxisPoint()

bool Point::isAxisPoint ( ) const

True if point is an axis point. This is used only for sanity checks.

Definition at line 281 of file Point.cpp.

282 {
283  return m_isAxisPoint;
284 }

◆ isXOnly()

bool Point::isXOnly ( ) const

In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined.

Definition at line 286 of file Point.cpp.

287 {
288  return m_isXOnly;
289 }

◆ operator=()

Point & Point::operator= ( const Point point)

Assignment constructor.

Definition at line 204 of file Point.cpp.

205 {
206  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::operator="
207  << " isAxisPoint=" << (point.isAxisPoint() ? "true" : "false")
208  << " identifier=" << point.identifier ().toLatin1().data()
209  << " posScreen=" << QPointFToString (point.posScreen ()).toLatin1().data()
210  << " hasPosGraph=" << (point.hasPosGraph() ? "true" : "false")
211  << " posGraph=" << QPointFToString (point.posGraph (SKIP_HAS_CHECK)).toLatin1().data()
212  << " hasOrdinal=" << (point.hasOrdinal() ? "true" : "false")
213  << " ordinal=" << point.ordinal (SKIP_HAS_CHECK);
214 
215  m_isAxisPoint = point.isAxisPoint ();
216  m_identifier = point.identifier ();
217  m_posScreen = point.posScreen ();
218  m_hasPosGraph = point.hasPosGraph ();
219  m_posGraph = point.posGraph (SKIP_HAS_CHECK);
220  m_hasOrdinal = point.hasOrdinal ();
221  m_ordinal = point.ordinal (SKIP_HAS_CHECK);
222  m_isXOnly = point.isXOnly ();
223 
224  return *this;
225 }
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
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
bool hasPosGraph() const
True if graph position is defined.
Definition: Point.cpp:263
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ ordinal()

double Point::ordinal ( ApplyHasCheck  applyHasCheck = KEEP_HAS_CHECK) const

Get method for ordinal. Skip check if copying one instance to another.

Definition at line 386 of file Point.cpp.

387 {
388  if (applyHasCheck == KEEP_HAS_CHECK) {
389  ENGAUGE_ASSERT (m_hasOrdinal);
390  }
391 
392  return m_ordinal;
393 }
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20

◆ posGraph()

QPointF Point::posGraph ( ApplyHasCheck  applyHasCheck = KEEP_HAS_CHECK) const

Accessor for graph position. Skip check if copying one instance to another.

Definition at line 395 of file Point.cpp.

396 {
397  if (applyHasCheck == KEEP_HAS_CHECK) {
398  ENGAUGE_ASSERT (m_hasPosGraph);
399  }
400 
401  return m_posGraph;
402 }
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20

◆ posScreen()

QPointF Point::posScreen ( ) const

Accessor for screen position.

Definition at line 404 of file Point.cpp.

405 {
406  return m_posScreen;
407 }

◆ printStream()

void Point::printStream ( QString  indentation,
QTextStream &  str 
) const

Debugging method that supports print method of this class and printStream method of some other class(es)

Definition at line 409 of file Point.cpp.

411 {
412  const QString UNDEFINED ("undefined");
413 
414  str << indentation << "Point\n";
415 
416  indentation += INDENTATION_DELTA;
417 
418  str << indentation << "identifier=" << m_identifier << "\n";
419  str << indentation << "posScreen=" << QPointFToString (m_posScreen) << "\n";
420  if (m_hasPosGraph) {
421  str << indentation << "posGraph=" << QPointFToString (m_posGraph) << "\n";
422  } else {
423  str << indentation << "posGraph=" << UNDEFINED << "\n";
424  }
425  if (m_hasOrdinal) {
426  str << indentation << "ordinal=" << m_ordinal << "\n";
427  } else {
428  str << indentation << "ordinal=" << UNDEFINED << "\n";
429  }
430 }
const QString INDENTATION_DELTA
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17

◆ saveXml()

void Point::saveXml ( QXmlStreamWriter &  writer) const

Serialize to stream.

Definition at line 432 of file Point.cpp.

433 {
434  LOG4CPP_INFO_S ((*mainCat)) << "Point::saveXml";
435 
436  writer.writeStartElement(DOCUMENT_SERIALIZE_POINT);
437  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_IDENTIFIER, m_identifier);
438  if (m_hasOrdinal) {
439  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_ORDINAL, QString::number (m_ordinal));
440  }
441  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_IS_AXIS_POINT,
443  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_IS_X_ONLY,
445 
446  // Variable m_identifierIndex is static, but for simplicity this is handled like other values. Those values are all
447  // the same, but simplicity wins over a few extra bytes of storage
448  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_IDENTIFIER_INDEX, QString::number (m_identifierIndex));
449 
450  writer.writeStartElement(DOCUMENT_SERIALIZE_POINT_POSITION_SCREEN);
451  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_X, QString::number (m_posScreen.x()));
452  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_Y, QString::number (m_posScreen.y()));
453  writer.writeEndElement();
454 
455  if (m_hasPosGraph) {
456 
457  // For time coordinates, many digits of precision are needed since a typical date is 1,246,870,000 = July 6, 2009
458  // and we want seconds of precision
459  const char FORMAT = 'g';
460  const int PRECISION = 16;
461 
462  writer.writeStartElement(DOCUMENT_SERIALIZE_POINT_POSITION_GRAPH);
463  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_X, QString::number (m_posGraph.x(), FORMAT, PRECISION));
464  writer.writeAttribute(DOCUMENT_SERIALIZE_POINT_Y, QString::number (m_posGraph.y(), FORMAT, PRECISION));
465  writer.writeEndElement();
466  }
467 
468  writer.writeEndElement();
469 }
const QString DOCUMENT_SERIALIZE_POINT_ORDINAL
const QString DOCUMENT_SERIALIZE_POINT
const QString DOCUMENT_SERIALIZE_POINT_POSITION_SCREEN
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
const QString DOCUMENT_SERIALIZE_POINT_X
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
const QString DOCUMENT_SERIALIZE_POINT_Y
const QString DOCUMENT_SERIALIZE_POINT_IS_X_ONLY
const QString DOCUMENT_SERIALIZE_POINT_IS_AXIS_POINT
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_POINT_IDENTIFIER
const QString DOCUMENT_SERIALIZE_POINT_POSITION_GRAPH
const QString DOCUMENT_SERIALIZE_POINT_IDENTIFIER_INDEX

◆ setCurveName()

void Point::setCurveName ( const QString &  curveName)

Update the point identifer to match the specified curve name.

Definition at line 471 of file Point.cpp.

472 {
473  // Replace the old curve name at the start of the string
474  QString curveNameOld = Point::curveNameFromPointIdentifier (m_identifier);
475  m_identifier = curveNameNew + m_identifier.mid (curveNameOld.length());
476 }
static QString curveNameFromPointIdentifier(const QString &pointIdentifier)
Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierG...
Definition: Point.cpp:227

◆ setIdentifierIndex()

void Point::setIdentifierIndex ( unsigned int  identifierIndex)
static

Reset the current index while performing a Redo.

Definition at line 478 of file Point.cpp.

479 {
480  LOG4CPP_INFO_S ((*mainCat)) << "Point::setIdentifierIndex"
481  << " identifierIndex=" << identifierIndex;
482 
483  m_identifierIndex = identifierIndex;
484 }
static unsigned int identifierIndex()
Return the current index for storage in case we need to reset it later while performing a Redo.
Definition: Point.cpp:273
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ setOrdinal()

void Point::setOrdinal ( double  ordinal)

Set the ordinal used for ordering Points.

Definition at line 486 of file Point.cpp.

487 {
488  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::setOrdinal"
489  << " identifier=" << m_identifier.toLatin1().data()
490  << " ordinal=" << ordinal;
491 
492  m_hasOrdinal = true;
493  m_ordinal = ordinal;
494 }
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
Definition: Point.cpp:386
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ setPosGraph()

void Point::setPosGraph ( const QPointF &  posGraph)

Set method for position in graph coordinates.

Definition at line 496 of file Point.cpp.

497 {
498  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::setPosGraph"
499  << " identifier=" << m_identifier.toLatin1().data()
500  << " posGraph=" << QPointFToString(posGraph).toLatin1().data();
501 
502  // Curve point graph coordinates should always be computed on the fly versus stored in this class, to reduce the
503  // chances for stale information
504  ENGAUGE_ASSERT (m_isAxisPoint);
505 
506  m_hasPosGraph = true;
507  m_posGraph = posGraph;
508 }
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
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 ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ setPosScreen()

void Point::setPosScreen ( const QPointF &  posScreen)

Set method for position in screen coordinates.

Definition at line 510 of file Point.cpp.

511 {
512  LOG4CPP_DEBUG_S ((*mainCat)) << "Point::setPosScreen"
513  << " identifier=" << m_identifier.toLatin1().data()
514  << " posScreen=" << QPointFToString(posScreen).toLatin1().data();
515 
516  m_posScreen = posScreen;
517 }
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20

◆ temporaryPointIdentifier()

QString Point::temporaryPointIdentifier ( )
static

Point identifier for temporary point that is used by DigitzeStateAxis.

Definition at line 519 of file Point.cpp.

520 {
521  return QString ("%1%2%3")
522  .arg (AXIS_CURVE_NAME)
524  .arg (0);
525 }
const QString AXIS_CURVE_NAME
const QString POINT_IDENTIFIER_DELIMITER_SAFE("\t")

◆ UNDEFINED_ORDINAL()

static double Point::UNDEFINED_ORDINAL ( )
inlinestatic

Get method for undefined ordinal constant.

Definition at line 134 of file Point.h.

134 { return -1.0; }

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