Marble

KmlLatitudeTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Gaurav Gupta <[email protected]>
4 // SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <[email protected]>
5 //
6 
7 #include "KmlLatitudeTagHandler.h"
8 
9 #include "MarbleDebug.h"
10 
11 #include "KmlElementDictionary.h"
12 #include "MarbleGlobal.h"
13 
14 #include "GeoDataLookAt.h"
15 #include "GeoDataCamera.h"
16 #include "GeoParser.h"
17 #include "GeoDataCoordinates.h"
18 #include "GeoDataLocation.h"
19 
20 namespace Marble
21 {
22 namespace kml
23 {
24  KML_DEFINE_TAG_HANDLER( latitude )
25  GeoNode *KmllatitudeTagHandler::parse( GeoParser & parser ) const
26  {
27  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_latitude)));
28 
29  GeoStackItem parentItem = parser.parentElement();
30 
31  if ( parentItem.is<GeoDataLookAt>() ) {
32  qreal latitude = parser.readElementText().trimmed().toDouble();
33  parentItem.nodeAs<GeoDataLookAt>()->setLatitude(latitude, GeoDataCoordinates::Degree);
34  } else if ( parentItem.is<GeoDataCamera>() ) {
35  qreal latitude = parser.readElementText().trimmed().toDouble();
36  parentItem.nodeAs<GeoDataCamera>()->setLatitude(latitude, GeoDataCoordinates::Degree);
37  } else if ( parentItem.is<GeoDataLocation>() ) {
38  qreal latitude = parser.readElementText().trimmed().toDouble();
39  parentItem.nodeAs<GeoDataLocation>()->setLatitude(latitude, GeoDataCoordinates::Degree);
40  }
41  return nullptr;
42  }
43  }
44 }
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:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.