Marble

GeoSceneLegend.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Torsten Rahn <rahn@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "GeoSceneLegend.h"
8
9#include "GeoSceneSection.h"
10#include "GeoSceneTypes.h"
11
12namespace Marble
13{
14
15class GeoSceneLegendPrivate
16{
17public:
18 ~GeoSceneLegendPrivate()
19 {
20 qDeleteAll(m_sections);
21 }
22
23 /// The vector holding all the sections in the legend.
24 /// (We want to preserve the order and don't care
25 /// much about speed here), so we don't use a hash
27};
28
29GeoSceneLegend::GeoSceneLegend()
30 : d(new GeoSceneLegendPrivate)
31{
32}
33
34GeoSceneLegend::~GeoSceneLegend()
35{
36 delete d;
37}
38
39const char *GeoSceneLegend::nodeType() const
40{
41 return GeoSceneTypes::GeoSceneLegendType;
42}
43
44void GeoSceneLegend::addSection(const GeoSceneSection *section)
45{
46 // Remove any section that has the same name
47 QList<const GeoSceneSection *>::iterator it = d->m_sections.begin();
48 while (it != d->m_sections.end()) {
49 const GeoSceneSection *currentSection = *it;
50 if (currentSection->name() == section->name()) {
51 delete currentSection;
52 d->m_sections.erase(it);
53 break;
54 } else {
55 ++it;
56 }
57 }
58
59 if (section) {
60 d->m_sections.append(section);
61 }
62}
63
64QList<const GeoSceneSection *> GeoSceneLegend::sections() const
65{
66 return d->m_sections;
67}
68
69}
Section of a GeoScene document.
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:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.