• 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
GPXurlTagHandler.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 //
10 
11 #include "GPXurlTagHandler.h"
12 
13 #include "MarbleDebug.h"
14 
15 #include "GPXElementDictionary.h"
16 #include "GeoParser.h"
17 #include "GeoDataDocument.h"
18 #include "GeoDataPlacemark.h"
19 #include "GeoDataData.h"
20 #include "GeoDataExtendedData.h"
21 
22 namespace Marble
23 {
24 namespace gpx
25 {
26 GPX_DEFINE_TAG_HANDLER_10(url)
27 
28 // Gpx 1.0 url element provides a link related to a waypoint, and is
29 // inserted into the waypoint description as this seems to be the
30 // simplest means to make it available to the user.
31 // In addition, url properties are saved to extendedData.
32 // The insertion is done in the urlname element, which is the link text.
33 GeoNode* GPXurlTagHandler::parse(GeoParser& parser) const
34 {
35  Q_ASSERT(parser.isStartElement() && parser.isValidElement(gpxTag_url));
36 
37  GeoStackItem parentItem = parser.parentElement();
38  if (parentItem.represents(gpxTag_wpt))
39  {
40  GeoDataPlacemark* placemark = parentItem.nodeAs<GeoDataPlacemark>();
41 
42  QXmlStreamAttributes attributes = parser.attributes();
43  QString url = parser.readElementText().trimmed();
44 
45  GeoDataExtendedData extendedData = placemark->extendedData();
46  extendedData.addValue(GeoDataData("url", url));
47  placemark->setExtendedData(extendedData);
48  }
49 
50  return 0;
51 }
52 
53 } // namespace gpx
54 
55 } // namespace Marble
GeoDataDocument.h
Marble::gpx::gpxTag_url
const char * gpxTag_url
Definition: GPXElementDictionary.cpp:51
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::setExtendedData
void setExtendedData(const GeoDataExtendedData &extendedData)
Sets the ExtendedData of the feature.
Definition: GeoDataFeature.cpp:658
GeoDataExtendedData.h
MarbleDebug.h
Marble::GeoDataExtendedData
a class which allows to add custom data to KML Feature.
Definition: GeoDataExtendedData.h:35
Marble::GeoParser
Definition: GeoParser.h:40
Marble::gpx::GPXurlTagHandler
Definition: GPXurlTagHandler.h:21
Marble::gpx::gpxTag_wpt
const char * gpxTag_wpt
Definition: GPXElementDictionary.cpp:46
Marble::GeoStackItem
Definition: GeoParser.h:97
GeoDataPlacemark.h
Marble::GeoDataData
Definition: GeoDataData.h:26
GeoDataData.h
Marble::GeoDataExtendedData::addValue
void addValue(const GeoDataData &data)
add a data object to the GeoDataExtendedData with the key
Definition: GeoDataExtendedData.cpp:59
GPX_DEFINE_TAG_HANDLER_10
#define GPX_DEFINE_TAG_HANDLER_10(Name)
Definition: GPXElementDictionary.h:62
Marble::GeoDataFeature::extendedData
GeoDataExtendedData & extendedData() const
Return the ExtendedData assigned to the feature.
Definition: GeoDataFeature.cpp:653
GPXElementDictionary.h
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
GPXurlTagHandler.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