• 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
GeoDataHotSpot.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 2007 Murad Tagirov <tmurad@gmail.com>
9 // Copyright 2008 Inge Wallin <inge@lysator.liu.se>
10 //
11 
12 
13 #include "GeoDataHotSpot.h"
14 
15 #include <QDataStream>
16 
17 #include "GeoDataTypes.h"
18 
19 namespace Marble
20 {
21 
22 class GeoDataHotSpotPrivate
23 {
24  public:
25  GeoDataHotSpotPrivate()
26  {
27  }
28 
29  GeoDataHotSpotPrivate( const QPointF& hotSpot, GeoDataHotSpot::Units xunits, GeoDataHotSpot::Units yunits )
30  : m_hotSpot( hotSpot ),
31  m_xunits( xunits ),
32  m_yunits( yunits )
33  {
34  }
35 
36  const char* nodeType() const
37  {
38  return GeoDataTypes::GeoDataHotspotType;
39  }
40 
41  QPointF m_hotSpot;
42  GeoDataHotSpot::Units m_xunits;
43  GeoDataHotSpot::Units m_yunits;
44 };
45 
46 GeoDataHotSpot::GeoDataHotSpot( const QPointF& hotSpot, Units xunits, Units yunits )
47  : d( new GeoDataHotSpotPrivate( hotSpot, xunits, yunits ) )
48 {
49 }
50 
51 GeoDataHotSpot::GeoDataHotSpot( const GeoDataHotSpot& other )
52  : GeoDataObject(other), d( new GeoDataHotSpotPrivate( *other.d ) )
53 {
54 }
55 
56 GeoDataHotSpot::~GeoDataHotSpot()
57 {
58  delete d;
59 }
60 
61 GeoDataHotSpot& GeoDataHotSpot::operator=( const GeoDataHotSpot& other )
62 {
63  GeoDataObject::operator=( other );
64 
65  *d = *other.d;
66  return *this;
67 }
68 
69 bool GeoDataHotSpot::operator==( const GeoDataHotSpot& other )
70 {
71  return equals(other) &&
72  d->m_hotSpot == other.d->m_hotSpot &&
73  d->m_xunits == other.d->m_xunits &&
74  d->m_yunits == other.d->m_yunits;
75 }
76 
77 bool GeoDataHotSpot::operator!=( const GeoDataHotSpot& other )
78 {
79  return !this->operator==(other);
80 }
81 
82 const QPointF& GeoDataHotSpot::hotSpot( Units& xunits, Units& yunits ) const
83 {
84  xunits = d->m_xunits;
85  yunits = d->m_yunits;
86 
87  return d->m_hotSpot;
88 }
89 
90 
91 void GeoDataHotSpot::setHotSpot( const QPointF& hotSpot, Units xunits, Units yunits )
92 {
93  d->m_hotSpot = hotSpot;
94  d->m_xunits = xunits;
95  d->m_yunits = yunits;
96 }
97 
98 const char* GeoDataHotSpot::nodeType() const
99 {
100  return d->nodeType();
101 }
102 
103 void GeoDataHotSpot::pack( QDataStream& stream ) const
104 {
105  GeoDataObject::pack( stream );
106 
107  stream << d->m_xunits << d->m_yunits;
108  stream << d->m_hotSpot;
109 }
110 
111 void GeoDataHotSpot::unpack( QDataStream& stream )
112 {
113  GeoDataObject::unpack( stream );
114  int xu, yu;
115  stream >> xu >> yu;
116  d->m_xunits = static_cast<Units>(xu);
117  d->m_yunits = static_cast<Units>(yu);
118  stream >> d->m_hotSpot;
119 }
120 
121 }
Marble::GeoDataHotSpot::~GeoDataHotSpot
~GeoDataHotSpot()
Definition: GeoDataHotSpot.cpp:56
Marble::GeoDataHotSpot::operator==
bool operator==(const GeoDataHotSpot &other)
Definition: GeoDataHotSpot.cpp:69
QDataStream
Marble::GeoDataObject
A base class for all geodata objects.
Definition: GeoDataObject.h:48
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::GeoDataObject::pack
virtual void pack(QDataStream &stream) const
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:114
Marble::GeoDataHotSpot::Units
Units
Definition: GeoDataHotSpot.h:30
Marble::GeoDataHotSpot::hotSpot
const QPointF & hotSpot(Units &xunits, Units &yunits) const
this function returns the hotspot and the units the hotspot is measured in
Definition: GeoDataHotSpot.cpp:82
QPointF
Marble::GeoDataHotSpot::operator!=
bool operator!=(const GeoDataHotSpot &other)
Definition: GeoDataHotSpot.cpp:77
Marble::GeoDataHotSpot
Definition: GeoDataHotSpot.h:27
Marble::GeoDataHotSpot::unpack
virtual void unpack(QDataStream &stream)
Unserialize the contents of the feature from stream.
Definition: GeoDataHotSpot.cpp:111
Marble::GeoDataTypes::GeoDataHotspotType
const char * GeoDataHotspotType
Definition: GeoDataTypes.cpp:45
Marble::GeoDataHotSpot::GeoDataHotSpot
GeoDataHotSpot(const QPointF &hotSpot=QPointF(0.5, 0.5), Units xunits=Fraction, Units yunits=Fraction)
Definition: GeoDataHotSpot.cpp:46
GeoDataHotSpot.h
Marble::GeoDataObject::operator=
GeoDataObject & operator=(const GeoDataObject &)
Definition: GeoDataObject.cpp:54
Marble::GeoDataObject::unpack
virtual void unpack(QDataStream &steam)
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:120
GeoDataTypes.h
Marble::GeoDataHotSpot::operator=
GeoDataHotSpot & operator=(const GeoDataHotSpot &other)
Definition: GeoDataHotSpot.cpp:61
Marble::GeoDataHotSpot::setHotSpot
void setHotSpot(const QPointF &hotSpot=QPointF(0.5, 0.5), Units xunits=Fraction, Units yunits=Fraction)
Definition: GeoDataHotSpot.cpp:91
Marble::GeoDataHotSpot::pack
virtual void pack(QDataStream &stream) const
Serialize the contents of the feature to stream.
Definition: GeoDataHotSpot.cpp:103
Marble::GeoDataHotSpot::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataHotSpot.cpp:98
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