• 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
GeoDataExtendedData.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 2010 Harshit Jain <hjain.itbhu@gmail.com>
9 // Copyright 2011 Niko Sams <niko.sams@gmail.com>
10 //
11 
12 #include "GeoDataExtendedData.h"
13 #include "GeoDataExtendedData_p.h"
14 #include <QDataStream>
15 
16 #include "GeoDataTypes.h"
17 
18 namespace Marble
19 {
20 
21 GeoDataExtendedData::GeoDataExtendedData()
22  : GeoDataObject(), d( new GeoDataExtendedDataPrivate )
23 {
24 }
25 
26 GeoDataExtendedData::GeoDataExtendedData( const GeoDataExtendedData& other )
27  : GeoDataObject( other ), d( new GeoDataExtendedDataPrivate( *other.d ) )
28 {
29 }
30 
31 bool GeoDataExtendedData::operator==( const GeoDataExtendedData& other ) const
32 {
33  return equals(other) &&
34  d->hash == other.d->hash &&
35  d->arrayHash == other.d->arrayHash;
36 }
37 
38 GeoDataExtendedData::~GeoDataExtendedData()
39 {
40  qDeleteAll( d->arrayHash );
41  delete d;
42 }
43 
44 GeoDataExtendedData& GeoDataExtendedData::operator=( const GeoDataExtendedData& other )
45 {
46  GeoDataObject::operator=( other );
47  *d = *other.d;
48  return *this;
49 }
50 
51 bool GeoDataExtendedData::operator!=( const GeoDataExtendedData &other ) const
52 {
53  return !this->operator==(other);
54 }
55 
56 const char* GeoDataExtendedData::nodeType() const
57 {
58  return d->nodeType();
59 }
60 
61 GeoDataData& GeoDataExtendedData::valueRef( const QString& key ) const
62 {
63  return d->hash[ key ];
64 }
65 
66 GeoDataData GeoDataExtendedData::value( const QString& key ) const
67 {
68  return d->hash.value( key );
69 }
70 
71 void GeoDataExtendedData::addValue( const GeoDataData& data )
72 {
73  d->hash.insert( data.name(), data );
74 }
75 
76 QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constBegin( ) const
77 {
78  return d->hash.constBegin();
79 }
80 
81 QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constEnd( ) const
82 {
83  return d->hash.constEnd();
84 }
85 
86 int GeoDataExtendedData::size() const
87 {
88  return d->hash.size();
89 }
90 
91 bool GeoDataExtendedData::isEmpty( ) const
92 {
93  return d->hash.empty();
94 }
95 
96 bool GeoDataExtendedData::contains( const QString &key ) const
97 {
98  return d->hash.contains( key );
99 }
100 
101 void GeoDataExtendedData::setSimpleArrayData( const QString& key, GeoDataSimpleArrayData *values )
102 {
103  d->arrayHash[ key ] = values;
104 }
105 
106 GeoDataSimpleArrayData* GeoDataExtendedData::simpleArrayData( const QString& key ) const
107 {
108  if ( !d->arrayHash.contains( key ) ) return 0;
109  return d->arrayHash[ key ];
110 }
111 
112 void GeoDataExtendedData::pack( QDataStream& stream ) const
113 {
114  GeoDataObject::pack( stream );
115 }
116 
117 void GeoDataExtendedData::unpack( QDataStream& stream )
118 {
119  GeoDataObject::unpack( stream );
120 }
121 
122 }
GeoDataExtendedData_p.h
Marble::GeoDataExtendedDataPrivate::arrayHash
QHash< QString, GeoDataSimpleArrayData * > arrayHash
Definition: GeoDataExtendedData_p.h:35
Marble::GeoDataExtendedData::unpack
virtual void unpack(QDataStream &stream)
Unserialize the ExtendedData from a stream.
Definition: GeoDataExtendedData.cpp:117
Marble::GeoDataExtendedDataPrivate::hash
QHash< QString, GeoDataData > hash
Definition: GeoDataExtendedData_p.h:34
QDataStream
Marble::GeoDataExtendedData::pack
virtual void pack(QDataStream &stream) const
Serialize the ExtendedData to a stream.
Definition: GeoDataExtendedData.cpp:112
Marble::GeoDataObject
A base class for all geodata objects.
Definition: GeoDataObject.h:48
Marble::GeoDataExtendedData::valueRef
GeoDataData & valueRef(const QString &key) const
return value of GeoDataExtendedData object associated with the given key as a modifiable reference ...
Definition: GeoDataExtendedData.cpp:61
Marble::GeoDataObject::equals
virtual bool equals(const GeoDataObject &other) const
Compares the value of id and targetId of the two objects.
Definition: GeoDataObject.cpp:126
Marble::GeoDataExtendedData::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataExtendedData.cpp:56
Marble::GeoDataObject::pack
virtual void pack(QDataStream &stream) const
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:114
Marble::GeoDataExtendedData::operator==
bool operator==(const GeoDataExtendedData &other) const
Definition: GeoDataExtendedData.cpp:31
Marble::GeoDataExtendedData::~GeoDataExtendedData
virtual ~GeoDataExtendedData()
Definition: GeoDataExtendedData.cpp:38
GeoDataExtendedData.h
Marble::GeoDataExtendedData::constEnd
QHash< QString, GeoDataData >::const_iterator constEnd() const
return const End iterator for QHash
Definition: GeoDataExtendedData.cpp:81
Marble::GeoDataExtendedData
a class which allows to add custom data to KML Feature.
Definition: GeoDataExtendedData.h:35
Marble::GeoDataExtendedData::isEmpty
bool isEmpty() const
return wthethe QHash is empty or not
Definition: GeoDataExtendedData.cpp:91
Marble::GeoDataSimpleArrayData
Definition: GeoDataSimpleArrayData.h:22
Marble::GeoDataExtendedData::operator!=
bool operator!=(const GeoDataExtendedData &other) const
Definition: GeoDataExtendedData.cpp:51
Marble::GeoDataExtendedDataPrivate
Definition: GeoDataExtendedData_p.h:25
Marble::GeoDataExtendedData::operator=
GeoDataExtendedData & operator=(const GeoDataExtendedData &other)
assignment operator
Definition: GeoDataExtendedData.cpp:44
Marble::GeoDataExtendedData::size
int size() const
return size of QHash
Definition: GeoDataExtendedData.cpp:86
Marble::GeoDataExtendedData::value
GeoDataData value(const QString &key) const
return the value of GeoDataExtendedData associated with the given key
Definition: GeoDataExtendedData.cpp:66
QString
Marble::GeoDataExtendedDataPrivate::nodeType
const char * nodeType() const
Definition: GeoDataExtendedData_p.h:29
Marble::GeoDataExtendedData::GeoDataExtendedData
GeoDataExtendedData()
Definition: GeoDataExtendedData.cpp:21
Marble::GeoDataExtendedData::simpleArrayData
GeoDataSimpleArrayData * simpleArrayData(const QString &key) const
return SimpleArrayData for given key, 0 pointer if none is set
Definition: GeoDataExtendedData.cpp:106
QHash::const_iterator
Marble::GeoDataData
Definition: GeoDataData.h:26
Marble::GeoDataExtendedData::addValue
void addValue(const GeoDataData &data)
add a data object to the GeoDataExtendedData with the key
Definition: GeoDataExtendedData.cpp:71
Marble::GeoDataObject::operator=
GeoDataObject & operator=(const GeoDataObject &)
Definition: GeoDataObject.cpp:54
Marble::GeoDataExtendedData::contains
bool contains(const QString &key) const
Returns true if there exists a value for the given key.
Definition: GeoDataExtendedData.cpp:96
Marble::GeoDataObject::unpack
virtual void unpack(QDataStream &steam)
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:120
Marble::GeoDataExtendedData::setSimpleArrayData
void setSimpleArrayData(const QString &key, GeoDataSimpleArrayData *values)
set SimpleArrayData for given key
Definition: GeoDataExtendedData.cpp:101
Marble::GeoDataData::name
QString name() const
return the name of data
Definition: GeoDataData.cpp:78
GeoDataTypes.h
Marble::GeoDataExtendedData::constBegin
QHash< QString, GeoDataData >::const_iterator constBegin() const
return const Begin iterator for QHash
Definition: GeoDataExtendedData.cpp:76
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