File indexing completed on 2024-05-05 03:49:53

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