Marble

KmlTiltTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Mayank Madan <[email protected]>
4 //
5 
6 #include "KmlTiltTagHandler.h"
7 
8 #include "MarbleDebug.h"
9 
10 #include "KmlElementDictionary.h"
11 #include "GeoDataCamera.h"
12 #include "GeoParser.h"
13 #include "GeoDataOrientation.h"
14 
15 
16 namespace Marble
17 {
18 namespace kml
19 {
20 KML_DEFINE_TAG_HANDLER( tilt )
21 
22 GeoNode* KmltiltTagHandler::parse( GeoParser& parser ) const
23 {
24  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_tilt)));
25 
26  GeoStackItem parentItem = parser.parentElement();
27 
28  if ( parentItem.is<GeoDataCamera>() ){
29  qreal tilt = parser.readElementText().trimmed().toDouble();
30  parentItem.nodeAs<GeoDataCamera>()->setTilt(tilt);
31  } else if ( parentItem.is<GeoDataOrientation>() ){
32  double tilt = parser.readElementText().trimmed().toDouble();
33  parentItem.nodeAs<GeoDataOrientation>()->setTilt(tilt);
34  }
35  return nullptr;
36 }
37 
38 }
39 }
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.