Marble

KmlLookAtTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Gaurav Gupta <1989.gaurav@googlemail.com>
4//
5#include "KmlLookAtTagHandler.h"
6
7#include "MarbleDebug.h"
8
9#include "GeoDataFeature.h"
10#include "GeoDataFlyTo.h"
11#include "GeoDataLookAt.h"
12#include "GeoParser.h"
13#include "KmlElementDictionary.h"
14
15namespace Marble
16{
17namespace kml
18{
19
20KML_DEFINE_TAG_HANDLER(LookAt)
21
22GeoNode *KmlLookAtTagHandler::parse(GeoParser &parser) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_LookAt)));
25
26 auto lookAt = new GeoDataLookAt();
27 GeoStackItem parentItem = parser.parentElement();
28 if (parentItem.is<GeoDataFeature>()) {
29 auto feature = parentItem.nodeAs<GeoDataFeature>();
30 feature->setAbstractView(lookAt);
31 return lookAt;
32 }
33 if (parentItem.is<GeoDataFlyTo>()) {
34 auto feature = parentItem.nodeAs<GeoDataFlyTo>();
35 feature->setView(lookAt);
36 return lookAt;
37 } else {
38 delete lookAt;
39 return nullptr;
40 }
41}
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-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.