Engauge Digitizer  2
GraphicsLinesForCurve.h
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 #ifndef GRAPHICS_LINES_FOR_CURVE_H
8 #define GRAPHICS_LINES_FOR_CURVE_H
9 
10 #include "Point.h"
11 #include "OrdinalToGraphicsPoint.h"
12 #include <QGraphicsPathItem>
13 
14 class CurveStyle;
15 class GeometryWindow;
16 class GraphicsPoint;
17 class GraphicsScene;
18 class LineStyle;
19 class PointStyle;
20 class QPainterPath;
21 class QTestStream;
22 class SplineDrawer;
23 class Transformation;
24 
27 class GraphicsLinesForCurve : public QGraphicsPathItem
28 {
29 public:
31  GraphicsLinesForCurve(const QString &curveName);
33 
38  void addPoint (const QString &pointIdentifier,
39  double ordinal,
40  GraphicsPoint &point);
41 
43  double identifierToOrdinal (const QString &identifier) const;
44 
46  void lineMembershipPurge (const LineStyle &lineStyle,
47  SplineDrawer &splineDrawer,
48  QPainterPath &pathMultiValued,
49  LineStyle &lineMultiValued);
50 
52  void lineMembershipReset ();
53 
55  void printStream (QString indentation,
56  QTextStream &str) const;
57 
59  void removePoint (double ordinal);
60 
64 
66  void updateAfterCommand (GraphicsScene &scene,
67  const PointStyle &pointStyle,
68  const Point &point,
69  GeometryWindow *geometryWindow);
70 
72  void updateCurveStyle (const CurveStyle &curveStyle);
73 
76  SplineDrawer &splineDrawer,
77  QPainterPath &pathMultiValued,
78  LineStyle &lineMultiValued);
79 
81  void updateHighlightOpacity (double highlightOpacity);
82 
84  void updatePointOrdinalsAfterDrag (const LineStyle &lineStyle,
85  const Transformation &transformation);
86 
87 private:
88 
89  QPainterPath drawLinesSmooth (const LineStyle &lineStyle,
90  SplineDrawer &splineDrawer,
91  QPainterPath &pathMultiValued,
92  LineStyle &lineMultiValued);
93  QPainterPath drawLinesStraight (QPainterPath &pathMultiValued);
94  bool needOrdinalRenumbering () const; // True if m_graphicsPoints ordinal keys need renumbering
95  void renumberOrdinals(); // Renumbers m_graphicsPoints ordinal keys
96 
97  const QString m_curveName;
98  OrdinalToGraphicsPoint m_graphicsPoints;
99 };
100 
101 #endif // GRAPHICS_LINES_FOR_CURVE_H
GraphicsLinesForCurve::~GraphicsLinesForCurve
~GraphicsLinesForCurve()
Definition: GraphicsLinesForCurve.cpp:44
Point.h
GraphicsLinesForCurve::addPoint
void addPoint(const QString &pointIdentifier, double ordinal, GraphicsPoint &point)
Add new line.
Definition: GraphicsLinesForCurve.cpp:55
GraphicsLinesForCurve::GraphicsLinesForCurve
GraphicsLinesForCurve(const QString &curveName)
Single constructor.
Definition: GraphicsLinesForCurve.cpp:34
GraphicsLinesForCurve::removeTemporaryPointIfExists
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
Definition: GraphicsLinesForCurve.cpp:323
OrdinalToGraphicsPoint.h
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition: Transformation.h:30
GraphicsLinesForCurve::updatePointOrdinalsAfterDrag
void updatePointOrdinalsAfterDrag(const LineStyle &lineStyle, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals.
Definition: GraphicsLinesForCurve.cpp:468
OrdinalToGraphicsPoint
QMap< double, GraphicsPoint * > OrdinalToGraphicsPoint
Definition: OrdinalToGraphicsPoint.h:11
CurveStyle
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:17
LineStyle
Details for a specific Line.
Definition: LineStyle.h:18
GraphicsLinesForCurve
This class stores the GraphicsLine objects for one Curve.
Definition: GraphicsLinesForCurve.h:26
GraphicsLinesForCurve::updateHighlightOpacity
void updateHighlightOpacity(double highlightOpacity)
Update the highlight opacity value. This may or may not affect the current display immediately depend...
Definition: GraphicsLinesForCurve.cpp:415
GraphicsLinesForCurve::updateAfterCommand
void updateAfterCommand(GraphicsScene &scene, const PointStyle &pointStyle, const Point &point, GeometryWindow *geometryWindow)
Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the ...
Definition: GraphicsLinesForCurve.cpp:366
GraphicsScene
Add point and line handling to generic QGraphicsScene.
Definition: GraphicsScene.h:35
GraphicsLinesForCurve::updateCurveStyle
void updateCurveStyle(const CurveStyle &curveStyle)
Update the curve style for this curve.
Definition: GraphicsLinesForCurve.cpp:403
GraphicsLinesForCurve::printStream
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: GraphicsLinesForCurve.cpp:286
SplineDrawer
This class takes the output from Spline and uses that to draw the curve in the graphics window,...
Definition: SplineDrawer.h:34
PointStyle
Details for a specific Point.
Definition: PointStyle.h:19
GraphicsPoint
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:42
Point
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:24
GraphicsLinesForCurve::lineMembershipReset
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
Definition: GraphicsLinesForCurve.cpp:252
GraphicsLinesForCurve::removePoint
void removePoint(double ordinal)
Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScen...
Definition: GraphicsLinesForCurve.cpp:309
GraphicsLinesForCurve::updateGraphicsLinesToMatchGraphicsPoints
void updateGraphicsLinesToMatchGraphicsPoints(const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
Definition: GraphicsLinesForCurve.cpp:429
GeometryWindow
Window that displays the geometry information, as a table, for the current curve.
Definition: GeometryWindow.h:27
GraphicsLinesForCurve::lineMembershipPurge
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...
Definition: GraphicsLinesForCurve.cpp:206
GraphicsLinesForCurve::identifierToOrdinal
double identifierToOrdinal(const QString &identifier) const
Get ordinal for specified identifier.
Definition: GraphicsLinesForCurve.cpp:186