• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataCoordinates.h
Go to the documentation of this file.
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 2006-2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007-2008 Inge Wallin <ingwa@kde.org>
10 // Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
11 //
12 
13 
14 #ifndef MARBLE_GEODATACOORDINATES_H
15 #define MARBLE_GEODATACOORDINATES_H
16 
17 #include <QCoreApplication>
18 #include <QMetaType>
19 #include <QVector>
20 #include <QString>
21 
22 #include <cmath>
23 
24 /* M_PI is a #define that may or may not be handled in <cmath> */
25 #ifndef M_PI
26 #define M_PI 3.14159265358979323846264338327950288419717
27 #endif
28 
29 #include "geodata_export.h"
30 #include "MarbleGlobal.h"
31 
32 namespace Marble
33 {
34 
35 const qreal TWOPI = 2 * M_PI;
36 
37 class GeoDataCoordinatesPrivate;
38 class Quaternion;
39 
52 class GEODATA_EXPORT GeoDataCoordinates
53 {
54  Q_DECLARE_TR_FUNCTIONS(GeoDataCoordinates)
55 
56  public:
64  enum Unit{
65  Radian,
66  Degree
67  };
68 
79  enum Notation{
80  Decimal,
81  DMS,
82  DM,
83  UTM,
84  Astro
85  };
86 
96  enum BearingType {
97  InitialBearing,
98  FinalBearing
99  };
100 
101  // Type definitions
102  typedef QVector<GeoDataCoordinates> Vector;
103  typedef QVector<GeoDataCoordinates*> PtrVector;
104 
105  GeoDataCoordinates( const GeoDataCoordinates& other );
106 
113  GeoDataCoordinates();
114 
124  GeoDataCoordinates( qreal lon, qreal lat, qreal alt = 0,
125  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian,
126  int detail = 0 );
127 
128  virtual ~GeoDataCoordinates();
129 
137  bool isValid() const;
138 
147  void set( qreal lon, qreal lat, qreal alt = 0,
148  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
149 
158  void geoCoordinates( qreal& lon, qreal& lat,
159  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
160  const;
161 
171  void geoCoordinates( qreal& lon, qreal& lat, qreal& alt,
172  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
173  const;
174 
181  void setLongitude( qreal lon,
182  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
183 
191  qreal longitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
192  const;
193 
201  qreal latitude( GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian )
202  const;
203 
210  void setLatitude( qreal lat,
211  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Radian );
212 
216  qreal altitude() const;
221  void setAltitude( const qreal altitude );
222 
227  int detail() const;
228 
233  void setDetail( const int det );
234 
243  qreal bearing( const GeoDataCoordinates &other, Unit unit = Radian, BearingType type = InitialBearing ) const;
244 
251  GeoDataCoordinates moveByBearing( qreal bearing, qreal distance ) const;
252 
256  const Quaternion &quaternion() const;
257 
264  GeoDataCoordinates interpolate( const GeoDataCoordinates &target, double t ) const;
265 
273  GeoDataCoordinates interpolate( const GeoDataCoordinates &before, const GeoDataCoordinates &target, const GeoDataCoordinates &after, double t ) const;
274 
280  bool isPole( Pole = AnyPole ) const;
281 
285  static GeoDataCoordinates::Notation defaultNotation();
286 
291  static void setDefaultNotation( GeoDataCoordinates::Notation notation );
292 
297  static qreal normalizeLon( qreal lon,
298  GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
299 
304  static qreal normalizeLat( qreal lat,
305  GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
306 
320  static void normalizeLonLat( qreal &lon, qreal &lat,
321  GeoDataCoordinates::Unit = GeoDataCoordinates::Radian );
322 
328  static GeoDataCoordinates fromString( const QString &string, bool& successful );
329 
334  QString toString() const;
335 
348  QString toString( GeoDataCoordinates::Notation notation, int precision = -1 ) const;
349 
350  static QString lonToString( qreal lon, GeoDataCoordinates::Notation notation,
351  GeoDataCoordinates::Unit unit = Radian,
352  int precision = -1,
353  char format = 'f' );
358  QString lonToString() const;
359 
360  static QString latToString( qreal lat, GeoDataCoordinates::Notation notation,
361  GeoDataCoordinates::Unit unit = Radian,
362  int precision = -1,
363  char format = 'f' );
368  QString latToString() const;
369 
370  virtual bool operator==( const GeoDataCoordinates& ) const;
371  virtual bool operator !=( const GeoDataCoordinates& ) const;
372  GeoDataCoordinates& operator=( const GeoDataCoordinates &other );
373 
375  virtual void pack( QDataStream& stream ) const;
377  virtual void unpack( QDataStream& stream );
378 
379  virtual void detach();
380  protected:
381  GeoDataCoordinatesPrivate* d;
382 
383  private:
384  static GeoDataCoordinates::Notation s_notation;
385  static const GeoDataCoordinates null;
386 };
387 
388 }
389 
390 Q_DECLARE_METATYPE( Marble::GeoDataCoordinates )
391 
392 #endif
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
Marble::GeoDataCoordinates::Vector
QVector< GeoDataCoordinates > Vector
Definition: GeoDataCoordinates.h:102
interpolate
void interpolate(MarbleWidget *widget, qreal value)
Definition: examples/cpp/animation-video/main.cpp:68
Marble::AnyPole
Any pole.
Definition: MarbleGlobal.h:156
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::GeoDataCoordinates::UTM
Definition: GeoDataCoordinates.h:83
Marble::GeoDataCoordinates::Radian
Definition: GeoDataCoordinates.h:65
Marble::GeoDataCoordinates::d
GeoDataCoordinatesPrivate * d
Definition: GeoDataCoordinates.h:381
Marble::GeoDataCoordinatesPrivate
Definition: GeoDataCoordinates_p.h:20
QDataStream
Marble::GeoDataCoordinates::Decimal
"Decimal" notation (base-10)
Definition: GeoDataCoordinates.h:80
Marble::operator==
bool operator==(const DownloadPolicyKey &lhs, const DownloadPolicyKey &rhs)
Definition: DownloadPolicy.h:49
Marble::GeoDataCoordinates::InitialBearing
Definition: GeoDataCoordinates.h:97
Marble::GeoDataCoordinates::BearingType
BearingType
The BearingType enum specifies where to measure the bearing along great circle arcs.
Definition: GeoDataCoordinates.h:96
Marble::operator!=
bool operator!=(GeoDataLatLonBox const &lhs, GeoDataLatLonBox const &rhs)
Definition: GeoDataLatLonBox.cpp:59
QString
MarbleGlobal.h
Marble::TWOPI
const qreal TWOPI
Definition: GeoDataCoordinates.h:35
Marble::GeoDataCoordinates::Notation
Notation
enum used to specify the notation / numerical system
Definition: GeoDataCoordinates.h:79
QVector
Marble::GeoDataCoordinates::PtrVector
QVector< GeoDataCoordinates * > PtrVector
Definition: GeoDataCoordinates.h:103
Marble::Quaternion
Definition: Quaternion.h:41
M_PI
#define M_PI
Definition: GeoDataCoordinates.h:26
GEODATA_EXPORT
#define GEODATA_EXPORT
Definition: geodata_export.h:22
geodata_export.h
Marble::Pole
Pole
Definition: MarbleGlobal.h:155
Marble::GeoDataCoordinates::DMS
"Sexagesimal DMS" notation (base-60)
Definition: GeoDataCoordinates.h:81
Marble::GeoDataCoordinates::DM
"Sexagesimal DM" notation (base-60)
Definition: GeoDataCoordinates.h:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal