mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-28 03:59:15 +02:00
Added the "Load map dir" feature
This commit is contained in:
@ -78,7 +78,7 @@ void Atlas::computeBounds()
|
||||
}
|
||||
|
||||
Atlas::Atlas(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _zoom(0), _mapIndex(-1), _valid(false)
|
||||
: Map(fileName, parent), _zoom(0), _mapIndex(-1), _valid(false)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
QByteArray ba;
|
||||
|
@ -388,8 +388,8 @@ QImage BSBMap::readImage()
|
||||
}
|
||||
|
||||
BSBMap::BSBMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _fileName(fileName), _img(0), _ratio(1.0), _dataOffset(-1),
|
||||
_valid(false)
|
||||
: Map(fileName, parent), _fileName(fileName), _img(0), _ratio(1.0),
|
||||
_dataOffset(-1), _valid(false)
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
||||
|
@ -18,7 +18,7 @@ static int limitZoom(int zoom)
|
||||
}
|
||||
|
||||
|
||||
EmptyMap::EmptyMap(QObject *parent) : Map(parent)
|
||||
EmptyMap::EmptyMap(QObject *parent) : Map(QString(), parent)
|
||||
{
|
||||
_zoom = OSM::ZOOMS.max();
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
|
||||
GeoTIFFMap::GeoTIFFMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _fileName(fileName), _img(0), _ratio(1.0), _valid(false)
|
||||
: Map(fileName, parent), _fileName(fileName), _img(0), _ratio(1.0),
|
||||
_valid(false)
|
||||
{
|
||||
QImageReader ir(fileName);
|
||||
if (!ir.canRead()) {
|
||||
|
@ -44,7 +44,7 @@ static QList<MapData*> overlays(const QString &fileName)
|
||||
}
|
||||
|
||||
IMGMap::IMGMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _projection(PCS::pcs(3857)), _valid(false)
|
||||
: Map(fileName, parent), _projection(PCS::pcs(3857)), _valid(false)
|
||||
{
|
||||
if (GMAP::isGMAP(fileName))
|
||||
_data.append(new GMAP(fileName));
|
||||
|
@ -139,7 +139,8 @@ bool JNXMap::readTiles()
|
||||
}
|
||||
|
||||
JNXMap::JNXMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _file(fileName), _zoom(0), _mapRatio(1.0), _valid(false)
|
||||
: Map(fileName, parent), _file(fileName), _zoom(0), _mapRatio(1.0),
|
||||
_valid(false)
|
||||
{
|
||||
_name = QFileInfo(fileName).fileName();
|
||||
|
||||
|
@ -24,9 +24,11 @@ public:
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
Map(QObject *parent = 0) : QObject(parent) {}
|
||||
Map(const QString &path, QObject *parent = 0)
|
||||
: QObject(parent), _path(path) {}
|
||||
virtual ~Map() {}
|
||||
|
||||
const QString &path() const {return _path;}
|
||||
virtual QString name() const = 0;
|
||||
|
||||
virtual QRectF bounds() = 0;
|
||||
@ -56,6 +58,9 @@ public:
|
||||
signals:
|
||||
void tilesLoaded();
|
||||
void mapLoaded();
|
||||
|
||||
private:
|
||||
QString _path;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(Map*)
|
||||
|
@ -293,24 +293,25 @@ Map *MapSource::loadMap(const QString &path, QString &errorString)
|
||||
|
||||
switch (config.type) {
|
||||
case WMTS:
|
||||
return new WMTSMap(config.name, WMTS::Setup(config.url, config.layer,
|
||||
config.set, config.style, config.format, config.rest,
|
||||
return new WMTSMap(path, config.name, WMTS::Setup(config.url,
|
||||
config.layer, config.set, config.style, config.format, config.rest,
|
||||
config.coordinateSystem, config.dimensions, config.authorization),
|
||||
config.tileRatio);
|
||||
case WMS:
|
||||
return new WMSMap(config.name, WMS::Setup(config.url, config.layer,
|
||||
config.style, config.format, config.crs, config.coordinateSystem,
|
||||
config.dimensions, config.authorization), config.tileSize);
|
||||
return new WMSMap(path, config.name, WMS::Setup(config.url,
|
||||
config.layer, config.style, config.format, config.crs,
|
||||
config.coordinateSystem, config.dimensions, config.authorization),
|
||||
config.tileSize);
|
||||
case TMS:
|
||||
return new OnlineMap(config.name, config.url, config.zooms,
|
||||
return new OnlineMap(path, config.name, config.url, config.zooms,
|
||||
config.bounds, config.tileRatio, config.authorization,
|
||||
config.tileSize, config.scalable, true, false);
|
||||
case OSM:
|
||||
return new OnlineMap(config.name, config.url, config.zooms,
|
||||
return new OnlineMap(path, config.name, config.url, config.zooms,
|
||||
config.bounds, config.tileRatio, config.authorization,
|
||||
config.tileSize, config.scalable, false, false);
|
||||
case QuadTiles:
|
||||
return new OnlineMap(config.name, config.url, config.zooms,
|
||||
return new OnlineMap(path, config.name, config.url, config.zooms,
|
||||
config.bounds, config.tileRatio, config.authorization,
|
||||
config.tileSize, config.scalable, false, true);
|
||||
default:
|
||||
|
@ -55,7 +55,7 @@ static double index2mercator(int index, int zoom)
|
||||
}
|
||||
|
||||
MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _fileName(fileName), _mapRatio(1.0), _tileRatio(1.0),
|
||||
: Map(fileName, parent), _fileName(fileName), _mapRatio(1.0), _tileRatio(1.0),
|
||||
_scalable(false), _scaledSize(0), _valid(false)
|
||||
{
|
||||
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "onlinemap.h"
|
||||
|
||||
|
||||
OnlineMap::OnlineMap(const QString &name, const QString &url,
|
||||
const Range &zooms, const RectC &bounds, qreal tileRatio,
|
||||
OnlineMap::OnlineMap(const QString &fileName, const QString &name,
|
||||
const QString &url, const Range &zooms, const RectC &bounds, qreal tileRatio,
|
||||
const Authorization &authorization, int tileSize, bool scalable, bool invertY,
|
||||
bool quadTiles, QObject *parent)
|
||||
: Map(parent), _name(name), _zooms(zooms), _bounds(bounds),
|
||||
: Map(fileName, parent), _name(name), _zooms(zooms), _bounds(bounds),
|
||||
_zoom(_zooms.max()), _mapRatio(1.0), _tileRatio(tileRatio),
|
||||
_tileSize(tileSize), _scalable(scalable), _invertY(invertY)
|
||||
{
|
||||
|
@ -11,10 +11,10 @@ class OnlineMap : public Map
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OnlineMap(const QString &name, const QString &url, const Range &zooms,
|
||||
const RectC &bounds, qreal tileRatio, const Authorization &authorization,
|
||||
int tileSize, bool scalable, bool invertY, bool quadTiles,
|
||||
QObject *parent = 0);
|
||||
OnlineMap(const QString &fileName, const QString &name, const QString &url,
|
||||
const Range &zooms, const RectC &bounds, qreal tileRatio,
|
||||
const Authorization &authorization, int tileSize, bool scalable,
|
||||
bool invertY, bool quadTiles, QObject *parent = 0);
|
||||
|
||||
QString name() const {return _name;}
|
||||
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
|
||||
OziMap::OziMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), _valid(false)
|
||||
: Map(fileName, parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0),
|
||||
_valid(false)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
QString suffix = fi.suffix().toLower();
|
||||
@ -79,7 +80,8 @@ OziMap::OziMap(const QString &fileName, QObject *parent)
|
||||
}
|
||||
|
||||
OziMap::OziMap(const QString &fileName, Tar &tar, QObject *parent)
|
||||
: Map(parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0), _valid(false)
|
||||
: Map(fileName, parent), _img(0), _tar(0), _ozf(0), _zoom(0), _mapRatio(1.0),
|
||||
_valid(false)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
QFileInfo map(fi.absolutePath());
|
||||
|
@ -161,7 +161,8 @@ bool RMap::parseIMP(const QByteArray &data)
|
||||
}
|
||||
|
||||
RMap::RMap(const QString &fileName, QObject *parent)
|
||||
: Map(parent), _mapRatio(1.0), _fileName(fileName), _zoom(0), _valid(false)
|
||||
: Map(fileName, parent), _mapRatio(1.0), _fileName(fileName), _zoom(0),
|
||||
_valid(false)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
|
@ -67,8 +67,9 @@ void WMSMap::updateTransform()
|
||||
PointD(pixelSpan, pixelSpan));
|
||||
}
|
||||
|
||||
WMSMap::WMSMap(const QString &name, const WMS::Setup &setup, int tileSize,
|
||||
QObject *parent) : Map(parent), _name(name), _tileLoader(0), _zoom(0),
|
||||
WMSMap::WMSMap(const QString &fileName, const QString &name,
|
||||
const WMS::Setup &setup, int tileSize, QObject *parent)
|
||||
: Map(fileName, parent), _name(name), _tileLoader(0), _zoom(0),
|
||||
_tileSize(tileSize), _mapRatio(1.0)
|
||||
{
|
||||
QString tilesDir(QDir(ProgramPaths::tilesDir()).filePath(_name));
|
||||
|
@ -14,8 +14,8 @@ class WMSMap : public Map
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WMSMap(const QString &name, const WMS::Setup &setup, int tileSize,
|
||||
QObject *parent = 0);
|
||||
WMSMap(const QString &fileName, const QString &name, const WMS::Setup &setup,
|
||||
int tileSize, QObject *parent = 0);
|
||||
|
||||
QString name() const {return _name;}
|
||||
|
||||
|
@ -12,9 +12,10 @@
|
||||
|
||||
#define CAPABILITIES_FILE "capabilities.xml"
|
||||
|
||||
WMTSMap::WMTSMap(const QString &name, const WMTS::Setup &setup, qreal tileRatio,
|
||||
QObject *parent) : Map(parent), _name(name), _tileLoader(0), _zoom(0),
|
||||
_mapRatio(1.0), _tileRatio(tileRatio)
|
||||
WMTSMap::WMTSMap(const QString &fileName, const QString &name,
|
||||
const WMTS::Setup &setup, qreal tileRatio,
|
||||
QObject *parent) : Map(fileName, parent), _name(name), _tileLoader(0),
|
||||
_zoom(0), _mapRatio(1.0), _tileRatio(tileRatio)
|
||||
{
|
||||
QString tilesDir(QDir(ProgramPaths::tilesDir()).filePath(_name));
|
||||
|
||||
|
@ -14,8 +14,8 @@ class WMTSMap : public Map
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WMTSMap(const QString &name, const WMTS::Setup &setup, qreal tileRatio,
|
||||
QObject *parent = 0);
|
||||
WMTSMap(const QString &fileName, const QString &name,
|
||||
const WMTS::Setup &setup, qreal tileRatio, QObject *parent = 0);
|
||||
|
||||
QString name() const {return _name;}
|
||||
|
||||
|
Reference in New Issue
Block a user