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

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_AZIMUTHALEQUIDISTANTPROJECTION_H
0008 #define MARBLE_AZIMUTHALEQUIDISTANTPROJECTION_H
0009 
0010 
0011 #include "AbstractProjection.h"
0012 #include "AzimuthalProjection.h"
0013 
0014 namespace Marble
0015 {
0016 
0017 class AzimuthalEquidistantProjectionPrivate;
0018 
0019 /**
0020  * @short A class to implement the spherical projection used by the "Globe" view.
0021  */
0022 
0023 class AzimuthalEquidistantProjection : 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 AzimuthalEquidistantProjection.
0030      */
0031     AzimuthalEquidistantProjection();
0032 
0033     ~AzimuthalEquidistantProjection() 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 
0052     qreal clippingRadius() const override;
0053 
0054     /**
0055      * @brief Get the screen coordinates corresponding to geographical coordinates in the map.
0056      * @param coordinates  the coordinates of the requested pixel position
0057      * @param params the viewport parameters
0058      * @param x      the x coordinate of the pixel is returned through this parameter
0059      * @param y      the y coordinate of the pixel is returned through this parameter
0060      * @param globeHidesPoint whether the globe hides the point
0061      * @return @c true  if the geographical coordinates are visible on the screen
0062      *         @c false if the geographical coordinates are not visible on the screen
0063      */
0064     bool screenCoordinates( const GeoDataCoordinates &coordinates,
0065                             const ViewportParams *params,
0066                             qreal &x, qreal &y, bool &globeHidesPoint ) const override;
0067 
0068     bool screenCoordinates( const GeoDataCoordinates &coordinates,
0069                             const ViewportParams * viewport,
0070                             qreal *x, qreal &y, int &pointRepeatNum,
0071                             const QSizeF& size,
0072                             bool &globeHidesPoint ) const override;
0073 
0074     using AbstractProjection::screenCoordinates;
0075 
0076     /**
0077      * @brief Get the earth coordinates corresponding to a pixel in the map.
0078      * @param x      the x coordinate of the pixel
0079      * @param y      the y coordinate of the pixel
0080      * @param params parameters of the viewport
0081      * @param lon    the longitude angle is returned through this parameter
0082      * @param lat    the latitude angle is returned through this parameter
0083      * @param unit   the unit
0084      * @return @c true  if the pixel (x, y) is within the globe
0085      *         @c false if the pixel (x, y) is outside the globe, i.e. in space.
0086      */
0087     bool geoCoordinates( const int x, const int y,
0088                          const ViewportParams *params,
0089                          qreal& lon, qreal& lat,
0090                          GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const override;
0091 
0092  protected:
0093     explicit AzimuthalEquidistantProjection(AzimuthalEquidistantProjectionPrivate *dd );
0094 
0095  private:
0096     Q_DECLARE_PRIVATE(AzimuthalEquidistantProjection)
0097     Q_DISABLE_COPY( AzimuthalEquidistantProjection )
0098 };
0099 
0100 }
0101 
0102 #endif