1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-03 22:39:15 +02:00

Compare commits

..

12 Commits
5.4 ... 5.5

19 changed files with 138 additions and 96 deletions

View File

@ -1,4 +1,4 @@
version: 5.4.{build}
version: 5.5.{build}
configuration: Release
platform: Any CPU
environment:

View File

@ -1,5 +1,5 @@
TARGET = GPXSee
VERSION = 5.4
VERSION = 5.5
QT += core \
gui \
network

View File

@ -1401,17 +1401,17 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="25"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>min/km</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>min/mi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>min/mpk</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="30"/>
@ -1421,7 +1421,7 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="32"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Tahti</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="90"/>
@ -1454,17 +1454,17 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="26"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>min/km</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>min/mi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>min/mpk</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="29"/>
@ -1479,7 +1479,7 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="33"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Tahti</translation>
</message>
</context>
<context>

View File

@ -1402,17 +1402,17 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="25"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>мин/км</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>мин/мл</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>мин/мор.мл</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="30"/>
@ -1422,7 +1422,7 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="32"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Темп</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="90"/>
@ -1455,17 +1455,17 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="26"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>мин/км</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>мин/мл</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>мин/мор.мл</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="29"/>
@ -1480,7 +1480,7 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="33"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Темп</translation>
</message>
</context>
<context>

View File

@ -1401,17 +1401,17 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="25"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>min/km</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>min/mi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="26"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>min/nmi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="30"/>
@ -1421,7 +1421,7 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="32"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Tempo</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="90"/>
@ -1454,17 +1454,17 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="26"/>
<source>min/km</source>
<translation type="unfinished"></translation>
<translation>min/km</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/mi</source>
<translation type="unfinished"></translation>
<translation>min/mi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="27"/>
<source>min/nmi</source>
<translation type="unfinished"></translation>
<translation>min/nmi</translation>
</message>
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="29"/>
@ -1479,7 +1479,7 @@
<message>
<location filename="../src/GUI/speedgraphitem.cpp" line="33"/>
<source>Pace</source>
<translation type="unfinished"></translation>
<translation>Tempo</translation>
</message>
</context>
<context>

View File

@ -344,6 +344,7 @@ Hjorsey 1955 / UTM zone 26N,3054,4658,16026,9001,9807,8801,0,9102,8802,-27,9102,
Hjorsey 1955 / UTM zone 27N,3055,4658,16027,9001,9807,8801,0,9102,8802,-21,9102,8805,0.9996,9201,8806,500000,9001,8807,0,9001,,,,,,
Hjorsey 1955 / UTM zone 28N,3056,4658,16028,9001,9807,8801,0,9102,8802,-15,9102,8805,0.9996,9201,8806,500000,9001,8807,0,9001,,,,,,
ED50 / Jordan TM,3066,4230,19995,9001,9807,8801,0,9102,8802,37,9102,8805,0.9998,9201,8806,500000,9001,8807,-3000000,9001,,,,,,
ETRS89 / TM35FIN (E-N),3067,4258,16065,9001,9807,8801,0,9102,8802,27,9102,8805,0.9996,9201,8806,500000,9001,8807,0,9001,,,,,,
NAD27 / Wisconsin Transverse Mercator,3069,4267,14811,9001,9807,8801,0,9102,8802,-90,9102,8805,0.9996,9201,8806,500000,9001,8807,-4500000,9001,,,,,,
NAD83 / Wisconsin Transverse Mercator,3070,4269,14841,9001,9807,8801,0,9102,8802,-90,9102,8805,0.9996,9201,8806,520000,9001,8807,-4480000,9001,,,,,,
NAD83 / Maine CS2000 East,3072,4269,11851,9001,9807,8801,43.5,9110,8802,-67.523,9110,8805,0.99998,9201,8806,700000,9001,8807,0,9001,,,,,,

