Marble

GeoSceneLegend.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Torsten Rahn <[email protected]>
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 
12 namespace Marble
13 {
14 
15 class 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 
30 GeoSceneLegend::GeoSceneLegend()
31  : d( new GeoSceneLegendPrivate )
32 {
33 }
34 
35 GeoSceneLegend::~GeoSceneLegend()
36 {
37  delete d;
38 }
39 
40 const char* GeoSceneLegend::nodeType() const
41 {
42  return GeoSceneTypes::GeoSceneLegendType;
43 }
44 
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 
66 QVector<const GeoSceneSection*> GeoSceneLegend::sections() const
67 {
68  return d->m_sections;
69 }
70 
71 }
void addSection(const GeoSceneSection *)
Add a section to the legend.
Section of a GeoScene document.
Binds a QML item to a specific geodetic location in screen coordinates.
const char * nodeType() const override
Provides type information for downcasting a GeoNode.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 04:09:48 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.