Marble

KmlStyleTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008-2009 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlStyleTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13#include "GeoDataStyle.h"
14#include "GeoDataFeature.h"
15#include "GeoParser.h"
16#include "GeoDataDocument.h"
17
18namespace Marble
19{
20namespace kml
21{
22KML_DEFINE_TAG_HANDLER( Style )
23
24GeoNode* KmlStyleTagHandler::parse( GeoParser& parser ) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Style)));
27
28
29 GeoStackItem parentItem = parser.parentElement();
30 /// for documents several styles are allowed: document wide styles are saved different!!!!!
31 if( parentItem.represents( kmlTag_Document ) ) {
32 GeoDataStyle::Ptr style(new GeoDataStyle);
33 KmlObjectTagHandler::parseIdentifiers( parser, style.data() );
34 parentItem.nodeAs<GeoDataDocument>()->addStyle( style );
35 return parentItem.nodeAs<GeoDataDocument>()->style( style->id() ).data();
36 }
37 else if ( parentItem.represents( kmlTag_Placemark ) ) {
38 GeoDataStyle::Ptr style(new GeoDataStyle);
39 KmlObjectTagHandler::parseIdentifiers( parser, style.data() );
40 parentItem.nodeAs<GeoDataFeature>()->setStyle( style );
41 return style.data();
42 }
43 // FIXME: KMLStyle can be contained in MultiGeometry as well
44 return nullptr;
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.