1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-21 14:24:24 +02:00

Added support for ENC atlases (catalogues)

This commit is contained in:
2023-09-07 09:31:23 +02:00
parent 864326210a
commit b1f104c2ec
18 changed files with 1215 additions and 466 deletions

65
src/map/ENC/atlasdata.h Normal file
View File

@ -0,0 +1,65 @@
#ifndef ENC_ATLASDATA_H
#define ENC_ATLASDATA_H
#include <QCache>
#include <QMutex>
#include "common/rtree.h"
#include "mapdata.h"
namespace ENC {
typedef QCache<const QString*, MapData> MapCache;
class AtlasData
{
public:
AtlasData(MapCache &cache, QMutex &lock)
: _cache(cache), _lock(lock) {}
~AtlasData();
void addMap(const RectC &bounds, const QString &path);
void polys(const RectC &rect, QList<MapData::Poly> *polygons,
QList<MapData::Line> *lines);
void points(const RectC &rect, QList<MapData::Point> *points);
private:
typedef RTree<const QString*, double, 2> MapTree;
struct PolyCTX
{
PolyCTX(const RectC &rect, QList<MapData::Poly> *polygons,
QList<MapData::Line> *lines, MapCache &cache, QMutex &lock)
: rect(rect), polygons(polygons), lines(lines), cache(cache),
lock(lock) {}
const RectC &rect;
QList<MapData::Poly> *polygons;
QList<MapData::Line> *lines;
MapCache &cache;
QMutex &lock;
};
struct PointCTX
{
PointCTX(const RectC &rect, QList<MapData::Point> *points,
MapCache &cache, QMutex &lock) : rect(rect), points(points),
cache(cache), lock(lock) {}
const RectC &rect;
QList<MapData::Point> *points;
MapCache &cache;
QMutex &lock;
};
static bool polyCb(const QString *map, void *context);
static bool pointCb(const QString *map, void *context);
MapTree _tree;
MapCache &_cache;
QMutex &_lock;
};
}
#endif // ENC_ATLASDATA_H