diff --git a/.appveyor.yml b/.appveyor.yml
index 9de385bc..90457454 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -40,7 +40,7 @@ build_script:
copy pkg\pcs.csv installer
- copy pkg\maps.xml installer
+ xcopy pkg\maps installer /s/h/e/k/f/c
copy licence.txt installer
diff --git a/gpxsee.pro b/gpxsee.pro
index 47878205..84f9284d 100644
--- a/gpxsee.pro
+++ b/gpxsee.pro
@@ -116,7 +116,7 @@ HEADERS += src/config.h \
src/map/primemeridian.h \
src/map/linearunits.h \
src/map/ct.h \
- src/map/omd.h
+ src/map/mapsource.h
SOURCES += src/main.cpp \
src/common/coordinates.cpp \
src/common/rectc.cpp \
@@ -202,7 +202,7 @@ SOURCES += src/main.cpp \
src/map/angularunits.cpp \
src/map/primemeridian.cpp \
src/map/linearunits.cpp \
- src/map/omd.cpp
+ src/map/mapsource.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \
lang/gpxsee_sv.ts \
@@ -218,7 +218,7 @@ macx {
icons/fit.icns \
icons/igc.icns \
icons/nmea.icns \
- pkg/maps.xml \
+ pkg/maps \
pkg/ellipsoids.csv \
pkg/gcs.csv \
pkg/pcs.csv
diff --git a/pkg/gpxsee.nsi b/pkg/gpxsee.nsi
index e8823c8b..81ec9ce8 100644
--- a/pkg/gpxsee.nsi
+++ b/pkg/gpxsee.nsi
@@ -83,7 +83,7 @@ Section "GPXSee" SEC_APP
; Put the files there
File "gpxsee.exe"
- File "maps.xml"
+ File /r "maps"
File "ellipsoids.csv"
File "gcs.csv"
File "pcs.csv"
diff --git a/pkg/gpxsee64.nsi b/pkg/gpxsee64.nsi
index 2deab1a3..163cd975 100644
--- a/pkg/gpxsee64.nsi
+++ b/pkg/gpxsee64.nsi
@@ -90,7 +90,7 @@ Section "GPXSee" SEC_APP
; Put the files there
File "gpxsee.exe"
- File "maps.xml"
+ File /r "maps"
File "ellipsoids.csv"
File "gcs.csv"
File "pcs.csv"
diff --git a/pkg/maps.xml b/pkg/maps.xml
deleted file mode 100644
index 9ea5aef3..00000000
--- a/pkg/maps.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/pkg/maps/4UMaps.xml b/pkg/maps/4UMaps.xml
new file mode 100644
index 00000000..374e3e16
--- /dev/null
+++ b/pkg/maps/4UMaps.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/pkg/maps/OpenStreetMap.xml b/pkg/maps/OpenStreetMap.xml
new file mode 100644
index 00000000..51cf8605
--- /dev/null
+++ b/pkg/maps/OpenStreetMap.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/pkg/maps/OpenTopoMap.xml b/pkg/maps/OpenTopoMap.xml
new file mode 100644
index 00000000..b076ace3
--- /dev/null
+++ b/pkg/maps/OpenTopoMap.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/pkg/maps/USGS-imagery.xml b/pkg/maps/USGS-imagery.xml
new file mode 100644
index 00000000..9d4a71b9
--- /dev/null
+++ b/pkg/maps/USGS-imagery.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/pkg/maps/USGS-topo.xml b/pkg/maps/USGS-topo.xml
new file mode 100644
index 00000000..629ea74c
--- /dev/null
+++ b/pkg/maps/USGS-topo.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/src/map/maplist.cpp b/src/map/maplist.cpp
index cab29cc1..46e1ffd8 100644
--- a/src/map/maplist.cpp
+++ b/src/map/maplist.cpp
@@ -4,25 +4,26 @@
#include "atlas.h"
#include "offlinemap.h"
#include "onlinemap.h"
-#include "omd.h"
+#include "mapsource.h"
#include "maplist.h"
-bool MapList::loadList(const QString &path, bool dir)
+bool MapList::loadSource(const QString &path, bool dir)
{
- OMD omd;
+ MapSource ms;
+ Map *map;
- if (!omd.loadFile(path)) {
+ if (!ms.loadFile(path)) {
if (dir)
- _errorString += path + ": " + omd.errorString() + "\n";
+ _errorString += path + ": " + ms.errorString() + "\n";
else
- _errorString = omd.errorString();
+ _errorString = ms.errorString();
return false;
}
- _maps += omd.maps();
- for (int i = 0; i < omd.maps().size(); i++)
- omd.maps()[i]->setParent(this);
+ map = ms.map();
+ map->setParent(this);
+ _maps.append(map);
return true;
}
@@ -71,7 +72,7 @@ bool MapList::loadFile(const QString &path, bool *atlas, bool dir)
return loadAtlas(path, dir);
} else if (suffix == "xml") {
*atlas = false;
- return loadList(path, dir);
+ return loadSource(path, dir);
} else {
*atlas = false;
return loadMap(path, dir);
@@ -123,7 +124,7 @@ QString MapList::formats()
+ tr("OziExplorer maps (*.map)") + ";;"
+ tr("TrekBuddy maps/atlases (*.tar *.tba)") + ";;"
+ tr("GeoTIFF images (*.tif *.tiff)") + ";;"
- + tr("Online map definitions (*.xml)");
+ + tr("Online map sources (*.xml)");
}
QStringList MapList::filter()
diff --git a/src/map/maplist.h b/src/map/maplist.h
index 9060fe7d..a12d055a 100644
--- a/src/map/maplist.h
+++ b/src/map/maplist.h
@@ -29,7 +29,7 @@ private:
Map *loadListEntry(const QByteArray &line);
- bool loadList(const QString &path, bool dir);
+ bool loadSource(const QString &path, bool dir);
bool loadMap(const QString &path, bool dir);
bool loadAtlas(const QString &path, bool dir);
diff --git a/src/map/omd.cpp b/src/map/mapsource.cpp
similarity index 88%
rename from src/map/omd.cpp
rename to src/map/mapsource.cpp
index 5cc4f904..f78ff248 100644
--- a/src/map/omd.cpp
+++ b/src/map/mapsource.cpp
@@ -1,7 +1,7 @@
#include
#include
#include "onlinemap.h"
-#include "omd.h"
+#include "mapsource.h"
#define ZOOM_MAX 19
@@ -11,7 +11,7 @@
#define BOUNDS_RIGHT 180
#define BOUNDS_BOTTOM -85.0511
-Range OMD::zooms(QXmlStreamReader &reader)
+Range MapSource::zooms(QXmlStreamReader &reader)
{
const QXmlStreamAttributes &attr = reader.attributes();
int min, max;
@@ -51,7 +51,7 @@ Range OMD::zooms(QXmlStreamReader &reader)
return Range(min, max);
}
-RectC OMD::bounds(QXmlStreamReader &reader)
+RectC MapSource::bounds(QXmlStreamReader &reader)
{
const QXmlStreamAttributes &attr = reader.attributes();
double top, left, bottom, right;
@@ -121,7 +121,7 @@ RectC OMD::bounds(QXmlStreamReader &reader)
return RectC(Coordinates(left, top), Coordinates(right, bottom));
}
-void OMD::map(QXmlStreamReader &reader)
+void MapSource::map(QXmlStreamReader &reader)
{
QString name, url;
Range z(ZOOM_MIN, ZOOM_MAX);
@@ -143,20 +143,10 @@ void OMD::map(QXmlStreamReader &reader)
reader.skipCurrentElement();
}
- _maps.append(new OnlineMap(name, url, z, b));
+ _map = new OnlineMap(name, url, z, b);
}
-void OMD::omd(QXmlStreamReader &reader)
-{
- while (reader.readNextStartElement()) {
- if (reader.name() == "map")
- map(reader);
- else
- reader.skipCurrentElement();
- }
-}
-
-bool OMD::loadFile(const QString &path)
+bool MapSource::loadFile(const QString &path)
{
QFile file(path);
QXmlStreamReader reader;
@@ -169,10 +159,10 @@ bool OMD::loadFile(const QString &path)
reader.setDevice(&file);
if (reader.readNextStartElement()) {
- if (reader.name() == "omd")
- omd(reader);
+ if (reader.name() == "map")
+ map(reader);
else
- reader.raiseError("Not an online map definitions file");
+ reader.raiseError("Not an online map source file");
}
if (reader.error())
@@ -182,9 +172,8 @@ bool OMD::loadFile(const QString &path)
return !reader.error();
}
-OMD::~OMD()
-{
- for (int i = 0; i < _maps.size(); i++)
- if (!_maps.at(i)->parent())
- delete _maps.at(i);
+MapSource::~MapSource()
+{
+ if (_map && !_map->parent())
+ delete _map;
}
diff --git a/src/map/omd.h b/src/map/mapsource.h
similarity index 68%
rename from src/map/omd.h
rename to src/map/mapsource.h
index a2184e36..703c3f47 100644
--- a/src/map/omd.h
+++ b/src/map/mapsource.h
@@ -1,5 +1,5 @@
-#ifndef OMD_H
-#define OMD_H
+#ifndef MAPSOURCE_H
+#define MAPSOURCE_H
#include
#include "common/range.h"
@@ -8,24 +8,24 @@
class Map;
class QXmlStreamReader;
-class OMD
+class MapSource
{
public:
- ~OMD();
+ MapSource() : _map(0) {}
+ ~MapSource();
bool loadFile(const QString &path);
const QString &errorString() const {return _errorString;}
- const QList