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

85 lines
1.8 KiB
C
Raw Normal View History

#ifndef OZIMAP_H
#define OZIMAP_H
2018-03-22 20:00:30 +01:00
#include "transform.h"
2017-11-26 18:54:03 +01:00
#include "projection.h"
#include "map.h"
2018-03-08 02:24:10 +01:00
class Tar;
class OZF;
class QImage;
class OziMap : public Map
{
Q_OBJECT
public:
OziMap(const QString &fileName, QObject *parent = 0);
OziMap(const QString &fileName, Tar &tar, QObject *parent = 0);
~OziMap();
2018-07-13 09:51:41 +02:00
QString name() const {return _name;}
2018-07-13 09:51:41 +02:00
QRectF bounds();
int zoom() const {return _zoom;}
2018-04-28 22:18:11 +02:00
void setZoom(int zoom) {_zoom = zoom;}
2018-03-22 20:00:30 +01:00
int zoomFit(const QSize &size, const RectC &rect);
int zoomIn();
int zoomOut();
QPointF ll2xy(const Coordinates &c);
Coordinates xy2ll(const QPointF &p);
2018-04-28 16:07:32 +02:00
void draw(QPainter *painter, const QRectF &rect, bool block);
2018-08-18 21:06:36 +02:00
void setDevicePixelRatio(qreal ratio) {_ratio = ratio;}
void setOpenGLEnabled(bool enabled) {_opengl = enabled;}
void load();
void unload();
bool isValid() const {return _valid;}
2018-02-20 23:37:19 +01:00
QString errorString() const {return _errorString;}
2017-04-01 05:59:55 +02:00
2018-04-15 17:32:25 +02:00
PointD ll2pp(const Coordinates &c) const
{return _projection.ll2xy(c);}
PointD xy2pp(const QPointF &p) const
2018-08-18 21:06:36 +02:00
{return _transform.img2proj(p * _ratio);}
2018-04-15 17:32:25 +02:00
QPointF pp2xy(const PointD &p) const
2018-08-18 21:06:36 +02:00
{return _transform.proj2img(p) / _ratio;}
private:
2018-03-08 02:24:10 +01:00
struct ImageInfo {
QSize size;
QString path;
bool isValid() const {return size.isValid() && !path.isEmpty();}
};
2018-03-08 19:08:39 +01:00
bool setTileInfo(const QStringList &tiles, const QString &path = QString());
bool setImageInfo(const QString &path);
2018-03-08 19:08:39 +01:00
void drawTiled(QPainter *painter, const QRectF &rect) const;
void drawOZF(QPainter *painter, const QRectF &rect) const;
void drawImage(QPainter *painter, const QRectF &rect) const;
2017-04-15 08:59:31 +02:00
2017-08-11 00:22:21 +02:00
void rescale(int zoom);
QString _name;
Projection _projection;
2018-03-22 20:00:30 +01:00
Transform _transform;
QImage *_img;
2018-03-08 02:24:10 +01:00
Tar *_tar;
OZF *_ozf;
ImageInfo _map, _tile;
2017-08-11 00:22:21 +02:00
int _zoom;
QPointF _scale;
2018-08-18 21:06:36 +02:00
qreal _ratio;
bool _opengl;
2018-01-08 23:47:45 +01:00
bool _valid;
QString _errorString;
};
#endif // OZIMAP_H