1 Hito XVIII 1963 / Argentina 2 2083 4254 18032 9001 9807 8801 -90 9102 8802 -69 9102 8805 1 9201 8806 2500000 9001 8807 0 9001
344 Hjorsey 1955 / UTM zone 27N 3055 4658 16027 9001 9807 8801 0 9102 8802 -21 9102 8805 0.9996 9201 8806 500000 9001 8807 0 9001
345 Hjorsey 1955 / UTM zone 28N 3056 4658 16028 9001 9807 8801 0 9102 8802 -15 9102 8805 0.9996 9201 8806 500000 9001 8807 0 9001
346 ED50 / Jordan TM 3066 4230 19995 9001 9807 8801 0 9102 8802 37 9102 8805 0.9998 9201 8806 500000 9001 8807 -3000000 9001
347 ETRS89 / TM35FIN (E-N) 3067 4258 16065 9001 9807 8801 0 9102 8802 27 9102 8805 0.9996 9201 8806 500000 9001 8807 0 9001
348 NAD27 / Wisconsin Transverse Mercator 3069 4267 14811 9001 9807 8801 0 9102 8802 -90 9102 8805 0.9996 9201 8806 500000 9001 8807 -4500000 9001
349 NAD83 / Wisconsin Transverse Mercator 3070 4269 14841 9001 9807 8801 0 9102 8802 -90 9102 8805 0.9996 9201 8806 520000 9001 8807 -4480000 9001
350 NAD83 / Maine CS2000 East 3072 4269 11851 9001 9807 8801 43.5 9110 8802 -67.523 9110 8805 0.99998 9201 8806 700000 9001 8807 0 9001

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "5.4"
!define VERSION "5.5"
; The file to write
OutFile "GPXSee-${VERSION}.exe"

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "5.4"
!define VERSION "5.5"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -70,7 +70,6 @@ AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
double sp1, sp2;
_e = ellipsoid;
_latitudeOrigin = deg2rad(latitudeOrigin);
_longitudeOrigin = deg2rad(longitudeOrigin);
_falseEasting = falseEasting;
@ -79,7 +78,9 @@ AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
sp1 = deg2rad(standardParallel1);
sp2 = deg2rad(standardParallel2);
_es2 = 2 * _e->flattening() - _e->flattening() * _e->flattening();
_a2 = ellipsoid->radius() * ellipsoid->radius();
_es2 = 2 * ellipsoid->flattening() - ellipsoid->flattening()
* ellipsoid->flattening();
_es = sqrt(_es2);
_one_minus_es2 = 1 - _es2;
_two_es = 2 * _es;
@ -109,7 +110,7 @@ AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
_n = sin_lat1;
_C = sqr_m1 + _n * q1;
_a_over_n = _e->radius() / _n;
_a_over_n = ellipsoid->radius() / _n;
nq0 = _n * q0;
_rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0);
}
@ -172,7 +173,7 @@ Coordinates AlbersEqual::xy2ll(const QPointF &p) const
if (rho != 0.0)
theta = atan2(dx, rho0_minus_dy);
rho_n = rho * _n;
q = (_C - (rho_n * rho_n) / (_e->radius() * _e->radius())) / _n;
q = (_C - (rho_n * rho_n) / _a2) / _n;
qc = 1 - ((_one_minus_es2) / (_two_es)) * log((1.0 - _es) / (1.0 + _es));
if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) {
q_over_2 = q / 2.0;

View File

@ -18,13 +18,12 @@ public:
virtual Coordinates xy2ll(const QPointF &p) const;
private:
const Ellipsoid *_e;
double _latitudeOrigin;
double _longitudeOrigin;
double _falseEasting;
double _falseNorthing;
double _a2;
double _rho0;
double _C;
double _n;

View File

@ -2,6 +2,7 @@
#include <QFileInfo>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QBasicTimer>
#include "config.h"
#include "downloader.h"
@ -25,15 +26,60 @@
#define ATTR_LEVEL (QNetworkRequest::Attribute)(QNetworkRequest::User + 2)
#define MAX_REDIRECT_LEVEL 5
#define TIMEOUT 30 /* s */
class Downloader::ReplyTimeout : public QObject
{
public:
static void setTimeout(QNetworkReply *reply, int timeout)
{
Q_ASSERT(reply);
new ReplyTimeout(reply, timeout);
}
private:
ReplyTimeout(QNetworkReply *reply, int timeout) : QObject(reply)
{
_timer.start(timeout * 1000, this);
}
void timerEvent(QTimerEvent *ev)
{
if (!_timer.isActive() || ev->timerId() != _timer.timerId())
return;
QNetworkReply *reply = static_cast<QNetworkReply*>(parent());
if (reply->isRunning())
reply->close();
_timer.stop();
}
QBasicTimer _timer;
};
class Downloader::Redirect
{
public:
Redirect() : _level(0) {}
Redirect(const QUrl &origin, int level) :
_origin(origin), _level(level) {}
const QUrl &origin() const {return _origin;}
int level() const {return _level;}
private:
QUrl _origin;
int _level;
};
Downloader::Downloader(QObject *parent) : QObject(parent)
{
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
SLOT(downloadFinished(QNetworkReply*)));
SLOT(downloadFinished(QNetworkReply*)));
}
bool Downloader::doDownload(const Download &dl, const Redirect &redirect)
bool Downloader::doDownload(const Download &dl, const Redirect *redirect)
{
QUrl url(dl.url());
@ -44,14 +90,18 @@ bool Downloader::doDownload(const Download &dl, const Redirect &redirect)
QNetworkRequest request(url);
request.setAttribute(ATTR_FILE, QVariant(dl.file()));
if (!redirect.isNull()) {
request.setAttribute(ATTR_ORIGIN, QVariant(redirect.origin()));
request.setAttribute(ATTR_LEVEL, QVariant(redirect.level()));
if (redirect) {
request.setAttribute(ATTR_ORIGIN, QVariant(redirect->origin()));
request.setAttribute(ATTR_LEVEL, QVariant(redirect->level()));
}
request.setRawHeader("User-Agent", USER_AGENT);
QNetworkReply *reply = _manager.get(request);
_currentDownloads.insert(url, reply);
QNetworkReply *reply = _manager.get(request);
if (reply) {
_currentDownloads.insert(url);
ReplyTimeout::setTimeout(reply, TIMEOUT);
} else
return false;
return true;
}
@ -109,7 +159,7 @@ void Downloader::downloadFinished(QNetworkReply *reply)
} else {
Redirect redirect(origin.isEmpty() ? url : origin, level + 1);
Download dl(location, filename);
doDownload(dl, redirect);
doDownload(dl, &redirect);
}
} else
if (!saveToDisk(filename, reply))

