• 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
  • osm
  • handlers
OsmNdTagHandler.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 2011 Konstantin Oblaukhov <oblaukhov.konstantin@gmail.com>
9 //
10 
11 #include "OsmNdTagHandler.h"
12 
13 #include "OsmElementDictionary.h"
14 #include "OsmParser.h"
15 
16 #include "GeoDataCoordinates.h"
17 #include "GeoDataLineString.h"
18 #include "GeoDataPoint.h"
19 
20 namespace Marble
21 {
22 
23 namespace osm
24 {
25 
26 static GeoTagHandlerRegistrar osmNdTagHandler( GeoParser::QualifiedName( osmTag_nd, "" ),
27  new OsmNdTagHandler() );
28 
29 GeoNode* OsmNdTagHandler::parse( GeoParser &geoParser ) const
30 {
31  Q_ASSERT( dynamic_cast<OsmParser *>( &geoParser ) != 0 );
32  OsmParser &parser = static_cast<OsmParser &>( geoParser );
33 
34  Q_ASSERT( parser.isStartElement() );
35 
36  GeoStackItem parentItem = parser.parentElement();
37 
38  if ( parentItem.represents( osmTag_way ) )
39  {
40  GeoDataLineString *s = parentItem.nodeAs<GeoDataLineString>();
41  Q_ASSERT( s );
42  quint64 id = parser.attribute( "ref" ).toULongLong();
43  if ( GeoDataPoint *p = parser.node( id ) ) {
44  s->append( GeoDataCoordinates( p->coordinates().longitude(), p->coordinates().latitude() ) );
45  }
46 
47  return 0;
48  }
49 
50  return 0;
51 }
52 
53 }
54 
55 }
Marble::GeoDataPoint
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:47
GeoDataCoordinates.h
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::osm::OsmNdTagHandler::parse
virtual GeoNode * parse(GeoParser &) const
Definition: OsmNdTagHandler.cpp:29
Marble::osm::osmNdTagHandler
static GeoTagHandlerRegistrar osmNdTagHandler(GeoParser::QualifiedName(osmTag_nd,""), new OsmNdTagHandler())
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
Marble::OsmParser::node
GeoDataPoint * node(quint64 id)
Definition: src/plugins/runner/osm/OsmParser.cpp:71
Marble::GeoParser::parentElement
GeoStackItem parentElement(unsigned int depth=0) const
Definition: GeoParser.cpp:122
Marble::osm::osmTag_nd
const char * osmTag_nd
Definition: OsmElementDictionary.cpp:22
Marble::GeoParser
Definition: GeoParser.h:40
OsmElementDictionary.h
OsmNdTagHandler.h
Marble::GeoParser::attribute
QString attribute(const char *attributeName) const
Definition: GeoParser.cpp:200
GeoDataLineString.h
Marble::osm::osmTag_way
const char * osmTag_way
Definition: OsmElementDictionary.cpp:24
Marble::GeoStackItem
Definition: GeoParser.h:97
QString::toULongLong
qulonglong toULongLong(bool *ok, int base) const
Marble::GeoDataLineString::append
void append(const GeoDataCoordinates &position)
Appends a given geodesic position as a new node to the LineString.
Definition: GeoDataLineString.cpp:225
Marble::GeoDataLineString
A LineString that allows to store a contiguous set of line segments.
Definition: GeoDataLineString.h:75
QXmlStreamReader::isStartElement
bool isStartElement() const
GeoDataPoint.h
Marble::OsmParser
Definition: src/plugins/runner/osm/OsmParser.h:29
Marble::GeoParser::QualifiedName
QPair< QString, QString > QualifiedName
Definition: GeoParser.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 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