Marble

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

KDE's Doxygen guidelines are available online.