Marble

GeoDataOverlay.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#include "GeoDataOverlay.h"
7#include "GeoDataOverlay_p.h"
8
9namespace Marble
10{
11
12GeoDataOverlay::GeoDataOverlay()
13 : GeoDataFeature(new GeoDataOverlayPrivate)
14{
15 // nothing to do
16}
17
18GeoDataOverlay::GeoDataOverlay(const GeoDataOverlay &other)
19 : GeoDataFeature(other, new GeoDataOverlayPrivate(*other.d_func()))
20{
21 // nothing to do
22}
23
24GeoDataOverlay::GeoDataOverlay(GeoDataOverlayPrivate *priv)
25 : GeoDataFeature(priv)
26{
27}
28
29GeoDataOverlay::GeoDataOverlay(const GeoDataOverlay &other, GeoDataOverlayPrivate *priv)
30 : GeoDataFeature(other, priv)
31{
32}
33
34GeoDataOverlay::~GeoDataOverlay() = default;
35
36GeoDataOverlay &GeoDataOverlay::operator=(const GeoDataOverlay &other)
37{
38 if (this != &other) {
39 Q_D(GeoDataOverlay);
40 *d = *other.d_func();
41 }
42
43 return *this;
44}
45
46QColor GeoDataOverlay::color() const
47{
48 Q_D(const GeoDataOverlay);
49 return d->m_color;
50}
51
52void GeoDataOverlay::setColor(const QColor &color)
53{
54 Q_D(GeoDataOverlay);
55 d->m_color = color;
56}
57
58int GeoDataOverlay::drawOrder() const
59{
60 Q_D(const GeoDataOverlay);
61 return d->m_drawOrder;
62}
63
64void GeoDataOverlay::setDrawOrder(int order)
65{
66 Q_D(GeoDataOverlay);
67 d->m_drawOrder = order;
68}
69
70QImage GeoDataOverlay::icon() const
71{
72 Q_D(const GeoDataOverlay);
73 if (d->m_image.isNull() && !d->m_iconPath.isEmpty()) {
74 d->m_image = QImage(absoluteIconFile());
75 }
76 return d->m_image;
77}
78
79void GeoDataOverlay::setIcon(const QImage &icon)
80{
81 Q_D(GeoDataOverlay);
82 d->m_image = icon;
83}
84
85void GeoDataOverlay::setIconFile(const QString &path)
86{
87 Q_D(GeoDataOverlay);
88 d->m_iconPath = path;
89 d->m_image = QImage(path);
90}
91
92QString GeoDataOverlay::iconFile() const
93{
94 Q_D(const GeoDataOverlay);
95 return d->m_iconPath;
96}
97
98QString GeoDataOverlay::absoluteIconFile() const
99{
100 Q_D(const GeoDataOverlay);
101 return resolvePath(d->m_iconPath);
102}
103
104bool GeoDataOverlay::equals(const GeoDataOverlay &other) const
105{
106 Q_D(const GeoDataOverlay);
107 const GeoDataOverlayPrivate *const other_d = other.d_func();
108
109 return GeoDataFeature::equals(other) && d->m_drawOrder == other_d->m_drawOrder && d->m_color == other_d->m_color && d->m_iconPath == other_d->m_iconPath
110 && d->m_image == other_d->m_image;
111}
112
113}
QString path(const QString &relativePath)
Binds a QML item to a specific geodetic location in screen coordinates.
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.