Marble

GeoDataStyle.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Murad Tagirov <tmurad@gmail.com>
4//
5
6
7#include "GeoDataStyle.h"
8
9#include "GeoDataTypes.h"
10#include "GeoDataBalloonStyle.h"
11#include "GeoDataIconStyle.h"
12#include "GeoDataLabelStyle.h"
13#include "GeoDataLineStyle.h"
14#include "GeoDataListStyle.h"
15#include "GeoDataPolyStyle.h"
16
17namespace Marble
18{
19
20class GeoDataStylePrivate
21{
22 public:
23 GeoDataStylePrivate()
24 {
25 }
26
27 GeoDataStylePrivate(const QString& iconPath,
28 const QFont &font, const QColor &color )
29 : m_iconStyle( iconPath ),
30 m_labelStyle( font, color ),
31 m_lineStyle( color ),
32 m_polyStyle( color ),
33 m_balloonStyle()
34 {
35 }
36
37 GeoDataIconStyle m_iconStyle;
38 GeoDataLabelStyle m_labelStyle;
39 GeoDataLineStyle m_lineStyle;
40 GeoDataPolyStyle m_polyStyle;
41 GeoDataBalloonStyle m_balloonStyle;
42 GeoDataListStyle m_listStyle;
43};
44
46 : d( new GeoDataStylePrivate )
47{
48}
49
51 : GeoDataStyleSelector( other ), d( new GeoDataStylePrivate( *other.d ) )
52{
53}
54
56 const QFont &font, const QColor &color )
57 : d( new GeoDataStylePrivate( iconPath, font, color ) )
58{
59}
60
61GeoDataStyle::~GeoDataStyle()
62{
63 delete d;
64}
65
67{
69 *d = *other.d;
70 return *this;
71}
72
73bool GeoDataStyle::operator==( const GeoDataStyle &other ) const
74{
75 if ( GeoDataStyleSelector::operator!=( other ) ) {
76 return false;
77 }
78
79 return d->m_iconStyle == other.d->m_iconStyle &&
80 d->m_labelStyle == other.d->m_labelStyle &&
81 d->m_lineStyle == other.d->m_lineStyle &&
82 d->m_polyStyle == other.d->m_polyStyle &&
83 d->m_balloonStyle == other.d->m_balloonStyle &&
84 d->m_listStyle == other.d->m_listStyle;
85}
86
87bool GeoDataStyle::operator!=( const GeoDataStyle &other ) const
88{
89 return !this->operator==( other );
90}
91
92const char* GeoDataStyle::nodeType() const
93{
94 return GeoDataTypes::GeoDataStyleType;
95}
96
97void GeoDataStyle::setIconStyle( const GeoDataIconStyle& style )
98{
99 d->m_iconStyle = style;
100 d->m_iconStyle.setParent( this );
101}
102
104{
105 d->m_lineStyle = style;
106}
107
109{
110 d->m_labelStyle = style;
111}
112
114{
115 d->m_polyStyle = style;
116}
117
118void GeoDataStyle::setBalloonStyle( const GeoDataBalloonStyle& style )
119{
120 d->m_balloonStyle = style;
121}
122
123void GeoDataStyle::setListStyle( const GeoDataListStyle& style )
124{
125 d->m_listStyle = style;
126 d->m_listStyle.setParent( this );
127}
128
129GeoDataIconStyle& GeoDataStyle::iconStyle()
130{
131 return d->m_iconStyle;
132}
133
134const GeoDataIconStyle& GeoDataStyle::iconStyle() const
135{
136 return d->m_iconStyle;
137}
138
140{
141 return d->m_lineStyle;
142}
143
145{
146 return d->m_lineStyle;
147}
148
150{
151 return d->m_polyStyle;
152}
153
155{
156 return d->m_polyStyle;
157}
158
160{
161 return d->m_labelStyle;
162}
163
165{
166 return d->m_labelStyle;
167}
168
169GeoDataBalloonStyle& GeoDataStyle::balloonStyle()
170{
171 return d->m_balloonStyle;
172}
173
174const GeoDataBalloonStyle& GeoDataStyle::balloonStyle() const
175{
176 return d->m_balloonStyle;
177}
178
179GeoDataListStyle& GeoDataStyle::listStyle()
180{
181 return d->m_listStyle;
182}
183
184const GeoDataListStyle& GeoDataStyle::listStyle() const
185{
186 return d->m_listStyle;
187}
188
189void GeoDataStyle::pack( QDataStream& stream ) const
190{
192
193 d->m_iconStyle.pack( stream );
194 d->m_labelStyle.pack( stream );
195 d->m_polyStyle.pack( stream );
196 d->m_lineStyle.pack( stream );
197 d->m_balloonStyle.pack( stream );
198 d->m_listStyle.pack( stream );
199}
200
202{
204
205 d->m_iconStyle.unpack( stream );
206 d->m_labelStyle.unpack( stream );
207 d->m_lineStyle.unpack( stream );
208 d->m_polyStyle.unpack( stream );
209 d->m_balloonStyle.unpack( stream );
210 d->m_listStyle.unpack( stream );
211}
212
213}
specifies how the name of a GeoDataFeature is drawn
void pack(QDataStream &stream) const override
Serialize the style to a stream.
void unpack(QDataStream &stream) override
Unserialize the style from a stream.
specifies the style how lines are drawn
void unpack(QDataStream &stream) override
Unserialize the style from a stream.
void pack(QDataStream &stream) const override
Serialize the style to a stream.
void setParent(GeoDataObject *parent)
Sets the parent of the object.
specifies the style how polygons are drawn
void unpack(QDataStream &stream) override
Unserialize the style from a stream.
void pack(QDataStream &stream) const override
Serialize the style to a stream.
an abstract base class for the style classes
GeoDataStyleSelector & operator=(const GeoDataStyleSelector &other)
assignment operator
void unpack(QDataStream &stream) override
Unserialize the styleselector from a stream.
void pack(QDataStream &stream) const override
Serialize the styleselector to a stream.
an addressable style group
void setPolyStyle(const GeoDataPolyStyle &style)
set the poly style
void setBalloonStyle(const GeoDataBalloonStyle &style)
set the balloon style
void setIconStyle(const GeoDataIconStyle &style)
set the icon style
GeoDataLineStyle & lineStyle()
Return the label style of this style.
void pack(QDataStream &stream) const override
Serialize the style to a stream.
GeoDataLabelStyle & labelStyle()
Return the label style of this style.
void unpack(QDataStream &stream) override
Unserialize the style from a stream.
GeoDataListStyle & listStyle()
Return the list style of this style.
void setLabelStyle(const GeoDataLabelStyle &style)
set the label style
GeoDataIconStyle & iconStyle()
Return the icon style of this style.
GeoDataStyle & operator=(const GeoDataStyle &other)
assignment operator
void setListStyle(const GeoDataListStyle &style)
set the list style
const char * nodeType() const override
Provides type information for downcasting a GeoNode.
GeoDataPolyStyle & polyStyle()
Return the label style of this style.
void setLineStyle(const GeoDataLineStyle &style)
set the line style
GeoDataStyle()
Construct a default style.
GeoDataBalloonStyle & balloonStyle()
Return the balloon style of this style.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.