Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
Curve Class Reference

Container for one set of digitized Points. More...

#include <Curve.h>

Collaboration diagram for Curve:
Collaboration graph

Public Member Functions

 Curve (const QString &curveName, const ColorFilterSettings &colorFilterSettings, const CurveStyle &curveStyle)
 Constructor from scratch. More...
 
 Curve (QDataStream &str)
 Constructor from serialized binary pre-version 6 file. More...
 
 Curve (QXmlStreamReader &reader)
 Constructor for use when loading from serialized xml. More...
 
 Curve (const Curve &curve)
 Copy constructor. Copying a Curve only helps for making a copy, since access to any Points inside must be via functor. More...
 
Curveoperator= (const Curve &curve)
 Assignment constructor. More...
 
void addPoint (const Point &point)
 Add Point to this Curve. More...
 
ColorFilterSettings colorFilterSettings () const
 Return the color filter. More...
 
QString curveName () const
 Name of this Curve. More...
 
CurveStyle curveStyle () const
 Return the curve style. More...
 
void editPointAxis (const QPointF &posGraph, const QString &identifier)
 Edit the graph coordinates of an axis point. This method does not apply to a graph point. More...
 
void editPointGraph (bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
 Edit the graph coordinates of one or more graph points. This method does not apply to an axis point. More...
 
void exportToClipboard (const QHash< QString, bool > &selectedHash, const Transformation &transformation, QTextStream &strCsv, QTextStream &strHtml, CurvesGraphs &curvesGraphs) const
 Export points in this Curve found in the specified point list. More...
 
bool isXOnly (const QString &pointIdentifier) const
 Determine if specified point has just x coordinate. Otherwise has just y coordinate, or both x and y coordinates. More...
 
void iterateThroughCurvePoints (const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
 Apply functor to Points on Curve. More...
 
void iterateThroughCurveSegments (const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
 Apply functor to successive Points, as line segments, on Curve. This could be a bit slow. More...
 
void movePoint (const QString &pointIdentifier, const QPointF &deltaScreen)
 Translate the position of a point by the specified distance vector. More...
 
int numPoints () const
 Number of points. More...
 
const Points points () const
 Return a shallow copy of the Points. More...
 
QPointF positionGraph (const QString &pointIdentifier) const
 Return the position, in graph coordinates, of the specified Point. More...
 
QPointF positionScreen (const QString &pointIdentifier) const
 Return the position, in screen coordinates, of the specified Point. 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 removePoint (const QString &identifier)
 Perform the opposite of addPointAtEnd. More...
 
void saveXml (QXmlStreamWriter &writer) const
 Serialize curve. More...
 
void setColorFilterSettings (const ColorFilterSettings &colorFilterSettings)
 Set color filter. More...
 
void setCurveName (const QString &curveName)
 Change the curve name. More...
 
void setCurveStyle (const CurveStyle &curveStyle)
 Set curve style. More...
 
void updatePointOrdinals (const Transformation &transformation)
 See CurveGraphs::updatePointOrdinals. More...
 

Detailed Description

Container for one set of digitized Points.

Definition at line 33 of file Curve.h.

Constructor & Destructor Documentation

Curve::Curve ( const QString &  curveName,
const ColorFilterSettings colorFilterSettings,
const CurveStyle curveStyle 
)

Constructor from scratch.

Definition at line 36 of file Curve.cpp.

38  :
39  m_curveName (curveName),
40  m_colorFilterSettings (colorFilterSettings),
41  m_curveStyle (curveStyle)
42 {
43 }
QString curveName() const
Name of this Curve.
Definition: Curve.cpp:144
Curve::Curve ( QDataStream &  str)

Constructor from serialized binary pre-version 6 file.

Definition at line 53 of file Curve.cpp.

54 {
55  const int CONVERT_ENUM_TO_RADIUS = 6;
56  MigrateToVersion6 migrate;
57 
58  qint32 int32, xScreen, yScreen;
59  double xGraph, yGraph;
60 
61  str >> m_curveName;
62 
63  // Scale bar points are handled as if they are axis points
64  if (m_curveName == SCALE_CURVE_NAME) {
65  m_curveName = AXIS_CURVE_NAME;
66  }
67 
68  str >> int32;
69  m_curveStyle.setPointShape(migrate.pointShape (int32));
70  str >> int32;
71  m_curveStyle.setPointRadius(int32 + CONVERT_ENUM_TO_RADIUS);
72  str >> int32;
73  m_curveStyle.setPointLineWidth (int32);
74  str >> int32;
75  m_curveStyle.setPointColor(migrate.colorPalette (int32));
76  str >> int32; // Point interior color
77  str >> int32;
78  m_curveStyle.setLineWidth(int32);
79  str >> int32;
80  if (m_curveName == AXIS_CURVE_NAME) {
81  m_curveStyle.setLineColor(migrate.colorPalette (int32));
82  } else {
84  }
85  str >> int32;
86  m_curveStyle.setLineConnectAs(migrate.curveConnectAs (int32));
87 
88  str >> int32;
89  int count = int32;
90  int ordinal = 0;
91  for (int i = 0; i < count; i++) {
92 
93  str >> xScreen;
94  str >> yScreen;
95  str >> xGraph;
96  str >> yGraph;
97  if (m_curveName == AXIS_CURVE_NAME) {
98 
99  // Axis point, with graph coordinates set by user and managed here
100  Point point (m_curveName,
101  QPointF (xScreen, yScreen),
102  QPointF (xGraph, yGraph),
103  ordinal++,
104  false);
105 
106  addPoint(point);
107  } else {
108 
109  // Curve point, with graph coordinates managed elsewhere
110  Point point (m_curveName,
111  QPointF (xScreen, yScreen));
112  point.setOrdinal (ordinal++);
113 
114  addPoint(point);
115  }
116  }
117 }
void setPointShape(PointShape shape)
Set method for curve point shape in specified curve.
Definition: CurveStyle.cpp:140
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
void setLineConnectAs(CurveConnectAs curveConnectAs)
Set method for connect as method for lines in specified curve.
Definition: CurveStyle.cpp:110
ColorPalette colorPalette(int preVersion6) const
Color from color palette.
Converts old (=pre version 6) enums to new (=version 6) enums, for reading of old document files...
PointShape pointShape(int preVersion6) const
Point shape.
void setPointRadius(int radius)
Set method for curve point radius.
Definition: CurveStyle.cpp:135
void setPointLineWidth(int width)
Set method for curve point perimeter line width.
Definition: CurveStyle.cpp:130
void setLineColor(ColorPalette lineColor)
Set method for line color in specified curve.
Definition: CurveStyle.cpp:105
void addPoint(const Point &point)
Add Point to this Curve.
Definition: Curve.cpp:134
void setPointColor(ColorPalette curveColor)
Set method curve point color in specified curve.
Definition: CurveStyle.cpp:125
const QString SCALE_CURVE_NAME
void setLineWidth(int width)
Set method for line width in specified curve.
Definition: CurveStyle.cpp:120
CurveConnectAs curveConnectAs(int preVersion6) const
Line drawn between points.
const QString AXIS_CURVE_NAME
Curve::Curve ( QXmlStreamReader &  reader)

Constructor for use when loading from serialized xml.

Definition at line 119 of file Curve.cpp.

120 {
121  loadXml(reader);
122 }
Curve::Curve ( const Curve curve)

Copy constructor. Copying a Curve only helps for making a copy, since access to any Points inside must be via functor.

Definition at line 45 of file Curve.cpp.

45  :
46  m_curveName (curve.curveName ()),
47  m_points (curve.points ()),
48  m_colorFilterSettings (curve.colorFilterSettings ()),
49  m_curveStyle (curve.curveStyle ())
50 {
51 }
const Points points() const
Return a shallow copy of the Points.
Definition: Curve.cpp:451
CurveStyle curveStyle() const
Return the curve style.
Definition: Curve.cpp:149
ColorFilterSettings colorFilterSettings() const
Return the color filter.
Definition: Curve.cpp:139
QString curveName() const
Name of this Curve.
Definition: Curve.cpp:144

Member Function Documentation

void Curve::addPoint ( const Point point)

Add Point to this Curve.

Definition at line 134 of file Curve.cpp.

135 {
136  m_points.push_back (point);
137 }
ColorFilterSettings Curve::colorFilterSettings ( ) const

Return the color filter.

Definition at line 139 of file Curve.cpp.

140 {
141  return m_colorFilterSettings;
142 }
QString Curve::curveName ( ) const

Name of this Curve.

Definition at line 144 of file Curve.cpp.

145 {
146  return m_curveName;
147 }
CurveStyle Curve::curveStyle ( ) const

Return the curve style.

Definition at line 149 of file Curve.cpp.

150 {
151  return m_curveStyle;
152 }
void Curve::editPointAxis ( const QPointF &  posGraph,
const QString &  identifier 
)

Edit the graph coordinates of an axis point. This method does not apply to a graph point.

Definition at line 154 of file Curve.cpp.

156 {
157  // Search for the point with matching identifier
158  QList<Point>::iterator itr;
159  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
160 
161  Point &point = *itr;
162  if (point.identifier () == identifier) {
163 
164  point.setPosGraph (posGraph);
165  break;
166 
167  }
168  }
169 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
void setPosGraph(const QPointF &posGraph)
Set method for position in graph coordinates.
Definition: Point.cpp:496
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
void Curve::editPointGraph ( bool  isX,
bool  isY,
double  x,
double  y,
const QStringList &  identifiers,
const Transformation transformation 
)

Edit the graph coordinates of one or more graph points. This method does not apply to an axis point.

Definition at line 171 of file Curve.cpp.

177 {
178  LOG4CPP_INFO_S ((*mainCat)) << "Curve::editPointGraph"
179  << " identifiers=" << identifiers.join(" ").toLatin1().data();
180 
181  if (transformation.transformIsDefined()) {
182 
183  // Search for the point with matching identifier
184  QList<Point>::iterator itr;
185  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
186 
187  Point &point = *itr;
188 
189  if (identifiers.contains (point.identifier ())) {
190 
191  // Although one or more graph coordinates are specified, it is the screen coordinates that must be
192  // moved. This is because only the screen coordinates of the graph points are tracked (not the graph coordinates).
193  // So we compute posScreen and call Point::setPosScreen instead of Point::setPosGraph
194 
195  // Get original graph coordinates
196  QPointF posScreen = point.posScreen ();
197  QPointF posGraph;
198  transformation.transformScreenToRawGraph (posScreen,
199  posGraph);
200 
201  // Override one or both coordinates
202  if (isX) {
203  posGraph.setX (x);
204  }
205 
206  if (isY) {
207  posGraph.setY (y);
208  }
209 
210  // Set the screen coordinates
211  transformation.transformRawGraphToScreen(posGraph,
212  posScreen);
213 
214  point.setPosScreen (posScreen);
215  }
216  }
217  }
218 }
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
#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
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
void setPosScreen(const QPointF &posScreen)
Set method for position in screen coordinates.
Definition: Point.cpp:510
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
void Curve::exportToClipboard ( const QHash< QString, bool > &  selectedHash,
const Transformation transformation,
QTextStream &  strCsv,
QTextStream &  strHtml,
CurvesGraphs curvesGraphs 
) const

Export points in this Curve found in the specified point list.

Definition at line 220 of file Curve.cpp.

225 {
226  LOG4CPP_INFO_S ((*mainCat)) << "Curve::exportToClipboard"
227  << " hashCount=" << selectedHash.count();
228 
229  // This method assumes Copy is only allowed when Transformation is valid
230 
231  bool isFirst = true;
232  QList<Point>::const_iterator itr;
233  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
234 
235  const Point &point = *itr;
236  if (selectedHash.contains (point.identifier ())) {
237 
238  if (isFirst) {
239 
240  // Insert headers to identify the points that follow
241  isFirst = false;
242  strCsv << "X" << TAB_DELIMITER << m_curveName << "\n";
243  strHtml << "<table>\n"
244  << "<tr><th>X</th><th>" << m_curveName << "</th></tr>\n";
245  }
246 
247  // Default curve style
248  CurveStyle curveStyleDefault;
249  curveStyleDefault.setLineStyle(LineStyle::defaultAxesCurve());
250  curveStyleDefault.setPointStyle(PointStyle::defaultGraphCurve (curvesGraphs.numCurves ()));
251 
252  // Check if this curve already exists from a previously exported point
253  if (curvesGraphs.curveForCurveName (m_curveName) == nullptr) {
254  Curve curve(m_curveName,
256  curveStyleDefault);
257  curvesGraphs.addGraphCurveAtEnd(curve);
258  }
259 
260  // Start with screen coordinates
261  QPointF pos = point.posScreen();
262  if (transformation.transformIsDefined()) {
263 
264  // Replace with graph coordinates which are almost always more useful
265  QPointF posGraph;
266  transformation.transformScreenToRawGraph(pos,
267  posGraph);
268  pos = posGraph;
269  }
270 
271  // Add point to text going to clipboard
272  strCsv << pos.x() << TAB_DELIMITER << pos.y() << "\n";
273  strHtml << "<tr><td>" << pos.x() << "</td><td>" << pos.y() << "</td></tr>\n";
274 
275  // Add point to list for undo/redo
276  curvesGraphs.curveForCurveName (m_curveName)->addPoint (point);
277  }
278  }
279 
280  if (!isFirst) {
281  strHtml << "</table>\n";
282  }
283 }
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
int numCurves() const
Current number of graphs curves.
#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
static LineStyle defaultAxesCurve()
Initial default for axes curve.
Definition: LineStyle.cpp:68
void addGraphCurveAtEnd(const Curve &curve)
Append new graph Curve to end of Curve list.
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
void setLineStyle(const LineStyle &lineStyle)
Set method for LineStyle.
Definition: CurveStyle.cpp:115
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:18
Container for one set of digitized Points.
Definition: Curve.h:33
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void addPoint(const Point &point)
Add Point to this Curve.
Definition: Curve.cpp:134
void setPointStyle(const PointStyle &pointStyle)
Set method for PointStyle.
Definition: CurveStyle.cpp:145
static PointStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: PointStyle.cpp:88
const QString TAB_DELIMITER("\t")
bool Curve::isXOnly ( const QString &  pointIdentifier) const

Determine if specified point has just x coordinate. Otherwise has just y coordinate, or both x and y coordinates.

Definition at line 285 of file Curve.cpp.

286 {
287  // Search for point with matching identifier
288  Points::const_iterator itr;
289  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
290  const Point &point = *itr;
291  if (pointIdentifier == point.identifier ()) {
292  return point.isXOnly();
293  }
294  }
295 
296  ENGAUGE_ASSERT (false);
297 
298  return false;
299 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined...
Definition: Point.cpp:286
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) &amp;&amp; !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20
void Curve::iterateThroughCurvePoints ( const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &  ftorWithCallback) const

