9 #include "common/rectc.h"
10 #include "projection.h"
11 #include "downloader.h"
12 #include "coordinatesystem.h"
14 class QXmlStreamReader
;
22 Setup(const QString
&url
, const QString
&layer
, const QString
&set
,
23 const QString
&style
, const QString
&format
, bool rest
,
24 const CoordinateSystem
&cs
,
25 const QList
<QPair
<QString
, QString
> > &dimensions
,
26 const Authorization
&authorization
= Authorization())
27 : _url(url
), _layer(layer
), _set(set
), _style(style
),
28 _format(format
), _rest(rest
), _cs(cs
), _dimensions(dimensions
),
29 _authorization(authorization
) {}
31 const QString
&url() const {return _url
;}
32 const Authorization
&authorization() const {return _authorization
;}
33 const QString
&layer() const {return _layer
;}
34 const QString
&set() const {return _set
;}
35 const QString
&style() const {return _style
;}
36 const QString
&format() const {return _format
;}
37 bool rest() const {return _rest
;}
38 const CoordinateSystem
&coordinateSystem() const {return _cs
;}
39 const QList
<QPair
<QString
, QString
> > &dimensions() const
50 QList
<QPair
<QString
, QString
> > _dimensions
;
51 Authorization _authorization
;
57 Zoom(const QString
&id
, double scaleDenominator
, const PointD
&topLeft
,
58 const QSize
&tile
, const QSize
&matrix
, const QRect
&limits
) :
59 _id(id
), _scaleDenominator(scaleDenominator
), _topLeft(topLeft
),
60 _tile(tile
), _matrix(matrix
), _limits(limits
) {}
61 bool operator<(const Zoom
&other
) const
62 {return _scaleDenominator
> other
._scaleDenominator
;}
64 const QString
&id() const {return _id
;}
65 double scaleDenominator() const {return _scaleDenominator
;}
66 const PointD
&topLeft() const {return _topLeft
;}
67 const QSize
&tile() const {return _tile
;}
68 const QSize
&matrix() const {return _matrix
;}
69 const QRect
&limits() const {return _limits
;}
73 double _scaleDenominator
;
81 WMTS(const QString
&path
, const Setup
&setup
);
83 const RectC
&bounds() const {return _bounds
;}
84 QList
<Zoom
> zooms() const;
85 const Projection
&projection() const {return _projection
;}
86 const QString
&tileUrl() const {return _tileUrl
;}
88 bool isValid() const {return _valid
;}
89 const QString
&errorString() const {return _errorString
;}
94 double scaleDenominator
;
99 TileMatrix() : scaleDenominator(0) {}
100 bool operator==(const TileMatrix
&other
) const
101 {return this->id
== other
.id
;}
103 {return !id
.isEmpty() && scaleDenominator
> 0 && tile
.isValid()
104 && matrix
.isValid();}
107 struct MatrixLimits
{
112 MatrixLimits(const QString
&id
) : id(id
) {}
113 bool operator==(const MatrixLimits
&other
) const
114 {return this->id
== other
.id
;}
116 {return !id
.isEmpty() && rect
.isValid();}
127 CTX(const Setup
&setup
) : setup(setup
), hasLayer(false), hasStyle(false),
128 hasFormat(false), hasSet(false) {}
131 RectC
wgs84BoundingBox(QXmlStreamReader
&reader
);
132 MatrixLimits
tileMatrixLimits(QXmlStreamReader
&reader
);
133 TileMatrix
tileMatrix(QXmlStreamReader
&reader
);
134 QSet
<MatrixLimits
> tileMatrixSetLimits(QXmlStreamReader
&reader
);
135 QString
style(QXmlStreamReader
&reader
);
136 void tileMatrixSet(QXmlStreamReader
&reader
, CTX
&ctx
);
137 void tileMatrixSetLink(QXmlStreamReader
&reader
, CTX
&ctx
);
138 void layer(QXmlStreamReader
&reader
, CTX
&ctx
);
139 void contents(QXmlStreamReader
&reader
, CTX
&ctx
);
140 void capabilities(QXmlStreamReader
&reader
, CTX
&ctx
);
141 bool parseCapabilities(const QString
&path
, const Setup
&setup
);
142 bool downloadCapabilities(const QString
&url
, const QString
&file
,
143 const Authorization
&authorization
);
145 QSet
<TileMatrix
> _matrixes
;
146 QSet
<MatrixLimits
> _limits
;
148 Projection _projection
;
152 QString _errorString
;
154 friend uint
qHash(const WMTS::TileMatrix
&key
);
155 friend uint
qHash(const WMTS::MatrixLimits
&key
);
158 inline uint
qHash(const WMTS::TileMatrix
&key
)
160 return ::qHash(key
.id
);
163 inline uint
qHash(const WMTS::MatrixLimits
&key
)
165 return ::qHash(key
.id
);
169 QDebug
operator<<(QDebug dbg
, const WMTS::Setup
&setup
);
170 QDebug
operator<<(QDebug dbg
, const WMTS::Zoom
&zoom
);
171 #endif // QT_NO_DEBUG