• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataLabelStyle.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 //
10 
11 
12 #include "GeoDataLabelStyle.h"
13 
14 #include <QFont>
15 
16 #include "GeoDataTypes.h"
17 
18 namespace Marble
19 {
20 #ifdef Q_OS_MACX
21 static const int defaultSize = 10;
22 #else
23 static const int defaultSize = 8;
24 #endif
25 
26 
27 class GeoDataLabelStylePrivate
28 {
29  public:
30  GeoDataLabelStylePrivate()
31  : m_scale( 1.0 ),
32  m_alignment( GeoDataLabelStyle::Corner ),
33  m_font( QFont("Sans Serif").family(), defaultSize, 50, false ),
34  m_glow( true )
35  {
36  }
37 
38  explicit GeoDataLabelStylePrivate( const QFont &font )
39  : m_scale( 1.0 ),
40  m_alignment( GeoDataLabelStyle::Corner ),
41  m_font( font ),
42  m_glow( true )
43  {
44  }
45 
46  const char* nodeType() const
47  {
48  return GeoDataTypes::GeoDataLabelStyleType;
49  }
50 
52  float m_scale;
54  GeoDataLabelStyle::Alignment m_alignment;
56  QFont m_font; // Not a KML property
58  bool m_glow; // Not a KML property
59 };
60 
61 GeoDataLabelStyle::GeoDataLabelStyle()
62  : d (new GeoDataLabelStylePrivate )
63 {
64  setColor( QColor( Qt::black ) );
65 }
66 
67 GeoDataLabelStyle::GeoDataLabelStyle( const GeoDataLabelStyle& other )
68  : GeoDataColorStyle( other ), d (new GeoDataLabelStylePrivate( *other.d ) )
69 {
70 }
71 
72 GeoDataLabelStyle::GeoDataLabelStyle( const QFont &font, const QColor &color )
73  : d (new GeoDataLabelStylePrivate( font ) )
74 {
75  setColor( color );
76 }
77 
78 GeoDataLabelStyle::~GeoDataLabelStyle()
79 {
80  delete d;
81 }
82 
83 GeoDataLabelStyle& GeoDataLabelStyle::operator=( const GeoDataLabelStyle& other )
84 {
85  GeoDataColorStyle::operator=( other );
86  *d = *other.d;
87  return *this;
88 }
89 
90 const char* GeoDataLabelStyle::nodeType() const
91 {
92  return d->nodeType();
93 }
94 
95 void GeoDataLabelStyle::setAlignment( GeoDataLabelStyle::Alignment alignment )
96 {
97  d->m_alignment = alignment;
98 }
99 
100 GeoDataLabelStyle::Alignment GeoDataLabelStyle::alignment() const
101 {
102  return d->m_alignment;
103 }
104 
105 void GeoDataLabelStyle::setScale( const float &scale )
106 {
107  d->m_scale = scale;
108 }
109 
110 float GeoDataLabelStyle::scale() const
111 {
112  return d->m_scale;
113 }
114 
115 void GeoDataLabelStyle::setFont( const QFont &font )
116 {
117  d->m_font = font;
118 }
119 
120 QFont GeoDataLabelStyle::font() const
121 {
122  return d->m_font;
123 }
124 
125 bool GeoDataLabelStyle::glow() const
126 {
127  return d->m_glow;
128 }
129 
130 void GeoDataLabelStyle::setGlow(bool on)
131 {
132  d->m_glow = on;
133 }
134 
135 void GeoDataLabelStyle::pack( QDataStream& stream ) const
136 {
137  GeoDataColorStyle::pack( stream );
138 
139  stream << d->m_scale;
140  stream << d->m_alignment;
141  stream << d->m_font;
142 }
143 
144 void GeoDataLabelStyle::unpack( QDataStream& stream )
145 {
146  int a;
147  GeoDataColorStyle::unpack( stream );
148 
149  stream >> d->m_scale;
150  stream >> a;
151  stream >> d->m_font;
152 
153  d->m_alignment = static_cast<GeoDataLabelStyle::Alignment>( a );
154 }
155 
156 }
Marble::GeoDataLabelStyle::scale
float scale() const
Return the current scale of the label.
Definition: GeoDataLabelStyle.cpp:110
Marble::GeoDataLabelStyle::GeoDataLabelStyle
GeoDataLabelStyle()
Construct a new GeoDataLabelStyle.
Definition: GeoDataLabelStyle.cpp:61
Marble::GeoDataLabelStyle::~GeoDataLabelStyle
~GeoDataLabelStyle()
Definition: GeoDataLabelStyle.cpp:78
Marble::defaultSize
static const int defaultSize
Definition: GeoDataLabelStyle.cpp:23
Marble::GeoDataLabelStyle::operator=
GeoDataLabelStyle & operator=(const GeoDataLabelStyle &other)
assignment operator
Definition: GeoDataLabelStyle.cpp:83
Marble::GeoDataColorStyle::setColor
void setColor(const QColor &value)
Set a new color.
Definition: GeoDataColorStyle.cpp:73
Marble::GeoDataLabelStyle::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataLabelStyle.cpp:90
Marble::GeoDataLabelStyle::Alignment
Alignment
Definition: GeoDataLabelStyle.h:39
Marble::GeoDataColorStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataColorStyle.cpp:107
GeoDataLabelStyle.h
Marble::GeoDataTypes::GeoDataLabelStyleType
const char * GeoDataLabelStyleType
Definition: GeoDataTypes.cpp:44
Marble::GeoDataColorStyle
an abstract base class for various style classes
Definition: GeoDataColorStyle.h:64
Marble::GeoDataLabelStyle::setFont
void setFont(const QFont &font)
Set the font of the label.
Definition: GeoDataLabelStyle.cpp:115
Marble::GeoDataLabelStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataLabelStyle.cpp:144
Marble::GeoDataLabelStyle::glow
bool glow() const
Return true if the text of the label should glow, false otherwise.
Definition: GeoDataLabelStyle.cpp:125
Marble::GeoDataLabelStyle::setScale
void setScale(const float &scale)
Set the scale of the label.
Definition: GeoDataLabelStyle.cpp:105
Marble::GeoDataLabelStyle::alignment
GeoDataLabelStyle::Alignment alignment() const
Return the alignment of the label.
Definition: GeoDataLabelStyle.cpp:100
Marble::GeoDataLabelStyle::pack
virtual void pack(QDataStream &stream) const
Serialize the style to a stream.
Definition: GeoDataLabelStyle.cpp:135
Marble::GeoDataLabelStyle
specifies how the name of a GeoDataFeature is drawn
Definition: GeoDataLabelStyle.h:36
Marble::GeoDataColorStyle::unpack
virtual void unpack(QDataStream &stream)
Unserialize the style from a stream.
Definition: GeoDataColorStyle.cpp:116
Marble::GeoDataLabelStyle::Corner
Definition: GeoDataLabelStyle.h:39
Marble::GeoDataLabelStyle::setGlow
void setGlow(bool on)
Enable or disable a glow effect around the text of the label.
Definition: GeoDataLabelStyle.cpp:130
Marble::GeoDataLabelStyle::setAlignment
void setAlignment(GeoDataLabelStyle::Alignment alignment)
Set the alignment of the label.
Definition: GeoDataLabelStyle.cpp:95
Marble::GeoDataLabelStyle::font
QFont font() const
Return the current font of the label.
Definition: GeoDataLabelStyle.cpp:120
GeoDataTypes.h
Marble::GeoDataColorStyle::operator=
GeoDataColorStyle & operator=(const GeoDataColorStyle &other)
assignment operator
Definition: GeoDataColorStyle.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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