Engauge Digitizer  2
DigitizeStateScale.h
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2017 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 DIGITIZE_STATE_SCALE_H
8 #define DIGITIZE_STATE_SCALE_H
9 
11 #include <QObject>
12 
13 class GraphicsPoint;
14 class QGraphicsLineItem;
15 class QPointF;
16 
23 class DigitizeStateScale : public QObject, public DigitizeStateAbstractBase
24 {
25 public:
28  virtual ~DigitizeStateScale();
29 
30  virtual QString activeCurve () const;
31  virtual void begin(CmdMediator *cmdMediator,
32  DigitizeState previousState);
33  virtual bool canPaste (const Transformation &transformation,
34  const QSize &viewSize) const;
35  virtual QCursor cursor (CmdMediator *cmdMediator) const;
36  virtual void end();
37  virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator,
38  const QString &pointIdentifier);
39  virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator,
40  const QStringList &pointIdentifiers);
41  virtual void handleCurveChange(CmdMediator *cmdMediator);
42  virtual void handleKeyPress (CmdMediator *cmdMediator,
43  Qt::Key key,
44  bool atLeastOneSelectedItem);
45  virtual void handleMouseMove (CmdMediator *cmdMediator,
46  QPointF posScreen);
47  virtual void handleMousePress (CmdMediator *cmdMediator,
48  QPointF posScreen);
49  virtual void handleMouseRelease (CmdMediator *cmdMediator,
50  QPointF posScreen);
51  virtual QString state() const;
52  virtual void updateAfterPointAddition ();
53  virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator,
54  const DocumentModelDigitizeCurve &modelDigitizeCurve);
55  virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
56 
57 private:
59 
60  void removeTemporaryPointsAndLine();
61  void updateLineGeometry ();
62 
63  QString m_pointIdentifier0;
64  QString m_pointIdentifier1;
65  GraphicsPoint *m_temporaryPoint0;
66  GraphicsPoint *m_temporaryPoint1;
67 
68  QGraphicsLineItem *m_line;
69 };
70 
71 #endif // DIGITIZE_STATE_SCALE_H
DigitizeState
Set of possible states of Digitize toolbar.
Command queue stack.
Definition: CmdMediator.h:24
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Digitizing state for creating the scale bar.
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual QString state() const
State name for debugging.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsSegments and CmdSettingsSegments.
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:44
Affine transformation between screen and graph coordinates, based on digitized axis points.