Engauge Digitizer  2
Public Member Functions | List of all members
BackgroundStateContext Class Reference

Context class that manages the background image state machine. More...

#include <BackgroundStateContext.h>

Public Member Functions

 BackgroundStateContext (MainWindow &mainWindow)
 Single constructor.
 
void close ()
 Open Document is being closed so remove the background.
 
void fitInView (GraphicsView &view)
 Zoom so background fills the window.
 
QImage imageForCurveState () const
 Image for the Curve state, even if the current state is different.
 
void requestStateTransition (BackgroundState backgroundState)
 Initiate state transition to be performed later, when BackgroundState is off the stack.
 
void setBackgroundImage (BackgroundImage backgroundImage)
 Transition to the specified state. This method is used by classes outside of the state machine to trigger transitions.
 
void setCurveSelected (const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QString &curveSelected)
 Update the selected curve. More...
 
void setPixmap (const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &modelColorFilter, const QPixmap &pixmapOriginal, const QString &curveSelected)
 Update the images of all states, rather than just the current state.
 
void updateColorFilter (const Transformation &transformation, const DocumentModelGridRemoval &modelGridRemoval, const DocumentModelColorFilter &colorFilter, const QString &curveSelected)
 Apply color filter settings.
 

Detailed Description

Context class that manages the background image state machine.

Overall strategy is that changing the currently selected curve should not affect the background image if the original image is being shown, or no image is being shown. However, if the curve-specific color filter image is being shown, then it should be replaced by the filtered image specific to the new curve.

Other considerations are that the processing should be robust in terms of ordering of the following incoming events:

  1. State transitions
  2. Setting of the background image
  3. Setting of the currently selected curve name

Definition at line 32 of file BackgroundStateContext.h.

Member Function Documentation

◆ setCurveSelected()

void BackgroundStateContext::setCurveSelected ( const Transformation transformation,
const DocumentModelGridRemoval modelGridRemoval,
const DocumentModelColorFilter modelColorFilter,
const QString &  curveSelected 
)

Update the selected curve.

Although this probably affects only the BACKGROUND_STATE_CURVE state, we will forward it to all states (consistent with setPixmap)

Definition at line 129 of file BackgroundStateContext.cpp.


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