Marble

GeoDataHotSpot.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Murad Tagirov <tmurad@gmail.com>
4// SPDX-FileCopyrightText: 2008 Inge Wallin <inge@lysator.liu.se>
5//
6
7
8#include "GeoDataHotSpot.h"
9
10#include <QDataStream>
11
12#include "GeoDataTypes.h"
13
14namespace Marble
15{
16
17class 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
36GeoDataHotSpot::GeoDataHotSpot( const QPointF& hotSpot, Units xunits, Units yunits )
37 : d( new GeoDataHotSpotPrivate( hotSpot, xunits, yunits ) )
38{
39}
40
41GeoDataHotSpot::GeoDataHotSpot( const GeoDataHotSpot& other )
42 : GeoDataObject(other), d( new GeoDataHotSpotPrivate( *other.d ) )
43{
44}
45
46GeoDataHotSpot::~GeoDataHotSpot()
47{
48 delete d;
49}
50
51GeoDataHotSpot& GeoDataHotSpot::operator=( const GeoDataHotSpot& other )
52{
53 GeoDataObject::operator=( other );
54
55 *d = *other.d;
56 return *this;
57}
58
59bool 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
67bool GeoDataHotSpot::operator!=( const GeoDataHotSpot& other ) const
68{
69 return !this->operator==(other);
70}
71
72const 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
81void 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
88const char* GeoDataHotSpot::nodeType() const
89{
90 return GeoDataTypes::GeoDataHotspotType;
91}
92
93void 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
101void 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 equals(const QVariant &lhs, const QVariant &rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.