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
8#ifndef MARBLE_MERCATORPROJECTION_H
9#define MARBLE_MERCATORPROJECTION_H
10
11
12/** @file
13 * This file contains the headers for MercatorProjection.
14 *
15 * @author Inge Wallin <inge@lysator.liu.se>
16 * @author Torsten Rahn <rahn@kde.org>
17 */
18
19
21
22namespace Marble
23{
24
25/**
26 * @short A class to implement the Mercator projection.
27 */
28
30{
31 // Not a QObject so far because we don't need to send signals.
32 public:
33
34 /**
35 * @brief Construct a new MercatorProjection.
36 */
38
39 ~MercatorProjection() override;
40
41 /**
42 * @brief Returns the user-visible name of the projection.
43 */
44 QString name() const override;
45
46 /**
47 * @brief Returns a short user description of the projection
48 * that can be used in tooltips or dialogs.
49 */
50 QString description() const override;
51
52 /**
53 * @brief Returns an icon for the projection.
54 */
55 QIcon icon() const override;
56
57 qreal maxValidLat() const override;
58 qreal minValidLat() const override;
59
60 PreservationType preservationType() const override { return Conformal; }
61
62 /**
63 * @brief Get the screen coordinates corresponding to geographical coordinates in the map.
64 * @param coordinates the coordinates of the requested pixel position
65 * @param params the viewport parameters
66 * @param x the x coordinate of the pixel is returned through this parameter
67 * @param y the y coordinate of the pixel is returned through this parameter
68 * @param globeHidesPoint whether the globe hides the point
69 * @return @c true if the geographical coordinates are visible on the screen
70 * @c false if the geographical coordinates are not visible on the screen
71 */
72 bool screenCoordinates( const GeoDataCoordinates &coordinates,
73 const ViewportParams *params,
74 qreal &x, qreal &y, bool &globeHidesPoint ) const override;
75
76 bool screenCoordinates( const GeoDataCoordinates &coordinates,
77 const ViewportParams * viewport,
78 qreal *x, qreal &y, int &pointRepeatNum,
79 const QSizeF& size,
80 bool &globeHidesPoint ) const override;
81
82 using CylindricalProjection::screenCoordinates;
83
84 /**
85 * @brief Get the earth coordinates corresponding to a pixel in the map.
86 *
87 * If the pixel (x, y) is outside the globe, only @p lon will be calculated,
88 * and lat will be unchanged.
89 *
90 * @param x the x coordinate of the pixel
91 * @param y the y coordinate of the pixel
92 * @param params the viewport parameters
93 * @param lon the longitude angle is returned through this parameter
94 * @param lat the latitude angle is returned through this parameter
95 * @param unit the unit
96 * @return @c true if the pixel (x, y) is within the globe
97 * @c false if the pixel (x, y) is outside the globe, i.e. in space.
98 */
99 bool geoCoordinates( const int x, const int y,
100 const ViewportParams *params,
101 qreal& lon, qreal& lat,
102 GeoDataCoordinates::Unit = GeoDataCoordinates::Degree ) const override;
103
104 GeoDataLatLonAltBox latLonAltBox( const QRect &screenRect,
105 const ViewportParams *viewport ) const override;
106
107 bool mapCoversViewport( const ViewportParams *viewport ) const override;
108
109 private:
110 mutable qreal m_lastCenterLat;
111 mutable qreal m_lastCenterLatInv;
112
113 Q_DISABLE_COPY( MercatorProjection )
114};
115
116}
117
118#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 Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.