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

This class stores the GraphicsLinesForCurves objects, one per Curve. More...

#include <GraphicsLinesForCurves.h>

Collaboration diagram for GraphicsLinesForCurves:
Collaboration graph

Public Member Functions

 GraphicsLinesForCurves ()
 Single constructor. More...
 
void addPoint (const QString &curveName, const QString &pointIdentifier, double ordinal, GraphicsPoint &point)
 Add new point. More...
 
void addRemoveCurves (GraphicsScene &scene, const QStringList &curveNames)
 Add new curves and remove expired curves to match the specified list. More...
 
void lineMembershipPurge (const CurveStyles &curveStyles, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
 Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines. More...
 
void lineMembershipReset ()
 Mark points as unwanted. Afterwards, lineMembershipPurge gets called. More...
 
void print () const
 Debugging method for printing directly from symbolic debugger. 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)
 Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScene. More...
 
void removeTemporaryPointIfExists ()
 Remove temporary point if it exists. More...
 
void resetOnLoad ()
 Reset, when loading a document after the first, to same state that first document was at when loaded. More...
 
void updateAfterCommand (GraphicsScene &scene, const CurveStyles &curveStyles, const QString &curveName, const Point &point, GeometryWindow *geometryWindow)
 Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the scene, we add it. More...
 
void updateCurveStyles (const CurveStyles &modelCurveStyles)
 Update the curve style for every curve. More...
 
