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 "MarbleDebug.h"
10#include "KmlElementDictionary.h"
11
12#include "GeoDataGeometry.h"
13#include "GeoDataPoint.h"
14#include "GeoDataPolygon.h"
15#include "GeoDataLineString.h"
16#include "GeoDataLinearRing.h"
17#include "GeoDataPlacemark.h"
18
19#include "GeoParser.h"
20
21namespace Marble
22{
23namespace kml
24{
25KML_DEFINE_TAG_HANDLER( extrude )
26
27GeoNode* KmlextrudeTagHandler::parse( GeoParser& parser ) const
28{
29 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_extrude)));
30
31 GeoStackItem parentItem = parser.parentElement();
32
33 GeoDataGeometry* geometry;
34 bool validParents = false;
35
36 if( parentItem.is<GeoDataPoint>() ) {
37 geometry = parentItem.nodeAs<GeoDataPoint>();
38 validParents = true;
39 } else if( parentItem.is<GeoDataPlacemark>() ) {
40 geometry = parentItem.nodeAs<GeoDataPlacemark>()->geometry();
41 validParents = true;
42 } else if( parentItem.is<GeoDataPolygon>() ) {
43 geometry = parentItem.nodeAs<GeoDataPolygon>();
44 validParents = true;
45 } else if( parentItem.is<GeoDataLineString>() ) {
46 geometry = parentItem.nodeAs<GeoDataLineString>();
47 validParents = true;
48 } else if( parentItem.is<GeoDataLinearRing>() ) {
49 geometry = parentItem.nodeAs<GeoDataLinearRing>();
50 validParents = true;
51 }
52
53 if( validParents ) {
54 QString content = parser.readElementText().trimmed();
55
56 const bool extrude = (content == QLatin1String("1"));
57 geometry->setExtrude(extrude);
58 }
59
60 return nullptr;
61}
62
63}
64}
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 17 2024 11:49:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.