Engauge Digitizer 2
Loading...
Searching...
No Matches
Transformation Class Reference

Affine transformation between screen and graph coordinates, based on digitized axis points. More...

#include <Transformation.h>

Collaboration diagram for Transformation:
Collaboration graph

Public Member Functions

 Transformation ()
 Default constructor. This is marked as undefined until the proper number of axis points are added.
 Transformation (const Transformation &other)
 Copy constructor.
Transformationoperator= (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, bool usingScaleBar)
 Return string descriptions of cursor coordinates for status bar.
DocumentModelCoords modelCoords () const
 Get method for DocumentModelCoords.
DocumentModelGeneral modelGeneral () const
 Get method for DocumentModelGeneral.
MainWindowModel modelMainWindow () const
 Get method for MainWindowModel.
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 TestCentipedeEndpoints
class TestExport
class TestSplineDrawer
class TestTransformation

Detailed Description

Affine transformation between screen and graph coordinates, based on digitized axis points.

Transformation from screen pixels to graph coordinates involves two steps:

  1. Transform from screen pixels (which are linear and cartesian) to linear cartesian graph coordinates
  2. Transform from linear cartesian graph coordinates to the final graph coordinates, which are linear or log scaled, and cartesian or polar

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 31 of file Transformation.h.

Constructor & Destructor Documentation

◆ Transformation() [1/2]

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.

27 :
28 m_transformIsDefined (false)
29{
30}

◆ Transformation() [2/2]

Transformation::Transformation ( const Transformation & other)

Copy constructor.

Definition at line 32 of file Transformation.cpp.

32 :
33 m_transformIsDefined (other.transformIsDefined()),
34 m_transform (other.transformMatrix())
35{
36 setModelCoords (other.modelCoords(),
37 other.modelGeneral(),
38 other.modelMainWindow());
39}
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
QTransform transformMatrix() const
Get method for copying only, for the transform matrix.
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
MainWindowModel modelMainWindow() const
Get method for MainWindowModel.

Member Function Documentation

◆ calculateTransformFromLinearCartesianPoints()

QTransform Transformation::calculateTransformFromLinearCartesianPoints ( const QPointF & posFrom0,
const QPointF & posFrom1,
const QPointF & posFrom2,
const QPointF & posTo0,
const QPointF & posTo1,
const QPointF & posTo2 )
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:

  1. In many place to calculate screen-to/from-graph
  2. By Checker to calculate unaligned-to/from-aligned

Definition at line 58 of file Transformation.cpp.

64{
65 LOG4CPP_INFO_S ((*mainCat)) << "Transformation::calculateTransformFromLinearCartesianPoints";
66
67 QTransform from, to;
68 from.setMatrix (posFrom0.x(), posFrom1.x(), posFrom2.x(),
69 posFrom0.y(), posFrom1.y(), posFrom2.y(),
70 1.0, 1.0, 1.0);
71
72 to.setMatrix (posTo0.x(), posTo1.x(), posTo2.x(),
73 posTo0.y(), posTo1.y(), posTo2.y(),
74 1.0, 1.0, 1.0);
75 QTransform fromInv = from.inverted ();
76
77 return to * fromInv;
78}
log4cpp::Category * mainCat
Definition Logger.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ cartesianFromCartesianOrPolar()

QPointF Transformation::cartesianFromCartesianOrPolar ( const DocumentModelCoords & modelCoords,
const QPointF & posGraphIn )
static

Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use externally.

Definition at line 80 of file Transformation.cpp.

82{
83 // Initialize assuming input coordinates are already cartesian
84 QPointF posGraphCartesian = posGraphIn;
85
86 if (modelCoords.coordsType() == COORDS_TYPE_POLAR) {
87
88 // Input coordinates are polar so convert them
89 double angleRadians = 0; // Initialized to prevent compiler warning
90 switch (modelCoords.coordUnitsTheta())
91 {
96 angleRadians = posGraphIn.x () * M_PI / 180.0;
97 break;
98
100 angleRadians = posGraphIn.x () * M_PI / 200.0;
101 break;
102
104 angleRadians = posGraphIn.x ();
105 break;
106
108 angleRadians = posGraphIn.x () * 2.0 * M_PI;
109 break;
110
111 default:
112 ENGAUGE_ASSERT (false);
113 }
114
115 double radius = posGraphIn.y ();
116 posGraphCartesian.setX (radius * cos (angleRadians));
117 posGraphCartesian.setY (radius * sin (angleRadians));
118 }
119
120 return posGraphCartesian;
121}
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS_NSEW
@ COORD_UNITS_POLAR_THETA_TURNS
@ COORD_UNITS_POLAR_THETA_RADIANS
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES
@ COORD_UNITS_POLAR_THETA_DEGREES
@ COORD_UNITS_POLAR_THETA_DEGREES_MINUTES_SECONDS
@ COORD_UNITS_POLAR_THETA_GRADIANS
@ COORDS_TYPE_POLAR
Definition CoordsType.h:14
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.

