Marble

GeoDataBalloonStyle.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Mohammed Nafees <[email protected]>
4 //
5 
6 #include "GeoDataBalloonStyle.h"
7 #include "GeoDataTypes.h"
8 
9 #include <QDataStream>
10 
11 namespace Marble
12 {
13 
14 class GeoDataBalloonStylePrivate
15 {
16 public:
17  GeoDataBalloonStylePrivate();
18 
19  QColor m_bgColor;
20  QColor m_textColor;
21  QString m_text;
22  GeoDataBalloonStyle::DisplayMode m_mode;
23 };
24 
25 GeoDataBalloonStylePrivate::GeoDataBalloonStylePrivate() :
26  m_bgColor( Qt::white ),
27  m_textColor( Qt::black ),
28  m_mode( GeoDataBalloonStyle::Default )
29 {
30 }
31 
32 GeoDataBalloonStyle::GeoDataBalloonStyle() :
33  d( new GeoDataBalloonStylePrivate )
34 {
35 }
36 
37 GeoDataBalloonStyle::GeoDataBalloonStyle( const Marble::GeoDataBalloonStyle &other ) :
38  GeoDataColorStyle( other ), d( new GeoDataBalloonStylePrivate( *other.d ) )
39 {
40 }
41 
42 GeoDataBalloonStyle &GeoDataBalloonStyle::operator=( const GeoDataBalloonStyle &other )
43 {
45  *d = *other.d;
46  return *this;
47 }
48 
49 bool GeoDataBalloonStyle::operator==( const GeoDataBalloonStyle &other ) const
50 {
51  return equals(other) &&
52  d->m_bgColor == other.d->m_bgColor &&
53  d->m_mode == other.d->m_mode &&
54  d->m_text == other.d->m_text &&
55  d->m_textColor == other.d->m_textColor;
56 }
57 
58 bool GeoDataBalloonStyle::operator!=( const GeoDataBalloonStyle &other ) const
59 {
60  return !this->operator==(other);
61 }
62 
63 GeoDataBalloonStyle::~GeoDataBalloonStyle()
64 {
65  delete d;
66 }
67 
68 const char *GeoDataBalloonStyle::nodeType() const
69 {
70  return GeoDataTypes::GeoDataBalloonStyleType;
71 }
72 
73 QColor GeoDataBalloonStyle::backgroundColor() const
74 {
75  return d->m_bgColor;
76 }
77 
78 void GeoDataBalloonStyle::setBackgroundColor( const QColor &color )
79 {
80  d->m_bgColor = color;
81 }
82 
83 QColor GeoDataBalloonStyle::textColor() const
84 {
85  return d->m_textColor;
86 }
87 
88 void GeoDataBalloonStyle::setTextColor( const QColor &color )
89 {
90  d->m_textColor = color;
91 }
92 
93 QString GeoDataBalloonStyle::text() const
94 {
95  return d->m_text;
96 }
97 
98 void GeoDataBalloonStyle::setText( const QString &text )
99 {
100  d->m_text = text;
101 }
102 
103 GeoDataBalloonStyle::DisplayMode GeoDataBalloonStyle::displayMode() const
104 {
105  return d->m_mode;
106 }
107 
108 void GeoDataBalloonStyle::setDisplayMode(DisplayMode mode)
109 {
110  d->m_mode = mode;
111 }
112 
113 void GeoDataBalloonStyle::pack( QDataStream& stream ) const
114 {
115  GeoDataColorStyle::pack( stream );
116 
117  stream << d->m_bgColor.name();
118  stream << d->m_textColor.name();
119  stream << d->m_text;
120 }
121 
122 void GeoDataBalloonStyle::unpack( QDataStream& stream )
123 {
124  GeoDataColorStyle::unpack( stream );
125 
126  stream >> d->m_bgColor;
127  stream >> d->m_textColor;
128  stream >> d->m_text;
129 }
130 
131 }
void pack(QDataStream &stream) const override
Serialize the style to a stream.
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Binds a QML item to a specific geodetic location in screen coordinates.
GeoDataColorStyle & operator=(const GeoDataColorStyle &other)
assignment operator
void unpack(QDataStream &stream) override
Unserialize the style from a stream.
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.