• 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
GeoDataPoint.cpp
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 2004-2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 // Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
11 //
12 
13 
14 #include "GeoDataPoint.h"
15 #include "GeoDataPoint_p.h"
16 #include "GeoDataCoordinates.h"
17 
18 #include <cmath>
19 
20 #include <QCoreApplication>
21 
22 #include "MarbleDebug.h"
23 #include "MarbleGlobal.h"
24 
25 #include "GeoDataTypes.h"
26 #include "GeoDataLatLonAltBox.h"
27 
28 
29 namespace Marble
30 {
31 
32 GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt,
33  GeoDataCoordinates::Unit unit )
34  : GeoDataGeometry( new GeoDataPointPrivate )
35 {
36  p()->m_coordinates = GeoDataCoordinates( lon, lat, alt, unit );
37  p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
38 }
39 
40 GeoDataPoint::GeoDataPoint( const GeoDataPoint& other )
41  : GeoDataGeometry( other )
42 
43 {
44  p()->m_coordinates = other.p()->m_coordinates;
45  p()->m_latLonAltBox = other.p()->m_latLonAltBox;
46 }
47 
48 GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other )
49  : GeoDataGeometry ( new GeoDataPointPrivate )
50 {
51  p()->m_coordinates = other;
52  p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
53 }
54 
55 GeoDataPoint::GeoDataPoint()
56  : GeoDataGeometry( new GeoDataPointPrivate )
57 {
58 }
59 
60 GeoDataPoint::~GeoDataPoint()
61 {
62 }
63 
64 bool GeoDataPoint::operator==( const GeoDataPoint &other ) const
65 {
66  return equals(other) &&
67  coordinates() == other.coordinates();
68 }
69 
70 bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const
71 {
72  return !this->operator==(other);
73 }
74 
75 void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates )
76 {
77  p()->m_coordinates = coordinates;
78  p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
79 }
80 
81 const GeoDataCoordinates &GeoDataPoint::coordinates() const
82 {
83  return p()->m_coordinates;
84 }
85 
86 GeoDataPointPrivate* GeoDataPoint::p()
87 {
88  return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d);
89 }
90 
91 const GeoDataPointPrivate* GeoDataPoint::p() const
92 {
93  return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d);
94 }
95 
96 const char* GeoDataPoint::nodeType() const
97 {
98  return GeoDataTypes::GeoDataPointType;
99 }
100 
101 void GeoDataPoint::detach()
102 {
103  GeoDataGeometry::detach();
104 }
105 
106 void GeoDataPoint::pack( QDataStream& stream ) const
107 {
108  p()->m_coordinates.pack( stream );
109 }
110 
111 void GeoDataPoint::unpack( QDataStream& stream )
112 {
113  p()->m_coordinates.unpack( stream );
114 }
115 
116 }
Marble::GeoDataPointPrivate::m_coordinates
GeoDataCoordinates m_coordinates
Definition: GeoDataPoint_p.h:23
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
Marble::GeoDataPoint
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:47
GeoDataCoordinates.h
Marble::GeoDataCoordinates::unpack
virtual void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition: GeoDataCoordinates.cpp:1335
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::GeoDataTypes::GeoDataPointType
const char * GeoDataPointType
Definition: GeoDataTypes.cpp:68
QDataStream
Marble::GeoDataGeometry
A base class for all geodata features.
Definition: GeoDataGeometry.h:47
Marble::GeoDataGeometry::detach
void detach()
Definition: GeoDataGeometry.cpp:54
Marble::GeoDataPoint::operator!=
bool operator!=(const GeoDataPoint &other) const
Definition: GeoDataPoint.cpp:70
MarbleDebug.h
Marble::GeoDataPoint::operator==
bool operator==(const GeoDataPoint &other) const
Definition: GeoDataPoint.cpp:64
Marble::GeoDataPoint::pack
virtual void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition: GeoDataPoint.cpp:106
Marble::GeoDataPoint::unpack
virtual void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition: GeoDataPoint.cpp:111
Marble::GeoDataPointPrivate
Definition: GeoDataPoint_p.h:20
GeoDataPoint_p.h
MarbleGlobal.h
Marble::GeoDataPoint::~GeoDataPoint
~GeoDataPoint()
Definition: GeoDataPoint.cpp:60
GeoDataPoint.h
Marble::GeoDataPoint::GeoDataPoint
GeoDataPoint()
Definition: GeoDataPoint.cpp:55
GeoDataLatLonAltBox.h
Marble::GeoDataPoint::detach
virtual void detach()
Definition: GeoDataPoint.cpp:101
Marble::GeoDataPoint::coordinates
const GeoDataCoordinates & coordinates() const
Definition: GeoDataPoint.cpp:81
Marble::GeoDataGeometryPrivate::m_latLonAltBox
GeoDataLatLonAltBox m_latLonAltBox
Definition: GeoDataGeometry_p.h:74
GeoDataTypes.h
Marble::GeoDataGeometry::equals
bool equals(const GeoDataGeometry &other) const
Definition: GeoDataGeometry.cpp:146
Marble::GeoDataPoint::setCoordinates
void setCoordinates(const GeoDataCoordinates &coordinates)
Definition: GeoDataPoint.cpp:75
Marble::GeoDataLatLonAltBox
A class that defines a 3D bounding box for geographic data.
Definition: GeoDataLatLonAltBox.h:49
Marble::GeoDataCoordinates::pack
virtual void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition: GeoDataCoordinates.cpp:1328
Marble::GeoDataPoint::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataPoint.cpp:96
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