◆ cartesianOrPolarFromCartesian()

QPointF Transformation::cartesianOrPolarFromCartesian ( const DocumentModelCoords & modelCoords,
const QPointF & posGraphIn )
static

Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use externally.

Definition at line 123 of file Transformation.cpp.

125{
126 // Initialize assuming output coordinates are to be cartesian
127 QPointF posGraphCartesianOrPolar = posGraphIn;
128
129 if (modelCoords.coordsType() == COORDS_TYPE_POLAR) {
130
131 // Output coordinates are to be polar so convert them
132 double angleRadians = qAtan2 (posGraphIn.y (),
133 posGraphIn.x ());
134 switch (modelCoords.coordUnitsTheta())
135 {
140 posGraphCartesianOrPolar.setX (angleRadians * 180.0 / M_PI);
141 break;
142
144 posGraphCartesianOrPolar.setX (angleRadians * 200.0 / M_PI);
145 break;
146
148 posGraphCartesianOrPolar.setX (angleRadians);
149 break;
150
152 posGraphCartesianOrPolar.setX (angleRadians / (2.0 * M_PI));
153 break;
154
155 default:
156 ENGAUGE_ASSERT (false);
157 }
158
159 double radius = qSqrt (posGraphIn.x () * posGraphIn.x () + posGraphIn.y () * posGraphIn.y ());
160 posGraphCartesianOrPolar.setY (radius);
161 }
162
163 return posGraphCartesianOrPolar;
164}

◆ coordTextForStatusBar()

void Transformation::coordTextForStatusBar ( QPointF cursorScreen,
QString & coordsScreen,
QString & coordsGraph,
QString & resolutionGraph,
bool usingScaleBar )

Return string descriptions of cursor coordinates for status bar.

Definition at line 166 of file Transformation.cpp.

171{
172 const int UNCONSTRAINED_FIELD_WIDTH = 0;
173 const double X_DELTA_PIXELS = 1.0, Y_DELTA_PIXELS = 1.0;
174 const char FORMAT = 'g';
175
176 QString needMoreText = (usingScaleBar ?
177 QObject::tr ("Need scale bar") :
178 QObject::tr ("Need more axis points"));
179
180 if (cursorScreen.x() < 0 ||
181 cursorScreen.y() < 0) {
182
183 // Out of bounds, so return empty text
184 coordsScreen = "";
185 coordsGraph = "";
186 resolutionsGraph = "";
187
188 } else {
189
190 coordsScreen = QString("(%1, %2)")
191 .arg (cursorScreen.x ())
192 .arg (cursorScreen.y ());
193
194 if (m_transformIsDefined) {
195
196 // For resolution we compute graph coords for cursorScreen, and then for cursorScreen plus a delta
197 QPointF cursorScreenDelta (cursorScreen.x () + X_DELTA_PIXELS,
198 cursorScreen.y () + Y_DELTA_PIXELS);
199
200 // Convert to graph coordinates
201 QPointF pointGraph, pointGraphDelta;
202 transformScreenToRawGraph (cursorScreen,
203 pointGraph);
204 transformScreenToRawGraph (cursorScreenDelta,
205 pointGraphDelta);
206
207 // Compute graph resolutions at cursor
208 double resolutionXGraph = qAbs ((pointGraphDelta.x () - pointGraph.x ()) / X_DELTA_PIXELS);
209 double resolutionYGraph = qAbs ((pointGraphDelta.y () - pointGraph.y ()) / Y_DELTA_PIXELS);
210
211 // Formatting for date/time and degrees/minutes/seconds is only done on coordinates, and not on resolution
212 FormatCoordsUnits format;
213 QString xThetaFormatted, yRadiusFormatted;
214 format.unformattedToFormatted (pointGraph.x(),
215 pointGraph.y(),
216 m_modelCoords,
217 m_modelGeneral,
218 m_modelMainWindow,
219 xThetaFormatted,
220 yRadiusFormatted,
221 *this);
222
223 coordsGraph = QString ("(%1, %2)")
224 .arg (xThetaFormatted)
225 .arg (yRadiusFormatted);
226
227 resolutionsGraph = QString ("(%1, %2)")
228 .arg (resolutionXGraph, UNCONSTRAINED_FIELD_WIDTH, FORMAT, PRECISION_DIGITS)
229 .arg (resolutionYGraph, UNCONSTRAINED_FIELD_WIDTH, FORMAT, PRECISION_DIGITS);
230
231 } else {
232
233 coordsGraph = QString ("<font color=\"red\">%1</font>")
234 .arg (needMoreText);
235 resolutionsGraph = coordsGraph;
236
237 }
238 }
239}

