Engauge Digitizer  2
DigitizeStateColorPicker.h
1 #ifndef DIGITIZE_STATE_COLOR_PICKER_H
2 #define DIGITIZE_STATE_COLOR_PICKER_H
3 
4 #include "BackgroundImage.h"
5 #include "DigitizeStateAbstractBase.h"
6 
8 class QColor;
9 class QImage;
10 class QPointF;
11 
16 {
17 public:
20  virtual ~DigitizeStateColorPicker();
21 
22  virtual QString activeCurve () const;
23  virtual void begin(DigitizeState previousState);
24  virtual QCursor cursor () const;
25  virtual void end();
26  virtual void handleCurveChange();
27  virtual void handleKeyPress (Qt::Key key,
28  bool atLeastOneSelectedItem);
29  virtual void handleMouseMove (QPointF posScreen);
30  virtual void handleMousePress (QPointF posScreen);
31  virtual void handleMouseRelease (QPointF posScreen);
32  virtual QString state() const;
33  virtual void updateModelDigitizeCurve (const DocumentModelDigitizeCurve &modelDigitizeCurve);
34  virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
35 
36 private:
38 
39  bool computeFilterFromPixel (const QPointF &posScreen,
40  const QString &curveName,
41  DocumentModelColorFilter &modelColorFilterAfter);
42  bool findNearestNonBackgroundPixel (const QImage &image,
43  const QPointF &posScreenPlusHalf,
44  const QRgb &rgbBackground,
45  QColor &pixel);
46  void saveLowerValueUpperValue (DocumentModelColorFilter &modelColorFilterAfter,
47  const QString &curveName,
48  double lowerValue,
49  double upperValue);
50 
51  // Save previous state and background for restoring as soon as user selects a valid point
52  DigitizeState m_previousDigitizeState;
53  BackgroundImage m_previousBackground;
54 };
55 
56 #endif // DIGITIZE_STATE_COLOR_PICKER_H
virtual void handleMousePress(QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Digitizing state for selecting a color for DigitizeStateSegment.
virtual QString state() const
State name for debugging.
virtual void begin(DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
virtual QCursor cursor() const
Returns the state-specific cursor shape.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
virtual void handleMouseMove(QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual void handleCurveChange()
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
Model for DlgSettingsSegments and CmdSettingsSegments.
virtual void updateModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
virtual void handleMouseRelease(QPointF posScreen)
Handle a mouse release that was intercepted earlier.