Engauge Digitizer 2
Loading...
Searching...
No Matches
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"
12#include <QGraphicsPathItem>
13
14class CurveStyle;
15class GeometryWindow;
16class GraphicsPoint;
17class GraphicsScene;
18class LineStyle;
19class PointStyle;
20class QPainterPath;
21class QTestStream;
22class SplineDrawer;
23class Transformation;
24
27class GraphicsLinesForCurve : public QGraphicsPathItem
28{
29public:
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
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
87private:
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
QMap< double, GraphicsPoint * > OrdinalToGraphicsPoint
Container for LineStyle and PointStyle for one Curve.
Definition CurveStyle.h:19
Window that displays the geometry information, as a table, for the current curve.
double identifierToOrdinal(const QString &identifier) const
Get ordinal for specified identifier.
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 ...
void updateCurveStyle(const CurveStyle &curveStyle)
Update the curve style for this 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...
void updateHighlightOpacity(double highlightOpacity)
Update the highlight opacity value. This may or may not affect the current display immediately depend...
void removePoint(double ordinal)
Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScen...
void addPoint(const QString &pointIdentifier, double ordinal, GraphicsPoint &point)
Add new line.
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
void updatePointOrdinalsAfterDrag(const LineStyle &lineStyle, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals.
GraphicsLinesForCurve(const QString &curveName)
Single constructor.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void updateGraphicsLinesToMatchGraphicsPoints(const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
Graphics item for drawing a circular or polygonal Point.
Add point and line handling to generic QGraphicsScene.
Details for a specific Line.
Definition LineStyle.h:20
Details for a specific Point.
Definition PointStyle.h:21
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
This class takes the output from Spline and uses that to draw the curve in the graphics window,...
Affine transformation between screen and graph coordinates, based on digitized axis points.