1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00
GPXSee/src/map/atlas.h

73 lines
1.3 KiB
C
Raw Normal View History

2017-03-26 15:32:55 +02:00
#ifndef ATLAS_H
#define ATLAS_H
2017-12-02 20:28:53 +01:00
#include "map.h"
#include "rectd.h"
2017-03-26 15:32:55 +02:00
2018-03-06 19:28:07 +01:00
class OfflineMap;
2017-03-26 15:32:55 +02:00
class Atlas : public Map
{
Q_OBJECT
public:
Atlas(const QString &fileName, QObject *parent = 0);
2017-03-26 15:32:55 +02:00
const QString &name() const {return _name;}
QRectF bounds() const;
qreal resolution(const QRectF &rect) const;
2017-03-26 15:32:55 +02:00
int zoom() const {return _zoom;}
2018-04-28 22:18:11 +02:00
void setZoom(int zoom);
int zoomFit(const QSize &size, const RectC &br);
int zoomIn();
int zoomOut();
2017-03-26 15:32:55 +02:00
2017-04-30 00:19:53 +02:00
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
2017-03-26 15:32:55 +02:00
2018-04-28 16:07:32 +02:00
void draw(QPainter *painter, const QRectF &rect, bool block);
2017-03-26 15:32:55 +02:00
void unload();
bool isValid() const {return _valid;}
2018-02-20 23:37:19 +01:00
QString errorString() const {return _errorString;}
2017-03-26 15:32:55 +02:00
static bool isAtlas(const QString &path);
2017-03-26 15:32:55 +02:00
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) {}
};
2017-04-01 05:59:55 +02:00
void draw(QPainter *painter, const QRectF &rect, int mapIndex);
2017-03-26 15:32:55 +02:00
void computeZooms();
void computeBounds();
QString _name;
QList<OfflineMap*> _maps;
QVector<Zoom> _zooms;
QVector<Bounds> _bounds;
2017-03-26 15:32:55 +02:00
int _zoom;
2018-03-09 18:56:54 +01:00
int _mapIndex;
2017-04-30 00:19:53 +02:00
2018-03-09 18:56:54 +01:00
bool _valid;
QString _errorString;
2017-03-26 15:32:55 +02:00
};
#endif // ATLAS_H