Marble

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

KDE's Doxygen guidelines are available online.