Apply functor to Points on Curve.

Definition at line 301 of file Curve.cpp.

302 {
303  QList<Point>::const_iterator itr;
304  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
305 
306  const Point &point = *itr;
307 
308  CallbackSearchReturn rtn = ftorWithCallback (m_curveName, point);
309 
311  break;
312  }
313  }
314 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
CallbackSearchReturn
Return values for search callback methods.
Immediately terminate the current search.
void Curve::iterateThroughCurveSegments ( const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &  ftorWithCallback) const

Apply functor to successive Points, as line segments, on Curve. This could be a bit slow.

Definition at line 316 of file Curve.cpp.

317 {
318  // Loop through Points. They are assumed to be already sorted by their ordinals, but we do NOT
319  // check the ordinal ordering since this could be called before, or while, the ordinal sorting is done
320  QList<Point>::const_iterator itr;
321  const Point *pointBefore = nullptr;
322  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
323 
324  const Point &point = *itr;
325 
326  if (pointBefore != nullptr) {
327 
328  CallbackSearchReturn rtn = ftorWithCallback (*pointBefore,
329  point);
330 
332  break;
333  }
334 
335  }
336  pointBefore = &point;
337  }
338 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
CallbackSearchReturn
Return values for search callback methods.
Immediately terminate the current search.
void Curve::movePoint ( const QString &  pointIdentifier,
const QPointF &  deltaScreen 
)

