Marble

StyleBuilder.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_STYLEBUILDER_H
7#define MARBLE_STYLEBUILDER_H
8
9#include "marble_export.h"
10
11#include <GeoDataPlacemark.h>
12#include <GeoDataStyle.h>
13#include <GeoDataRelation.h>
14
15#include <QHash>
16#include <QPair>
17
18class QFont;
19class QColor;
20
21namespace Marble {
22class OsmPlacemarkData;
23
24class MARBLE_EXPORT StyleParameters
25{
26public:
27 explicit StyleParameters(const GeoDataPlacemark *placemark_ = nullptr, int tileLevel = 0);
28
29 const GeoDataPlacemark *placemark;
30 int tileLevel;
31 const GeoDataRelation *relation;
32};
33
34enum StyleEffect {
35 NoEffect,
36 InvertedEffect,
37 GrayscaleEffect,
38 RedModeEffect
39};
40
41class MARBLE_EXPORT StyleBuilder
42{
43public:
44 typedef QPair<QString, QString> OsmTag;
45
46 StyleBuilder();
47 ~StyleBuilder();
48
49 /**
50 * Return the label font of the placemark.
51 */
52 QFont defaultFont() const;
53 void setDefaultFont( const QFont& font );
54
55 QColor defaultLabelColor() const;
56 void setDefaultLabelColor( const QColor& color );
57
58 GeoDataStyle::ConstPtr createStyle(const StyleParameters &parameters) const;
59
60 /**
61 * @brief Returns the order in which the visual categories used in the theme shall be painted on the map.
62 * @return order in which the visual categories shall be painted on the map
63 */
64 QStringList renderOrder() const;
65
66 void reset();
67
68 /**
69 * @brief Returns the zoom level from which on the given visual category will be visible.
70 * @param placemark the placemark for which the minimum zoom level shall be returned
71 * @return zoom level from which on the given visual category will be visible
72 */
73 int minimumZoomLevel(const GeoDataPlacemark &placemark) const;
74
75 static int minimumZoomLevel(const GeoDataPlacemark::GeoDataVisualCategory &visualCategory);
76
77 static qint64 popularity(const GeoDataPlacemark* placemark);
78
79 /**
80 * @brief Returns the maximum zoom level in the theme.
81 * @return maximum zoom level in the theme
82 */
83 int maximumZoomLevel() const;
84
85 static QString visualCategoryName(GeoDataPlacemark::GeoDataVisualCategory category);
86
87 static QColor effectColor(const QColor& color);
88 static StyleEffect styleEffect();
89 static void setStyleEffect(StyleEffect effect);
90
91 /**
92 * @brief Mapping between osm key=value pairs and visual categories
93 */
95
96 static QStringList shopValues();
97 static QSet<OsmTag> buildingTags();
98
99 static GeoDataPlacemark::GeoDataVisualCategory determineVisualCategory(const OsmPlacemarkData &osmData);
100
101private:
102 Q_DISABLE_COPY(StyleBuilder)
103
104 class Private;
105 Private * const d;
106};
107
108}
109
110#endif
KGuiItem reset()
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 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.