• 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_p.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 2008 Patrick Spendrin <ps_ml@gmx.de>
9 //
10 
11 #ifndef MARBLE_GEODATACOORDINATES_P_H
12 #define MARBLE_GEODATACOORDINATES_P_H
13 
14 #include "Quaternion.h"
15 #include <QAtomicInt>
16 
17 namespace Marble
18 {
19 
20 class GeoDataCoordinatesPrivate
21 {
22  public:
23  /*
24  * if this ctor is called there exists exactly one GeoDataCoordinates object
25  * with this data.
26  * changes will be made in the GeoDataCoordinates class
27  * ref must be called ref as qAtomicAssign used in GeoDataCoordinates::operator=
28  * needs this name. Maybe we can rename it to our scheme later on.
29  */
30  GeoDataCoordinatesPrivate()
31  : m_lon( 0 ),
32  m_lat( 0 ),
33  m_altitude( 0 ),
34  m_detail( 0 ),
35  ref( 0 )
36  {
37  }
38 
39  /*
40  * if this ctor is called there exists exactly one GeoDataCoordinates object
41  * with this data.
42  * changes will be made in the GeoDataCoordinates class
43  * ref must be called ref as qAtomicAssign used in GeoDataCoordinates::operator=
44  * needs this name. Maybe we can rename it to our scheme later on.
45  */
46  GeoDataCoordinatesPrivate( qreal _lon, qreal _lat, qreal _alt,
47  GeoDataCoordinates::Unit unit,
48  int _detail )
49  : m_altitude( _alt ),
50  m_detail( _detail ),
51  ref( 0 )
52  {
53  switch( unit ){
54  default:
55  case GeoDataCoordinates::Radian:
56  m_q = Quaternion::fromSpherical( _lon, _lat );
57  m_lon = _lon;
58  m_lat = _lat;
59  break;
60  case GeoDataCoordinates::Degree:
61  m_q = Quaternion::fromSpherical( _lon * DEG2RAD , _lat * DEG2RAD );
62  m_lon = _lon * DEG2RAD;
63  m_lat = _lat * DEG2RAD;
64  break;
65  }
66  }
67 
68  /*
69  * this constructor is needed as Quaternion doesn't define a copy ctor
70  * initialize the reference with the value of the other
71  */
72  GeoDataCoordinatesPrivate( const GeoDataCoordinatesPrivate &other )
73  : m_q( Quaternion::fromSpherical( other.m_lon, other.m_lat ) ),
74  m_lon( other.m_lon ),
75  m_lat( other.m_lat ),
76  m_altitude( other.m_altitude ),
77  m_detail( other.m_detail ),
78  ref( 0 )
79  {
80  }
81 
82  /*
83  * return this instead of &other
84  */
85  GeoDataCoordinatesPrivate& operator=( const GeoDataCoordinatesPrivate &other )
86  {
87  m_lon = other.m_lon;
88  m_lat = other.m_lat;
89  m_altitude = other.m_altitude;
90  m_detail = other.m_detail;
91  m_q = other.m_q;
92  ref = 0;
93  return *this;
94  }
95 
96  bool operator==( const GeoDataCoordinatesPrivate &rhs ) const;
97  bool operator!=( const GeoDataCoordinatesPrivate &rhs ) const;
98 
99  static Quaternion basePoint( const Quaternion &q1, const Quaternion &q2, const Quaternion &q3 );
100 
101  Quaternion m_q;
102  qreal m_lon;
103  qreal m_lat;
104  qreal m_altitude; // in meters above sea level
105  int m_detail;
106  QAtomicInt ref;
107 };
108 
109 inline bool GeoDataCoordinatesPrivate::operator==( const GeoDataCoordinatesPrivate &rhs ) const
110 {
111  // do not compare the m_detail member as it does not really belong to
112  // GeoDataCoordinates and should be removed
113  return m_lon == rhs.m_lon && m_lat == rhs.m_lat && m_altitude == rhs.m_altitude;
114 }
115 
116 inline bool GeoDataCoordinatesPrivate::operator!=( const GeoDataCoordinatesPrivate &rhs ) const
117 {
118  // do not compare the m_detail member as it does not really belong to
119  // GeoDataCoordinates and should be removed
120  return ! (*this == rhs);
121 }
122 
123 }
124 
125 #endif
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
Marble::GeoDataCoordinatesPrivate::m_detail
int m_detail
Definition: GeoDataCoordinates_p.h:105
Quaternion.h
Marble::GeoDataCoordinates::Radian
Definition: GeoDataCoordinates.h:65
Marble::GeoDataCoordinatesPrivate
Definition: GeoDataCoordinates_p.h:20
Marble::GeoDataCoordinatesPrivate::GeoDataCoordinatesPrivate
GeoDataCoordinatesPrivate(qreal _lon, qreal _lat, qreal _alt, GeoDataCoordinates::Unit unit, int _detail)
Definition: GeoDataCoordinates_p.h:46
Marble::GeoDataCoordinatesPrivate::m_lon
qreal m_lon
Definition: GeoDataCoordinates_p.h:102
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::GeoDataCoordinatesPrivate::operator=
GeoDataCoordinatesPrivate & operator=(const GeoDataCoordinatesPrivate &other)
Definition: GeoDataCoordinates_p.h:85
Marble::GeoDataCoordinatesPrivate::GeoDataCoordinatesPrivate
GeoDataCoordinatesPrivate(const GeoDataCoordinatesPrivate &other)
Definition: GeoDataCoordinates_p.h:72
Marble::GeoDataCoordinatesPrivate::GeoDataCoordinatesPrivate
GeoDataCoordinatesPrivate()
Definition: GeoDataCoordinates_p.h:30
Marble::GeoDataCoordinatesPrivate::m_altitude
qreal m_altitude
Definition: GeoDataCoordinates_p.h:104
QAtomicInt
Marble::GeoDataCoordinatesPrivate::ref
QAtomicInt ref
Definition: GeoDataCoordinates_p.h:106
Marble::DEG2RAD
const qreal DEG2RAD
Definition: MarbleGlobal.h:219
Marble::GeoDataCoordinatesPrivate::m_q
Quaternion m_q
Definition: GeoDataCoordinates_p.h:101
Marble::Quaternion
Definition: Quaternion.h:41
Marble::GeoDataCoordinatesPrivate::basePoint
static Quaternion basePoint(const Quaternion &q1, const Quaternion &q2, const Quaternion &q3)
Definition: GeoDataCoordinates.cpp:1346
Marble::GeoDataCoordinatesPrivate::operator!=
bool operator!=(const GeoDataCoordinatesPrivate &rhs) const
Definition: GeoDataCoordinates_p.h:116
Marble::GeoDataCoordinatesPrivate::operator==
bool operator==(const GeoDataCoordinatesPrivate &rhs) const
Definition: GeoDataCoordinates_p.h:109
Marble::GeoDataCoordinatesPrivate::m_lat
qreal m_lat
Definition: GeoDataCoordinates_p.h:103
Marble::Quaternion::fromSpherical
static Quaternion fromSpherical(qreal lon, qreal lat)
used to generate Quaternion from longitude and latitude
Definition: Quaternion.cpp:38
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