Marble

DgmlVectorTagHandler.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 "DgmlVectorTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "DgmlAttributeDictionary.h"
12#include "DgmlAuxillaryDictionary.h"
13#include "DgmlElementDictionary.h"
14#include "GeoParser.h"
15#include "GeoSceneGeodata.h"
16#include "GeoSceneLayer.h"
17
18namespace Marble
19{
20namespace dgml
21{
22DGML_DEFINE_TAG_HANDLER(Vector)
23
24GeoNode *DgmlVectorTagHandler::parse(GeoParser &parser) const
25{
26 // Check whether the tag is valid
27 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(dgmlTag_Vector)));
28
29 QString name = parser.attribute(dgmlAttr_name).trimmed();
30 QString feature = parser.attribute(dgmlAttr_feature).trimmed();
31
32 GeoSceneGeodata *vector = nullptr;
33
34 // Checking for parent item
35 GeoStackItem parentItem = parser.parentElement();
36
37 // Check parent type and make sure that the dataSet type
38 // matches the backend of the parent layer
39 if (parentItem.represents(dgmlTag_Layer) && parentItem.nodeAs<GeoSceneLayer>()->backend() == QString::fromLatin1(dgmlValue_vector)) {
40 vector = new GeoSceneGeodata(name);
41 vector->setProperty(feature);
42 vector->setColorize(feature);
43 parentItem.nodeAs<GeoSceneLayer>()->addDataset(vector);
44 }
45
46 return vector;
47}
48
49}
50}
QString name(GameStandardAction id)
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.