2018-01-29 00:19:57 +01:00
|
|
|
#ifndef MAPSOURCE_H
|
|
|
|
#define MAPSOURCE_H
|
2018-01-28 22:56:08 +01:00
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
#include "common/range.h"
|
|
|
|
#include "common/rectc.h"
|
|
|
|
|
|
|
|
class Map;
|
|
|
|
class QXmlStreamReader;
|
|
|
|
|
2018-01-29 00:19:57 +01:00
|
|
|
class MapSource
|
2018-01-28 22:56:08 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-02-20 23:37:19 +01:00
|
|
|
Map *loadFile(const QString &path);
|
2018-01-28 22:56:08 +01:00
|
|
|
const QString &errorString() const {return _errorString;}
|
|
|
|
|
|
|
|
private:
|
2018-02-27 01:02:22 +01:00
|
|
|
enum Type {
|
|
|
|
TMS,
|
|
|
|
WMTS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TMSConfig {
|
|
|
|
Range zooms;
|
|
|
|
RectC bounds;
|
|
|
|
|
|
|
|
TMSConfig();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WMTSConfig {
|
|
|
|
QString layer;
|
|
|
|
QString style;
|
|
|
|
QString set;
|
|
|
|
QString format;
|
|
|
|
bool rest;
|
|
|
|
bool yx;
|
|
|
|
|
|
|
|
WMTSConfig() : format("image/png"), rest(false), yx(false) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Config {
|
|
|
|
QString name;
|
|
|
|
QString url;
|
|
|
|
Type type;
|
|
|
|
WMTSConfig wmts;
|
|
|
|
TMSConfig tms;
|
|
|
|
|
|
|
|
Config() : type(TMS) {}
|
|
|
|
};
|
|
|
|
|
2018-02-27 21:50:29 +01:00
|
|
|
RectC bounds(QXmlStreamReader &reader);
|
|
|
|
Range zooms(QXmlStreamReader &reader);
|
2018-02-27 01:02:22 +01:00
|
|
|
void map(QXmlStreamReader &reader, Config &config);
|
2018-01-28 22:56:08 +01:00
|
|
|
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
2018-01-29 00:19:57 +01:00
|
|
|
#endif // MAPSOURCE_H
|