• 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
  • lib
  • marble
  • geodata
  • handlers
  • kml
KmlAltitudeModeTagHandler.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Patrick Spendrin <ps_ml@gmx.de>
3  Copyright (C) 2009 Bastian Holst <bastianholst@gmx.de>
4 
5  This file is part of the KDE project
6 
7  This library is free software you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  aint with this library see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include "KmlAltitudeModeTagHandler.h"
24 
25 #include "MarbleDebug.h"
26 
27 #include "KmlElementDictionary.h"
28 
29 #include "GeoDataGeometry.h"
30 #include "GeoDataGroundOverlay.h"
31 #include "GeoDataPoint.h"
32 #include "GeoDataPlacemark.h"
33 #include "GeoDataTrack.h"
34 #include "GeoDataAbstractView.h"
35 #include "GeoDataModel.h"
36 
37 #include "GeoParser.h"
38 
39 namespace Marble
40 {
41 namespace kml
42 {
43 KML_DEFINE_TAG_HANDLER( altitudeMode )
44 
45 GeoNode* KmlaltitudeModeTagHandler::parse( GeoParser& parser ) const
46 {
47  Q_ASSERT( parser.isStartElement() && parser.isValidElement( kmlTag_altitudeMode ) );
48 
49  QString content = parser.readElementText().trimmed();
50 
51  AltitudeMode mode;
52  if( content == QString( "relativeToGround" ) ) {
53  mode = RelativeToGround;
54  } else if( content == QString( "absolute" ) ) {
55  mode = Absolute;
56  } else { // clampToGround is Standard
57  mode = ClampToGround;
58  }
59 
60  GeoStackItem parentItem = parser.parentElement();
61 
62  if ( parentItem.is<GeoDataPlacemark>() ) {
63  parentItem.nodeAs<GeoDataPlacemark>()->geometry()->setAltitudeMode( mode );
64  } else if ( parentItem.is<GeoDataPoint>() ) {
65  parentItem.nodeAs<GeoDataPoint>()->setAltitudeMode( mode );
66  } else if ( parentItem.is<GeoDataLatLonAltBox>() ) {
67  parentItem.nodeAs<GeoDataLatLonAltBox>()->setAltitudeMode( mode );
68  } else if ( parentItem.is<GeoDataTrack>() ) {
69  parentItem.nodeAs<GeoDataTrack>()->setAltitudeMode( mode );
70  } else if ( parentItem.is<GeoDataGroundOverlay>() ) {
71  parentItem.nodeAs<GeoDataGroundOverlay>()->setAltitudeMode( mode );
72  } else if ( parentItem.is<GeoDataAbstractView>() ) {
73  parentItem.nodeAs<GeoDataAbstractView>()->setAltitudeMode( mode );
74  } else if ( parentItem.is<GeoDataModel>() ) {
75  parentItem.nodeAs<GeoDataModel>()->setAltitudeMode( mode );
76  }
77 
78  return 0;
79 }
80 
81 }
82 }
Marble::GeoDataPoint
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:47
Marble::GeoDataTrack
A geometry for tracking objects made of (time, coordinates) pairs.
Definition: GeoDataTrack.h:54
Marble::GeoDataAbstractView
Definition: GeoDataAbstractView.h:30
GeoDataAbstractView.h
Marble::GeoStackItem::nodeAs
T * nodeAs()
Definition: GeoParser.h:120
Marble::Absolute
Altitude is given relative to the sealevel.
Definition: MarbleGlobal.h:150
GeoDataGroundOverlay.h
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoParser.h
Marble::kml::kmlTag_altitudeMode
const char * kmlTag_altitudeMode
Definition: KmlElementDictionary.cpp:41
GeoDataModel.h
Marble::GeoDataModel
Definition: GeoDataModel.h:29
MarbleDebug.h
GeoDataTrack.h
Marble::GeoParser
Definition: GeoParser.h:40
Marble::RelativeToGround
Altitude is always given relative to ground level.
Definition: MarbleGlobal.h:149
KmlElementDictionary.h
Marble::AltitudeMode
AltitudeMode
Definition: MarbleGlobal.h:147
QString::trimmed
QString trimmed() const
Marble::GeoStackItem
Definition: GeoParser.h:97
KML_DEFINE_TAG_HANDLER
#define KML_DEFINE_TAG_HANDLER(Name)
Definition: KmlElementDictionary.h:242
QString
KmlAltitudeModeTagHandler.h
GeoDataPlacemark.h
GeoDataPoint.h
Marble::ClampToGround
Altitude always sticks to ground level.
Definition: MarbleGlobal.h:148
Marble::kml::KmlaltitudeModeTagHandler
Definition: KmlAltitudeModeTagHandler.h:32
Marble::GeoDataGroundOverlay
Definition: GeoDataGroundOverlay.h:24
GeoDataGeometry.h
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::GeoDataLatLonAltBox
A class that defines a 3D bounding box for geographic data.
Definition: GeoDataLatLonAltBox.h:49
Marble::GeoStackItem::is
bool is() const
Definition: GeoParser.h:127
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 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