1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00
GPXSee/src/map/atlas.h
Martin Tůma cf81e42f52 Remaining qreal/double separation
+ some minor TrekBuddy atlas issues fixes
2018-05-02 21:25:14 +02:00

73 lines
1.3 KiB
C++

#ifndef ATLAS_H
#define ATLAS_H
#include "map.h"
#include "rectd.h"
class OfflineMap;
class Atlas : public Map
{
Q_OBJECT
public:
Atlas(const QString &fileName, QObject *parent = 0);
const QString &name() const {return _name;}
QRectF bounds() const;
qreal resolution(const QRectF &rect) const;
int zoom() const {return _zoom;}
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &br);
int zoomIn();
int zoomOut();
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
void draw(QPainter *painter, const QRectF &rect, bool block);
void unload();
bool isValid() const {return _valid;}
QString errorString() const {return _errorString;}
static bool isAtlas(const QString &path);
private:
struct Zoom {
int first;
int last;
Zoom() : first(-1), last(-1) {}
Zoom(int first, int last) : first(first), last(last) {}
};
struct Bounds {
RectD pp;
QRectF xy;
Bounds() {}
Bounds(const RectD &pp, const QRectF &xy) : pp(pp), xy(xy) {}
};
void draw(QPainter *painter, const QRectF &rect, int mapIndex);
void computeZooms();
void computeBounds();
QString _name;
QList<OfflineMap*> _maps;
QVector<Zoom> _zooms;
QVector<Bounds> _bounds;
int _zoom;
int _mapIndex;
bool _valid;
QString _errorString;
};
#endif // ATLAS_H