Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
BackgroundStateNone.cpp
1 #include "BackgroundStateContext.h"
2 #include "BackgroundStateNone.h"
3 #include "DocumentModelColorFilter.h"
4 #include "DocumentModelGridRemoval.h"
5 #include "GraphicsScene.h"
6 #include "GraphicsView.h"
7 #include "Logger.h"
8 #include <QPixmap>
9 
11  GraphicsScene &scene) :
13  scene)
14 {
15 }
16 
18 {
19  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::begin";
20 
21  setImageVisible (true);
22 }
23 
25 {
26  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::end";
27 
28  setImageVisible (false);
29 }
30 
32 {
33  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::fitInView";
34 
35  view.fitInView (imageItem ().boundingRect());
36 }
37 
38 void BackgroundStateNone::setCurveSelected (const Transformation & /* transformation */,
39  const DocumentModelGridRemoval & /* modelGridRemoval */,
40  const DocumentModelColorFilter & /* modelColorFilter */,
41  const QString & /* curveSelected */)
42 {
43  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::setCurveSelected";
44 }
45 
46 void BackgroundStateNone::setPixmap (const Transformation & /* transformation */,
47  const DocumentModelGridRemoval & /* modelGridRemoval */,
48  const DocumentModelColorFilter & /* modelColorFilter */,
49  const QPixmap &pixmapOriginal)
50 {
51  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::setPixmap";
52 
53  // Empty background
54  QPixmap pixmapNone (pixmapOriginal);
55  pixmapNone.fill (Qt::white);
56  setProcessedPixmap (pixmapNone);
57 
58 }
59 
61 {
62  return "BackgroundStateNone";
63 }
64 
65 void BackgroundStateNone::updateColorFilter (const Transformation & /* transformation */,
66  const DocumentModelGridRemoval & /* modelGridRemoval */,
67  const DocumentModelColorFilter & /* modelColorFilter */)
68 {
69  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateNone::updateColorFilter";
70 }
virtual void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter)
Apply color filter settings.
virtual void setCurveSelected(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
Update the currently selected curve name.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
QGraphicsPixmapItem & imageItem() const
Graphics image item for the current state.
void setImageVisible(bool visible)
Show/hide background image.
void setProcessedPixmap(const QPixmap &pixmap)
Save the image for this state after it has been processed by the leaf class.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
BackgroundStateNone(BackgroundStateContext &context, GraphicsScene &scene)
Single constructor.
Context class that manages the background image state machine.
QGraphicsView class with event handling added. Typically the events are sent to the active digitizing...
Definition: GraphicsView.h:14
Background image state machine state base class.
virtual void fitInView(GraphicsView &view)
Zoom so background fills the window.
virtual void begin()
Method that is called at the exact moment a state is entered. Typically called just after end for the...
virtual QString state() const
State name for debugging.
Add point and line handling to generic QGraphicsScene.
Definition: GraphicsScene.h:25
virtual void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmap)
Update the image for this state, after the leaf class processes it appropriately. ...
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...