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

marble

  • sources
  • kde-4.12
  • 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_checkable( false ),
37  m_spacing( 12 )
38 {
39 }
40 
41 GeoSceneSection::~GeoSceneSection()
42 {
43  qDeleteAll( m_items );
44 }
45 
46 const char* GeoSceneSection::nodeType() const
47 {
48  return GeoSceneTypes::GeoSceneSectionType;
49 }
50 
51 void GeoSceneSection::addItem( GeoSceneItem* item )
52 {
53  // Remove any item that has the same name
54  QVector<GeoSceneItem*>::iterator it = m_items.begin();
55  while (it != m_items.end()) {
56  GeoSceneItem* currentItem = *it;
57  if ( currentItem->name() == item->name() ) {
58  delete currentItem;
59  it = m_items.erase(it);
60  break;
61  }
62  else {
63  ++it;
64  }
65  }
66 
67  if ( item ) {
68  m_items.append( item );
69  }
70 }
71 
72 GeoSceneItem* GeoSceneSection::item( const QString& name )
73 {
74  GeoSceneItem* item = 0;
75 
76  QVector<GeoSceneItem*>::const_iterator it = m_items.constBegin();
77  QVector<GeoSceneItem*>::const_iterator end = m_items.constEnd();
78  for (; it != end; ++it) {
79  if ( (*it)->name() == name ) {
80  item = *it;
81  break;
82  }
83  }
84 
85  if ( !item ) {
86  item = new GeoSceneItem( name );
87  addItem( item );
88  }
89 
90  return item;
91 }
92 
93 QVector<GeoSceneItem*> GeoSceneSection::items() const
94 {
95  return m_items;
96 }
97 
98 QString GeoSceneSection::name() const
99 {
100  return m_name;
101 }
102 
103 QString GeoSceneSection::heading() const
104 {
105  return m_heading;
106 }
107 
108 void GeoSceneSection::setHeading( const QString& heading )
109 {
110  m_heading = heading;
111 }
112 
113 bool GeoSceneSection::checkable() const
114 {
115  return m_checkable;
116 }
117 
118 void GeoSceneSection::setCheckable( bool checkable )
119 {
120  m_checkable = checkable;
121 }
122 
123 QString GeoSceneSection::connectTo() const
124 {
125  return m_connectTo;
126 }
127 
128 void GeoSceneSection::setConnectTo( const QString& connectTo )
129 {
130  m_connectTo = connectTo;
131 }
132 
133 int GeoSceneSection::spacing() const
134 {
135  return m_spacing;
136 }
137 
138 void GeoSceneSection::setSpacing( int spacing )
139 {
140  m_spacing = spacing;
141 }
142 
143 }
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:128
GeoSceneItem.h
Marble::GeoSceneSection::setCheckable
void setCheckable(bool checkable)
Definition: GeoSceneSection.cpp:118
Marble::GeoSceneSection::checkable
bool checkable() const
Definition: GeoSceneSection.cpp:113
Marble::GeoSceneSection::item
GeoSceneItem * item(const QString &)
Definition: GeoSceneSection.cpp:72
MarbleDebug.h
Marble::GeoSceneSection::addItem
void addItem(GeoSceneItem *)
Add an item to the legend section.
Definition: GeoSceneSection.cpp:51
Marble::GeoSceneSection::setSpacing
void setSpacing(int spacing)
Definition: GeoSceneSection.cpp:138
Marble::GeoSceneSection::connectTo
QString connectTo() const
Definition: GeoSceneSection.cpp:123
Marble::GeoSceneItem::name
QString name() const
Definition: GeoSceneItem.cpp:60
Marble::GeoSceneSection::heading
QString heading() const
Definition: GeoSceneSection.cpp:103
Marble::GeoSceneSection::GeoSceneSection
GeoSceneSection(const QString &name)
Definition: GeoSceneSection.cpp:32
Marble::GeoSceneSection::setHeading
void setHeading(const QString &heading)
Definition: GeoSceneSection.cpp:108
GeoSceneSection.h
Marble::GeoSceneSection::spacing
int spacing() const
Definition: GeoSceneSection.cpp:133
Marble::GeoSceneSection::~GeoSceneSection
~GeoSceneSection()
Definition: GeoSceneSection.cpp:41
Marble::GeoSceneSection::nodeType
virtual const char * nodeType() const
Definition: GeoSceneSection.cpp:46
Marble::GeoSceneSection::name
QString name() const
Definition: GeoSceneSection.cpp:98
Marble::GeoSceneTypes::GeoSceneSectionType
const char * GeoSceneSectionType
Definition: GeoSceneTypes.cpp:30
Marble::GeoSceneSection::items
QVector< GeoSceneItem * > items() const
Definition: GeoSceneSection.cpp:93
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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