5 #include <QtConcurrent>
6 #include "common/range.h"
8 #include "projection.h"
10 #include "ENC/iso8211.h"
11 #include "ENC/mapdata.h"
12 #include "ENC/style.h"
16 class ENCMap
: public Map
21 ENCMap(const QString
&fileName
, QObject
*parent
= 0);
24 QString
name() const {return _name
;}
26 QRectF
bounds() {return _bounds
;}
27 RectC
llBounds() {return _llBounds
;}
29 int zoom() const {return _zoom
;}
30 void setZoom(int zoom
);
31 int zoomFit(const QSize
&size
, const RectC
&rect
);
35 void load(const Projection
&in
, const Projection
&out
, qreal deviceRatio
,
39 QPointF
ll2xy(const Coordinates
&c
)
40 {return _transform
.proj2img(_projection
.ll2xy(c
));}
41 Coordinates
xy2ll(const QPointF
&p
)
42 {return _projection
.xy2ll(_transform
.img2proj(p
));}
44 void draw(QPainter
*painter
, const QRectF
&rect
, Flags flags
);
46 bool isValid() const {return _valid
;}
47 QString
errorString() const {return _errorString
;}
49 static Map
*create(const QString
&path
, const Projection
&proj
, bool *isMap
);
52 void jobFinished(ENCJob
*job
);
58 : _minX(INT_MAX
), _maxX(INT_MIN
), _minY(INT_MAX
), _maxY(INT_MIN
) {}
59 Rect(int minX
, int maxX
, int minY
, int maxY
)
60 : _minX(minX
), _maxX(maxX
), _minY(minY
), _maxY(maxY
) {}
62 int minX() const {return _minX
;}
63 int maxX() const {return _maxX
;}
64 int minY() const {return _minY
;}
65 int maxY() const {return _maxY
;}
67 void unite(int x
, int y
) {
78 Rect
&operator|=(const Rect
&r
) {*this = *this | r
; return *this;}
79 Rect
operator|(const Rect
&r
) const
81 return Rect(qMin(_minX
, r
._minX
), qMax(_maxX
, r
._maxX
),
82 qMin(_minY
, r
._minY
), qMax(_maxY
, r
._maxY
));
86 int _minX
, _maxX
, _minY
, _maxY
;
89 Transform
transform(int zoom
) const;
90 void updateTransform();
91 bool isRunning(int zoom
, const QPoint
&xy
) const;
92 void runJob(ENCJob
*job
);
93 void removeJob(ENCJob
*job
);
94 void cancelJobs(bool wait
);
95 QString
key(int zoom
, const QPoint
&xy
) const;
97 static bool bounds(const ENC::ISO8211::Record
&record
, Rect
&rect
);
98 static bool bounds(const QVector
<ENC::ISO8211::Record
> &gv
, Rect
&b
);
99 static bool processRecord(const ENC::ISO8211::Record
&record
,
100 QVector
<ENC::ISO8211::Record
> &rv
, uint
&COMF
, QString
&name
);
105 Projection _projection
;
106 Transform _transform
;
113 QList
<ENCJob
*> _jobs
;
116 QString _errorString
;