Marble

DgmlLegendTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <[email protected]>
3  SPDX-FileCopyrightText: 2008 Torsten Rahn <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "DgmlLegendTagHandler.h"
9 
10 #include "MarbleDebug.h"
11 
12 #include "DgmlElementDictionary.h"
13 #include "GeoParser.h"
14 #include "GeoSceneDocument.h"
15 #include "GeoSceneLegend.h"
16 
17 namespace Marble
18 {
19 namespace dgml
20 {
21 DGML_DEFINE_TAG_HANDLER(Legend)
22 
23 GeoNode* DgmlLegendTagHandler::parse(GeoParser& parser) const
24 {
25  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Legend)));
26 
27  // Checking for parent item
28  GeoStackItem parentItem = parser.parentElement();
29  if (parentItem.represents(dgmlTag_Document))
30  return parentItem.nodeAs<GeoSceneDocument>()->legend();
31 
32  return nullptr;
33 }
34 
35 }
36 }
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:41 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.