Engauge Digitizer 2
Loading...
Searching...
No Matches
DigitizeStatePointMatch.h
Go to the documentation of this file.
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#ifndef DIGITIZE_STATE_POINT_MATCH_H
8#define DIGITIZE_STATE_POINT_MATCH_H
9
11#include "PointMatchPixel.h"
12#include <QList>
13#include <QPoint>
14
16class QGraphicsEllipseItem;
17class QGraphicsPixmapItem;
18class QImage;
19
22{
23public:
27
28 virtual QString activeCurve () const;
29 virtual void begin(CmdMediator *cmdMediator,
30 DigitizeState previousState);
31 virtual bool canPaste (const Transformation &transformation,
32 const QSize &viewSize) const;
33 virtual QCursor cursor (CmdMediator *cmdMediator) const;
34 virtual void end();
35 virtual void handleContextMenuEventAxis (CmdMediator *cmdMediator,
36 const QString &pointIdentifier);
37 virtual void handleContextMenuEventGraph (CmdMediator *cmdMediator,
38 const QStringList &pointIdentifiers);
39 virtual void handleCurveChange(CmdMediator *cmdMediator);
40 virtual void handleKeyPress (CmdMediator *cmdMediator,
41 Qt::Key key,
42 bool atLeastOneSelectedItem);
43 virtual void handleMouseMove (CmdMediator *cmdMediator,
44 QPointF posScreen);
45 virtual void handleMousePress (CmdMediator *cmdMediator,
46 QPointF posScreen);
47 virtual void handleMouseRelease (CmdMediator *cmdMediator,
48 QPointF posScreen);
49 virtual QString state() const;
50 virtual void updateAfterPointAddition ();
51 virtual void updateModelDigitizeCurve (CmdMediator *cmdMediator,
52 const DocumentModelDigitizeCurve &modelDigitizeCurve);
53 virtual void updateModelSegments(const DocumentModelSegments &modelSegments);
54
55private:
57
58 void createPermanentPoint (CmdMediator *cmdMediator,
59 const QPointF &posScreen);
60 void createTemporaryPoint (CmdMediator *cmdMediator,
61 const QPoint &posScreen);
62 QList<PointMatchPixel> extractSamplePointPixels (const QImage &img,
63 const DocumentModelPointMatch &modelPointMatch,
64 const QPointF &posScreen) const;
65 void findPointsAndShowFirstCandidate (CmdMediator *cmdMediator,
66 const QPointF &posScreen);
67 bool pixelIsOnInImage (const QImage &img,
68 int x,
69 int y,
70 int radiusLimit) const;
71 void popCandidatePoint (CmdMediator *cmdMediator);
72 void promoteCandidatePointToPermanentPoint(CmdMediator *cmdMediator);
73
74 QGraphicsEllipseItem *m_outline;
75 QGraphicsPixmapItem *m_candidatePoint;
76
77 // Candidate points sorted from best match to worst match. Once accepted, each is removed since there
78 // is now an "official" point in the Document and GraphicsScene
79 QList<QPoint> m_candidatePoints;
80
81 QPoint m_posCandidatePoint;
82};
83
84#endif // DIGITIZE_STATE_POINT_MATCH_H
DigitizeState
Set of possible states of Digitize toolbar.
Command queue stack.
Definition CmdMediator.h:24
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Digitizing state for matching Curve Points, one at a time.
virtual QString state() const
State name for debugging.
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Model for DlgSettingsSegments and CmdSettingsSegments.
Affine transformation between screen and graph coordinates, based on digitized axis points.