• 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
KmlGxAltitudeModeTagHandler.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 2013 Sanjiban Bairagya <sanjiban22393@gmail.com>
9 //
10 
11 
12 #include "KmlGxAltitudeModeTagHandler.h"
13 #include "KmlAltitudeModeTagHandler.h"
14 
15 #include "MarbleDebug.h"
16 
17 #include "KmlElementDictionary.h"
18 
19 #include "GeoDataGeometry.h"
20 #include "GeoDataGroundOverlay.h"
21 #include "GeoDataPoint.h"
22 #include "GeoDataPlacemark.h"
23 #include "GeoDataTrack.h"
24 #include "GeoDataAbstractView.h"
25 #include "GeoDataModel.h"
26 
27 #include "GeoParser.h"
28 
29 namespace Marble
30 {
31 namespace kml
32 {
33 namespace gx
34 {
35 KML_DEFINE_TAG_HANDLER_GX22( altitudeMode )
36 
37 GeoNode* KmlaltitudeModeTagHandler::parse( GeoParser& parser ) const
38 {
39  Q_ASSERT( parser.isStartElement() && parser.isValidElement( kmlTag_altitudeMode ) );
40 
41  QString content = parser.readElementText().trimmed();
42 
43  AltitudeMode mode;
44  if( content == QString( "relativeToGround" ) ) {
45  mode = RelativeToGround;
46  } else if( content == QString( "absolute" ) ) {
47  mode = Absolute;
48  } else if( content == QString( "relativeToSeaFloor" ) ) {
49  mode = RelativeToSeaFloor;
50  } else if( content == QString( "clampToSeaFloor" ) ) {
51  mode = ClampToSeaFloor;
52  }else if( content == QString( "clampToGround" ) ) {
53  mode = ClampToGround;
54  } else {
55  mDebug() << "Unknown altitude mode " << content << ", falling back to 'clampToGround'";
56  mode = ClampToGround;
57  }
58 
59  GeoStackItem parentItem = parser.parentElement();
60 
61  if ( parentItem.is<GeoDataPlacemark>() ) {
62  parentItem.nodeAs<GeoDataPlacemark>()->geometry()->setAltitudeMode( mode );
63  } else if ( parentItem.is<GeoDataPoint>() ) {
64  parentItem.nodeAs<GeoDataPoint>()->setAltitudeMode( mode );
65  } else if ( parentItem.is<GeoDataLatLonAltBox>() ) {
66  parentItem.nodeAs<GeoDataLatLonAltBox>()->setAltitudeMode( mode );
67  } else if ( parentItem.is<GeoDataTrack>() ) {
68  parentItem.nodeAs<GeoDataTrack>()->setAltitudeMode( mode );
69  } else if ( parentItem.is<GeoDataGroundOverlay>() ) {
70  parentItem.nodeAs<GeoDataGroundOverlay>()->setAltitudeMode( mode );
71  } else if ( parentItem.is<GeoDataAbstractView>() ) {
72  parentItem.nodeAs<GeoDataAbstractView>()->setAltitudeMode( mode );
73  } else if ( parentItem.is<GeoDataModel>() ) {
74  parentItem.nodeAs<GeoDataModel>()->setAltitudeMode( mode );
75  }
76 
77  return 0;
78 }
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
Marble::kml::gx::KmlaltitudeModeTagHandler
Definition: KmlGxAltitudeModeTagHandler.h:22
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::ClampToSeaFloor
Altitude always sticks to sea floor.
Definition: MarbleGlobal.h:152
Marble::kml::kmlTag_altitudeMode
const char * kmlTag_altitudeMode
Definition: KmlElementDictionary.cpp:41
GeoDataModel.h
Marble::GeoDataModel
Definition: GeoDataModel.h:29
MarbleDebug.h
GeoDataTrack.h
KmlGxAltitudeModeTagHandler.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
QString
KmlAltitudeModeTagHandler.h
GeoDataPlacemark.h
GeoDataPoint.h
KML_DEFINE_TAG_HANDLER_GX22
#define KML_DEFINE_TAG_HANDLER_GX22(Name)
Definition: KmlElementDictionary.h:240
Marble::ClampToGround
Altitude always sticks to ground level.
Definition: MarbleGlobal.h:148
Marble::GeoDataGroundOverlay
Definition: GeoDataGroundOverlay.h:24
GeoDataGeometry.h
Marble::RelativeToSeaFloor
Altitude is given relative to the sea floor.
Definition: MarbleGlobal.h:151
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
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