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

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. More...
 

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 ( 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.
DigitizeStateCurve::~DigitizeStateCurve ( )
virtual

Definition at line 26 of file DigitizeStateCurve.cpp.

27 {
28 }

Member Function Documentation

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 }
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
MainWindow & mainWindow()
Reference to the MainWindow, without const.
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 }
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
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
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
MainWindow & mainWindow()
Reference to the MainWindow, without const.
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
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.
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 
56  CursorFactory cursorFactory;
57  QCursor cursor = cursorFactory.generate (cmdMediator->document().modelDigitizeCurve());
58 
59  return cursor;
60 }
Create standard cross cursor, or custom cursor, according to settings.
Definition: CursorFactory.h:15
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
Definition: Document.cpp:709
log4cpp::Category * mainCat
Definition: Logger.cpp:14
QCursor generate(const DocumentModelDigitizeCurve &modelDigitizeCurve) const
Factory method to generate standard or custom cursor.
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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
112  OrdinalGenerator ordinalGenerator;
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 }
Transformation transformation() const
Return read-only copy of transformation.
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
MainWindow & mainWindow()
Reference to the MainWindow, without const.
Affine transformation between screen and graph coordinates, based on digitized axis points...
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
Command for adding one graph point.
Storage of one imported image and the data attached to that image.
Definition: Document.h:41
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Utility class for generating ordinal numbers.
double generateCurvePointOrdinal(const Document &document, const Transformation &transformation, const QPointF &posScreen, const QString &curveName)
Select ordinal so new point curve passes smoothly through existing points.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
QString DigitizeStateCurve::state ( ) const
virtual

State name for debugging.

Implements DigitizeStateAbstractBase.

Definition at line 127 of file DigitizeStateCurve.cpp.

128 {
129  return "DigitizeStateCurve";
130 }
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
log4cpp::Category * mainCat
Definition: Logger.cpp:14
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 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

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