Marble

KmlLongitudeTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Gaurav Gupta <1989.gaurav@googlemail.com>
4// SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <sanjiban22393@gmail.com>
5//
6
7#include "KmlLongitudeTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12
13#include "GeoDataLookAt.h"
14#include "GeoDataCamera.h"
15#include "GeoParser.h"
16#include "GeoDataCoordinates.h"
17#include "MarbleGlobal.h"
18#include "GeoDataLocation.h"
19
20namespace Marble
21{
22namespace kml
23{
24 KML_DEFINE_TAG_HANDLER( longitude )
25
26 GeoNode *KmllongitudeTagHandler::parse( GeoParser & parser ) const
27 {
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_longitude)));
29
30 GeoStackItem parentItem = parser.parentElement();
31 if ( parentItem.is<GeoDataLookAt>() ) {
32 qreal longitude = parser.readElementText().trimmed().toDouble();
33 parentItem.nodeAs<GeoDataLookAt>()->setLongitude(longitude, GeoDataCoordinates::Degree);
34 } else if ( parentItem.is<GeoDataCamera>() ) {
35 qreal longitude = parser.readElementText().trimmed().toDouble();
36 parentItem.nodeAs<GeoDataCamera>()->setLongitude(longitude, GeoDataCoordinates::Degree);
37 } else if ( parentItem.is<GeoDataLocation>() ) {
38 qreal longitude = parser.readElementText().trimmed().toDouble();
39 parentItem.nodeAs<GeoDataLocation>()->setLongitude(longitude, GeoDataCoordinates::Degree);
40 }
41
42 return nullptr;
43 }
44
45}
46}
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.