Marble

ServerLayout.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010, 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
4//
5
6#ifndef MARBLE_SERVERLAYOUT_H
7#define MARBLE_SERVERLAYOUT_H
8
9class QUrl;
10class QString;
11
12namespace Marble
13{
14class GeoSceneTileDataset;
15class TileId;
16
17class ServerLayout
18{
19public:
20 explicit ServerLayout( GeoSceneTileDataset *textureLayer );
21 virtual ~ServerLayout();
22
23 /**
24 * Translates given tile @p id using a @p prototypeUrl into an URL
25 * that can be used for downloading.
26 *
27 * @param prototypeUrl prototype URL, to be completed by this method
28 * @param id Marble-specific ID of requested tile
29 * @return completed URL for requested tile id
30 */
31 virtual QUrl downloadUrl( const QUrl &prototypeUrl, const TileId &id ) const = 0;
32
33 /**
34 * Returns the name of the server layout to be used as the value in the
35 * mode attribute in the DGML file.
36 */
37 virtual QString name() const = 0;
38
39 /**
40 * Returns the sourceDir of the texture layer, or an empty string if the texture layer is 0
41 */
42 QString sourceDir() const;
43
44protected:
45 GeoSceneTileDataset *const m_textureLayer;
46};
47
48class MarbleServerLayout : public ServerLayout
49{
50public:
51 explicit MarbleServerLayout( GeoSceneTileDataset *textureLayer );
52
53 /**
54 * Completes the path of the @p prototypeUrl and returns it.
55 */
56 QUrl downloadUrl( const QUrl &prototypeUrl, const TileId & ) const override;
57
58 QString name() const override;
59};
60
61class OsmServerLayout : public ServerLayout
62{
63public:
64 explicit OsmServerLayout( GeoSceneTileDataset *textureLayer );
65
66 /**
67 * Appends %zoomLevel/%x/%y.%suffix to the path of the @p prototypeUrl and returns
68 * the result.
69 */
70 QUrl downloadUrl( const QUrl &prototypeUrl, const TileId & ) const override;
71
72 QString name() const override;
73};
74
75class CustomServerLayout : public ServerLayout
76{
77public:
78 explicit CustomServerLayout( GeoSceneTileDataset *texture );
79
80 /**
81 * Replaces escape sequences in the @p prototypeUrl by the values in @p id
82 * and returns the result.
83 *
84 * Escape sequences are: {zoomLevel}, {x}, and {y}.
85 */
86 QUrl downloadUrl( const QUrl &prototypeUrl, const TileId &id ) const override;
87
88 QString name() const override;
89};
90
91class WmsServerLayout : public ServerLayout
92{
93public:
94 explicit WmsServerLayout( GeoSceneTileDataset *texture );
95
96 /**
97 * Adds WMS query items to the @p prototypeUrl and returns the result.
98 *
99 * The following items are added: service, request, version, width, height, bbox.
100 *
101 * The following items are only added if they are not already specified in the dgml file:
102 * styles, format, srs, layers.
103 */
104 QUrl downloadUrl( const QUrl &prototypeUrl, const Marble::TileId &tileId ) const override;
105
106 QString name() const override;
107
108 QString epsgCode() const;
109};
110
111class WmtsServerLayout : public ServerLayout
112{
113public:
114 explicit WmtsServerLayout( GeoSceneTileDataset *texture );
115
116 /**
117 * Adds WMTS query items to the @p prototypeUrl and returns the result.
118 */
119 QUrl downloadUrl( const QUrl &prototypeUrl, const Marble::TileId &tileId ) const override;
120
121 QString name() const override;
122
123 QString epsgCode() const;
124};
125
126class QuadTreeServerLayout : public ServerLayout
127{
128public:
129 explicit QuadTreeServerLayout( GeoSceneTileDataset* textureLayer );
130 QUrl downloadUrl( const QUrl &, const Marble::TileId & ) const override;
131
132 QString name() const override;
133
134private:
135 static QString encodeQuadTree( const Marble::TileId & );
136};
137
138class TmsServerLayout : public ServerLayout
139{
140public:
141 explicit TmsServerLayout( GeoSceneTileDataset *textureLayer );
142
143 /**
144 * Appends %zoomLevel/%x/2^%zoomLevel-%y-1.%suffix to the path of the @p prototypeUrl and returns
145 * the result.
146 * TMS (TileMapService) maps take the origin for y coordinate at the bottom of the map,
147 * as opposed to what Marble and OpenStreepMap (SlippyTiles) do.
148 */
149 QUrl downloadUrl( const QUrl &prototypeUrl, const TileId & ) const override;
150
151 QString name() const override;
152};
153
154}
155
156#endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.