◆ identity()

void Transformation::identity ( )

Identity transformation.

Definition at line 241 of file Transformation.cpp.

242{
243 // Initialize assuming points (0,0) (1,0) (0,1)
244 m_transformIsDefined = true;
245
246 QTransform ident;
247 m_transform = ident;
248}

◆ logToLinearCartesian()

double Transformation::logToLinearCartesian ( double xy)
static

Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is necessary.

Definition at line 250 of file Transformation.cpp.

251{
252 return qLn (xy);
253}

◆ logToLinearRadius()

double Transformation::logToLinearRadius ( double r,
double rCenter )
static

Convert radius scaling from log to linear. Calling code is responsible for determining if this is necessary.

Definition at line 255 of file Transformation.cpp.

257{
258 return qLn (r) - qLn (rCenter);
259}

◆ modelCoords()

DocumentModelCoords Transformation::modelCoords ( ) const

Get method for DocumentModelCoords.

Definition at line 261 of file Transformation.cpp.

262{
263 return m_modelCoords;
264}

◆ modelGeneral()

DocumentModelGeneral Transformation::modelGeneral ( ) const

Get method for DocumentModelGeneral.

Definition at line 266 of file Transformation.cpp.

267{
268 return m_modelGeneral;
269}

◆ modelMainWindow()

MainWindowModel Transformation::modelMainWindow ( ) const

Get method for MainWindowModel.

Definition at line 271 of file Transformation.cpp.

272{
273 return m_modelMainWindow;
274}

◆ operator!=()

bool Transformation::operator!= ( const Transformation & other)

Inequality operator. This is marked as defined.

Definition at line 52 of file Transformation.cpp.

53{
54 return (m_transformIsDefined != other.transformIsDefined()) ||
55 (m_transform != other.transformMatrix ());
56}

◆ operator=()

Transformation & Transformation::operator= ( const Transformation & other)

Assignment operator.

Definition at line 41 of file Transformation.cpp.

42{
43 m_transformIsDefined = other.transformIsDefined();
44 m_transform = other.transformMatrix ();
45 setModelCoords (other.modelCoords(),
46 other.modelGeneral(),
47 other.modelMainWindow());
48
49 return *this;
50}

◆ printStream()

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 288 of file Transformation.cpp.

290{
291 str << "Transformation\n";
292
293 indentation += INDENTATION_DELTA;
294
295 if (m_transformIsDefined) {
296
297 str << indentation << "affine=" << (m_transform.isAffine() ? "yes" : "no") << " matrix=("
298 << m_transform.m11() << ", " << m_transform.m12() << ", " << m_transform.m13() << ", "
299 << m_transform.m21() << ", " << m_transform.m22() << ", " << m_transform.m23() << ", "
300 << m_transform.m31() << ", " << m_transform.m32() << ", " << m_transform.m33() << ")";
301
302 } else {
303
304 str << indentation << "undefined";
305
306 }
307}
const QString INDENTATION_DELTA

◆ resetOnLoad()

void Transformation::resetOnLoad ( )

Reset, when loading a document after the first, to same state that first document was at when loaded.

Definition at line 309 of file Transformation.cpp.

310{
311 LOG4CPP_INFO_S ((*mainCat)) << "Transformation::resetOnLoad";
312
313 m_transformIsDefined = false;
314}

◆ transformIsDefined()

bool Transformation::transformIsDefined ( ) const

