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

KDE's Doxygen guidelines are available online.