Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DigitizeStateCurve Class Reference

Digitizing state for creating Curve Points, one at a time. More...

#include <DigitizeStateCurve.h>

Inheritance diagram for DigitizeStateCurve:
Inheritance graph
Collaboration diagram for DigitizeStateCurve:
Collaboration graph

Public Member Functions

 DigitizeStateCurve (DigitizeStateContext &context)
 Single constructor.
 
virtual ~DigitizeStateCurve ()
 
virtual QString activeCurve () const
 Name of the active Curve. This can include AXIS_CURVE_NAME.
 
virtual void begin (CmdMediator *cmdMediator, DigitizeState previousState)
 Method that is called at the exact moment a state is entered.
 
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 current state.
 
virtual QCursor cursor (CmdMediator *cmdMediator) const
 Returns the state-specific cursor shape.
 
virtual void end ()
 Method that is called at the exact moment a state is exited. Typically called just before begin for the next state.
 
virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator, const QString &pointIdentifier)
 Handle a right click, on an axis point, that was intercepted earlier.
 
virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
 Handle a right click, on a graph point, that was intercepted earlier.
 
virtual void handleCurveChange (CmdMediator *cmdMediator)
 Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Segments.
 
virtual void handleKeyPress (CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
 Handle a key press that was intercepted earlier.
 
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 mode is worthwhile.
 
virtual void handleMousePress (CmdMediator *cmdMediator, QPointF posScreen)
 Handle a mouse press that was intercepted earlier.
 
virtual void handleMouseRelease (CmdMediator *cmdMediator, QPointF posScreen)
 Handle a mouse release that was intercepted earlier.
 
virtual QString state () const
 State name for debugging.
 
virtual void updateAfterPointAddition ()
 Update graphics attributes after possible new points. This is useful for highlight opacity.
 
virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
 Update the digitize curve settings.
 
virtual void updateModelSegments (const DocumentModelSegments &modelSegments)
 Update the segments given the new settings.
 
- Public Member Functions inherited from DigitizeStateAbstractBase
 DigitizeStateAbstractBase (DigitizeStateContext &context)
 Single constructor.
 
virtual ~DigitizeStateAbstractBase ()
 
DigitizeStateContextcontext ()
 Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.
 
const DigitizeStateContextcontext () const
 Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses, without const.
 
void setCursor (CmdMediator *cmdMediator)
 Update the cursor according to the current state.
 

Additional Inherited Members

- Protected Member Functions inherited from DigitizeStateAbstractBase
bool canPasteProtected (const Transformation &transformation, const QSize &viewSize) const
 Protected version of canPaste method. Some, but not all, leaf classes use this method.
 

Detailed Description

Digitizing state for creating Curve Points, one at a time.

Definition at line 13 of file DigitizeStateCurve.h.

Constructor & Destructor Documentation

◆ DigitizeStateCurve()

DigitizeStateCurve::DigitizeStateCurve ( DigitizeStateContext & context)

Single constructor.

Definition at line 21 of file DigitizeStateCurve.cpp.

21 :
23{
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,...

◆ ~DigitizeStateCurve()

DigitizeStateCurve::~DigitizeStateCurve ( )
virtual

Definition at line 26 of file DigitizeStateCurve.cpp.

27{
28}

Member Function Documentation

◆ activeCurve()

QString DigitizeStateCurve::activeCurve ( ) const
virtual

Name of the active Curve. This can include AXIS_CURVE_NAME.

Implements DigitizeStateAbstractBase.

Definition at line 30 of file DigitizeStateCurve.cpp.

31{
33}
MainWindow & mainWindow()
Reference to the MainWindow, without const.
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.

◆ begin()

void DigitizeStateCurve::begin ( CmdMediator * cmdMediator,
DigitizeState previousState )
virtual

Method that is called at the exact moment a state is entered.

Typically called just after end for the previous state. The previousState value is used by DigitizeStateColorPicker to return to the previous state

Implements DigitizeStateAbstractBase.

Definition at line 35 of file DigitizeStateCurve.cpp.

37{
38 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::begin";
39
40 setCursor(cmdMediator);
41 context().setDragMode(QGraphicsView::NoDrag);
43}
log4cpp::Category * mainCat
Definition Logger.cpp:14
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ canPaste()

bool DigitizeStateCurve::canPaste ( const Transformation & transformation,
const QSize & viewSize ) const
virtual

Return true if there is good data in the clipboard for pasting, and that is compatible with the current state.

Implements DigitizeStateAbstractBase.

Definition at line 45 of file DigitizeStateCurve.cpp.

47{
48 return canPasteProtected (transformation,
49 size);
50}
bool canPasteProtected(const Transformation &transformation, const QSize &viewSize) const
Protected version of canPaste method. Some, but not all, leaf classes use this method.

◆ cursor()

QCursor DigitizeStateCurve::cursor ( CmdMediator * cmdMediator) const
virtual

Returns the state-specific cursor shape.

Implements DigitizeStateAbstractBase.

Definition at line 52 of file DigitizeStateCurve.cpp.

53{
54 LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateCurve::cursor";
55
58
59 return cursor;
60}
const int INNER_RADIUS_MIN
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Create standard cross cursor, or custom cursor, according to settings.
QCursor generate(const DocumentModelDigitizeCurve &modelDigitizeCurve) const
Factory method to generate standard or custom cursor.
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
Definition Document.cpp:709
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ end()

void DigitizeStateCurve::end ( )
virtual

Method that is called at the exact moment a state is exited. Typically called just before begin for the next state.

Implements DigitizeStateAbstractBase.

Definition at line 62 of file DigitizeStateCurve.cpp.

63{
64 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::end";
65}

◆ handleContextMenuEventAxis()

void DigitizeStateCurve::handleContextMenuEventAxis ( CmdMediator * cmdMediator,
const QString & pointIdentifier )
virtual

Handle a right click, on an axis point, that was intercepted earlier.

Implements DigitizeStateAbstractBase.

Definition at line 67 of file DigitizeStateCurve.cpp.

69{
70 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::handleContextMenuEventAxis "
71 << " point=" << pointIdentifier.toLatin1 ().data ();
72}

◆ handleContextMenuEventGraph()

void DigitizeStateCurve::handleContextMenuEventGraph ( CmdMediator * cmdMediator,
const QStringList & pointIdentifiers )
virtual

Handle a right click, on a graph point, that was intercepted earlier.

Implements DigitizeStateAbstractBase.

Definition at line 74 of file DigitizeStateCurve.cpp.

76{
77 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve ::handleContextMenuEventGraph "
78 << "points=" << pointIdentifiers.join(",").toLatin1 ().data ();
79}

◆ handleCurveChange()

void DigitizeStateCurve::handleCurveChange ( CmdMediator * cmdMediator)
virtual

Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Segments.

Implements DigitizeStateAbstractBase.

Definition at line 81 of file DigitizeStateCurve.cpp.

82{
83 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::handleCurveChange";
84}

◆ handleKeyPress()

void DigitizeStateCurve::handleKeyPress ( CmdMediator * cmdMediator,
Qt::Key key,
bool atLeastOneSelectedItem )
virtual

Handle a key press that was intercepted earlier.

Implements DigitizeStateAbstractBase.

Definition at line 86 of file DigitizeStateCurve.cpp.

89{
90 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::handleKeyPress"
91 << " key=" << QKeySequence (key).toString ().toLatin1 ().data ();
92}

◆ handleMouseMove()

void DigitizeStateCurve::handleMouseMove ( CmdMediator * cmdMediator,
QPointF posScreen )
virtual

Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mode is worthwhile.

Implements DigitizeStateAbstractBase.

Definition at line 94 of file DigitizeStateCurve.cpp.

96{
97// LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateCurve::handleMouseMove";
98}

◆ handleMousePress()

void DigitizeStateCurve::handleMousePress ( CmdMediator * cmdMediator,
QPointF pos )
virtual

Handle a mouse press that was intercepted earlier.

Implements DigitizeStateAbstractBase.

Definition at line 100 of file DigitizeStateCurve.cpp.

102{
103 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::handleMousePress";
104}

◆ handleMouseRelease()

void DigitizeStateCurve::handleMouseRelease ( CmdMediator * cmdMediator,
QPointF pos )
virtual

Handle a mouse release that was intercepted earlier.

Implements DigitizeStateAbstractBase.

Definition at line 106 of file DigitizeStateCurve.cpp.

108{
109 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::handleMouseRelease";
110
111 // Create command to add point
113 Document &document = cmdMediator->document ();
114 const Transformation &transformation = context ().mainWindow ().transformation();
115 QUndoCommand *cmd = new CmdAddPointGraph (context ().mainWindow(),
116 document,
117 context ().mainWindow().selectedGraphCurve(),
118 posScreen,
119 ordinalGenerator.generateCurvePointOrdinal(document,
120 transformation,
121 posScreen,
122 activeCurve ()));
123 context().appendNewCmd(cmdMediator,
124 cmd);
125}
Command for adding one graph point.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
Storage of one imported image and the data attached to that image.
Definition Document.h:42
Transformation transformation() const
Return read-only copy of transformation.
Utility class for generating ordinal numbers.
Affine transformation between screen and graph coordinates, based on digitized axis points.

◆ state()

QString DigitizeStateCurve::state ( ) const
virtual

State name for debugging.

Implements DigitizeStateAbstractBase.

Definition at line 127 of file DigitizeStateCurve.cpp.

128{
129 return "DigitizeStateCurve";
130}

◆ updateAfterPointAddition()

void DigitizeStateCurve::updateAfterPointAddition ( )
virtual

Update graphics attributes after possible new points. This is useful for highlight opacity.

Implements DigitizeStateAbstractBase.

Definition at line 132 of file DigitizeStateCurve.cpp.

133{
134 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::updateAfterPointAddition";
135}

◆ updateModelDigitizeCurve()

void DigitizeStateCurve::updateModelDigitizeCurve ( CmdMediator * cmdMediator,
const DocumentModelDigitizeCurve & modelDigitizeCurve )
virtual

Update the digitize curve settings.

Implements DigitizeStateAbstractBase.

Definition at line 137 of file DigitizeStateCurve.cpp.

139{
140 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::updateModelDigitizeCurve";
141
142 setCursor(cmdMediator);
143}

◆ updateModelSegments()

void DigitizeStateCurve::updateModelSegments ( const DocumentModelSegments & modelSegments)
virtual

Update the segments given the new settings.

Implements DigitizeStateAbstractBase.

Definition at line 145 of file DigitizeStateCurve.cpp.

146{
147 LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateCurve::updateModelSegments";
148}

The documentation for this class was generated from the following files: