Engauge Digitizer  2
DigitizeStateSegment.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 DIGITIZE_STATE_SEGMENT_H
8 #define DIGITIZE_STATE_SEGMENT_H
9 
11 #include <QList>
12 #include <QObject>
13 
14 class Segment;
15 
17 class DigitizeStateSegment : public QObject, public DigitizeStateAbstractBase
18 {
19  Q_OBJECT;
20 
21 public:
24  virtual ~DigitizeStateSegment();
25 
26  virtual QString activeCurve () const;
27  virtual void begin(CmdMediator *cmdMediator,
28  DigitizeState previousState);
29  virtual bool canPaste (const Transformation &transformation,
30  const QSize &viewSize) const;
31  virtual QCursor cursor (CmdMediator *cmdMediator) const;
32  virtual void end();
33  virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator,
34  const QString &pointIdentifier);
35  virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator,
36  const QStringList &pointIdentifiers);
37  virtual void handleCurveChange(CmdMediator *cmdMediator);
38  virtual void handleKeyPress (CmdMediator *cmdMediator,
39  Qt::Key key,
40  bool atLeastOneSelectedItem);
41  virtual void handleMouseMove (CmdMediator *cmdMediator,
42  QPointF posScreen);
43  virtual void handleMousePress (CmdMediator *cmdMediator,
44  QPointF posScreen);
45  virtual void handleMouseRelease (CmdMediator *cmdMediator,
46  QPointF posScreen);
47  virtual QString state() const;
48  virtual void updateAfterPointAddition ();
49  virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator,
50  const DocumentModelDigitizeCurve &modelDigitizeCurve);
51  virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
52 
53 public slots:
55  void slotMouseClickOnSegment(QPointF);
56 
57 private:
59 
60  // Identify which Segment owns the SegmentLine that was clicked on
61  Segment *segmentFromSegmentStart (const QPointF &posSegmentStart) const;
62 
63  QList<Segment*> m_segments;
64  CmdMediator *m_cmdMediator;
65 };
66 
67 #endif // DIGITIZE_STATE_SEGMENT_H
DigitizeStateSegment::handleContextMenuEventGraph
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
Definition: DigitizeStateSegment.cpp:82
DigitizeStateSegment::handleMousePress
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Definition: DigitizeStateSegment.cpp:132
DigitizeStateContext
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Definition: DigitizeStateContext.h:26
DigitizeStateAbstractBase::context
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Definition: DigitizeStateAbstractBase.cpp:41
DigitizeStateSegment::handleMouseRelease
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
Definition: DigitizeStateSegment.cpp:138
DigitizeStateSegment::updateModelDigitizeCurve
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Definition: DigitizeStateSegment.cpp:217
DigitizeStateSegment::updateModelSegments
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
Definition: DigitizeStateSegment.cpp:223
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition: Transformation.h:30
DigitizeStateSegment
Digitizing state for creating multiple Points along a highlighted segment.
Definition: DigitizeStateSegment.h:16
Segment
Selectable piecewise-defined line that follows a filtered line in the image.
Definition: Segment.h:20
DigitizeStateSegment::cursor
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
Definition: DigitizeStateSegment.cpp:57
DigitizeStateAbstractBase.h
DigitizeStateSegment::handleMouseMove
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...
Definition: DigitizeStateSegment.cpp:126
DigitizeState
DigitizeState
Set of possible states of Digitize toolbar.
Definition: DigitizeStateAbstractBase.h:23
DigitizeStateSegment::slotMouseClickOnSegment
void slotMouseClickOnSegment(QPointF)
Receive signal from Segment that has been clicked on. The CmdMediator from the begin method will be u...
Definition: DigitizeStateSegment.cpp:164
DigitizeStateSegment::handleContextMenuEventAxis
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
Definition: DigitizeStateSegment.cpp:75
DigitizeStateSegment::begin
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
Definition: DigitizeStateSegment.cpp:36
DocumentModelSegments
Model for DlgSettingsSegments and CmdSettingsSegments.
Definition: DocumentModelSegments.h:16
DocumentModelDigitizeCurve
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Definition: DocumentModelDigitizeCurve.h:17
CmdMediator
Command queue stack.
Definition: CmdMediator.h:22
DigitizeStateSegment::activeCurve
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
Definition: DigitizeStateSegment.cpp:31
DigitizeStateSegment::handleKeyPress
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
Definition: DigitizeStateSegment.cpp:118
DigitizeStateSegment::canPaste
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...
Definition: DigitizeStateSegment.cpp:50
DigitizeStateSegment::end
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
Definition: DigitizeStateSegment.cpp:64
DigitizeStateSegment::state
virtual QString state() const
State name for debugging.
Definition: DigitizeStateSegment.cpp:207
DigitizeStateSegment::handleCurveChange
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
Definition: DigitizeStateSegment.cpp:89
DigitizeStateSegment::updateAfterPointAddition
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
Definition: DigitizeStateSegment.cpp:212
DigitizeStateAbstractBase
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
Definition: DigitizeStateAbstractBase.h:36
DigitizeStateSegment::~DigitizeStateSegment
virtual ~DigitizeStateSegment()
Definition: DigitizeStateSegment.cpp:27