2018-08-21 20:01:47 +02:00
|
|
|
#ifndef OZIMAP_H
|
|
|
|
#define OZIMAP_H
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-03-22 20:00:30 +01:00
|
|
|
#include "transform.h"
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "projection.h"
|
2017-03-18 01:30:31 +01:00
|
|
|
#include "map.h"
|
|
|
|
|
2018-03-08 02:24:10 +01:00
|
|
|
class Tar;
|
|
|
|
class OZF;
|
2018-08-23 20:26:10 +02:00
|
|
|
class Image;
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-08-21 20:01:47 +02:00
|
|
|
class OziMap : public Map
|
2017-03-18 01:30:31 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-06-10 08:09:07 +02:00
|
|
|
OziMap(const QString &fileName, bool TAR, QObject *parent = 0);
|
2018-08-21 20:01:47 +02:00
|
|
|
OziMap(const QString &fileName, Tar &tar, QObject *parent = 0);
|
|
|
|
~OziMap();
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QString name() const {return _name;}
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-07-13 09:51:41 +02:00
|
|
|
QRectF bounds();
|
2017-03-18 01:30:31 +01: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) {_zoom = zoom;}
|
2018-03-22 20:00:30 +01:00
|
|
|
int zoomFit(const QSize &size, const RectC &rect);
|
2018-02-28 22:19:46 +01:00
|
|
|
int zoomIn();
|
|
|
|
int zoomOut();
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-06-30 12:14:58 +02:00
|
|
|
QPointF ll2xy(const Coordinates &c);
|
|
|
|
Coordinates xy2ll(const QPointF &p);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-08-23 20:26:10 +02:00
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
void load(const Projection &in, const Projection &out, qreal deviceRatio,
|
|
|
|
bool hidpi);
|
2017-03-18 01:30:31 +01: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-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-11-17 10:10:35 +01:00
|
|
|
{return _transform.img2proj(p * _mapRatio);}
|
2018-04-15 17:32:25 +02:00
|
|
|
QPointF pp2xy(const PointD &p) const
|
2018-11-17 10:10:35 +01:00
|
|
|
{return _transform.proj2img(p) / _mapRatio;}
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2023-05-04 09:38:35 +02:00
|
|
|
static Map *createTAR(const QString &path, bool *isDir);
|
|
|
|
static Map *createMAP(const QString &path, bool *isDir);
|
2022-04-29 23:16:10 +02:00
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
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);
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2018-03-08 19:08:39 +01:00
|
|
|
void drawTiled(QPainter *painter, const QRectF &rect) const;
|
|
|
|
void drawOZF(QPainter *painter, const QRectF &rect) const;
|
2018-08-23 20:26:10 +02:00
|
|
|
void drawImage(QPainter *painter, const QRectF &rect, Flags flags) const;
|
2017-04-15 08:59:31 +02:00
|
|
|
|
2017-08-11 00:22:21 +02:00
|
|
|
void rescale(int zoom);
|
|
|
|
|
2017-03-18 01:30:31 +01:00
|
|
|
QString _name;
|
2018-01-25 00:19:11 +01:00
|
|
|
Projection _projection;
|
2018-03-22 20:00:30 +01:00
|
|
|
Transform _transform;
|
2018-08-23 20:26:10 +02:00
|
|
|
Image *_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-11-17 10:10:35 +01:00
|
|
|
qreal _mapRatio;
|
2018-01-08 23:47:45 +01:00
|
|
|
|
|
|
|
bool _valid;
|
|
|
|
QString _errorString;
|
2017-03-18 01:30:31 +01:00
|
|
|
};
|
|
|
|
|
2018-08-21 20:01:47 +02:00
|
|
|
#endif // OZIMAP_H
|