View File

@ -4,10 +4,8 @@
#include <QNetworkAccessManager>
#include <QUrl>
#include <QList>
#include <QMap>
#include <QSet>
class QNetworkReply;
class Download
@ -32,6 +30,7 @@ public:
Downloader(QObject *parent = 0);
bool get(const QList<Download> &list);
void clearErrors() {_errorDownloads.clear();}
signals:
void finished();
@ -40,28 +39,14 @@ private slots:
void downloadFinished(QNetworkReply *reply);
private:
class Redirect
{
public:
Redirect() : _level(0) {}
Redirect(const QUrl &origin, int level) :
_origin(origin), _level(level) {}
class Redirect;
class ReplyTimeout;
const QUrl &origin() const {return _origin;}
int level() const {return _level;}
bool isNull() const {return (_level == 0);}
private:
QUrl _origin;
int _level;
};
bool doDownload(const Download &dl, const Redirect &redirect = Redirect());
bool doDownload(const Download &dl, const Redirect *redirect = 0);
bool saveToDisk(const QString &filename, QIODevice *data);
QNetworkAccessManager _manager;
QMap<QUrl, QNetworkReply *> _currentDownloads;
QSet<QUrl> _currentDownloads;
QSet<QUrl> _errorDownloads;
};

View File

@ -22,6 +22,7 @@
#define GeogPrimeMeridianGeoKey 2051
#define GeogAngularUnitsGeoKey 2054
#define GeogEllipsoidGeoKey 2056
#define GeogAzimuthUnitsGeoKey 2060
#define ProjectedCSTypeGeoKey 3072
#define ProjectionGeoKey 3074
#define ProjCoordTransGeoKey 3075
@ -54,13 +55,7 @@
#define IS_SET(map, key) \
((map).contains(key) && (map).value(key).SHORT != 32767)
#define TO_M(lu, val) \
(std::isnan(val) ? val : (lu).toMeters(val))
#define TO_DEG(au, val) \
(std::isnan(val) ? val : (au).toDegrees(val))
#define ARRAY_SIZE(a) \
(sizeof(a) / sizeof(*a))
typedef struct {
quint16 KeyDirectoryVersion;
@ -236,6 +231,7 @@ bool GeoTIFF::readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const
case GeogGeodeticDatumGeoKey:
case GeogPrimeMeridianGeoKey:
case GeogAngularUnitsGeoKey:
case GeogAzimuthUnitsGeoKey:
case ProjectedCSTypeGeoKey:
case ProjectionGeoKey:
case ProjCoordTransGeoKey:
@ -296,14 +292,15 @@ const GCS *GeoTIFF::gcs(QMap<quint16, Value> &kv)
_errorString = QString("%1: unknown GCS")
.arg(kv.value(GeographicTypeGeoKey).SHORT);
} else if (IS_SET(kv, GeogGeodeticDatumGeoKey)
|| kv.value(GeogEllipsoidGeoKey).SHORT == 7019) {
|| kv.value(GeogEllipsoidGeoKey).SHORT == 7019
|| kv.value(GeogEllipsoidGeoKey).SHORT == 7030) {
int pm = IS_SET(kv, GeogPrimeMeridianGeoKey)
? kv.value(GeogPrimeMeridianGeoKey).SHORT : 8901;
int au = IS_SET(kv, GeogAngularUnitsGeoKey)
? kv.value(GeogAngularUnitsGeoKey).SHORT : 9102;
/* If only the ellipsoid is defined and it is GRS80, handle such
definition as a WGS84 geodetic datum. */
// If only the ellipsoid is defined and it is GRS80 or WGS84, handle
// such definition as a WGS84 geodetic datum.
int gd = IS_SET(kv, GeogGeodeticDatumGeoKey)
? kv.value(GeogGeodeticDatumGeoKey).SHORT : 6326;
@ -383,6 +380,8 @@ bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
AngularUnits au(IS_SET(kv, GeogAngularUnitsGeoKey)
? kv.value(GeogAngularUnitsGeoKey).SHORT : 9102);
AngularUnits zu(IS_SET(kv, GeogAzimuthUnitsGeoKey)
? kv.value(GeogAzimuthUnitsGeoKey).SHORT : 9102);
LinearUnits lu(IS_SET(kv, ProjLinearUnitsGeoKey)
? kv.value(ProjLinearUnitsGeoKey).SHORT : 9001);
if (lu.isNull()) {
@ -392,15 +391,15 @@ bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
}
if (kv.contains(ProjNatOriginLatGeoKey))
lat0 = kv.value(ProjNatOriginLatGeoKey).DOUBLE;
lat0 = au.toDegrees(kv.value(ProjNatOriginLatGeoKey).DOUBLE);
else if (kv.contains(ProjCenterLatGeoKey))
lat0 = kv.value(ProjCenterLatGeoKey).DOUBLE;
lat0 = au.toDegrees(kv.value(ProjCenterLatGeoKey).DOUBLE);
else
lat0 = NAN;
if (kv.contains(ProjNatOriginLongGeoKey))
lon0 = kv.value(ProjNatOriginLongGeoKey).DOUBLE;
lon0 = au.toDegrees(kv.value(ProjNatOriginLongGeoKey).DOUBLE);
else if (kv.contains(ProjCenterLongGeoKey))
lon0 = kv.value(ProjCenterLongGeoKey).DOUBLE;
lon0 = au.toDegrees(kv.value(ProjCenterLongGeoKey).DOUBLE);
else
lon0 = NAN;
if (kv.contains(ProjScaleAtNatOriginGeoKey))
@ -410,28 +409,27 @@ bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
else
scale = NAN;
if (kv.contains(ProjStdParallel1GeoKey))
sp1 = kv.value(ProjStdParallel1GeoKey).DOUBLE;
sp1 = au.toDegrees(kv.value(ProjStdParallel1GeoKey).DOUBLE);
else if (kv.contains(ProjAzimuthAngleGeoKey))
sp1 = kv.value(ProjAzimuthAngleGeoKey).DOUBLE;
sp1 = zu.toDegrees(kv.value(ProjAzimuthAngleGeoKey).DOUBLE);
else
sp1 = NAN;
if (kv.contains(ProjStdParallel2GeoKey))
sp2 = kv.value(ProjStdParallel2GeoKey).DOUBLE;
sp2 = au.toDegrees(kv.value(ProjStdParallel2GeoKey).DOUBLE);
else if (kv.contains(ProjRectifiedGridAngleGeoKey))
sp2 = kv.value(ProjRectifiedGridAngleGeoKey).DOUBLE;
sp2 = au.toDegrees(kv.value(ProjRectifiedGridAngleGeoKey).DOUBLE);
else
sp2 = NAN;
if (kv.contains(ProjFalseNorthingGeoKey))
fn = kv.value(ProjFalseNorthingGeoKey).DOUBLE;
fn = lu.toMeters(kv.value(ProjFalseNorthingGeoKey).DOUBLE);
else
fn = NAN;
if (kv.contains(ProjFalseEastingGeoKey))
fe = kv.value(ProjFalseEastingGeoKey).DOUBLE;
fe = lu.toMeters(kv.value(ProjFalseEastingGeoKey).DOUBLE);
else
fe = NAN;
Projection::Setup setup(TO_DEG(au, lat0), TO_DEG(au, lon0), scale,
TO_M(lu, fe), TO_M(lu, fn), TO_DEG(au, sp1), TO_DEG(au, sp2));
Projection::Setup setup(lat0, lon0, scale, fe, fn, sp1, sp2);
_projection = Projection(g, m, setup, lu);
}

