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 "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13#include "GeoDataContainer.h"
14#include "GeoDataPlacemark.h"
15#include "GeoDataDocument.h"
16#include "GeoDataParser.h"
17
18namespace Marble
19{
20namespace kml
21{
22KML_DEFINE_TAG_HANDLER( Placemark )
23
24GeoNode* KmlPlacemarkTagHandler::parse( GeoParser& parser ) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Placemark)));
27
28 GeoDataPlacemark *placemark = new GeoDataPlacemark;
29 KmlObjectTagHandler::parseIdentifiers( parser, placemark );
30
31 GeoStackItem parentItem = parser.parentElement();
32
33 if( parentItem.represents( kmlTag_Folder ) || parentItem.represents( kmlTag_Document ) ||
34 parentItem.represents( kmlTag_Change ) || parentItem.represents( kmlTag_Create ) || parentItem.represents( kmlTag_Delete ) ){
35 parentItem.nodeAs<GeoDataContainer>()->append( placemark );
36 return placemark;
37 } else if ( parentItem.qualifiedName().first == kmlTag_kml ) {
38 GeoDataDocument* doc = geoDataDoc(parser);
39 doc->append( placemark );
40 return placemark;
41 } else {
42 delete placemark;
43 return nullptr;
44 }
45}
46
47}
48}
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 Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.