24#include <QGraphicsScene>
25#include <QGraphicsView>
33 m_mainWindow (mainWindow),
35 m_imageIsLoaded (false),
36 m_isGnuplot (isGnuplot)
56 qDeleteAll (m_states);
61 return m_states [m_currentState]->activeCurve ();
69 cmdMediator->push (cmd);
73 const QSize &size)
const
75 return m_states [m_currentState]->canPaste (transformation,
79void DigitizeStateContext::completeRequestedStateTransitionIfExists (
CmdMediator *cmdMediator)
81 if (m_currentState != m_requestedState) {
88 m_states [m_currentState]->end ();
93 m_currentState = m_requestedState;
94 m_states [m_requestedState]->begin (cmdMediator,
104 const QString &pointIdentifier)
106 m_states [m_currentState]->handleContextMenuEventAxis (cmdMediator,
111 const QStringList &pointIdentifiers)
113 m_states [m_currentState]->handleContextMenuEventGraph (cmdMediator,
119 m_states [m_currentState]->handleCurveChange(cmdMediator);
124 bool atLeastOneSelectedItem)
126 m_states [m_currentState]->handleKeyPress (cmdMediator,
128 atLeastOneSelectedItem);
130 completeRequestedStateTransitionIfExists(cmdMediator);
137 m_states [m_currentState]->handleMouseMove (cmdMediator,
140 completeRequestedStateTransitionIfExists(cmdMediator);
147 m_states [m_currentState]->handleMousePress (cmdMediator,
150 completeRequestedStateTransitionIfExists(cmdMediator);
157 m_states [m_currentState]->handleMouseRelease (cmdMediator,
160 completeRequestedStateTransitionIfExists(cmdMediator);
180 m_requestedState = digitizeState;
186 m_requestedState = digitizeState;
187 completeRequestedStateTransitionIfExists(cmdMediator);
198 completeRequestedStateTransitionIfExists(cmdMediator);
208 m_states [m_currentState]->setCursor (cmdMediator);
215 if (m_imageIsLoaded) {
216 m_view.setDragMode (dragMode);
225 m_imageIsLoaded = imageIsLoaded;
233 return m_states [m_currentState]->state();
240 m_states [m_currentState]->updateAfterPointAddition ();
250 m_states [m_currentState]->updateModelDigitizeCurve (cmdMediator,
260 m_states [m_currentState]->updateModelSegments (modelSegments);
DigitizeState
Set of possible states of Digitize toolbar.
@ DIGITIZE_STATE_POINT_MATCH
@ DIGITIZE_STATE_COLOR_PICKER
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
log4cpp::Category * mainCat
Digitizing state for digitizing one axis point at a time.
Digitizing state for selecting a color for DigitizeStateSegment.
QString state() const
State name for debugging.
bool isGnuplot() const
Get method for gnuplot flag.
void resetOnLoad(CmdMediator *cmdMediator)
Resetting makes re-initializes for documents after the first.
virtual ~DigitizeStateContext()
void handleMouseRelease(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseRelease.
bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that operation is compatible with...
DigitizeStateContext(MainWindow &mainWindow, QGraphicsView &view, bool isGnuplot)
Single constructor.
void handleMouseMove(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMouseMove.
void requestImmediateStateTransition(CmdMediator *cmdMediator, DigitizeState digitizeState)
Perform immediate state transition. Called from outside state machine.
void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
See DigitizeStateAbstractBase::handleContextMenuEventGraph.
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
void handleMousePress(CmdMediator *cmdMediator, QPointF pos)
See DigitizeStateAbstractBase::handleMousePress.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
void setCursor(CmdMediator *cmdMediator)
Set cursor after asking state for the new cursor shape.
void setImageIsLoaded(CmdMediator *cmdMediator, bool imageIsLoaded)
Set the image so QGraphicsView cursor and drag mode are accessible.
QString activeCurve() const
Curve name for active Curve. This can include AXIS_CURVE_NAME, and empty string.
void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
See DigitizeStateAbstractBase::handleKeyPress.
void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
void requestDelayedStateTransition(DigitizeState digitizeState)
Initiate state transition to be performed later, when DigitizeState is off the stack.
void updateAfterPointAddition()
Update the graphics attributes.
QGraphicsView & view()
QGraphicsView for use by DigitizeStateAbstractBase subclasses.
void handleCurveChange(CmdMediator *cmdMediator)
See DigitizeStateAbstractBase::handleCurveChange.
MainWindow & mainWindow()
Reference to the MainWindow, without const.
void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
See DigitizeStateAbstractBase::handleContextMenuEventAxis.
Digitizing state for creating Curve Points, one at a time.
Digitizing state before a Document has been created. In this state, the cursor is Qt::ArrowCursor.
Digitizing state for matching Curve Points, one at a time.
Digitizing state for creating the scale bar.
Digitizing state for creating multiple Points along a highlighted segment.
Digitizing state for selecting one or more Points in the Document.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsSegments and CmdSettingsSegments.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
void updateDigitizeStateIfSoftwareTriggered(DigitizeState digitizeState)
After software-triggered state transition, this method manually triggers the action as if user had cl...
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)