View File

@ -216,6 +216,9 @@ bool MapFile::createProjection(const GCS *gcs, const QString &name,
else if (name == "(VG94) VICGRID94 Victoria Australia")
_projection = Projection(gcs, 9802, Projection::Setup(-37, 145, NAN,
2500000, 2500000, -36, -38), 9001);
else if (name == "(SUI) Swiss Grid")
_projection = Projection(gcs, 9815, Projection::Setup(46.570866,
7.26225, 1.0, 600000, 200000, 90.0, 90.0), 9001);
else {
_errorString = QString("%1: Unknown map projection").arg(name);
return false;

View File

@ -77,6 +77,8 @@ void TileLoader::clearCache()
for (int i = 0; i < list.count(); i++)
dir.remove(list.at(i));
_downloader->clearErrors();
}
QString TileLoader::tileUrl(const Tile &tile) const

View File

@ -3,7 +3,8 @@
#include <QString>
#include "tile.h"
#include "downloader.h"
class Downloader;
class TileLoader
{

View File

@ -47,14 +47,14 @@ Defense.
#define SPHSN(lat) \
((double)(_e->radius() / sqrt(1.e0 - _es * pow(sin(lat), 2))))
((double)(_a / sqrt(1.e0 - _es * pow(sin(lat), 2))))
#define SPHTMD(lat) \
((double)(_ap * lat - _bp * sin(2.e0 * lat) + _cp * sin(4.e0 * lat) \
- _dp * sin(6.e0 * lat) + _ep * sin(8.e0 * lat)))
#define DENOM(lat) \
((double)(sqrt(1.e0 - _es * pow(sin(lat),2))))
#define SPHSR(lat) \
((double)(_e->radius() * (1.e0 - _es) / pow(DENOM(lat), 3)))
((double)(_a * (1.e0 - _es) / pow(DENOM(lat), 3)))
TransverseMercator::TransverseMercator(const Ellipsoid *ellipsoid,
@ -65,31 +65,32 @@ TransverseMercator::TransverseMercator(const Ellipsoid *ellipsoid,
double b;
_e = ellipsoid;
_a = ellipsoid->radius();
_longitudeOrigin = deg2rad(longitudeOrigin);
_latitudeOrigin = deg2rad(latitudeOrigin);
_scale = scale;
_falseEasting = falseEasting;
_falseNorthing = falseNorthing;
_es = 2 * _e->flattening() - _e->flattening() * _e->flattening();
_es = 2 * ellipsoid->flattening() - ellipsoid->flattening()
* ellipsoid->flattening();
_ebs = (1 / (1 - _es)) - 1;
b = _e->radius() * (1 - _e->flattening());
b = _a * (1 - ellipsoid->flattening());
tn = (_e->radius() - b) / (_e->radius() + b);
tn = (_a - b) / (_a + b);
tn2 = tn * tn;
tn3 = tn2 * tn;
tn4 = tn3 * tn;
tn5 = tn4 * tn;
_ap = _e->radius() * (1.e0 - tn + 5.e0 * (tn2 - tn3) / 4.e0 + 81.e0
_ap = _a * (1.e0 - tn + 5.e0 * (tn2 - tn3) / 4.e0 + 81.e0
* (tn4 - tn5) / 64.e0);
_bp = 3.e0 * _e->radius() * (tn - tn2 + 7.e0 * (tn3 - tn4) / 8.e0 + 55.e0
_bp = 3.e0 * _a * (tn - tn2 + 7.e0 * (tn3 - tn4) / 8.e0 + 55.e0
* tn5 / 64.e0 ) / 2.e0;
_cp = 15.e0 * _e->radius() * (tn2 - tn3 + 3.e0 * (tn4 - tn5 ) / 4.e0) / 16.0;
_dp = 35.e0 * _e->radius() * (tn3 - tn4 + 11.e0 * tn5 / 16.e0) / 48.e0;
_ep = 315.e0 * _e->radius() * (tn4 - tn5) / 512.e0;
_cp = 15.e0 * _a * (tn2 - tn3 + 3.e0 * (tn4 - tn5 ) / 4.e0) / 16.0;
_dp = 35.e0 * _a * (tn3 - tn4 + 11.e0 * tn5 / 16.e0) / 48.e0;
_ep = 315.e0 * _a * (tn4 - tn5) / 512.e0;
}
QPointF TransverseMercator::ll2xy(const Coordinates &c) const

View File

@ -18,12 +18,12 @@ public:
virtual Coordinates xy2ll(const QPointF &p) const;
private:
const Ellipsoid *_e;
double _longitudeOrigin;
double _latitudeOrigin;
double _scale;
double _falseEasting;
double _falseNorthing;
double _a;
double _es;
double _ebs;

View File

@ -3,6 +3,7 @@
#include "common/wgs84.h"
#include "config.h"
#include "transform.h"
#include "downloader.h"
#include "wmts.h"
#include "wmtsmap.h"