Marble

KmlLookAtTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Gaurav Gupta <[email protected]>
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 
15 namespace Marble
16 {
17 namespace kml
18 {
19 
20 KML_DEFINE_TAG_HANDLER( LookAt )
21 
22 GeoNode *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-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.