mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 11:39:16 +02:00
Redesigned CRS logic (including CSV files structure)
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#include "common/downloader.h"
|
||||
#include "map/ellipsoid.h"
|
||||
#include "map/gcs.h"
|
||||
#include "map/conversion.h"
|
||||
#include "map/pcs.h"
|
||||
#include "data/dem.h"
|
||||
#include "data/waypoint.h"
|
||||
@ -172,11 +173,21 @@ void App::loadDatums()
|
||||
|
||||
void App::loadPCSs()
|
||||
{
|
||||
QString projectionsFile(ProgramPaths::projectionsFile());
|
||||
QString pcsFile(ProgramPaths::pcsFile());
|
||||
|
||||
if (!QFileInfo::exists(projectionsFile)) {
|
||||
qWarning("No projections file found.");
|
||||
projectionsFile = QString();
|
||||
}
|
||||
if (!QFileInfo::exists(pcsFile)) {
|
||||
qWarning("No PCS file found.");
|
||||
qWarning("Maps based on a projection different from EPSG:3857 won't work.");
|
||||
} else
|
||||
pcsFile = QString();
|
||||
}
|
||||
|
||||
if (!projectionsFile.isNull() && !pcsFile.isNull()) {
|
||||
Conversion::loadList(projectionsFile);
|
||||
PCS::loadList(pcsFile);
|
||||
} else
|
||||
qWarning("Maps based on a projection different from EPSG:3857 won't work.");
|
||||
}
|
||||
|
@ -2745,7 +2745,8 @@ void GUI::loadOptions()
|
||||
_mapView->useOpenGL(true);
|
||||
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||
_mapView->setOutputProjection(CRS::projection(_options.outputProjection));
|
||||
_mapView->setOutputProjection(CRS::projection(4326,
|
||||
_options.outputProjection));
|
||||
_mapView->setInputProjection(CRS::projection(_options.inputProjection));
|
||||
_mapView->setTimeZone(_options.timeZone.zone());
|
||||
_mapView->setPositionSource(_positionSource);
|
||||
@ -2859,7 +2860,8 @@ void GUI::updateOptions(const Options &options)
|
||||
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||
options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||
if (options.outputProjection != _options.outputProjection)
|
||||
_mapView->setOutputProjection(CRS::projection(options.outputProjection));
|
||||
_mapView->setOutputProjection(CRS::projection(4326,
|
||||
options.outputProjection));
|
||||
if (options.inputProjection != _options.inputProjection)
|
||||
_mapView->setInputProjection(CRS::projection(options.inputProjection));
|
||||
if (options.timeZone != _options.timeZone) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <QSysInfo>
|
||||
#include <QButtonGroup>
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "map/pcs.h"
|
||||
#include "icons.h"
|
||||
#include "infolabel.h"
|
||||
#include "colorbox.h"
|
||||
@ -52,18 +53,20 @@ void OptionsDialog::automaticPauseDetectionSet(bool set)
|
||||
|
||||
QWidget *OptionsDialog::createMapPage()
|
||||
{
|
||||
_outputProjection = new ProjectionComboBox();
|
||||
_outputProjection = new ProjectionComboBox(GCS::WGS84List()
|
||||
+ Conversion::list());
|
||||
_outputProjection->setCurrentIndex(_outputProjection->findData(
|
||||
_options.outputProjection));
|
||||
_inputProjection = new ProjectionComboBox();
|
||||
_inputProjection = new ProjectionComboBox(GCS::list() + PCS::list());
|
||||
_inputProjection->setCurrentIndex(_inputProjection->findData(
|
||||
_options.inputProjection));
|
||||
|
||||
InfoLabel *inInfo = new InfoLabel(tr("Select the proper projection of maps"
|
||||
" without a projection definition (JNX, KMZ and world file maps)."));
|
||||
InfoLabel *outInfo = new InfoLabel(tr("Select the desired projection of"
|
||||
" vector maps (IMG and Mapsforge maps). The projection must be valid for"
|
||||
" the whole map area."));
|
||||
InfoLabel *inInfo = new InfoLabel(tr("Select the proper coordinate "
|
||||
"reference system (CRS) of maps without a CRS definition "
|
||||
"(JNX, KMZ and World file maps)."));
|
||||
InfoLabel *outInfo = new InfoLabel(tr("Select the desired projection of "
|
||||
"vector maps (IMG, Mapsforge and ENC maps). The projection must be valid "
|
||||
"for the whole map area."));
|
||||
|
||||
_hidpi = new QRadioButton(tr("High-resolution"));
|
||||
_lodpi = new QRadioButton(tr("Standard"));
|
||||
|
@ -1,21 +1,16 @@
|
||||
#include "map/pcs.h"
|
||||
#include "projectioncombobox.h"
|
||||
|
||||
ProjectionComboBox::ProjectionComboBox(QWidget *parent) : QComboBox(parent)
|
||||
ProjectionComboBox::ProjectionComboBox(const QList<KV<int, QString> > &list,
|
||||
QWidget *parent) : QComboBox(parent)
|
||||
{
|
||||
setSizeAdjustPolicy(AdjustToMinimumContentsLengthWithIcon);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
int last = -1;
|
||||
QList<KV<int, QString> > projections(GCS::list() + PCS::list());
|
||||
std::sort(projections.begin(), projections.end());
|
||||
for (int i = 0; i < projections.size(); i++) {
|
||||
const KV<int, QString> &proj = projections.at(i);
|
||||
// There may be duplicit EPSG codes with different names
|
||||
if (proj.key() == last)
|
||||
continue;
|
||||
else
|
||||
last = proj.key();
|
||||
QList<KV<int, QString> > projs(list);
|
||||
std::sort(projs.begin(), projs.end());
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
const KV<int, QString> &proj = projs.at(i);
|
||||
QString text = QString::number(proj.key()) + " - " + proj.value();
|
||||
addItem(text, QVariant(proj.key()));
|
||||
}
|
||||
|
@ -2,11 +2,13 @@
|
||||
#define PROJECTIONCOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QList>
|
||||
#include "common/kv.h"
|
||||
|
||||
class ProjectionComboBox : public QComboBox
|
||||
{
|
||||
public:
|
||||
ProjectionComboBox(QWidget *parent = 0);
|
||||
ProjectionComboBox(const QList<KV<int, QString> > &list, QWidget *parent = 0);
|
||||
};
|
||||
|
||||
#endif // PROJECTIONCOMBOBOX_H
|
||||
|
@ -256,7 +256,7 @@ SETTING(printMovingTime, "printMovingTime", false );
|
||||
SETTING(printItemCount, "printItemCount", true );
|
||||
SETTING(separateGraphPage, "separateGraphPage", false );
|
||||
SETTING(sliderColor, "sliderColor", QColor(Qt::red) );
|
||||
SETTING(outputProjection, "outputProjection", 3857 );
|
||||
SETTING(outputProjection, "outputProjection", 3856 );
|
||||
SETTING(inputProjection, "inputProjection", 4326 );
|
||||
SETTING(hidpiMap, "HiDPIMap", true );
|
||||
SETTING(poiPath, "poiPath", "" );
|
||||
|
Reference in New Issue
Block a user