Marble

GeoSceneTileDataset.h
1/*
2 SPDX-FileCopyrightText: 2008 Torsten Rahn <rahn@kde.org>
3 SPDX-FileCopyrightText: 2008 Jens-Michael Hoffmann <jensmh@gmx.de>
4 SPDX-FileCopyrightText: 2012 Ander Pijoan <ander.pijoan@deusto.es>
5
6 SPDX-License-Identifier: LGPL-2.1-or-later
7*/
8
9#ifndef MARBLE_GEOSCENETILEDATASET_H
10#define MARBLE_GEOSCENETILEDATASET_H
11
12#include <QList>
13#include <QVector>
14#include <QSize>
15
16#include "GeoSceneAbstractDataset.h"
17#include "GeoSceneAbstractTileProjection.h"
18#include "MarbleGlobal.h"
19#include "GeoDataLatLonBox.h"
20
21class QStringList;
22class QUrl;
23
24/**
25 * @short Tiled dataset stored in a layer. TextureTile and VectorTile layes inherit from this class.
26 */
27
28/* In order to make Marble able to manage vector tiles,
29 * now there is GeoSceneTileDataset and then GeoSceneTextureTileDataset
30 * (for the tag <texture> in dgml) or GeoSceneVectorTileDataset
31 * (for <vectortile>) are created, which inherit from this class */
32
33namespace Marble
34{
35class DownloadPolicy;
36class ServerLayout;
37class TileId;
38
39class GEODATA_EXPORT GeoSceneTileDataset : public GeoSceneAbstractDataset
40{
41 public:
42 enum StorageLayout { Marble, OpenStreetMap, TileMapService };
43
44 explicit GeoSceneTileDataset( const QString& name );
45 ~GeoSceneTileDataset() override;
46 const char* nodeType() const override;
47
48 QString sourceDir() const;
49 void setSourceDir( const QString& sourceDir );
50
51 QString installMap() const;
52 void setInstallMap( const QString& installMap );
53
54 StorageLayout storageLayout() const;
55 void setStorageLayout( const StorageLayout );
56
57 void setServerLayout( const ServerLayout * );
58 const ServerLayout *serverLayout() const;
59
60 int levelZeroColumns() const;
61 void setLevelZeroColumns( const int );
62
63 int levelZeroRows() const;
64 void setLevelZeroRows( const int );
65
66 bool hasMaximumTileLevel() const;
67 int maximumTileLevel() const;
68 void setMaximumTileLevel( const int );
69
70 int minimumTileLevel() const;
71 void setMinimumTileLevel(int level);
72
73 void setTileLevels(const QString &tileLevels);
74 QVector<int> tileLevels() const;
75
76 QVector<QUrl> downloadUrls() const;
77
78 const QSize tileSize() const;
79 void setTileSize( const QSize &tileSize );
80
81 /**
82 * @brief set bounds for the texture. Tiles outside of these bounds won't be searched in this texture.
83 * Null box means no bounds.
84 */
85 void setLatLonBox( const GeoDataLatLonBox &box );
86 GeoDataLatLonBox latLonBox() const;
87
88 void setTileProjection(GeoSceneAbstractTileProjection::Type projectionType);
89
90 const GeoSceneAbstractTileProjection * tileProjection() const;
91 GeoSceneAbstractTileProjection::Type tileProjectionType() const;
92
93 QString blending() const;
94 void setBlending( const QString &name );
95
96 /**
97 * Creates a download URL for the given tile id.
98 *
99 * It implements the round robin for the tile servers.
100 * On each invocation the next url is returned.
101 */
102 QUrl downloadUrl( const TileId & ) const;
103 void addDownloadUrl( const QUrl & );
104
105 QString relativeTileFileName( const TileId & ) const;
106
107 QString themeStr() const;
108
109 QList<const DownloadPolicy *> downloadPolicies() const;
110 void addDownloadPolicy( const DownloadUsage usage, const int maximumConnections );
111
112 private:
113 Q_DISABLE_COPY( GeoSceneTileDataset )
114 QStringList hostNames() const;
115
116 QString m_sourceDir;
117 QString m_installMap;
118 StorageLayout m_storageLayoutMode;
119 const ServerLayout *m_serverLayout;
120 int m_levelZeroColumns;
121 int m_levelZeroRows;
122 int m_minimumTileLevel;
123 int m_maximumTileLevel;
124 QVector<int> m_tileLevels;
125 mutable QSize m_tileSize;
126 GeoDataLatLonBox m_latLonBox;
127 GeoSceneAbstractTileProjection *m_tileProjection;
128 QString m_blending;
129
130 /// List of Urls which are used in a round robin fashion
131 QVector<QUrl> m_downloadUrls;
132
133 /// Points to next Url for the round robin algorithm
134 mutable QVector<QUrl>::const_iterator m_nextUrl;
135 QList<const DownloadPolicy *> m_downloadPolicies;
136};
137
138inline bool GeoSceneTileDataset::hasMaximumTileLevel() const
139{
140 return m_maximumTileLevel != -1;
141}
142
143inline QString GeoSceneTileDataset::blending() const
144{
145 return m_blending;
146}
147
148inline void GeoSceneTileDataset::setBlending( const QString &name )
149{
150 m_blending = name;
151}
152
153}
154
155#endif
QString name(StandardAction id)
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 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.