1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
4 //
5 
6 
7 #ifndef MARBLE_VERTICALPERSPECTIVEPROJECTION_H
8 #define MARBLE_VERTICALPERSPECTIVEPROJECTION_H
9 
10 
11 #include "AbstractProjection.h"
12 #include "AzimuthalProjection.h"
13 
14 namespace Marble
15 {
16 
17 class VerticalPerspectiveProjectionPrivate;
18 
19 /**
20  * @short A class to implement the spherical projection used by the "Globe" view.
21  */
22 
23 class VerticalPerspectiveProjection : public AzimuthalProjection
24 {
25     // Not a QObject so far because we don't need to send signals.
26  public:
27 
28     /**
29      * @brief Construct a new VerticalPerspectiveProjection.
30      */
31     VerticalPerspectiveProjection();
32 
33     ~VerticalPerspectiveProjection() override;
34 
35     /**
36      * @brief Returns the user-visible name of the projection.
37      */
38     QString name() const override;
39 
40     /**
41      * @brief Returns a short user description of the projection
42      * that can be used in tooltips or dialogs.
43      */
44     QString description() const override;
45 
46     /**
47      * @brief Returns an icon for the projection.
48      */
49     QIcon icon() const override;
50 
51     qreal clippingRadius() const override;
52 
53     /**
54      * @brief Get the screen coordinates corresponding to geographical coordinates in the map.
55      * @param coordinates  the coordinates of the requested pixel position
56      * @param params the viewport parameters
57      * @param x      the x coordinate of the pixel is returned through this parameter
58      * @param y      the y coordinate of the pixel is returned through this parameter
59      * @param globeHidesPoint whether the globe hides the point
60      * @return @c true  if the geographical coordinates are visible on the screen
61      *         @c false if the geographical coordinates are not visible on the screen
62      */
63     bool screenCoordinates( const GeoDataCoordinates &coordinates,
64                             const ViewportParams *params,
65                             qreal &x, qreal &y, bool &globeHidesPoint ) const override;
66 
67     bool screenCoordinates( const GeoDataCoordinates &coordinates,
68                             const ViewportParams * viewport,
69                             qreal *x, qreal &y, int &pointRepeatNum,
70                             const QSizeF& size,
71                             bool &globeHidesPoint ) const override;
72 
73     using AbstractProjection::screenCoordinates;
74 
75     /**
76      * @brief Get the earth coordinates corresponding to a pixel in the map.
77      * @param x      the x coordinate of the pixel
78      * @param y      the y coordinate of the pixel
79      * @param params the viewport parameters
80      * @param lon    the longitude angle is returned through this parameter
81      * @param lat    the latitude angle is returned through this parameter
82      * @param unit   the unit
83      * @return @c true  if the pixel (x, y) is within the globe
84      *         @c false if the pixel (x, y) is outside the globe, i.e. in space.
85      */
86     bool geoCoordinates( const int x, const int y,
87                          const ViewportParams *params,
88                          qreal& lon, qreal& lat,
89                          GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const override;
90 
91  protected:
92     explicit VerticalPerspectiveProjection(VerticalPerspectiveProjectionPrivate *dd );
93 
94  private:
95     Q_DECLARE_PRIVATE(VerticalPerspectiveProjection)
96     Q_DISABLE_COPY( VerticalPerspectiveProjection )
97 };
98 
99 }
100 
101 #endif
102