Marble

DgmlPropertyTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "DgmlPropertyTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "DgmlElementDictionary.h"
12#include "DgmlAttributeDictionary.h"
13#include "GeoParser.h"
14#include "GeoSceneSettings.h"
15#include "GeoSceneGroup.h"
16#include "GeoSceneProperty.h"
17
18namespace Marble
19{
20namespace dgml
21{
22DGML_DEFINE_TAG_HANDLER(Property)
23
24GeoNode* DgmlPropertyTagHandler::parse(GeoParser& parser) const
25{
26 // Check whether the tag is valid
27 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Property)));
28
29 QString name = parser.attribute(dgmlAttr_name).trimmed();
30
31 GeoSceneProperty* property = nullptr;
32
33 // Checking for parent item
34 GeoStackItem parentItem = parser.parentElement();
35 if (parentItem.represents(dgmlTag_Settings)) {
36 property = new GeoSceneProperty( name );
37 parentItem.nodeAs<GeoSceneSettings>()->addProperty( property );
38 }
39 if (parentItem.represents(dgmlTag_Group)) {
40 property = new GeoSceneProperty( name );
41 parentItem.nodeAs<GeoSceneGroup>()->addProperty( property);
42 }
43
44 return property;
45}
46
47}
48}
QString name(StandardAction id)
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
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.