Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
DigitizeStatePointMatch.h
1 #ifndef DIGITIZE_STATE_POINT_MATCH_H
2 #define DIGITIZE_STATE_POINT_MATCH_H
3 
4 #include "DigitizeStateAbstractBase.h"
5 #include "PointMatchPixel.h"
6 #include <QList>
7 #include <QPoint>
8 
10 class QGraphicsEllipseItem;
11 class QGraphicsPixmapItem;
12 class QImage;
13 
16 {
17 public:
20  virtual ~DigitizeStatePointMatch();
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  void createPermanentPoint (const QPointF &posScreen);
40  void createTemporaryPoint (const QPoint &posScreen);
41  QList<PointMatchPixel> extractSamplePointPixels (const QImage &img,
42  const DocumentModelPointMatch &modelPointMatch,
43  const QPointF &posScreen) const;
44  void findPointsAndShowFirstCandidate (const QPointF &posScreen);
45  bool pixelIsOnInImage (const QImage &img,
46  int x,
47  int y,
48  int radiusLimit) const;
49  void popCandidatePoint ();
50  void promoteCandidatePointToPermanentPoint();
51 
52  QGraphicsEllipseItem *m_outline;
53  QGraphicsPixmapItem *m_candidatePoint;
54 
55  // Candidate points sorted from best match to worst match. Once accepted, each is removed since there
56  // is now an "official" point in the Document and GraphicsScene
57  QList<QPoint> m_candidatePoints;
58 
59  QPoint m_posCandidatePoint;
60 };
61 
62 #endif // DIGITIZE_STATE_POINT_MATCH_H
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
virtual void begin(DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
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 updateModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
virtual void handleMouseRelease(QPointF posScreen)
Handle a mouse release that was intercepted earlier.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
virtual void handleCurveChange()
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
Digitizing state for matching Curve Points, one at a time.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
virtual QString state() const
State name for debugging.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual void handleMousePress(QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Model for DlgSettingsSegments and CmdSettingsSegments.
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
virtual QCursor cursor() const
Returns the state-specific cursor shape.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.