• 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
  • plugins
  • runner
  • gpx
  • handlers
GPXnameTagHandler.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Marble Virtual Globe.
3 
4  This library is free software you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library. If not, see <http://www.gnu.org/licenses/>.
16 
17  Copyright 2009 Thibaut GRIDEL <tgridel@free.fr>
18 */
19 
20 #include "GPXnameTagHandler.h"
21 
22 #include "MarbleDebug.h"
23 
24 #include "GPXElementDictionary.h"
25 #include "GeoParser.h"
26 #include "GeoDataDocument.h"
27 #include "GeoDataPlacemark.h"
28 #include "GeoDataPoint.h"
29 #include "GeoDataFolder.h"
30 
31 namespace Marble
32 {
33 namespace gpx
34 {
35 GPX_DEFINE_TAG_HANDLER(name)
36 
37 GeoNode* GPXnameTagHandler::parse(GeoParser& parser) const
38 {
39  Q_ASSERT(parser.isStartElement() && parser.isValidElement(gpxTag_name));
40 
41  GeoStackItem parentItem = parser.parentElement();
42  if (parentItem.represents(gpxTag_wpt)
43  || parentItem.represents(gpxTag_trk)
44  || parentItem.represents(gpxTag_rtept))
45  {
46  GeoDataPlacemark* placemark = parentItem.nodeAs<GeoDataPlacemark>();
47 
48  placemark->setName(parser.readElementText().trimmed());
49  }
50  else if (parentItem.represents(gpxTag_rte))
51  {
52  GeoDataFeature* route = parentItem.nodeAs<GeoDataFeature>();
53  route->setName(parser.readElementText().trimmed());
54  }
55  return 0;
56 }
57 
58 } // namespace gpx
59 
60 } // namespace Marble
GeoDataDocument.h
Marble::gpx::gpxTag_name
const char * gpxTag_name
Definition: GPXElementDictionary.cpp:39
Marble::gpx::gpxTag_rtept
const char * gpxTag_rtept
Definition: GPXElementDictionary.cpp:48
Marble::gpx::gpxTag_trk
const char * gpxTag_trk
Definition: GPXElementDictionary.cpp:43
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoParser.h
MarbleDebug.h
GPX_DEFINE_TAG_HANDLER
#define GPX_DEFINE_TAG_HANDLER(Name)
Definition: GPXElementDictionary.h:66
Marble::GeoParser
Definition: GeoParser.h:40
GPXnameTagHandler.h
Marble::GeoDataFeature::setName
void setName(const QString &value)
Set a new name for this feature.
Definition: GeoDataFeature.cpp:549
Marble::gpx::gpxTag_wpt
const char * gpxTag_wpt
Definition: GPXElementDictionary.cpp:46
Marble::GeoStackItem
Definition: GeoParser.h:97
Marble::gpx::GPXnameTagHandler
Definition: GPXnameTagHandler.h:30
GeoDataPlacemark.h
GeoDataFolder.h
GeoDataPoint.h
Marble::GeoDataFeature
A base class for all geodata features.
Definition: GeoDataFeature.h:57
GPXElementDictionary.h
Marble::gpx::gpxTag_rte
const char * gpxTag_rte
Definition: GPXElementDictionary.cpp:47
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
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