File indexing completed on 2025-01-05 03:59:10
0001 /* 0002 SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef MARBLE_GEOSCENEABSTRACTTILEPROJECTION_H 0008 #define MARBLE_GEOSCENEABSTRACTTILEPROJECTION_H 0009 0010 #include "digikam_export.h" 0011 0012 #include <QRect> 0013 #include <QScopedPointer> 0014 0015 namespace Marble 0016 { 0017 0018 class GeoSceneAbstractTileProjectionPrivate; 0019 0020 class GeoDataLatLonBox; 0021 class TileId; 0022 0023 /** 0024 * @short A base class for projections between tile indizes and geo coordinates in Marble. 0025 * 0026 * For map tiling with indizes in x and y dimensions and 1 or multiple zoomlevels. 0027 * The lowest zoomlevel is 0. 0028 */ 0029 class DIGIKAM_EXPORT GeoSceneAbstractTileProjection 0030 { 0031 public: 0032 enum Type { Equirectangular, Mercator }; 0033 0034 /** 0035 * @brief Construct a new GeoSceneAbstractTileProjection. 0036 */ 0037 GeoSceneAbstractTileProjection(); 0038 0039 virtual ~GeoSceneAbstractTileProjection(); 0040 0041 public: 0042 virtual GeoSceneAbstractTileProjection::Type type() const = 0; 0043 0044 /** 0045 * @return the number of tiles on level 0 in x dimension 0046 */ 0047 int levelZeroColumns() const; 0048 /** 0049 * @brief Sets the number of tiles on level 0 in x dimension 0050 * 0051 * @param levelZeroColumns new number of tiles on level 0 in x dimension 0052 * 0053 * Default value of the levelZeroColumns property is 1. 0054 */ 0055 void setLevelZeroColumns(int levelZeroColumns); 0056 0057 /** 0058 * @return the number of tiles on level 0 in y dimension 0059 */ 0060 int levelZeroRows() const; 0061 /** 0062 * @brief Sets the number of tiles on level 0 in y dimension 0063 * 0064 * @param levelZeroRows new number of tiles on level 0 in y dimension 0065 * 0066 * Default value of the levelZeroRows property is 1. 0067 */ 0068 void setLevelZeroRows(int levelZeroRows); 0069 0070 /** 0071 * @brief Get the tile indexes which cover the given geographical box. 0072 * If @p latLonBox or @p zoomLevel have values out-of-bounds, the behaviour is undefined. 0073 * 0074 * @param latLonBox the geo coordinates of the requested tiles 0075 * @param zoomLevel the zoomlevel of the requested tiles 0076 * 0077 * @return range of tile indexes covering given geographical box at given zoom level 0078 */ 0079 virtual QRect tileIndexes(const GeoDataLatLonBox &latLonBox, int zoomLevel) const = 0; 0080 0081 /** 0082 * @brief Get the boundary geo coordinates corresponding to a tile. 0083 * If @p x, @p y or @p zoomLevel have values out-of-bounds, the behaviour is undefined. 0084 * 0085 * @param zoomLevel the zoomlevel of the tile 0086 * @param x the x index of the tile 0087 * @param y the y index of the tile 0088 * 0089 * @return geographic bounding box covered by the given tile 0090 */ 0091 virtual GeoDataLatLonBox geoCoordinates(int zoomLevel, int x, int y) const = 0; 0092 0093 /** 0094 * @brief Get the boundary geo coordinates corresponding to a tile. 0095 * If @p tildId has values out-of-bounds, the behaviour is undefined. 0096 * 0097 * @param tileId the id of the tile 0098 * 0099 * @return geographic bounding box covered by the given tile 0100 */ 0101 GeoDataLatLonBox geoCoordinates(const TileId &tileId) const; 0102 0103 private: 0104 Q_DISABLE_COPY(GeoSceneAbstractTileProjection) 0105 const QScopedPointer<GeoSceneAbstractTileProjectionPrivate> d_ptr; 0106 }; 0107 0108 } 0109 0110 #endif