File indexing completed on 2025-01-05 03:59:33
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org> 0004 // SPDX-FileCopyrightText: 2007-2012 Torsten Rahn <rahn@kde.org> 0005 // 0006 0007 0008 #ifndef MARBLE_SPHERICALPROJECTION_H 0009 #define MARBLE_SPHERICALPROJECTION_H 0010 0011 0012 /** @file 0013 * This file contains the headers for SphericalProjection. 0014 * 0015 * @author Inge Wallin <inge@lysator.liu.se> 0016 * @author Torsten Rahn <rahn@kde.org> 0017 */ 0018 0019 0020 #include "AbstractProjection.h" 0021 #include "AzimuthalProjection.h" 0022 0023 namespace Marble 0024 { 0025 0026 class SphericalProjectionPrivate; 0027 0028 /** 0029 * @short A class to implement the spherical projection used by the "Globe" view. 0030 */ 0031 0032 class SphericalProjection : public AzimuthalProjection 0033 { 0034 // Not a QObject so far because we don't need to send signals. 0035 public: 0036 0037 /** 0038 * @brief Construct a new SphericalProjection. 0039 */ 0040 SphericalProjection(); 0041 0042 ~SphericalProjection() override; 0043 0044 /** 0045 * @brief Returns the user-visible name of the projection. 0046 */ 0047 QString name() const override; 0048 0049 /** 0050 * @brief Returns a short user description of the projection 0051 * that can be used in tooltips or dialogs. 0052 */ 0053 QString description() const override; 0054 0055 /** 0056 * @brief Returns an icon for the projection. 0057 */ 0058 QIcon icon() const override; 0059 0060 /** 0061 * @brief Get the screen coordinates corresponding to geographical coordinates in the map. 0062 * @param coordinates the coordinates of the requested pixel position 0063 * @param params the viewport parameters 0064 * @param x the x coordinate of the pixel is returned through this parameter 0065 * @param y the y coordinate of the pixel is returned through this parameter 0066 * @param globeHidesPoint whether the globe hides the point 0067 * @return @c true if the geographical coordinates are visible on the screen 0068 * @c false if the geographical coordinates are not visible on the screen 0069 */ 0070 bool screenCoordinates( const GeoDataCoordinates &coordinates, 0071 const ViewportParams *params, 0072 qreal &x, qreal &y, bool &globeHidesPoint ) const override; 0073 0074 bool screenCoordinates( const GeoDataCoordinates &coordinates, 0075 const ViewportParams * viewport, 0076 qreal *x, qreal &y, int &pointRepeatNum, 0077 const QSizeF& size, 0078 bool &globeHidesPoint ) const override; 0079 0080 using AbstractProjection::screenCoordinates; 0081 0082 /** 0083 * @brief Get the earth coordinates corresponding to a pixel in the map. 0084 * @param x the x coordinate of the pixel 0085 * @param y the y coordinate of the pixel 0086 * @param params parameters of the viewport 0087 * @param lon the longitude angle is returned through this parameter 0088 * @param lat the latitude angle is returned through this parameter 0089 * @param unit the unit 0090 * @return @c true if the pixel (x, y) is within the globe 0091 * @c false if the pixel (x, y) is outside the globe, i.e. in space. 0092 */ 0093 bool geoCoordinates( const int x, const int y, 0094 const ViewportParams *params, 0095 qreal& lon, qreal& lat, 0096 GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const override; 0097 0098 protected: 0099 explicit SphericalProjection(SphericalProjectionPrivate *dd ); 0100 0101 private: 0102 Q_DECLARE_PRIVATE(SphericalProjection) 0103 Q_DISABLE_COPY( SphericalProjection ) 0104 }; 0105 0106 } 0107 0108 #endif