Engauge Digitizer  2
GraphicsScene.h
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"
11 #include "GraphicsLinesForCurves.h"
12 #include <QGraphicsScene>
13 #include <QStringList>
14 
15 class CmdMediator;
16 class Curve;
17 class CurvesGraphs;
18 class CurveStyles;
19 class GeometryWindow;
20 class GraphicsPoint;
21 class MainWindow;
22 class PointStyle;
23 class QTextStream;
24 class ScaleBar;
25 class Transformation;
26 
33 class GraphicsScene : public QGraphicsScene
34 {
35 public:
37  GraphicsScene(MainWindow *mainWindow);
38 
40  void addTemporaryPoint (const QString &identifier,
41  GraphicsPoint *point);
42 
45  void addTemporaryScaleBar (GraphicsPoint *point0,
46  GraphicsPoint *point1,
47  const QString &pointIdentifier0,
48  const QString &pointIdentifier1);
49 
51  GraphicsPoint *createPoint (const QString &identifier,
52  const PointStyle &pointStyle,
53  const QPointF &posScreen,
54  GeometryWindow *geometryWindow);
55 
58 
60  QStringList positionHasChangedPointIdentifiers () const;
61 
63  void printStream (QString indentation,
64  QTextStream &str);
65 
67  void removePoint (const QString &identifier);
68 
72 
75 
77  void resetOnLoad();
78 
81 
83  void showCurves (bool show,
84  bool showAll = false,
85  const QString &curveName = "");
86 
89  void updateAfterCommand (CmdMediator &cmdMediator,
90  double highlightOpacity,
91  GeometryWindow *geometryWindow);
92 
94  void updateCurveStyles(const CurveStyles &modelCurveStyles);
95 
98  void updateGraphicsLinesToMatchGraphicsPoints (const CurveStyles &modelCurveStyles,
99  const Transformation &transformation);
100 
101 private:
102 
104  QString dumpCursors () const;
105 
106  const QGraphicsPixmapItem *image () const;
107 
109  void updateCurves (CmdMediator &cmdMediator);
110 
112  void updatePointMembership (CmdMediator &cmdMediator,
113  GeometryWindow *geometryWindow);
114 
116  GraphicsLinesForCurves m_graphicsLinesForCurves;
117 };
118 
119 #endif // GRAPHICS_SCENE_H
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &modelCurveStyles, const Transformation &transformation)
A mouse move has just occurred so move the selected points, since they were dragged.
void printStream(QString indentation, QTextStream &str)
Debugging method that supports print method of this class and printStream method of some other class(...
void removePoint(const QString &identifier)
Remove specified point. This aborts if the point does not exist.
GraphicsScene(MainWindow *mainWindow)
Single constructor.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition: CurveStyles.h:22
void updateAfterCommand(CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow)
Update the Points and their Curves after executing a command.
void addTemporaryScaleBar(GraphicsPoint *point0, GraphicsPoint *point1, const QString &pointIdentifier0, const QString &pointIdentifier1)
Add temporary scale bar to scene.
void removeTemporaryScaleBarIfExists()
Remove temporary scale bar, composed of two points and the line between them.
Window that displays the geometry information, as a table, for the current curve. ...
QStringList positionHasChangedPointIdentifiers() const
Return a list of identifiers for the points that have moved since the last call to resetPositionHasCh...
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...
Affine transformation between screen and graph coordinates, based on digitized axis points...
Details for a specific Point.
Definition: PointStyle.h:20
Container for all graph curves. The axes point curve is external to this class.
Definition: CurvesGraphs.h:24
This class stores the GraphicsLinesForCurves objects, one per Curve.
void resetPositionHasChangedFlags()
Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
Container for one set of digitized Points.
Definition: Curve.h:33
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:43
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update curve styles after settings changed.
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded...
Command queue stack.
Definition: CmdMediator.h:23
void addTemporaryPoint(const QString &identifier, GraphicsPoint *point)
Add one temporary point to m_graphicsLinesForCurves. Non-temporary points are handled by the updateLi...
Add point and line handling to generic QGraphicsScene.
Definition: GraphicsScene.h:33
void hideAllItemsExceptImage()
Hide all graphics items, except background image, in preparation for preview during IMPORT_TYPE_ADVAN...
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);...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:89