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"
|
2018-05-02 21:25:14 +02:00
|
|
|
#include "rectd.h"
|
2023-05-04 09:38:35 +02:00
|
|
|
#include "projection.h"
|
2017-03-26 15:32:55 +02:00
|
|
|
|
2018-08-21 20:01:47 +02:00
|
|
|
class OziMap;
|
2017-03-26 15:32:55 +02:00
|
|
|
|
|
|
|
class Atlas : public Map
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-09-14 18:36:03 +02:00
|
|
|
Atlas(const QString &fileName, bool TAR, const Projection &proj,
|
|
|
|
QObject *parent = 0);
|
2017-03-26 15:32:55 +02:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QString name() const {return _name;}
|
2017-03-26 15:32:55 +02:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QRectF bounds();
|
2023-09-14 18:36:03 +02:00
|
|
|
RectC llBounds();
|
2017-03-26 15:32:55 +02:00
|
|
|
|
2018-02-28 22:19:46 +01:00
|
|
|
int zoom() const {return _zoom;}
|
2018-04-28 22:18:11 +02:00
|
|
|
void setZoom(int zoom);
|
2018-02-28 22:19:46 +01:00
|
|
|
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-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
2017-03-26 15:32:55 +02:00
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
void load(const Projection &in, const Projection &out, qreal deviceRatio,
|
|
|
|
bool hidpi);
|
2017-04-22 10:19:02 +02:00
|
|
|
void unload();
|
|
|
|
|
2017-04-21 21:15:58 +02:00
|
|
|
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
|
|
|
|
2023-09-14 18:36:03 +02:00
|
|
|
static Map *createTAR(const QString &path, const Projection &proj,
|
|
|
|
bool *isDir);
|
|
|
|
static Map *createTBA(const QString &path, const Projection &proj,
|
|
|
|
bool *isDir);
|
2018-01-14 23:03:27 +01:00
|
|
|
|
2017-03-26 15:32:55 +02:00
|
|
|
private:
|
2018-05-02 21:25:14 +02:00
|
|
|
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) {}
|
|
|
|
};
|
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, int mapIndex, Flags flags);
|
2017-03-26 15:32:55 +02:00
|
|
|
void computeZooms();
|
|
|
|
void computeBounds();
|
|
|
|
|
2023-09-14 18:36:03 +02:00
|
|
|
friend QDebug operator<<(QDebug dbg, const Bounds &bounds);
|
|
|
|
friend QDebug operator<<(QDebug dbg, const Zoom &zoom);
|
|
|
|
|
2017-03-26 15:32:55 +02:00
|
|
|
QString _name;
|
|
|
|
|
2018-08-21 20:01:47 +02:00
|
|
|
QList<OziMap*> _maps;
|
2018-05-02 21:25:14 +02:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2023-09-14 18:36:03 +02:00
|
|
|
#ifndef QT_NO_DEBUG
|
|
|
|
QDebug operator<<(QDebug dbg, const Atlas::Zoom &zoom);
|
|
|
|
QDebug operator<<(QDebug dbg, const Atlas::Bounds &bounds);
|
|
|
|
#endif // QT_NO_DEBUG
|
|
|
|
|
2017-03-26 15:32:55 +02:00
|
|
|
#endif // ATLAS_H
|