1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 07:13:21 +02:00
GPXSee/src/map/IMG/vectortile.h

94 lines
2.1 KiB
C
Raw Normal View History

2021-04-10 15:27:40 +02:00
#ifndef IMG_VECTORTILE_H
#define IMG_VECTORTILE_H
2019-05-10 18:56:19 +02:00
#include "trefile.h"
#include "rgnfile.h"
#include "lblfile.h"
#include "netfile.h"
#include "nodfile.h"
2019-05-10 18:56:19 +02:00
2021-04-10 15:27:40 +02:00
namespace IMG {
2019-05-10 18:56:19 +02:00
class VectorTile {
public:
VectorTile()
: _tre(0), _rgn(0), _lbl(0), _net(0), _nod(0), _gmp(0), _loaded(0) {}
~VectorTile()
{
delete _tre; delete _rgn; delete _lbl; delete _net; delete _nod;
delete _gmp;
}
2019-05-10 18:56:19 +02:00
bool init();
void markAsBasemap() {_tre->markAsBasemap();}
void clear();
2019-05-10 18:56:19 +02:00
const RectC &bounds() const {return _tre->bounds();}
Range zooms() const {return _tre->zooms();}
2019-05-10 18:56:19 +02:00
SubFile *file(SubFile::Type type);
void polys(const RectC &rect, int bits, bool baseMap,
QList<MapData::Poly> *polygons, QList<MapData::Poly> *lines,
QCache<const SubDiv *, MapData::Polys> *polyCache);
void points(const RectC &rect, int bits, bool baseMap,
QList<MapData::Point> *points, QCache<const SubDiv*,
QList<MapData::Point> > *pointCache);
2019-05-10 18:56:19 +02:00
2020-01-19 13:23:20 +01:00
static bool isTileFile(SubFile::Type type)
{
return (type == SubFile::TRE || type == SubFile::LBL
|| type == SubFile::RGN || type == SubFile::NET
|| type == SubFile::NOD || type == SubFile::GMP);
2020-01-19 13:23:20 +01:00
}
template<typename T>
SubFile *addFile(T *container, SubFile::Type type)
{
switch (type) {
case SubFile::TRE:
_tre = new TREFile(container);
return _tre;
case SubFile::RGN:
_rgn = new RGNFile(container);
return _rgn;
case SubFile::LBL:
_lbl = new LBLFile(container);
return _lbl;
case SubFile::NET:
_net = new NETFile(container);
return _net;
case SubFile::NOD:
_nod = new NODFile(container);
return _nod;
case SubFile::GMP:
_gmp = new SubFile(container);
return _gmp;
default:
return 0;
}
}
2019-05-10 18:56:19 +02:00
private:
bool initGMP();
bool load(SubFile::Handle &rgnHdl, SubFile::Handle &lblHdl,
SubFile::Handle &netHdl, SubFile::Handle &nodHdl);
2019-05-10 18:56:19 +02:00
TREFile *_tre;
RGNFile *_rgn;
LBLFile *_lbl;
NETFile *_net;
NODFile *_nod;
SubFile *_gmp;
int _loaded;
2019-05-10 18:56:19 +02:00
};
2021-04-10 15:27:40 +02:00
}
2019-05-10 18:56:19 +02:00
#ifndef QT_NO_DEBUG
2021-04-10 15:27:40 +02:00
QDebug operator<<(QDebug dbg, const IMG::VectorTile &tile);
2019-05-10 18:56:19 +02:00
#endif // QT_NO_DEBUG
2021-04-10 15:27:40 +02:00
#endif // IMG_VECTORTILE_H