• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • scene
GeoSceneSection.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Torsten Rahn <rahn@kde.org>
3 
4  This file is part of the KDE project
5 
6  This library is free software you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  aint with this library see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "GeoSceneSection.h"
23 
24 #include "MarbleDebug.h"
25 
26 #include "GeoSceneTypes.h"
27 #include "GeoSceneItem.h"
28 
29 namespace Marble
30 {
31 
32 GeoSceneSection::GeoSceneSection( const QString& name )
33  : m_name( name ),
34  m_heading( "" ),
35  m_connectTo( "" ),
36  m_radio( "" ),
37  m_checkable( false ),
38  m_spacing( 12 )
39 {
40 }
41 
42 GeoSceneSection::~GeoSceneSection()
43 {
44  qDeleteAll( m_items );
45 }
46 
47 const char* GeoSceneSection::nodeType() const
48 {
49  return GeoSceneTypes::GeoSceneSectionType;
50 }
51 
52 void GeoSceneSection::addItem( GeoSceneItem* item )
53 {
54  // Remove any item that has the same name
55  QVector<GeoSceneItem*>::iterator it = m_items.begin();
56  while (it != m_items.end()) {
57  GeoSceneItem* currentItem = *it;
58  if ( currentItem->name() == item->name() ) {
59  delete currentItem;
60  it = m_items.erase(it);
61  break;
62  }
63  else {
64  ++it;
65  }
66  }
67 
68  if ( item ) {
69  m_items.append( item );
70  }
71 }
72 
73 GeoSceneItem* GeoSceneSection::item( const QString& name )
74 {
75  GeoSceneItem* item = 0;
76 
77  QVector<GeoSceneItem*>::const_iterator it = m_items.constBegin();
78  QVector<GeoSceneItem*>::const_iterator end = m_items.constEnd();
79  for (; it != end; ++it) {
80  if ( (*it)->name() == name ) {
81  item = *it;
82  break;
83  }
84  }
85 
86  if ( !item ) {
87  item = new GeoSceneItem( name );
88  addItem( item );
89  }
90 
91  return item;
92 }
93 
94 QVector<GeoSceneItem*> GeoSceneSection::items() const
95 {
96  return m_items;
97 }
98 
99 QString GeoSceneSection::name() const
100 {
101  return m_name;
102 }
103 
104 QString GeoSceneSection::heading() const
105 {
106  return m_heading;
107 }
108 
109 void GeoSceneSection::setHeading( const QString& heading )
110 {
111  m_heading = heading;
112 }
113 
114 bool GeoSceneSection::checkable() const
115 {
116  return m_checkable;
117 }
118 
119 void GeoSceneSection::setCheckable( bool checkable )
120 {
121  m_checkable = checkable;
122 }
123 
124 QString GeoSceneSection::connectTo() const
125 {
126  return m_connectTo;
127 }
128 
129 void GeoSceneSection::setConnectTo( const QString& connectTo )
130 {
131  m_connectTo = connectTo;
132 }
133 
134 int GeoSceneSection::spacing() const
135 {
136  return m_spacing;
137 }
138 
139 void GeoSceneSection::setSpacing( int spacing )
140 {
141  m_spacing = spacing;
142 }
143 
144 QString GeoSceneSection::radio() const
145 {
146  return m_radio;
147 }
148 
149 void GeoSceneSection::setRadio( const QString& radio )
150 {
151  m_radio = radio;
152 }
153 
154 }
GeoSceneTypes.h
Marble::GeoSceneItem
The section item in a legend of a GeoScene document.
Definition: GeoSceneItem.h:38
Marble::GeoSceneSection::setConnectTo
void setConnectTo(const QString &text)
Definition: GeoSceneSection.cpp:129
Marble::GeoSceneSection::radio
QString radio() const
Definition: GeoSceneSection.cpp:144
GeoSceneItem.h
Marble::GeoSceneSection::setCheckable
void setCheckable(bool checkable)
Definition: GeoSceneSection.cpp:119
Marble::GeoSceneSection::checkable
bool checkable() const
Definition: GeoSceneSection.cpp:114
Marble::GeoSceneSection::item
GeoSceneItem * item(const QString &)
Definition: GeoSceneSection.cpp:73
MarbleDebug.h
Marble::GeoSceneSection::addItem
void addItem(GeoSceneItem *)
Add an item to the legend section.
Definition: GeoSceneSection.cpp:52
Marble::GeoSceneSection::setSpacing
void setSpacing(int spacing)
Definition: GeoSceneSection.cpp:139
Marble::GeoSceneSection::connectTo
QString connectTo() const
Definition: GeoSceneSection.cpp:124
Marble::GeoSceneItem::name
QString name() const
Definition: GeoSceneItem.cpp:60
QString
Marble::GeoSceneSection::heading
QString heading() const
Definition: GeoSceneSection.cpp:104
Marble::GeoSceneSection::setRadio
void setRadio(const QString &radio)
Definition: GeoSceneSection.cpp:149
Marble::GeoSceneSection::GeoSceneSection
GeoSceneSection(const QString &name)
Definition: GeoSceneSection.cpp:32
Marble::GeoSceneSection::setHeading
void setHeading(const QString &heading)
Definition: GeoSceneSection.cpp:109
GeoSceneSection.h
QVector
Marble::GeoSceneSection::spacing
int spacing() const
Definition: GeoSceneSection.cpp:134
Marble::GeoSceneSection::~GeoSceneSection
~GeoSceneSection()
Definition: GeoSceneSection.cpp:42
Marble::GeoSceneSection::nodeType
virtual const char * nodeType() const
Definition: GeoSceneSection.cpp:47
Marble::GeoSceneSection::name
QString name() const
Definition: GeoSceneSection.cpp:99
Marble::GeoSceneTypes::GeoSceneSectionType
const char * GeoSceneSectionType
Definition: GeoSceneTypes.cpp:30
Marble::GeoSceneSection::items
QVector< GeoSceneItem * > items() const
Definition: GeoSceneSection.cpp:94
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal