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 "KmlElementDictionary.h"
10#include "GeoDataLookAt.h"
11#include "GeoParser.h"
12#include "GeoDataFeature.h"
13#include "GeoDataFlyTo.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(QLatin1String(kmlTag_LookAt)));
25
26 GeoDataLookAt *lookAt = new GeoDataLookAt();
27 GeoStackItem parentItem = parser.parentElement();
28 if ( parentItem.is<GeoDataFeature>() ) {
29 GeoDataFeature *feature = parentItem.nodeAs<GeoDataFeature>();
30 feature->setAbstractView( lookAt );
31 return lookAt;
32 } if ( parentItem.is<GeoDataFlyTo>() ) {
33 GeoDataFlyTo *feature = parentItem.nodeAs<GeoDataFlyTo>();
34 feature->setView( lookAt );
35 return lookAt;
36 } else {
37 delete lookAt;
38 return nullptr;
39 }
40}
41
42}
43}
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 Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.