• 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
  • plugins
  • runner
  • gpx
  • handlers
GPXdescTagHandler.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Anders Lund <anders@alweb.dk>
9 // Copyright 2009 Thibaut GRIDEL <tgridel@free.fr>
10 //
11 
12 #include "GPXdescTagHandler.h"
13 
14 #include "MarbleDebug.h"
15 
16 #include "GPXElementDictionary.h"
17 #include "GeoParser.h"
18 #include "GeoDataDocument.h"
19 #include "GeoDataPlacemark.h"
20 #include "GeoDataPoint.h"
21 #include "GeoDataFolder.h"
22 
23 namespace Marble
24 {
25 namespace gpx
26 {
27 GPX_DEFINE_TAG_HANDLER(desc)
28 
29 GeoNode* GPXdescTagHandler::parse(GeoParser& parser) const
30 {
31  Q_ASSERT(parser.isStartElement() && parser.isValidElement(gpxTag_desc));
32  GeoStackItem parentItem = parser.parentElement();
33  if (parentItem.represents(gpxTag_wpt)
34  || parentItem.represents(gpxTag_trk)
35  || parentItem.represents(gpxTag_rtept))
36  {
37  GeoDataPlacemark* placemark = parentItem.nodeAs<GeoDataPlacemark>();
38 
39  QString desc = placemark->description();
40  if (!desc.isEmpty())
41  {
42  desc.append("<br/>");
43  }
44  placemark->setDescription(desc.append(parser.readElementText().trimmed().replace(QLatin1Char('\n'),QLatin1String("\n<br/>"))));
45  placemark->setDescriptionCDATA(true);
46 
47  }
48  else if (parentItem.represents(gpxTag_rte))
49  {
50  GeoDataFeature* route = parentItem.nodeAs<GeoDataFeature>();
51  QString desc = route->description();
52  if (!desc.isEmpty())
53  {
54  desc.append("<br/>");
55  }
56  route->setDescription(desc.append(parser.readElementText().trimmed().replace(QLatin1Char('\n'),QLatin1String("\n<br/>"))));
57  route->setDescriptionCDATA(true);
58  }
59  return 0;
60 }
61 
62 } // namespace gpx
63 
64 } // namespace Marble
GeoDataDocument.h
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
Marble::GeoDataFeature::setDescription
void setDescription(const QString &value)
Set the description of this feature to value.
Definition: GeoDataFeature.cpp:518
Marble::GeoDataFeature::description
QString description() const
Return the text description of the feature.
Definition: GeoDataFeature.cpp:513
MarbleDebug.h
GPX_DEFINE_TAG_HANDLER
#define GPX_DEFINE_TAG_HANDLER(Name)
Definition: GPXElementDictionary.h:66
Marble::GeoParser
Definition: GeoParser.h:40
Marble::gpx::GPXdescTagHandler
Definition: GPXdescTagHandler.h:22
Marble::gpx::gpxTag_wpt
const char * gpxTag_wpt
Definition: GPXElementDictionary.cpp:46
Marble::GeoStackItem
Definition: GeoParser.h:97
GeoDataPlacemark.h
GeoDataFolder.h
GeoDataPoint.h
Marble::GeoDataFeature::setDescriptionCDATA
void setDescriptionCDATA(bool cdata)
Set the description to be CDATA See:
Definition: GeoDataFeature.cpp:529
Marble::GeoDataFeature
A base class for all geodata features.
Definition: GeoDataFeature.h:55
Marble::gpx::gpxTag_desc
const char * gpxTag_desc
Definition: GPXElementDictionary.cpp:41
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
GPXdescTagHandler.h
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