2020-11-27 01:11:50 +01:00
|
|
|
#ifndef BSBMAP_H
|
|
|
|
#define BSBMAP_H
|
|
|
|
|
|
|
|
#include <QColor>
|
|
|
|
#include "transform.h"
|
|
|
|
#include "projection.h"
|
|
|
|
#include "map.h"
|
|
|
|
|
|
|
|
class QFile;
|
|
|
|
class Image;
|
|
|
|
|
|
|
|
class BSBMap : public Map
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BSBMap(const QString &fileName, QObject *parent = 0);
|
|
|
|
~BSBMap();
|
|
|
|
|
|
|
|
QString name() const {return _name;}
|
|
|
|
|
|
|
|
QRectF bounds();
|
|
|
|
QPointF ll2xy(const Coordinates &c);
|
|
|
|
Coordinates xy2ll(const QPointF &p);
|
|
|
|
|
|
|
|
void draw(QPainter *painter, const QRectF &rect, Flags flags);
|
|
|
|
|
|
|
|
void load();
|
|
|
|
void unload();
|
|
|
|
void setDevicePixelRatio(qreal deviceRatio, qreal mapRatio);
|
|
|
|
|
|
|
|
bool isValid() const {return _valid;}
|
|
|
|
QString errorString() const {return _errorString;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool parseBSB(const QByteArray &line);
|
|
|
|
bool parseKNP(const QByteArray &line, QString &datum, QString &proj,
|
|
|
|
double &pp);
|
2020-11-28 14:48:20 +01:00
|
|
|
bool parseKNQ(const QByteArray &line, double params[9]);
|
2020-12-02 20:51:19 +01:00
|
|
|
bool parseREF(const QByteArray &line, const QString &datum,
|
|
|
|
const QString &proj, double params[9], QList<ReferencePoint> &points);
|
2020-11-27 01:11:50 +01:00
|
|
|
bool parseRGB(const QByteArray &line);
|
2020-11-28 20:34:25 +01:00
|
|
|
bool readHeader(QFile &file);
|
2020-11-27 01:11:50 +01:00
|
|
|
bool createProjection(const QString &datum, const QString &proj,
|
2020-12-02 20:51:19 +01:00
|
|
|
double params[9], const Coordinates &c);
|
2020-12-01 19:03:58 +01:00
|
|
|
bool createTransform(QList<ReferencePoint> &points);
|
2020-11-27 01:11:50 +01:00
|
|
|
QImage readImage();
|
|
|
|
bool readRow(QFile &file, char bits, uchar *buf);
|
|
|
|
|
|
|
|
QString _name;
|
|
|
|
Projection _projection;
|
|
|
|
Transform _transform;
|
2020-12-01 19:03:58 +01:00
|
|
|
qreal _skew;
|
2020-11-27 01:11:50 +01:00
|
|
|
Image *_img;
|
|
|
|
QSize _size;
|
2020-12-01 19:03:58 +01:00
|
|
|
QSize _skewSize;
|
2020-11-27 01:11:50 +01:00
|
|
|
qreal _ratio;
|
|
|
|
qint64 _dataOffset;
|
|
|
|
QVector<QRgb> _palette;
|
|
|
|
|
|
|
|
bool _valid;
|
|
|
|
QString _errorString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BSBMAP_H
|