mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-23 07:14:22 +02:00
Moved the datums initialization where it belongs
This commit is contained in:
@ -6,8 +6,11 @@
|
||||
#include <QLibraryInfo>
|
||||
#include "map/onlinemap.h"
|
||||
#include "map/downloader.h"
|
||||
#include "map/ellipsoid.h"
|
||||
#include "map/datum.h"
|
||||
#include "opengl.h"
|
||||
#include "gui.h"
|
||||
#include "config.h"
|
||||
#include "app.h"
|
||||
|
||||
|
||||
@ -31,6 +34,7 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
OnlineMap::setDownloader(new Downloader(this));
|
||||
OPENGL_SET_SAMPLES(4);
|
||||
loadDatums();
|
||||
|
||||
_gui = new GUI();
|
||||
}
|
||||
@ -59,3 +63,47 @@ bool App::event(QEvent *event)
|
||||
|
||||
return QApplication::event(event);
|
||||
}
|
||||
|
||||
void App::loadDatums()
|
||||
{
|
||||
QString ef, df;
|
||||
bool ok = false;
|
||||
|
||||
if (QFile::exists(USER_ELLIPSOID_FILE))
|
||||
ef = USER_ELLIPSOID_FILE;
|
||||
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
|
||||
ef = GLOBAL_ELLIPSOID_FILE;
|
||||
else
|
||||
qWarning("No ellipsoids file found.");
|
||||
|
||||
if (QFile::exists(USER_DATUM_FILE))
|
||||
df = USER_DATUM_FILE;
|
||||
else if (QFile::exists(GLOBAL_DATUM_FILE))
|
||||
df = GLOBAL_DATUM_FILE;
|
||||
else
|
||||
qWarning("No datums file found.");
|
||||
|
||||
if (!ef.isNull() && !df.isNull()) {
|
||||
if (!Ellipsoid::loadList(ef)) {
|
||||
if (Ellipsoid::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
|
||||
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(ef), qPrintable(
|
||||
Ellipsoid::errorString()));
|
||||
} else {
|
||||
if (!Datum::loadList(df)) {
|
||||
if (Datum::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
|
||||
Datum::errorLine(), qPrintable(Datum::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(ef), qPrintable(
|
||||
Datum::errorString()));
|
||||
} else
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
qWarning("Maps based on a datum different from WGS84 won't work.");
|
||||
}
|
||||
|
Reference in New Issue
Block a user