Marble

KmlAltitudeTagHandler.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 "KmlAltitudeTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12
13#include "GeoDataCamera.h"
14#include "GeoDataCoordinates.h"
15#include "GeoDataGroundOverlay.h"
16#include "GeoDataLocation.h"
17#include "GeoDataLookAt.h"
18#include "GeoParser.h"
19
20namespace Marble
21{
22namespace kml
23{
24KML_DEFINE_TAG_HANDLER(altitude)
25GeoNode *KmlaltitudeTagHandler::parse(GeoParser &parser) const
26{
27 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_altitude)));
28
29 GeoStackItem parentItem = parser.parentElement();
30
31 qreal const altitude = parser.readElementText().trimmed().toDouble();
32 if (parentItem.is<GeoDataLookAt>()) {
33 parentItem.nodeAs<GeoDataLookAt>()->setAltitude(altitude);
34 } else if (parentItem.is<GeoDataCamera>()) {
35 parentItem.nodeAs<GeoDataCamera>()->setAltitude(altitude);
36 } else if (parentItem.is<GeoDataGroundOverlay>()) {
37 parentItem.nodeAs<GeoDataGroundOverlay>()->setAltitude(altitude);
38 } else if (parentItem.is<GeoDataLocation>()) {
39 parentItem.nodeAs<GeoDataLocation>()->setAltitude(altitude);
40 }
41
42 return nullptr;
43}
44}
45}
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 Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.