mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Code cleanup
This commit is contained in:
parent
a7154988ab
commit
a45125be9a
@ -244,12 +244,8 @@ bool OfflineMap::createProjection(const QString &datum,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OfflineMap::computeTransformation(const QList<ReferencePoint> &points)
|
bool OfflineMap::simpleTransformation(const QList<ReferencePoint> &points)
|
||||||
{
|
{
|
||||||
Q_ASSERT(points.size() >= 2);
|
|
||||||
|
|
||||||
// translate + scale
|
|
||||||
if (points.size() == 2) {
|
|
||||||
if (points.at(0).xy.x() == points.at(1).xy.x()
|
if (points.at(0).xy.x() == points.at(1).xy.x()
|
||||||
|| points.at(0).xy.y() == points.at(1).xy.y()) {
|
|| points.at(0).xy.y() == points.at(1).xy.y()) {
|
||||||
_errorString = "Invalid reference points tuple";
|
_errorString = "Invalid reference points tuple";
|
||||||
@ -271,7 +267,8 @@ bool OfflineMap::computeTransformation(const QList<ReferencePoint> &points)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// full affine transformation (least squares method)
|
bool OfflineMap::affineTransformation(const QList<ReferencePoint> &points)
|
||||||
|
{
|
||||||
Matrix c(3, 2);
|
Matrix c(3, 2);
|
||||||
c.zeroize();
|
c.zeroize();
|
||||||
for (size_t i = 0; i < c.h(); i++) {
|
for (size_t i = 0; i < c.h(); i++) {
|
||||||
@ -317,6 +314,16 @@ bool OfflineMap::computeTransformation(const QList<ReferencePoint> &points)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OfflineMap::computeTransformation(const QList<ReferencePoint> &points)
|
||||||
|
{
|
||||||
|
Q_ASSERT(points.size() >= 2);
|
||||||
|
|
||||||
|
if (points.size() == 2)
|
||||||
|
return simpleTransformation(points);
|
||||||
|
else
|
||||||
|
return affineTransformation(points);
|
||||||
|
}
|
||||||
|
|
||||||
bool OfflineMap::computeResolution(QList<ReferencePoint> &points)
|
bool OfflineMap::computeResolution(QList<ReferencePoint> &points)
|
||||||
{
|
{
|
||||||
Q_ASSERT(points.count() >= 2);
|
Q_ASSERT(points.count() >= 2);
|
||||||
|
@ -75,6 +75,8 @@ private:
|
|||||||
bool totalSizeSet();
|
bool totalSizeSet();
|
||||||
bool createProjection(const QString &datum, const QString &projection,
|
bool createProjection(const QString &datum, const QString &projection,
|
||||||
const ProjectionSetup &setup, QList<ReferencePoint> &points);
|
const ProjectionSetup &setup, QList<ReferencePoint> &points);
|
||||||
|
bool simpleTransformation(const QList<ReferencePoint> &points);
|
||||||
|
bool affineTransformation(const QList<ReferencePoint> &points);
|
||||||
bool computeTransformation(const QList<ReferencePoint> &points);
|
bool computeTransformation(const QList<ReferencePoint> &points);
|
||||||
bool computeResolution(QList<ReferencePoint> &points);
|
bool computeResolution(QList<ReferencePoint> &points);
|
||||||
bool getTileInfo(const QStringList &tiles, const QString &path = QString());
|
bool getTileInfo(const QStringList &tiles, const QString &path = QString());
|
||||||
|
Loading…
Reference in New Issue
Block a user