• 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
GPXtrkptTagHandler.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 "GPXtrkptTagHandler.h"
21 
22 #include "MarbleDebug.h"
23 
24 #include "GPXElementDictionary.h"
25 #include "GeoParser.h"
26 #include "GeoDataLineString.h"
27 #include "GeoDataCoordinates.h"
28 #include "GeoDataTrack.h"
29 
30 namespace Marble
31 {
32 namespace gpx
33 {
34 GPX_DEFINE_TAG_HANDLER(trkpt)
35 
36 GeoNode* GPXtrkptTagHandler::parse(GeoParser& parser) const
37 {
38  Q_ASSERT(parser.isStartElement() && parser.isValidElement(gpxTag_trkpt));
39 
40  GeoStackItem parentItem = parser.parentElement();
41  if (parentItem.represents(gpxTag_trkseg))
42  {
43  GeoDataTrack* track = parentItem.nodeAs<GeoDataTrack>();
44  GeoDataCoordinates coord;
45 
46  QXmlStreamAttributes attributes = parser.attributes();
47  QStringRef tmp;
48  qreal lat = 0;
49  qreal lon = 0;
50  tmp = attributes.value(gpxTag_lat);
51  if ( !tmp.isEmpty() )
52  {
53  lat = tmp.toString().toDouble();
54  }
55  tmp = attributes.value(gpxTag_lon);
56  if ( !tmp.isEmpty() )
57  {
58  lon = tmp.toString().toDouble();
59  }
60  coord.set(lon, lat, 0, GeoDataCoordinates::Degree);
61  track->appendCoordinates( coord );
62 
63  return track;
64  }
65  return 0;
66 }
67 
68 } // namespace gpx
69 
70 } // namespace Marble
GeoDataCoordinates.h
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::GeoDataTrack
A geometry for tracking objects made of (time, coordinates) pairs.
Definition: GeoDataTrack.h:54
Marble::gpx::gpxTag_trkseg
const char * gpxTag_trkseg
Definition: GPXElementDictionary.cpp:45
Marble::gpx::GPXtrkptTagHandler
Definition: GPXtrkptTagHandler.h:30
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GPXtrkptTagHandler.h
GeoParser.h
Marble::gpx::gpxTag_lon
const char * gpxTag_lon
Definition: GPXElementDictionary.cpp:38
MarbleDebug.h
GPX_DEFINE_TAG_HANDLER
#define GPX_DEFINE_TAG_HANDLER(Name)
Definition: GPXElementDictionary.h:66
GeoDataTrack.h
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::GeoParser
Definition: GeoParser.h:40
GeoDataLineString.h
Marble::GeoStackItem
Definition: GeoParser.h:97
Marble::gpx::gpxTag_trkpt
const char * gpxTag_trkpt
Definition: GPXElementDictionary.cpp:44
Marble::GeoDataCoordinates::toString
QString toString() const
return a string representation of the coordinate this is a convenience function which uses the defaul...
Definition: GeoDataCoordinates.cpp:921
Marble::GeoDataTrack::appendCoordinates
void appendCoordinates(const GeoDataCoordinates &coord)
Add the coordinates part for a new point.
Definition: GeoDataTrack.cpp:190
GPXElementDictionary.h
Marble::gpx::gpxTag_lat
const char * gpxTag_lat
Definition: GPXElementDictionary.cpp:37
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