Marble

KmlLocationTagHandler.cpp
1
2// SPDX-License-Identifier: LGPL-2.1-or-later
3//
4// SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <sanjiban22393@gmail.com>
5//
6
7#include "KmlLocationTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "GeoDataGeometry.h"
12#include "GeoDataLocation.h"
13#include "GeoDataModel.h"
14#include "GeoDataParser.h"
15#include "KmlElementDictionary.h"
16#include "KmlObjectTagHandler.h"
17
18namespace Marble
19{
20namespace kml
21{
22KML_DEFINE_TAG_HANDLER(Location)
23
24GeoNode *KmlLocationTagHandler::parse(GeoParser &parser) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(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 } else {
36 return nullptr;
37 }
38}
39
40}
41}
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-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.