Marble

GeoDataHotSpot.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007 Murad Tagirov <[email protected]>
4 // SPDX-FileCopyrightText: 2008 Inge Wallin <[email protected]>
5 //
6 
7 
8 #include "GeoDataHotSpot.h"
9 
10 #include <QDataStream>
11 
12 #include "GeoDataTypes.h"
13 
14 namespace Marble
15 {
16 
17 class GeoDataHotSpotPrivate
18 {
19  public:
20  GeoDataHotSpotPrivate()
21  {
22  }
23 
24  GeoDataHotSpotPrivate( const QPointF& hotSpot, GeoDataHotSpot::Units xunits, GeoDataHotSpot::Units yunits )
25  : m_hotSpot( hotSpot ),
26  m_xunits( xunits ),
27  m_yunits( yunits )
28  {
29  }
30 
31  QPointF m_hotSpot;
32  GeoDataHotSpot::Units m_xunits;
33  GeoDataHotSpot::Units m_yunits;
34 };
35 
36 GeoDataHotSpot::GeoDataHotSpot( const QPointF& hotSpot, Units xunits, Units yunits )
37  : d( new GeoDataHotSpotPrivate( hotSpot, xunits, yunits ) )
38 {
39 }
40 
41 GeoDataHotSpot::GeoDataHotSpot( const GeoDataHotSpot& other )
42  : GeoDataObject(other), d( new GeoDataHotSpotPrivate( *other.d ) )
43 {
44 }
45 
46 GeoDataHotSpot::~GeoDataHotSpot()
47 {
48  delete d;
49 }
50 
51 GeoDataHotSpot& GeoDataHotSpot::operator=( const GeoDataHotSpot& other )
52 {
53  GeoDataObject::operator=( other );
54 
55  *d = *other.d;
56  return *this;
57 }
58 
59 bool GeoDataHotSpot::operator==( const GeoDataHotSpot& other ) const
60 {
61  return equals(other) &&
62  d->m_hotSpot == other.d->m_hotSpot &&
63  d->m_xunits == other.d->m_xunits &&
64  d->m_yunits == other.d->m_yunits;
65 }
66 
67 bool GeoDataHotSpot::operator!=( const GeoDataHotSpot& other ) const
68 {
69  return !this->operator==(other);
70 }
71 
72 const QPointF& GeoDataHotSpot::hotSpot( Units& xunits, Units& yunits ) const
73 {
74  xunits = d->m_xunits;
75  yunits = d->m_yunits;
76 
77  return d->m_hotSpot;
78 }
79 
80 
81 void GeoDataHotSpot::setHotSpot( const QPointF& hotSpot, Units xunits, Units yunits )
82 {
83  d->m_hotSpot = hotSpot;
84  d->m_xunits = xunits;
85  d->m_yunits = yunits;
86 }
87 
88 const char* GeoDataHotSpot::nodeType() const
89 {
90  return GeoDataTypes::GeoDataHotspotType;
91 }
92 
93 void GeoDataHotSpot::pack( QDataStream& stream ) const
94 {
95  GeoDataObject::pack( stream );
96 
97  stream << d->m_xunits << d->m_yunits;
98  stream << d->m_hotSpot;
99 }
100 
101 void GeoDataHotSpot::unpack( QDataStream& stream )
102 {
103  GeoDataObject::unpack( stream );
104  int xu, yu;
105  stream >> xu >> yu;
106  d->m_xunits = static_cast<Units>(xu);
107  d->m_yunits = static_cast<Units>(yu);
108  stream >> d->m_hotSpot;
109 }
110 
111 }
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
void pack(QDataStream &stream) const override
Reimplemented from Serializable.
Binds a QML item to a specific geodetic location in screen coordinates.
void unpack(QDataStream &steam) override
Reimplemented from Serializable.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.