Translate the position of a point by the specified distance vector.

Definition at line 423 of file Curve.cpp.

425 {
426  Point *point = pointForPointIdentifier (pointIdentifier);
427 
428  QPointF posScreen = deltaScreen + point->posScreen ();
429  point->setPosScreen (posScreen);
430 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
void setPosScreen(const QPointF &posScreen)
Set method for position in screen coordinates.
Definition: Point.cpp:510
int Curve::numPoints ( ) const

Number of points.

Definition at line 432 of file Curve.cpp.

433 {
434  return m_points.count ();
435 }
Curve & Curve::operator= ( const Curve curve)

Assignment constructor.

Definition at line 124 of file Curve.cpp.

125 {
126  m_curveName = curve.curveName ();
127  m_points = curve.points ();
128  m_colorFilterSettings = curve.colorFilterSettings ();
129  m_curveStyle = curve.curveStyle ();
130 
131  return *this;
132 }
const Points points() const
Return a shallow copy of the Points.
Definition: Curve.cpp:451
CurveStyle curveStyle() const
Return the curve style.
Definition: Curve.cpp:149
ColorFilterSettings colorFilterSettings() const
Return the color filter.
Definition: Curve.cpp:139
QString curveName() const
Name of this Curve.
Definition: Curve.cpp:144
const Points Curve::points ( ) const

Return a shallow copy of the Points.

Definition at line 451 of file Curve.cpp.

452 {
453  return m_points;
454 }
QPointF Curve::positionGraph ( const QString &  pointIdentifier) const

Return the position, in graph coordinates, of the specified Point.

Definition at line 456 of file Curve.cpp.

457 {
458  QPointF posGraph;
459 
460  // Search for point with matching identifier
461  Points::const_iterator itr;
462  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
463  const Point &point = *itr;
464  if (pointIdentifier == point.identifier ()) {
465  posGraph = point.posGraph ();
466  break;
467  }
468  }
469 
470  return posGraph;
471 }
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:395
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
QPointF Curve::positionScreen ( const QString &  pointIdentifier) const

