|
Engauge Digitizer 2
|
Affine transformation between screen and graph coordinates, based on digitized axis points. More...
#include <Transformation.h>
Public Member Functions | |
| Transformation () | |
| Default constructor. This is marked as undefined until the proper number of axis points are added. | |
| Transformation & | operator= (const Transformation &other) |
| Assignment operator. | |
| void | identity () |
| Identity transformation. | |
| bool | operator!= (const Transformation &other) |
| Inequality operator. This is marked as defined. | |
| void | coordTextForStatusBar (QPointF cursorScreen, QString &coordsScreen, QString &coordsGraph, QString &resolutionGraph) |
| Return string descriptions of cursor coordinates for status bar. | |
| DocumentModelCoords | modelCoords () const |
| Get method for DocumentModelCoords. | |
| void | printStream (QString indentation, QTextStream &str) const |
| Debugging method that supports print method of this class and printStream method of some other class(es) | |
| void | resetOnLoad () |
| Reset, when loading a document after the first, to same state that first document was at when loaded. | |
| bool | transformIsDefined () const |
| Transform is defined when at least three axis points have been digitized. | |
| void | transformLinearCartesianGraphToRawGraph (const QPointF &coordGraph, QPointF &coordScreen) const |
| Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates. | |
| void | transformLinearCartesianGraphToScreen (const QPointF &coordGraph, QPointF &coordScreen) const |
| Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates. | |
| QTransform | transformMatrix () const |
| Get method for copying only, for the transform matrix. | |
| void | transformRawGraphToLinearCartesianGraph (const QPointF &pointRaw, QPointF &pointLinearCartesian) const |
| Convert graph coordinates (linear or log, cartesian or polar) to linear cartesian coordinates. | |
| void | transformRawGraphToScreen (const QPointF &pointRaw, QPointF &pointScreen) const |
| Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinates. | |
| void | transformScreenToLinearCartesianGraph (const QPointF &pointScreen, QPointF &pointLinearCartesian) const |
| Transform screen coordinates to linear cartesian coordinates. | |
| void | transformScreenToRawGraph (const QPointF &coordScreen, QPointF &coordGraph) const |
| Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates. | |
| void | update (bool fileIsLoaded, const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow) |
| Update transform by iterating through the axis points. | |
Static Public Member Functions | |
| static QTransform | calculateTransformFromLinearCartesianPoints (const QPointF &posFrom0, const QPointF &posFrom1, const QPointF &posFrom2, const QPointF &posTo0, const QPointF &posTo1, const QPointF &posTo2) |
| Calculate QTransform using from/to points that have already been adjusted for, when applicable, log scaling and polar coordinates. | |
| static QPointF | cartesianFromCartesianOrPolar (const DocumentModelCoords &modelCoords, const QPointF &posGraphIn) |
| Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use externally. | |
| static QPointF | cartesianOrPolarFromCartesian (const DocumentModelCoords &modelCoords, const QPointF &posGraphIn) |
| Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use externally. | |
| static double | logToLinearCartesian (double xy) |
| Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is necessary. | |
| static double | logToLinearRadius (double r, double rCenter) |
| Convert radius scaling from log to linear. Calling code is responsible for determining if this is necessary. | |
Friends | |
| class | TestTransformation |
Affine transformation between screen and graph coordinates, based on digitized axis points.
Transformation from screen pixels to graph coordinates involves two steps:
Transformation from graph coordinates to screen pixels reverses the steps involved in the transformation from screen pixels to graph coordinates
Log scaling is calculated as (xLinear - xLogMin) / (xLogMax - xLogMin) = (ln(xLog) - ln(xLogMin)) / (ln(xLogMax) - ln(xLogMin)), which leaves the points (xLogMin,yLonMin) and (xLogMax,yLogMax) unaffected but gives log growth on all other points
Definition at line 30 of file Transformation.h.
| Transformation::Transformation | ( | ) |
Default constructor. This is marked as undefined until the proper number of axis points are added.
Definition at line 27 of file Transformation.cpp.
|
static |
Calculate QTransform using from/to points that have already been adjusted for, when applicable, log scaling and polar coordinates.
The points are linear and cartesian.
This method is kept very generic since it used for different types of transformations:
Definition at line 46 of file Transformation.cpp.
|
static |
Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use externally.
Definition at line 68 of file Transformation.cpp.
|
static |
Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use externally.
Definition at line 111 of file Transformation.cpp.
| void Transformation::coordTextForStatusBar | ( | QPointF | cursorScreen, |
| QString & | coordsScreen, | ||
| QString & | coordsGraph, | ||
| QString & | resolutionGraph | ||
| ) |
Return string descriptions of cursor coordinates for status bar.
Definition at line 154 of file Transformation.cpp.
| void Transformation::identity | ( | ) |
Identity transformation.
Definition at line 222 of file Transformation.cpp.
|
static |
Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is necessary.
Definition at line 231 of file Transformation.cpp.
|
static |
Convert radius scaling from log to linear. Calling code is responsible for determining if this is necessary.
Definition at line 236 of file Transformation.cpp.
| DocumentModelCoords Transformation::modelCoords | ( | ) | const |
Get method for DocumentModelCoords.
Definition at line 242 of file Transformation.cpp.
| bool Transformation::operator!= | ( | const Transformation & | other | ) |
Inequality operator. This is marked as defined.
Definition at line 40 of file Transformation.cpp.
| Transformation & Transformation::operator= | ( | const Transformation & | other | ) |
Assignment operator.
Definition at line 32 of file Transformation.cpp.
| void Transformation::printStream | ( | QString | indentation, |
| QTextStream & | str | ||
| ) | const |
Debugging method that supports print method of this class and printStream method of some other class(es)
Definition at line 259 of file Transformation.cpp.
| void Transformation::resetOnLoad | ( | ) |
Reset, when loading a document after the first, to same state that first document was at when loaded.
Definition at line 280 of file Transformation.cpp.
| bool Transformation::transformIsDefined | ( | ) | const |
Transform is defined when at least three axis points have been digitized.
Definition at line 303 of file Transformation.cpp.
| void Transformation::transformLinearCartesianGraphToRawGraph | ( | const QPointF & | coordGraph, |
| QPointF & | coordScreen | ||
| ) | const |
Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates.
Definition at line 308 of file Transformation.cpp.
| void Transformation::transformLinearCartesianGraphToScreen | ( | const QPointF & | coordGraph, |
| QPointF & | coordScreen | ||
| ) | const |
Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates.
Definition at line 347 of file Transformation.cpp.
| QTransform Transformation::transformMatrix | ( | ) | const |
Get method for copying only, for the transform matrix.
Definition at line 355 of file Transformation.cpp.
| void Transformation::transformRawGraphToLinearCartesianGraph | ( | const QPointF & | pointRaw, |
| QPointF & | pointLinearCartesian | ||
| ) | const |
Convert graph coordinates (linear or log, cartesian or polar) to linear cartesian coordinates.
Definition at line 360 of file Transformation.cpp.
| void Transformation::transformRawGraphToScreen | ( | const QPointF & | pointRaw, |
| QPointF & | pointScreen | ||
| ) | const |
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinates.
Definition at line 402 of file Transformation.cpp.
| void Transformation::transformScreenToLinearCartesianGraph | ( | const QPointF & | pointScreen, |
| QPointF & | pointLinearCartesian | ||
| ) | const |
Transform screen coordinates to linear cartesian coordinates.
Definition at line 413 of file Transformation.cpp.
| void Transformation::transformScreenToRawGraph | ( | const QPointF & | coordScreen, |
| QPointF & | coordGraph | ||
| ) | const |
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Definition at line 421 of file Transformation.cpp.
| void Transformation::update | ( | bool | fileIsLoaded, |
| const CmdMediator & | cmdMediator, | ||
| const MainWindowModel & | modelMainWindow | ||
| ) |
Update transform by iterating through the axis points.
Definition at line 431 of file Transformation.cpp.
|
friend |
Definition at line 33 of file Transformation.h.