Marble

KmlLocationTagHandler.cpp
1 
2 // SPDX-License-Identifier: LGPL-2.1-or-later
3 //
4 // SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <[email protected]>
5 //
6 
7 #include "KmlLocationTagHandler.h"
8 
9 #include "MarbleDebug.h"
10 
11 #include "KmlElementDictionary.h"
12 #include "KmlObjectTagHandler.h"
13 #include "GeoDataLocation.h"
14 #include "GeoDataGeometry.h"
15 #include "GeoDataModel.h"
16 #include "GeoDataParser.h"
17 
18 namespace Marble
19 {
20 namespace kml
21 {
22 KML_DEFINE_TAG_HANDLER( Location )
23 
24 GeoNode* KmlLocationTagHandler::parse( GeoParser& parser ) const
25 {
26  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Location)));
27 
28  GeoDataLocation location;
29  KmlObjectTagHandler::parseIdentifiers( parser, &location );
30  GeoStackItem parentItem = parser.parentElement();
31 
32  if( parentItem.represents( kmlTag_Model ) ) {
33  parentItem.nodeAs<GeoDataModel>()->setLocation(location);
34  return &parentItem.nodeAs<GeoDataModel>()->location();
35  }
36  else{
37  return nullptr;
38  }
39 }
40 
41 }
42 }
QVariant location(const QVariant &res)
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 Thu Sep 21 2023 04:12:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.