Return the position, in screen coordinates, of the specified Point.

Definition at line 473 of file Curve.cpp.

474 {
475  QPointF posScreen;
476 
477  // Search for point with matching identifier
478  Points::const_iterator itr;
479  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
480  const Point &point = *itr;
481  if (pointIdentifier == point.identifier ()) {
482  posScreen = point.posScreen ();
483  break;
484  }
485  }
486 
487  return posScreen;
488 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:404
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
void Curve::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 490 of file Curve.cpp.

492 {
493  str << indentation << "Curve=" << m_curveName << "\n";
494 
495  indentation += INDENTATION_DELTA;
496 
497  Points::const_iterator itr;
498  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
499  const Point &point = *itr;
500  point.printStream (indentation,
501  str);
502  }
503 
504  m_colorFilterSettings.printStream (indentation,
505  str);
506  m_curveStyle.printStream (indentation,
507  str);
508 }
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: CurveStyle.cpp:80
const QString INDENTATION_DELTA
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: Point.cpp:409
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void Curve::removePoint ( const QString &  identifier)

Perform the opposite of addPointAtEnd.

Definition at line 510 of file Curve.cpp.

511 {
512  // Search for point with matching identifier
513  Points::iterator itr;
514  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
515  Point point = *itr;
516  if (point.identifier () == identifier) {
517  m_points.erase (itr);
518  break;
519  }
520  }
521 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
void Curve::saveXml ( QXmlStreamWriter &  writer) const

