1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007 Inge Wallin <ingwa@kde.org>
// Copyright 2007-2009 Torsten Rahn <rahn@kde.org>
//
#ifndef MARBLE_EQUIRECTPROJECTION_H
#define MARBLE_EQUIRECTPROJECTION_H
/** @file
* This file contains the headers for EquirectProjection.
*
* @author Inge Wallin <inge@lysator.liu.se>
* @author Torsten Rahn <rahn@kde.org>
*/
#include "AbstractProjection.h"
namespace Marble
{
class EquirectProjectionPrivate;
/**
* @short A class to implement the Equirectangular projection used by the "Flat Map" view.
*/
class EquirectProjection : public AbstractProjection
{
// Not a QObject so far because we don't need to send signals.
public:
/**
* @brief Construct a new EquirectProjection.
*/
EquirectProjection();
virtual ~EquirectProjection();
virtual bool repeatableX() const;
virtual qreal maxValidLat() const;
virtual qreal minValidLat() const;
virtual bool traversablePoles() const { return false; }
virtual bool traversableDateLine() const { return false; }
virtual SurfaceType surfaceType() const { return Cylindrical; }
virtual PreservationType preservationType() const { return NoPreservation; }
/**
* @brief Get the screen coordinates corresponding to geographical coordinates in the map.
* @param lon the lon coordinate of the requested pixel position
* @param lat the lat coordinate of the requested pixel position
* @param x the x coordinate of the pixel is returned through this parameter
* @param y the y coordinate of the pixel is returned through this parameter
* @return @c true if the geographical coordinates are visible on the screen
* @c false if the geographical coordinates are not visible on the screen
*/
bool screenCoordinates( const qreal lon, const qreal lat,
const ViewportParams *params,
qreal& x, qreal& y ) const;
bool screenCoordinates( const GeoDataCoordinates &geopoint,
const ViewportParams *params,
qreal &x, qreal &y, bool &globeHidesPoint ) const;
bool screenCoordinates( const GeoDataCoordinates &coordinates,
const ViewportParams *viewport,
qreal *x, qreal &y, int &pointRepeatNum,
const QSizeF& size,
bool &globeHidesPoint ) const;
/**
* @brief Get the earth coordinates corresponding to a pixel in the map.
* @param x the x coordinate of the pixel
* @param y the y coordinate of the pixel
* @param lon the longitude angle is returned through this parameter
* @param lat the latitude angle is returned through this parameter
* @return @c true if the pixel (x, y) is within the globe
* @c false if the pixel (x, y) is outside the globe, i.e. in space.
*/
bool geoCoordinates( const int x, const int y,
const ViewportParams *params,
qreal& lon, qreal& lat,
GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const;
GeoDataLatLonAltBox latLonAltBox( const QRect& screenRect,
const ViewportParams *viewport ) const;
bool mapCoversViewport( const ViewportParams *viewport ) const;
virtual QPainterPath mapShape( const ViewportParams *viewport ) const;
private:
Q_DISABLE_COPY( EquirectProjection )
EquirectProjectionPrivate * d;
};
}
#endif
|