void updateGraphicsLinesToMatchGraphicsPoints (const CurveStyles &curveStyles, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
 Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly. More...
 
void updateHighlightOpacity (double highlightOpacity)
 Update the highlight opacity value. This may or may not affect the current display immediately depending on the state. More...
 
void updatePointOrdinalsAfterDrag (const CurveStyles &curveStyles, const Transformation &transformation)
 See GraphicsScene::updateOrdinalsAfterDrag. More...
 

Detailed Description

This class stores the GraphicsLinesForCurves objects, one per Curve.

Definition at line 29 of file GraphicsLinesForCurves.h.

Constructor & Destructor Documentation

GraphicsLinesForCurves::GraphicsLinesForCurves ( )

Single constructor.

Definition at line 26 of file GraphicsLinesForCurves.cpp.

27 {
28 }

Member Function Documentation

void GraphicsLinesForCurves::addPoint ( const QString &  curveName,
const QString &  pointIdentifier,
double  ordinal,
GraphicsPoint point 
)

Add new point.

The ordinal is already in the GraphicsPoint as DATA_KEY_ORDINAL

Definition at line 30 of file GraphicsLinesForCurves.cpp.

34 {
35  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::addPoint"
36  << " curve=" << curveName.toLatin1().data()
37  << " identifier=" << pointIdentifier.toLatin1().data()
38  << " ordinal=" << ordinal
39  << " pos=" << QPointFToString (point.pos()).toLatin1().data();
40 
41  m_graphicsLinesForCurve [curveName]->addPoint (pointIdentifier,
42  ordinal,
43  point);
44 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
log4cpp::Category * mainCat
Definition: Logger.cpp:14
QPointF pos() const
Proxy method for QGraphicsItem::pos.
void GraphicsLinesForCurves::addRemoveCurves ( GraphicsScene scene,
const QStringList &  curveNames 
)

Add new curves and remove expired curves to match the specified list.

Definition at line 46 of file GraphicsLinesForCurves.cpp.

48 {
49  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::addRemoveCurves"
50  << " curveCount=" << m_graphicsLinesForCurve.count();
51 
52  // Add new curves
53  QStringList::const_iterator itrC;
54  for (itrC = curveNames.begin (); itrC != curveNames.end (); itrC++) {
55 
56  QString curveName = *itrC;
57 
58  if (!m_graphicsLinesForCurve.contains (curveName)) {
59 
60  GraphicsLinesForCurve *item = new GraphicsLinesForCurve(curveName);
61  scene.addItem (item);
62 
63  m_graphicsLinesForCurve [curveName] = item;
64  }
65  }
66 
67  // Remove expired curves
68  GraphicsLinesContainer::const_iterator itrG, itrGNext;
69  for (itrG = m_graphicsLinesForCurve.begin (); itrG != m_graphicsLinesForCurve.end (); itrG = itrGNext) {
70 
71  const QString curveName = itrG.key ();
72  GraphicsLinesForCurve *graphicsLines = itrG.value();
73 
74  itrGNext = itrG;
75  itrGNext++;
76 
77  if (!curveNames.contains (curveName)) {
78 
79  delete graphicsLines;
80  m_graphicsLinesForCurve.remove (curveName);
81  }
82  }
83 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
This class stores the GraphicsLine objects for one Curve.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void GraphicsLinesForCurves::lineMembershipPurge ( const CurveStyles curveStyles,
SplineDrawer splineDrawer,
QPainterPath &  pathMultiValued,
LineStyle lineMultiValued 
)

Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines.

Definition at line 85 of file GraphicsLinesForCurves.cpp.

89 {
90  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::lineMembershipPurge";
91 
92  GraphicsLinesContainer::const_iterator itr;
93  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
94 
95  const QString curveName = itr.key ();
96  GraphicsLinesForCurve *graphicsLines = itr.value();
97 
98  graphicsLines->lineMembershipPurge (curveStyles.lineStyle (curveName),
99  splineDrawer,
100  pathMultiValued,
101  lineMultiValued);
102  }
103 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
Definition: CurveStyles.cpp:97
This class stores the GraphicsLine objects for one Curve.
void lineMembershipPurge(const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines...
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void GraphicsLinesForCurves::lineMembershipReset ( )

Mark points as unwanted. Afterwards, lineMembershipPurge gets called.

Definition at line 105 of file GraphicsLinesForCurves.cpp.

106 {
107  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::lineMembershipReset";
108 
109  GraphicsLinesContainer::const_iterator itr;
110  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
111 
112  GraphicsLinesForCurve *graphicsLines = itr.value();
113 
114  graphicsLines->lineMembershipReset ();
115  }
116 }
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
This class stores the GraphicsLine objects for one Curve.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void GraphicsLinesForCurves::print ( ) const

Debugging method for printing directly from symbolic debugger.

Definition at line 118 of file GraphicsLinesForCurves.cpp.

119 {
120  QString text;
121  QTextStream str (&text);
122 
123  printStream ("", str);
124  std::cerr << text.toLatin1().data();
125 }
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void GraphicsLinesForCurves::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 127 of file GraphicsLinesForCurves.cpp.

129 {
130  str << indentation << "GraphicsLinesForCurves\n";
131 
132  indentation += INDENTATION_DELTA;
133 
134  GraphicsLinesContainer::const_iterator itr;
135  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
136 
137  const GraphicsLinesForCurve *graphicsLines = itr.value();
138 
139  graphicsLines->printStream (indentation,
140  str);
141  }
142 }
const QString INDENTATION_DELTA
This class stores the GraphicsLine objects for one Curve.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void GraphicsLinesForCurves::removePoint ( const QString &  identifier)

Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScene.

Definition at line 144 of file GraphicsLinesForCurves.cpp.

145 {
146  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::removePoint"
147  << " point=" << identifier.toLatin1().data ()
148  << " curveCount=" << m_graphicsLinesForCurve.count();
149 
150  QString curveName = Point::curveNameFromPointIdentifier(identifier);
151 
152  ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
153  double ordinal = m_graphicsLinesForCurve [curveName]->identifierToOrdinal (identifier);
154  m_graphicsLinesForCurve [curveName]->removePoint(ordinal);
155 }
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
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#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 GraphicsLinesForCurves::removeTemporaryPointIfExists ( )

Remove temporary point if it exists.

Temporary point handling is so complicated that this method quietly allows redundant calls to this method, without complaining that the point has already been removed when called again

Definition at line 157 of file GraphicsLinesForCurves.cpp.

158 {
159  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::removeTemporaryPointIfExists";
160 
162 
163  ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
164  m_graphicsLinesForCurve [curveName]->removeTemporaryPointIfExists ();
165 }
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
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
static QString temporaryPointIdentifier()
Point identifier for temporary point that is used by DigitzeStateAxis.
Definition: Point.cpp:519
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#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 GraphicsLinesForCurves::resetOnLoad ( )

Reset, when loading a document after the first, to same state that first document was at when loaded.

Definition at line 167 of file GraphicsLinesForCurves.cpp.

168 {
169  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::resetOnLoad";
170 
171  GraphicsLinesContainer::iterator itr;
172  for (itr = m_graphicsLinesForCurve.begin(); itr != m_graphicsLinesForCurve.end(); itr++) {
173  GraphicsLinesForCurve *curve = itr.value();
174  delete curve;
175  }
176 
177  m_graphicsLinesForCurve.clear();
178 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
This class stores the GraphicsLine objects for one Curve.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void GraphicsLinesForCurves::updateAfterCommand ( GraphicsScene scene,
const CurveStyles curveStyles,
const QString &  curveName,
const Point point,
GeometryWindow geometryWindow 
)

Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the scene, we add it.

Definition at line 180 of file GraphicsLinesForCurves.cpp.

185 {
186  LOG4CPP_DEBUG_S ((*mainCat)) << "GraphicsLinesForCurves::updateAfterCommand"
187  << " point=" << point.identifier().toLatin1().data()
188  << " curveCount=" << m_graphicsLinesForCurve.count();
189 
190  ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
191  m_graphicsLinesForCurve [curveName]->updateAfterCommand (scene,
192  curveStyles.pointStyle(curveName),
193  point,
194  geometryWindow);
195 }
const PointStyle pointStyle(const QString &curveName) const
Get method for copying one point style. Cannot return just a reference or else there is a warning abo...
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:268
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#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
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20
void GraphicsLinesForCurves::updateCurveStyles ( const CurveStyles modelCurveStyles)

Update the curve style for every curve.

Definition at line 197 of file GraphicsLinesForCurves.cpp.

198 {
199  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::updateCurveStyles";
200 
201  GraphicsLinesContainer::const_iterator itr;
202  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
203 
204  QString curveName = itr.key();
205 
206  m_graphicsLinesForCurve [curveName]->updateCurveStyle (modelCurveStyles.curveStyle (curveName));
207  }
208 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Definition: CurveStyles.cpp:79
void GraphicsLinesForCurves::updateGraphicsLinesToMatchGraphicsPoints ( const CurveStyles curveStyles,
SplineDrawer splineDrawer,
QPainterPath &  pathMultiValued,
LineStyle lineMultiValued 
)

Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.

Definition at line 210 of file GraphicsLinesForCurves.cpp.

214 {
215  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::updateGraphicsLinesToMatchGraphicsPoints";
216 
217  GraphicsLinesContainer::const_iterator itr;
218  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
219 
220  QString curveName = itr.key();
221 
222  // This is where we add lines for non-axes curves
223  if (curveName != AXIS_CURVE_NAME) {
224 
225  m_graphicsLinesForCurve [curveName]->updateGraphicsLinesToMatchGraphicsPoints(curveStyles.lineStyle (curveName),
226  splineDrawer,
227  pathMultiValued,
228  lineMultiValued);
229  }
230  }
231 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
Definition: CurveStyles.cpp:97
log4cpp::Category * mainCat
Definition: Logger.cpp:14
const QString AXIS_CURVE_NAME
void GraphicsLinesForCurves::updateHighlightOpacity ( double  highlightOpacity)

Update the highlight opacity value. This may or may not affect the current display immediately depending on the state.

Definition at line 233 of file GraphicsLinesForCurves.cpp.

234 {
235  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::updateHighlightOpacity"
236  << " highlightOpacity=" << highlightOpacity;
237 
238  GraphicsLinesContainer::const_iterator itr;
239  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
240 
241  QString curveName = itr.key();
242 
243  m_graphicsLinesForCurve [curveName]->updateHighlightOpacity (highlightOpacity);
244  }
245 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void GraphicsLinesForCurves::updatePointOrdinalsAfterDrag ( const CurveStyles curveStyles,
const Transformation transformation 
)

See GraphicsScene::updateOrdinalsAfterDrag.

Definition at line 247 of file GraphicsLinesForCurves.cpp.

249 {
250  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsLinesForCurves::updatePointOrdinalsAfterDrag";
251 
252  GraphicsLinesContainer::const_iterator itr;
253  for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
254 
255  QString curveName = itr.key();
256  GraphicsLinesForCurve *graphicsLines = itr.value();
257 
258  graphicsLines->updatePointOrdinalsAfterDrag (curveStyles.lineStyle (curveName),
259  transformation);
260  }
261 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void updatePointOrdinalsAfterDrag(const LineStyle &lineStyle, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals...
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
Definition: CurveStyles.cpp:97
This class stores the GraphicsLine objects for one Curve.
log4cpp::Category * mainCat
Definition: Logger.cpp:14

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