15 #include <QGraphicsItem>
16 #include <QGraphicsScene>
19 #include <QTextStream>
46 const QList<Point> &points,
53 const double UNIT_LENGTH = 1.0;
61 path = QString (
"yMin=%1 ").arg (yMin);
65 double angle0 = points.at(0).posGraph().x();
66 double angle1 = points.at(1).posGraph().x();
67 double angle2 = points.at(2).posGraph().x();
69 QPointF (angle0, UNIT_LENGTH));
71 QPointF (angle1, UNIT_LENGTH));
73 QPointF (angle2, UNIT_LENGTH));
80 if ((sumAngle0 <= sumAngle1) && (sumAngle0 <= sumAngle2)) {
85 path += QString (
"from 1=%1 through 0 to 2=%2").arg (angle1).arg (angle2);
89 path += QString (
"from 2=%1 through 0 to 1=%2").arg (angle2).arg (angle1);
93 }
else if ((sumAngle1 <= sumAngle0) && (sumAngle1 <= sumAngle2)) {
98 path += QString (
"from 0=%1 through 1 to 2=%2").arg (angle0).arg (angle2);
102 path += QString (
"from 2=%1 through 1 to 0=%2").arg (angle2).arg (angle0);
111 path += QString (
"from 0=%1 through 2 to 1=%2").arg (angle0).arg (angle1);
115 path += QString (
"from 1=%1 through 2 to 0=%2").arg (angle1).arg (angle0);
122 while (xMax < xMin) {
126 path += QString (
" xMax+=%1").arg (thetaPeriod);
132 LOG4CPP_INFO_S ((*
mainCat)) <<
"Checker::adjustPolarAngleRanges path=(" << path.toLatin1().data() <<
")";
150 QPolygonF::const_iterator itr;
151 for (itr = polygon.begin (); itr != polygon.end (); itr++) {
153 const QPointF &pF = *itr;
159 points.push_back (p);
170 documentAxesPointsRequired);
181 <<
" transformation=" << transformation;
188 m_gridLines.
clear ();
193 double xFrom = 0, xTo = 0, yFrom = 0, yTo = 0;
197 for (i = 0; i < points.count(); i++) {
198 if (!fourPoints || (points.at(i).isXOnly() && fourPoints)) {
202 xFrom = points.at(i).posGraph().x();
203 xTo = points.at(i).posGraph().x();
206 xFrom = qMin (xFrom, points.at(i).posGraph().x());
207 xTo = qMax (xTo , points.at(i).posGraph().x());
211 if (!fourPoints || (!points.at(i).isXOnly() && fourPoints)) {
215 yFrom = points.at(i).posGraph().y();
216 yTo = points.at(i).posGraph().y();
219 yFrom = qMin (yFrom, points.at(i).posGraph().y());
220 yTo = qMax (yTo , points.at(i).posGraph().y());
227 adjustPolarAngleRanges (modelCoords,
239 m_gridLines.
add (factory.
createGridLine (xFrom, yFrom, xFrom, yTo , transformation));
240 m_gridLines.
add (factory.
createGridLine (xFrom, yTo , xTo , yTo , transformation));
241 m_gridLines.
add (factory.
createGridLine (xTo , yTo , xTo , yFrom, transformation));
242 m_gridLines.
add (factory.
createGridLine (xTo , yFrom, xFrom, yFrom, transformation));
Factory class for generating the points, composed of QGraphicsItem objects, along a GridLine...
void clear()
Deallocate and remove all grid lines.
const int CHECKER_POINTS_WIDTH
void setPen(const QPen &pen)
Set the pen style of each grid line.
virtual void updateModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Apply the new DocumentModelAxesChecker, to the points already associated with this object...
const int NUM_AXES_POINTS_4
double originRadius() const
Get method for origin radius in polar mode.
ColorPalette lineColor() const
Get method for line color.
#define LOG4CPP_INFO_S(logger)
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
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...
double thetaPeriod() const
Return the period of the theta value for polar coordinates, consistent with CoordThetaUnits.
const int NUM_AXES_POINTS_2
QColor ColorPaletteToQColor(ColorPalette color)
const QString DUMMY_CURVE_NAME
CoordsType coordsType() const
Get method for coordinates type.
double angleBetweenVectors(const QPointF &v1, const QPointF &v2)
Angle between two vectors. Direction is unimportant, so result is between 0 to pi radians...
Model for DlgSettingsCoords and CmdSettingsCoords.
void setVisible(bool visible)
Make all grid lines visible or hidden.
const int NUM_AXES_POINTS_3
double angleFromVectorToVector(const QPointF &vFrom, const QPointF &vTo)
Angle between two vectors. Direction is positive when rotation is about +z vector, so result is betwen -pi to pi radians.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
log4cpp::Category * mainCat
void add(GridLine *gridLine)
Add specified grid line. Ownership of all allocated QGraphicsItems is passed to new GridLine...
Checker(QGraphicsScene &scene)
Single constructor for DlgSettingsAxesChecker, which does not have an explicit transformation. The identity transformation is assumed.
void setVisible(bool visible)
Show/hide this axes checker.
DocumentAxesPointsRequired
GridLine * createGridLine(double xFrom, double yFrom, double xTo, double yTo, const Transformation &transformation)
Create grid line, either along constant X/theta or constant Y/radius side.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...