Transform is defined when at least three axis points have been digitized.

Definition at line 334 of file Transformation.cpp.

335{
336 return m_transformIsDefined;
337}

◆ transformLinearCartesianGraphToRawGraph()

void Transformation::transformLinearCartesianGraphToRawGraph ( const QPointF & coordGraph,
QPointF & coordScreen ) const

Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates.

Definition at line 339 of file Transformation.cpp.

341{
342 // WARNING - the code in this method must mirror the code in transformRawGraphToLinearCartesianGraph. In
343 // other words, making a change here without a corresponding change there will produce a bug
344
345 pointRawGraph = pointLinearCartesianGraph;
346
347 // Apply polar coordinates if appropriate
348 if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
349 pointRawGraph = cartesianOrPolarFromCartesian (m_modelCoords,
350 pointRawGraph);
351 }
352
353 // Apply linear offset to radius if appropriate
354 if ((m_modelCoords.coordsType() == COORDS_TYPE_POLAR) &&
355 (m_modelCoords.coordScaleYRadius() == COORD_SCALE_LINEAR)) {
356 pointRawGraph.setY (pointRawGraph.y() + m_modelCoords.originRadius());
357 }
358
359 // Apply log scaling if appropriate
360 if (m_modelCoords.coordScaleXTheta() == COORD_SCALE_LOG) {
361 pointRawGraph.setX (qExp (pointRawGraph.x()));
362 }
363
364 if (m_modelCoords.coordScaleYRadius() == COORD_SCALE_LOG) {
365 double offset;
366 if (m_modelCoords.coordsType() == COORDS_TYPE_CARTESIAN) {
367 // Cartesian
368 offset = ZERO_OFFSET_AFTER_LOG;
369 } else {
370 // Polar radius
371 offset = m_modelCoords.originRadius();
372 }
373
374 pointRawGraph.setY (qExp (pointRawGraph.y() + qLn (offset)));
375 }
376}
@ COORD_SCALE_LINEAR
Definition CoordScale.h:13
@ COORD_SCALE_LOG
Definition CoordScale.h:14
@ COORDS_TYPE_CARTESIAN
Definition CoordsType.h:13
const double ZERO_OFFSET_AFTER_LOG
static QPointF cartesianOrPolarFromCartesian(const DocumentModelCoords &modelCoords, const QPointF &posGraphIn)
Output cartesian or polar coordinates from input cartesian coordinates. This is static for easier use...

◆ transformLinearCartesianGraphToScreen()

void Transformation::transformLinearCartesianGraphToScreen ( const QPointF & coordGraph,
QPointF & coordScreen ) const

Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates.

Definition at line 378 of file Transformation.cpp.

380{
381 ENGAUGE_ASSERT (m_transformIsDefined);
382
383 coordScreen = m_transform.inverted ().transposed ().map (coordGraph);
384}

◆ transformMatrix()

QTransform Transformation::transformMatrix ( ) const

Get method for copying only, for the transform matrix.

Definition at line 386 of file Transformation.cpp.

387{
388 return m_transform;
389}

◆ transformRawGraphToLinearCartesianGraph()

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 391 of file Transformation.cpp.

393{
394 // WARNING - the code in this method must mirror the code in transformLinearCartesianGraphToRawGraph. In
395 // other words, making a change here without a corresponding change there will produce a bug
396
397 double x = pointRaw.x();
398 double y = pointRaw.y();
399
400 // Apply linear offset to radius if appropriate
401 if ((m_modelCoords.coordsType() == COORDS_TYPE_POLAR) &&
402 (m_modelCoords.coordScaleYRadius() == COORD_SCALE_LINEAR)) {
403 y -= m_modelCoords.originRadius();
404 }
405
406 // Apply log scaling if appropriate
407 if (m_modelCoords.coordScaleXTheta() == COORD_SCALE_LOG) {
408 x = logToLinearCartesian (x);
409 }
410
411 if (m_modelCoords.coordScaleYRadius() == COORD_SCALE_LOG) {
412 if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
413 y = logToLinearRadius (y,
414 m_modelCoords.originRadius());
415 } else {
416 y = logToLinearRadius (y,
418 }
419 }
420
421 // Apply polar coordinates if appropriate. Note range coordinate has just been transformed if it has log scaling
422 if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
423 QPointF pointCart = cartesianFromCartesianOrPolar (m_modelCoords,
424 QPointF (x, y));
425 x = pointCart.x();
426 y = pointCart.y();
427 }
428
429 pointLinearCartesian.setX (x);
430 pointLinearCartesian.setY (y);
431}
static double logToLinearCartesian(double xy)
Convert cartesian scaling from log to linear. Calling code is responsible for determining if this is ...
static QPointF cartesianFromCartesianOrPolar(const DocumentModelCoords &modelCoords, const QPointF &posGraphIn)
Output cartesian coordinates from input cartesian or polar coordinates. This is static for easier use...
static double logToLinearRadius(double r, double rCenter)
Convert radius scaling from log to linear. Calling code is responsible for determining if this is nec...

