Marble

KmlExtrudeTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3 SPDX-FileCopyrightText: 2014 Marek Hakala <hakala.marek@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "KmlExtrudeTagHandler.h"
9#include "KmlElementDictionary.h"
10
11#include "GeoDataGeometry.h"
12#include "GeoDataLineString.h"
13#include "GeoDataLinearRing.h"
14#include "GeoDataPlacemark.h"
15#include "GeoDataPoint.h"
16#include "GeoDataPolygon.h"
17
18#include "GeoParser.h"
19
20namespace Marble
21{
22namespace kml
23{
24KML_DEFINE_TAG_HANDLER(extrude)
25
26GeoNode *KmlextrudeTagHandler::parse(GeoParser &parser) const
27{
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_extrude)));
29
30 GeoStackItem parentItem = parser.parentElement();
31
32 GeoDataGeometry *geometry;
33 bool validParents = false;
34
35 if (parentItem.is<GeoDataPoint>()) {
36 geometry = parentItem.nodeAs<GeoDataPoint>();
37 validParents = true;
38 } else if (parentItem.is<GeoDataPlacemark>()) {
39 geometry = parentItem.nodeAs<GeoDataPlacemark>()->geometry();
40 validParents = true;
41 } else if (parentItem.is<GeoDataPolygon>()) {
42 geometry = parentItem.nodeAs<GeoDataPolygon>();
43 validParents = true;
44 } else if (parentItem.is<GeoDataLineString>()) {
45 geometry = parentItem.nodeAs<GeoDataLineString>();
46 validParents = true;
47 } else if (parentItem.is<GeoDataLinearRing>()) {
48 geometry = parentItem.nodeAs<GeoDataLinearRing>();
49 validParents = true;
50 }
51
52 if (validParents) {
53 QString content = parser.readElementText().trimmed();
54
55 const bool extrude = (content == QLatin1StringView("1"));
56 geometry->setExtrude(extrude);
57 }
58
59 return nullptr;
60}
61
62}
63}
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.