Marble

KmlFlyToModeTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
4//
5
6#include "KmlFlyToModeTagHandler.h"
7#include "GeoDataFlyTo.h"
8#include "GeoParser.h"
9#include "KmlElementDictionary.h"
10#include "MarbleDebug.h"
11
12namespace Marble
13{
14namespace kml
15{
16KML_DEFINE_TAG_HANDLER_GX22(flyToMode)
17
18GeoNode *KmlflyToModeTagHandler::parse(GeoParser &parser) const
19{
20 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_flyToMode)));
21
22 QString content = parser.readElementText().trimmed();
23
24 GeoDataFlyTo::FlyToMode mode;
25 if (content == QLatin1StringView("smooth")) {
26 mode = GeoDataFlyTo::Smooth;
27 } else if (content == QLatin1StringView("bounce")) {
28 mode = GeoDataFlyTo::Bounce;
29 } else {
30 mDebug() << "Unknown mode " << content << ", using 'bounce' instead.";
31 mode = GeoDataFlyTo::Bounce;
32 }
33
34 GeoStackItem parentItem = parser.parentElement();
35
36 if (parentItem.is<GeoDataFlyTo>()) {
37 parentItem.nodeAs<GeoDataFlyTo>()->setFlyToMode(mode);
38 }
39
40 return nullptr;
41}
42
43}
44}
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.