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 "GeoSceneTypes.h"
10#include "GeoSceneSection.h"
11
12namespace Marble
13{
14
15class GeoSceneLegendPrivate
16{
17 public:
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
29
30GeoSceneLegend::GeoSceneLegend()
31 : d( new GeoSceneLegendPrivate )
32{
33}
34
35GeoSceneLegend::~GeoSceneLegend()
36{
37 delete d;
38}
39
40const char* GeoSceneLegend::nodeType() const
41{
42 return GeoSceneTypes::GeoSceneLegendType;
43}
44
45void GeoSceneLegend::addSection( const GeoSceneSection* section )
46{
47 // Remove any section that has the same name
48 QVector<const GeoSceneSection*>::iterator it = d->m_sections.begin();
49 while (it != d->m_sections.end()) {
50 const GeoSceneSection* currentSection = *it;
51 if ( currentSection->name() == section->name() ) {
52 delete currentSection;
53 d->m_sections.erase(it);
54 break;
55 }
56 else {
57 ++it;
58 }
59 }
60
61 if ( section ) {
62 d->m_sections.append( section );
63 }
64}
65
66QVector<const GeoSceneSection*> GeoSceneLegend::sections() const
67{
68 return d->m_sections;
69}
70
71}
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 Fri Jun 14 2024 11:54:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.