Serialize curve.

Definition at line 523 of file Curve.cpp.

524 {
525  LOG4CPP_INFO_S ((*mainCat)) << "Curve::saveXml";
526 
527  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE);
528  writer.writeAttribute(DOCUMENT_SERIALIZE_CURVE_NAME, m_curveName);
529  m_colorFilterSettings.saveXml (writer,
530  m_curveName);
531  m_curveStyle.saveXml (writer,
532  m_curveName);
533 
534  // Loop through points
535  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE_POINTS);
536  Points::const_iterator itr;
537  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
538  const Point &point = *itr;
539  point.saveXml (writer);
540  }
541  writer.writeEndElement();
542 
543  writer.writeEndElement();
544 }
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Serialize to xml.
Definition: CurveStyle.cpp:93
const QString DOCUMENT_SERIALIZE_CURVE_POINTS
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: Point.cpp:432
#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
const QString DOCUMENT_SERIALIZE_CURVE
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Save curve filter to stream.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString DOCUMENT_SERIALIZE_CURVE_NAME
void Curve::setColorFilterSettings ( const ColorFilterSettings colorFilterSettings)

Set color filter.

Definition at line 546 of file Curve.cpp.

547 {
548  m_colorFilterSettings = colorFilterSettings;
549 }
ColorFilterSettings colorFilterSettings() const
Return the color filter.
Definition: Curve.cpp:139
void Curve::setCurveName ( const QString &  curveName)

