Marble

EquirectProjection.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
4 // SPDX-FileCopyrightText: 2007-2012 Torsten Rahn <[email protected]>
5 //
6 
7 
8 #ifndef MARBLE_EQUIRECTPROJECTION_H
9 #define MARBLE_EQUIRECTPROJECTION_H
10 
11 
12 /** @file
13  * This file contains the headers for EquirectProjection.
14  *
15  * @author Inge Wallin <[email protected]>
16  * @author Torsten Rahn <[email protected]>
17  */
18 
19 
20 #include "CylindricalProjection.h"
21 
22 
23 namespace Marble
24 {
25 
26 /**
27  * @short A class to implement the Equirectangular projection used by the "Flat Map" view.
28  */
29 
31 {
32  // Not a QObject so far because we don't need to send signals.
33  public:
34 
35  /**
36  * @brief Construct a new EquirectProjection.
37  */
39 
40  ~EquirectProjection() override;
41 
42  /**
43  * @brief Returns the user-visible name of the projection.
44  */
45  QString name() const override;
46 
47  /**
48  * @brief Returns a short user description of the projection
49  * that can be used in tooltips or dialogs.
50  */
51  QString description() const override;
52 
53  /**
54  * @brief Returns an icon for the projection.
55  */
56  QIcon icon() const override;
57 
58  PreservationType preservationType() const override { return NoPreservation; }
59 
60  /**
61  * @brief Get the screen coordinates corresponding to geographical coordinates in the map.
62  * @param coordinates the coordinates of the requested pixel position
63  * @param params the viewport parameters
64  * @param x the x coordinate of the pixel is returned through this parameter
65  * @param y the y coordinate of the pixel is returned through this parameter
66  * @param globeHidesPoint whether the globe hides the point
67  * @return @c true if the geographical coordinates are visible on the screen
68  * @c false if the geographical coordinates are not visible on the screen
69  */
70  bool screenCoordinates( const GeoDataCoordinates &coordinates,
71  const ViewportParams *params,
72  qreal &x, qreal &y, bool &globeHidesPoint ) const override;
73 
74  bool screenCoordinates( const GeoDataCoordinates &coordinates,
75  const ViewportParams *viewport,
76  qreal *x, qreal &y, int &pointRepeatNum,
77  const QSizeF& size,
78  bool &globeHidesPoint ) const override;
79 
80  using CylindricalProjection::screenCoordinates;
81 
82  /**
83  * @brief Get the earth coordinates corresponding to a pixel in the map.
84  *
85  * If the pixel (x, y) is outside the globe, only @p lon will be calculated,
86  * and lat will be unchanged.
87  *
88  * @param x the x coordinate of the pixel
89  * @param y the y coordinate of the pixel
90  * @param params parameters of the viewport
91  * @param lon the longitude angle is returned through this parameter
92  * @param lat the latitude angle is returned through this parameter
93  * @param unit the unit
94  * @return @c true if the pixel (x, y) is within the map
95  * @c false if the pixel (x, y) is above or underneath the map
96  */
97  bool geoCoordinates( const int x, const int y,
98  const ViewportParams *params,
99  qreal& lon, qreal& lat,
100  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const override;
101 
102  GeoDataLatLonAltBox latLonAltBox( const QRect& screenRect,
103  const ViewportParams *viewport ) const override;
104 
105  bool mapCoversViewport( const ViewportParams *viewport ) const override;
106 
107  private:
108  Q_DISABLE_COPY( EquirectProjection )
109 };
110 
111 }
112 
113 #endif
A 3d point representation.
A class that defines a 3D bounding box for geographic data.
bool mapCoversViewport(const ViewportParams *viewport) const override
Returns whether the projected data fully obstructs the current viewport.
bool geoCoordinates(const int x, const int y, const ViewportParams *params, qreal &lon, qreal &lat, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Degree) const override
Get the earth coordinates corresponding to a pixel in the map.
GeoDataLatLonAltBox latLonAltBox(const QRect &screenRect, const ViewportParams *viewport) const override
Returns a GeoDataLatLonAltBox bounding box of the given screenrect inside the given viewport.
QIcon icon() const override
Returns an icon for the projection.
A public class that controls what is visible in the viewport of a Marble map.
A base class for the Equirectangular and Mercator projections in Marble.
Binds a QML item to a specific geodetic location in screen coordinates.
EquirectProjection()
Construct a new EquirectProjection.
Unit
enum used constructor to specify the units used
QString description() const override
Returns a short user description of the projection that can be used in tooltips or dialogs.
bool screenCoordinates(const GeoDataCoordinates &coordinates, const ViewportParams *params, qreal &x, qreal &y, bool &globeHidesPoint) const override
Get the screen coordinates corresponding to geographical coordinates in the map.
A class to implement the Equirectangular projection used by the "Flat Map" view.
QString name() const override
Returns the user-visible name of the projection.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.