Engauge Digitizer 2
Loading...
Searching...
No Matches
GraphicsScene.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_SCENE_H
8#define GRAPHICS_SCENE_H
9
10#include "CmdMediator.h"
12#include <QGraphicsScene>
13#include <QObject>
14#include <QStringList>
15
16class CmdMediator;
17class Curve;
18class CurvesGraphs;
19class CurveStyles;
20class GeometryWindow;
21class GraphicsPoint;
22class LineStyle;
23class MainWindow;
24class PointStyle;
25class QGraphicsPathItem;
26class QTextStream;
27class ScaleBar;
28class Transformation;
29
36class GraphicsScene : public QGraphicsScene
37{
38 // We use Q_OBJECT so translations work
39 Q_OBJECT;
40
41public:
43 GraphicsScene(MainWindow *mainWindow);
44
46 virtual ~GraphicsScene();
47
49 void addTemporaryPoint (const QString &identifier,
50 GraphicsPoint *point);
51
55 GraphicsPoint *point1,
56 const QString &pointIdentifier0,
57 const QString &pointIdentifier1);
58
60 GraphicsPoint *createPoint (const QString &identifier,
61 const PointStyle &pointStyle,
62 const QPointF &posScreen,
63 GeometryWindow *geometryWindow);
64
67
69 QStringList positionHasChangedPointIdentifiers () const;
70
72 void printStream (QString indentation,
73 QTextStream &str);
74
76 void removePoint (const QString &identifier);
77
81
84
86 void resetOnLoad();
87
90
92 void showCurves (bool show,
93 bool showAll = false,
94 const QString &curveName = "");
95
98 void updateAfterCommand (CmdMediator &cmdMediator,
99 double highlightOpacity,
100 GeometryWindow *geometryWindow,
101 const Transformation &transformation);
102
104 void updateCurveStyles(const CurveStyles &modelCurveStyles);
105
108 void updateGraphicsLinesToMatchGraphicsPoints (const CurveStyles &modelCurveStyles,
109 const Transformation &transformation);
110
111private:
112
114 QString dumpCursors () const;
115
116 const QGraphicsPixmapItem *image () const;
117
119 void updateCurves (CmdMediator &cmdMediator);
120
122 void updatePathItemMultiValued (const QPainterPath &pathMultiValued,
123 const LineStyle &lineMultiValued);
124
126 void updatePointMembership (CmdMediator &cmdMediator,
127 GeometryWindow *geometryWindow,
128 const Transformation &transformation);
129
131 GraphicsLinesForCurves m_graphicsLinesForCurves;
132
137 QGraphicsPathItem *m_pathItemMultiValued;
138};
139
140#endif // GRAPHICS_SCENE_H
Command queue stack.
Definition CmdMediator.h:24
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition CurveStyles.h:23
Container for one set of digitized Points.
Definition Curve.h:34
Container for all graph curves. The axes point curve is external to this class.
Window that displays the geometry information, as a table, for the current curve.
This class stores the GraphicsLinesForCurves objects, one per Curve.
Graphics item for drawing a circular or polygonal Point.
GraphicsPoint * createPoint(const QString &identifier, const PointStyle &pointStyle, const QPointF &posScreen, GeometryWindow *geometryWindow)
Create one QGraphicsItem-based object that represents one Point. It is NOT added to m_graphicsLinesFo...
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded.
void removeTemporaryScaleBarIfExists()
Remove temporary scale bar, composed of two points and the line between them.
GraphicsScene(MainWindow *mainWindow)
Single constructor.
virtual ~GraphicsScene()
Virtual destructor needed since using Q_OBJECT.
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow, const Transformation &transformation)
Update the Points and their Curves after executing a command.
void hideAllItemsExceptImage()
Hide all graphics items, except background image, in preparation for preview during IMPORT_TYPE_ADVAN...
void addTemporaryPoint(const QString &identifier, GraphicsPoint *point)
Add one temporary point to m_graphicsLinesForCurves. Non-temporary points are handled by the updateLi...
void addTemporaryScaleBar(GraphicsPoint *point0, GraphicsPoint *point1, const QString &pointIdentifier0, const QString &pointIdentifier1)
Add temporary scale bar to scene.
QStringList positionHasChangedPointIdentifiers() const
Return a list of identifiers for the points that have moved since the last call to resetPositionHasCh...
void showCurves(bool show, bool showAll=false, const QString &curveName="")
Show or hide all Curves (if showAll is true) or just the selected Curve (if showAll is false);.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
void removePoint(const QString &identifier)
Remove specified point. This aborts if the point does not exist.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
Details for a specific Line.
Definition LineStyle.h:20
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
Details for a specific Point.
Definition PointStyle.h:21
Affine transformation between screen and graph coordinates, based on digitized axis points.