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 "DgmlElementDictionary.h"
12#include "DgmlAttributeDictionary.h"
13#include "DgmlAuxillaryDictionary.h"
14#include "GeoParser.h"
15#include "GeoSceneLayer.h"
16#include "GeoSceneGeodata.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(QLatin1String(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)
40 && parentItem.nodeAs<GeoSceneLayer>()->backend() == dgmlValue_vector ) {
41
42 vector = new GeoSceneGeodata( name );
43 vector->setProperty( feature );
44 vector->setColorize( feature );
45 parentItem.nodeAs<GeoSceneLayer>()->addDataset( vector );
46 }
47
48 return vector;
49}
50
51}
52}
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 May 24 2024 11:50:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.