Engauge Digitizer 2
Loading...
Searching...
No Matches
Checker.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 CHECKER_H
8#define CHECKER_H
9
10#include "CheckerMode.h"
12#include "GridLine.h"
13#include "GridLines.h"
14#include <QColor>
15#include <QList>
16#include <QPainterPath>
17#include <QPolygonF>
18
21class Point;
22class QGraphicsEllipseItem;
23class QGraphicsItem;
24class QGraphicsScene;
25class QPolygonF;
26class Transformation;
27
34{
35public:
37 Checker(QGraphicsScene &scene);
38 virtual ~Checker ();
39
43 void prepareForDisplay (const QPolygonF &polygon,
44 int pointRadius,
45 const DocumentModelAxesChecker &modelAxesChecker,
46 const DocumentModelCoords &modelCoords,
47 DocumentAxesPointsRequired documentAxesPointsRequired);
48
51 void prepareForDisplay (const QList<Point> &Points,
52 int pointRadius,
53 const DocumentModelAxesChecker &modelAxesChecker,
54 const DocumentModelCoords &modelCoords,
55 const Transformation &transformation,
56 DocumentAxesPointsRequired documentAxesPointsRequired);
57
59 void setVisible (bool visible);
60
63 virtual void updateModelAxesChecker (const DocumentModelAxesChecker &modelAxesChecker);
64
65private:
66 Checker();
67
68 // For polar coordinates, pick the smallest angle range. Note that xMax may be less than xMin, in which case
69 // xMax+period should be used. Ymin is also set to zero for polar coordinates
70 void adjustPolarAngleRanges (const DocumentModelCoords &modelCoords,
71 const Transformation &transformation,
72 const QList<Point> &points,
73 double &xMin,
74 double &xMax,
75 double &yMin) const;
76
77 // Low level routine to set line color
78 void setLineColor (GridLine &gridLine,
79 const QPen &pen);
80
81 QGraphicsScene &m_scene;
82
83 // These grid lines are QGraphicsLineItem line segments or QGraphicsEllipseItem arc segments. Together they
84 // make up a box (cartesian) or annular (polar) shape in cartesian coordinates.
85 //
86 // A major complication is that drawing the box with just four lines from corner to corner results in extremely
87 // thick lines through the axes points, which obscures the axis point unacceptably. So, each side is drawn with
88 // up to 3 visible lines:
89 // 1) corner1 to either point1 or corner2 (whichever comes first)
90 // 2) unused, or point1 to either point2 or corner2 (whichever comes first)
91 // 3) unused point2 to corner2
92 GridLines m_gridLines;
93};
94
95#endif // CHECKER_H
QList< Point > Points
Definition Points.h:13
virtual ~Checker()
Definition Checker.cpp:39
void prepareForDisplay(const QPolygonF &polygon, int pointRadius, const DocumentModelAxesChecker &modelAxesChecker, const DocumentModelCoords &modelCoords, DocumentAxesPointsRequired documentAxesPointsRequired)
Create the polygon from current information, including pixel coordinates, just prior to display.
Definition Checker.cpp:135
Checker(QGraphicsScene &scene)
Single constructor for DlgSettingsAxesChecker, which does not have an explicit transformation....
Definition Checker.cpp:34
void setVisible(bool visible)
Show/hide this axes checker.
Definition Checker.cpp:247
virtual void updateModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Apply the new DocumentModelAxesChecker, to the points already associated with this object.
Definition Checker.cpp:252
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
Model for DlgSettingsCoords and CmdSettingsCoords.
Single grid line drawn a straight or curved line.
Definition GridLine.h:21
Container class for GridLine objects.
Definition GridLines.h:19
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition Point.h:26
Affine transformation between screen and graph coordinates, based on digitized axis points.