1 #include "ExportOrdinalsStraight.h"
6 #include "Transformation.h"
15 double pointsInterval)
const
17 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsStraight::ordinalsAtIntervalsGraph";
20 ExportValuesOrdinal ordinals;
23 double distanceAlongSegment = 0;
24 QPointF posLast (points [0].posScreen().x(),
25 points [0].posScreen().y());
26 double ordinalLast = 0;
31 for (
int iP = 0; iP < points.count(); iP++) {
33 const Point &pointNew = points.at (iP);
36 QPointF posDelta = posNew - posLast;
37 double segmentLength = qSqrt (posDelta.x() * posDelta.x() + posDelta.y() * posDelta.y());
39 while (distanceAlongSegment < segmentLength) {
41 double sLocal = distanceAlongSegment / segmentLength;
43 ordinals.push_back (ordinalLast + sLocal);
45 distanceAlongSegment += pointsInterval;
48 distanceAlongSegment -= segmentLength;
49 ordinalLast = pointNew.
ordinal();
58 double pointsInterval)
const
60 LOG4CPP_INFO_S ((*mainCat)) <<
"ExportOrdinalsStraight::ordinalsAtIntervalsGraph";
63 ExportValuesOrdinal ordinals;
66 double distanceAlongSegment = 0;
70 double ordinalLast = 0;
75 for (
int iP = 0; iP < points.count(); iP++) {
77 const Point &pointNew = points.at (iP);
82 QPointF posDelta = posNew - posLast;
83 double segmentLength = qSqrt (posDelta.x() * posDelta.x() + posDelta.y() * posDelta.y());
85 while (distanceAlongSegment < segmentLength) {
87 double sLocal = distanceAlongSegment / segmentLength;
89 ordinals.push_back (ordinalLast + sLocal);
91 distanceAlongSegment += pointsInterval;
94 ordinalLast = pointNew.
ordinal();
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
QPointF posScreen() const
Accessor for screen position.
ExportOrdinalsStraight()
Single constructor.
ExportValuesOrdinal ordinalsAtIntervalsGraphWithoutTransformation(const Points &points, double pointsInterval) const
Compute ordinals, without any conversion to graph coordinates.
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
ExportValuesOrdinal ordinalsAtIntervalsGraphWithTransformation(const Points &points, const Transformation &transformation, double pointsInterval) const
Compute ordinals, converting screen coordinates to graph coordinates.