Marble

DgmlGroupTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "DgmlGroupTagHandler.h"
8 
9 #include "MarbleDebug.h"
10 
11 #include "DgmlElementDictionary.h"
12 #include "DgmlAttributeDictionary.h"
13 #include "GeoParser.h"
14 #include "GeoSceneDocument.h"
15 #include "GeoSceneSettings.h"
16 #include "GeoSceneGroup.h"
17 
18 namespace Marble
19 {
20 namespace dgml
21 {
22 DGML_DEFINE_TAG_HANDLER(Group)
23 
24 GeoNode* DgmlGroupTagHandler::parse(GeoParser& parser) const
25 {
26  // Check whether the tag is valid
27  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Group)));
28 
29  QString name = parser.attribute(dgmlAttr_name);
30 
31  GeoSceneGroup* group = nullptr;
32 
33  // Checking for parent item
34  GeoStackItem parentItem = parser.parentElement();
35  if (parentItem.represents(dgmlTag_Settings)) {
36  group = new GeoSceneGroup( name );
37  parentItem.nodeAs<GeoSceneSettings>()->addGroup( group );
38  }
39 
40  return group;
41 }
42 
43 }
44 }
Binds a QML item to a specific geodetic location in screen coordinates.
QString name(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.