Change the curve name.

Definition at line 551 of file Curve.cpp.

552 {
553  m_curveName = curveName;
554 
555  // Pass to member objects
556  QList<Point>::iterator itr;
557  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
558  Point &point = *itr;
559  point.setCurveName (curveName);
560  }
561 }
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:25
void setCurveName(const QString &curveName)
Update the point identifer to match the specified curve name.
Definition: Point.cpp:471
QString curveName() const
Name of this Curve.
Definition: Curve.cpp:144
void Curve::setCurveStyle ( const CurveStyle curveStyle)

Set curve style.

Definition at line 563 of file Curve.cpp.

564 {
565  m_curveStyle = curveStyle;
566 }
CurveStyle curveStyle() const
Return the curve style.
Definition: Curve.cpp:149
void Curve::updatePointOrdinals ( const Transformation transformation)

See CurveGraphs::updatePointOrdinals.

Same algorithm as GraphicsLinesForCurve::updatePointOrdinalsAfterDrag, although graph coordinates of points have been updated before this is called so the graph coordinates are not updated by this method

Definition at line 568 of file Curve.cpp.

569 {
570  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
571 
572  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinals"
573  << " curve=" << m_curveName.toLatin1().data()
574  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
575 
576  // Make sure ordinals are properly ordered. Sorting is done afterward
577 
578  if (curveConnectAs == CONNECT_AS_FUNCTION_SMOOTH ||
579  curveConnectAs == CONNECT_AS_FUNCTION_STRAIGHT) {
580 
581  updatePointOrdinalsFunctions (transformation);
582 
583  } else if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH ||
584  curveConnectAs == CONNECT_AS_RELATION_STRAIGHT) {
585 
586  updatePointOrdinalsRelations ();
587 
588  } else {
589 
590  LOG4CPP_ERROR_S ((*mainCat)) << "Curve::updatePointOrdinals";
591  ENGAUGE_ASSERT (false);
592 
593  }
594 
595  qSort (m_points.begin(),
596  m_points.end(),
597  PointComparator());
598 }
Comparator for sorting Point class.
LineStyle lineStyle() const
Get method for LineStyle.
Definition: CurveStyle.cpp:26
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
#define LOG4CPP_ERROR_S(logger)
Definition: convenience.h:12
CurveConnectAs
log4cpp::Category * mainCat
Definition: Logger.cpp:14
QString curveConnectAsToString(CurveConnectAs curveConnectAs)
CurveConnectAs curveConnectAs() const
Get method for connect type.
Definition: LineStyle.cpp:63
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) &amp;&amp; !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20

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