~ubuntu-branches/ubuntu/quantal/marble/quantal

« back to all changes in this revision

Viewing changes to src/lib/Projections/EquirectProjection.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-11 15:43:02 UTC
  • Revision ID: james.westby@ubuntu.com-20110711154302-lq69ftcx125g1jx5
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

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