Marble

TextureLayer.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010, 2011 Bernhard Beschow <[email protected]>
4 //
5 
6 #ifndef MARBLE_MARBLETEXTURELAYER_H
7 #define MARBLE_MARBLETEXTURELAYER_H
8 
9 #include "TileLayer.h"
10 
11 #include "MarbleGlobal.h"
12 
13 class QAbstractItemModel;
14 class QImage;
15 class QSize;
16 
17 namespace Marble
18 {
19 
20 class GeoPainter;
21 class GeoDataDocument;
22 class GeoSceneGroup;
23 class GeoSceneAbstractTileProjection;
24 class GeoSceneTextureTileDataset;
25 class HttpDownloadManager;
26 class SunLocator;
27 class TileId;
28 class ViewportParams;
29 class PluginManager;
30 
31 class MARBLE_EXPORT TextureLayer : public TileLayer
32 {
33  Q_OBJECT
34 
35  public:
36  TextureLayer( HttpDownloadManager *downloadManager,
37  PluginManager* pluginManager,
38  const SunLocator *sunLocator,
39  QAbstractItemModel *groundOverlayModel );
40 
41  ~TextureLayer() override;
42 
43  void addSeaDocument( const GeoDataDocument *seaDocument );
44 
45  void addLandDocument( const GeoDataDocument *landDocument );
46 
47  int layerCount() const;
48 
49  /**
50  * @brief Adds texture sublayer, taking ownership of the object's memory
51  * Does nothing if a texture with the same source directory was already
52  * added with this method.
53  * @return returned string is the key for the texture that can be later used to remove it
54  */
55  QString addTextureLayer(GeoSceneTextureTileDataset *texture);
56 
57  /**
58  * @brief Removes texture sublayer identified by a key.
59  * Deletes the texture object. Does nothing if key is not found.
60  * @param A key to identify the texture, returned from addTextureLayer
61  */
62  void removeTextureLayer(const QString &key);
63 
64  bool showSunShading() const;
65  bool showCityLights() const;
66 
67  /**
68  * @brief Return the current tile zoom level. For example for OpenStreetMap
69  * possible values are 1..18, for BlueMarble 0..6.
70  */
71  int tileZoomLevel() const;
72 
73  QSize tileSize() const;
74 
75  const GeoSceneAbstractTileProjection *tileProjection() const;
76 
77  int tileColumnCount( int level ) const;
78  int tileRowCount( int level ) const;
79 
80  quint64 volatileCacheLimit() const;
81 
82  int preferredRadiusCeil( int radius ) const;
83  int preferredRadiusFloor( int radius ) const;
84 
85  RenderState renderState() const override;
86 
87  QString runtimeTrace() const override;
88 
89  bool render( GeoPainter *painter, ViewportParams *viewport,
90  const QString &renderPos = QLatin1String("NONE"),
91  GeoSceneLayer *layer = nullptr ) override;
92 
93 public Q_SLOTS:
94  void setShowRelief( bool show );
95 
96  void setShowSunShading( bool show );
97 
98  void setShowCityLights( bool show );
99 
100  void setShowTileId( bool show );
101 
102  /**
103  * @brief Set the Projection used for the map
104  * @param projection projection type (e.g. Spherical, Equirectangular, Mercator)
105  */
106  void setProjection( Projection projection );
107 
108  void setNeedsUpdate();
109 
110  void setMapTheme( const QVector<const GeoSceneTextureTileDataset *> &textures, const GeoSceneGroup *textureLayerSettings, const QString &seaFile, const QString &landFile );
111 
112  void setVolatileCacheLimit( quint64 kilobytes );
113 
114  void reset();
115 
116  void reload();
117 
118  void downloadStackedTile( const TileId &stackedTileId );
119 
120  Q_SIGNALS:
121  void tileLevelChanged( int );
122  void repaintNeeded();
123 
124  private:
125  Q_PRIVATE_SLOT( d, void requestDelayedRepaint() )
126  Q_PRIVATE_SLOT( d, void updateTextureLayers() )
127  Q_PRIVATE_SLOT( d, void updateTile( const TileId &tileId, const QImage &tileImage ) )
128  Q_PRIVATE_SLOT( d, void addGroundOverlays( const QModelIndex& parent, int first, int last ) )
129  Q_PRIVATE_SLOT( d, void removeGroundOverlays( const QModelIndex& parent, int first, int last ) )
130  Q_PRIVATE_SLOT( d, void resetGroundOverlaysCache() )
131 
132  private:
133  class Private;
134  Private *const d;
135 };
136 
137 }
138 
139 #endif
const QList< QKeySequence > & reload()
Binds a QML item to a specific geodetic location in screen coordinates.
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:41
KGuiItem reset()
Q_INVOKABLE void setProjection(uint proj)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.