◆ transformRawGraphToScreen()

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 433 of file Transformation.cpp.

435{
436 QPointF pointLinearCartesianGraph;
437
439 pointLinearCartesianGraph);
440 transformLinearCartesianGraphToScreen (pointLinearCartesianGraph,
441 pointScreen);
442}
void transformRawGraphToLinearCartesianGraph(const QPointF &pointRaw, QPointF &pointLinearCartesian) const
Convert graph coordinates (linear or log, cartesian or polar) to linear cartesian coordinates.
void transformLinearCartesianGraphToScreen(const QPointF &coordGraph, QPointF &coordScreen) const
Transform from linear cartesian graph coordinates to cartesian pixel screen coordinates.

◆ transformScreenToLinearCartesianGraph()

void Transformation::transformScreenToLinearCartesianGraph ( const QPointF & pointScreen,
QPointF & pointLinearCartesian ) const

Transform screen coordinates to linear cartesian coordinates.

Definition at line 444 of file Transformation.cpp.

446{
447 ENGAUGE_ASSERT (m_transformIsDefined);
448
449 coordGraph = m_transform.transposed ().map (coordScreen);
450}

◆ transformScreenToRawGraph()

void Transformation::transformScreenToRawGraph ( const QPointF & coordScreen,
QPointF & coordGraph ) const

Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

Definition at line 452 of file Transformation.cpp.

454{
455 QPointF pointLinearCartesianGraph;
457 pointLinearCartesianGraph);
458 transformLinearCartesianGraphToRawGraph (pointLinearCartesianGraph,
459 coordGraph);
460}
void transformLinearCartesianGraphToRawGraph(const QPointF &coordGraph, QPointF &coordScreen) const
Transform from linear cartesian graph coordinates to cartesian, polar, linear, log coordinates.
void transformScreenToLinearCartesianGraph(const QPointF &pointScreen, QPointF &pointLinearCartesian) const
Transform screen coordinates to linear cartesian coordinates.

◆ update()

void Transformation::update ( bool fileIsLoaded,
const CmdMediator & cmdMediator,
const MainWindowModel & modelMainWindow )

Update transform by iterating through the axis points.

Definition at line 462 of file Transformation.cpp.

465{
466 LOG4CPP_DEBUG_S ((*mainCat)) << "Transformation::update";
467
468 if (!fileIsLoaded) {
469
470 m_transformIsDefined = false;
471
472 } else {
473
474 setModelCoords (cmdMediator.document().modelCoords(),
475 cmdMediator.document().modelGeneral(),
477
478 CallbackUpdateTransform ftor (m_modelCoords,
479 cmdMediator.document().documentAxesPointsRequired());
480
481 Functor2wRet<const QString &, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
483 cmdMediator.iterateThroughCurvePointsAxes (ftorWithCallback);
484
485 if (ftor.transformIsDefined ()) {
486
487 updateTransformFromMatrices (ftor.matrixScreen(),
488 ftor.matrixGraph());
489
490 } else {
491
492 m_transformIsDefined = false;
493
494 }
495 }
496}
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the single axes curve.
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
Definition Document.cpp:735
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition Document.cpp:707
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Definition Document.cpp:369
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ TestCentipedeEndpoints

friend class TestCentipedeEndpoints
friend

Definition at line 34 of file Transformation.h.

◆ TestExport

friend class TestExport
friend

Definition at line 35 of file Transformation.h.

◆ TestSplineDrawer

friend class TestSplineDrawer
friend

Definition at line 36 of file Transformation.h.

◆ TestTransformation

friend class TestTransformation
friend

Definition at line 37 of file Transformation.h.


The documentation for this class was generated from the following files: