Engauge Digitizer  2
BackgroundStateOriginal.cpp
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 #include "BackgroundStateContext.h"
8 #include "BackgroundStateOriginal.h"
9 #include "DocumentModelColorFilter.h"
10 #include "DocumentModelGridRemoval.h"
11 #include "GraphicsScene.h"
12 #include "GraphicsView.h"
13 #include "Logger.h"
14 #include <QPixmap>
15 #include "Transformation.h"
16 
18  GraphicsScene &scene) :
20  scene)
21 {
22 }
23 
25 {
26  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::begin";
27 
28  setImageVisible (true);
29 }
30 
32 {
33  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::end";
34 
35  setImageVisible (false);
36 }
37 
39 {
40  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::fitInView";
41 
42  view.fitInView (imageItem ().boundingRect());
43 }
44 
45 void BackgroundStateOriginal::setCurveSelected (const Transformation & /* transformation */,
46  const DocumentModelGridRemoval & /* modelGridRemoval */,
47  const DocumentModelColorFilter & /* modelColorFilter */,
48  const QString & /* curveSelected */)
49 {
50  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::setCurveSelected";
51 }
52 
53 void BackgroundStateOriginal::setPixmap (const Transformation & /* transformation */,
54  const DocumentModelGridRemoval & /* modelGridRemoval */,
55  const DocumentModelColorFilter & /* modelColorFilter */,
56  const QPixmap &pixmapOriginal,
57  const QString & /* curveSelected */)
58 {
59  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::setPixmap";
60 
61  // Unfiltered original image
62  setProcessedPixmap (pixmapOriginal);
63 }
64 
66 {
67  return "BackgroundStateOriginal";
68 }
69 
71  const DocumentModelGridRemoval & /* modelGridRemoval */,
72  const DocumentModelColorFilter & /* modelColorFilter */,
73  const QString & /* curveSelected */)
74 {
75  LOG4CPP_INFO_S ((*mainCat)) << "BackgroundStateOriginal::updateColorFilter";
76 }
virtual void setPixmap(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmap, const QString &curveSelected)
Update the image for this state, after the leaf class processes it appropriately. ...
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...
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.
BackgroundStateOriginal(BackgroundStateContext &context, GraphicsScene &scene)
Single constructor.
QGraphicsPixmapItem & imageItem() const
Graphics image item for the current state.
virtual QString state() const
State name for debugging.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
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:20
Background image state machine state base class.
virtual void updateColorFilter(const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
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.
Add point and line handling to generic QGraphicsScene.
Definition: GraphicsScene.h:33
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...