Marble

KmlPlacemarkTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlPlacemarkTagHandler.h"
8
9#include "GeoDataContainer.h"
10#include "GeoDataDocument.h"
11#include "GeoDataParser.h"
12#include "GeoDataPlacemark.h"
13#include "KmlElementDictionary.h"
14#include "KmlObjectTagHandler.h"
15
16namespace Marble
17{
18namespace kml
19{
20KML_DEFINE_TAG_HANDLER(Placemark)
21
22GeoNode *KmlPlacemarkTagHandler::parse(GeoParser &parser) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_Placemark)));
25
26 auto placemark = new GeoDataPlacemark;
27 KmlObjectTagHandler::parseIdentifiers(parser, placemark);
28
29 GeoStackItem parentItem = parser.parentElement();
30
31 if (parentItem.represents(kmlTag_Folder) || parentItem.represents(kmlTag_Document) || parentItem.represents(kmlTag_Change)
32 || parentItem.represents(kmlTag_Create) || parentItem.represents(kmlTag_Delete)) {
33 parentItem.nodeAs<GeoDataContainer>()->append(placemark);
34 return placemark;
35 } else if (parentItem.qualifiedName().first == QString::fromLatin1(kmlTag_kml)) {
36 GeoDataDocument *doc = geoDataDoc(parser);
37 doc->append(placemark);
38 return placemark;
39 } else {
40 delete placemark;
41 return nullptr;
42 }
43}
44
45}
46}
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
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.