Marble

GeoDataLabelStyle.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007 Murad Tagirov <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 //
6 
7 
8 #ifndef MARBLE_GEODATALABELSTYLE_H
9 #define MARBLE_GEODATALABELSTYLE_H
10 
11 #include "GeoDataColorStyle.h"
12 
13 #include "geodata_export.h"
14 
15 class QFont;
16 
17 namespace Marble
18 {
19 
20 class GeoDataLabelStylePrivate;
21 
22 /**
23  * @short specifies how the <b>name</b> of a GeoDataFeature is drawn
24  *
25  * A GeoDataLabelStyle specifies how the <b>name</b> of a
26  * GeoDataFeature is drawn in the viewer. A custom color, color mode
27  * (both inherited from GeoDataColorStyle, and scale for the label
28  * (name) can be specified.
29  */
30 class GEODATA_EXPORT GeoDataLabelStyle : public GeoDataColorStyle
31 {
32  public:
33  enum Alignment{Corner, Center, Right /*, Left, Below */};
34 
35  /// Construct a new GeoDataLabelStyle
37  GeoDataLabelStyle( const GeoDataLabelStyle& other );
38  /**
39  * @brief Construct a new GeoDataLabelStyle
40  * @param font the font to use when showing the name
41  * @param color the color to use when showing the name @see GeoDataColorStyle
42  */
43  GeoDataLabelStyle( const QFont &font, const QColor &color );
44 
45  ~GeoDataLabelStyle() override;
46 
47  /**
48  * @brief assignment operator
49  */
50  GeoDataLabelStyle& operator=( const GeoDataLabelStyle& other );
51 
52  bool operator==( const GeoDataLabelStyle &other ) const;
53  bool operator!=( const GeoDataLabelStyle &other ) const;
54 
55  /// Provides type information for downcasting a GeoData
56  const char* nodeType() const override;
57 
58  /**
59  * @brief Set the scale of the label
60  * @param scale the new scale
61  */
62  void setScale(float scale);
63  /**
64  * @brief Return the current scale of the label
65  * @return the current scale
66  */
67  float scale() const;
68  /**
69  * @brief Set the alignment of the label
70  * @param alignment the alignment
71  */
72  void setAlignment ( GeoDataLabelStyle::Alignment alignment );
73  /**
74  * @brief Return the alignment of the label
75  * @return the current alignment
76  */
77  GeoDataLabelStyle::Alignment alignment() const;
78  /**
79  * @brief Set the font of the label
80  * @param font the new font
81  */
82  void setFont( const QFont &font );
83  /**
84  * @brief Return the current font of the label
85  * @return the current font
86  */
87  QFont font() const;
88 
89  /**
90  * @brief Return the scaled font of the label
91  * @return the scaled font
92  */
93  QFont scaledFont() const;
94 
95  /**
96  * @brief Return true if the text of the label should glow, false otherwise
97  * @see setGlow
98  */
99  bool glow() const;
100 
101  /**
102  * @brief Enable or disable a glow effect around the text of the label.
103  *
104  * The default is false.
105  *
106  * Note that this is not a KML property.
107  */
108  void setGlow( bool on );
109 
110  /**
111  * @brief Serialize the style to a stream.
112  * @param stream the stream
113  */
114  void pack( QDataStream& stream ) const override;
115  /**
116  * @brief Unserialize the style from a stream
117  * @param stream the stream
118  */
119  void unpack( QDataStream& stream ) override;
120 
121  private:
122  GeoDataLabelStylePrivate * const d;
123 };
124 
125 }
126 
127 #endif
specifies how the name of a GeoDataFeature is drawn
Binds a QML item to a specific geodetic location in screen coordinates.
an abstract base class for various style classes
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.