• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • handlers
  • kml
KmlExtrudeTagHandler.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Patrick Spendrin <ps_ml@gmx.de>
3  Copyright (C) 2014 Marek Hakala <hakala.marek@gmail.com>
4 
5  This file is part of the KDE project
6 
7  This library is free software you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  aint with this library see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include "KmlExtrudeTagHandler.h"
24 #include "MarbleDebug.h"
25 #include "KmlElementDictionary.h"
26 
27 #include "GeoDataGeometry.h"
28 #include "GeoDataPoint.h"
29 #include "GeoDataPolygon.h"
30 #include "GeoDataLineString.h"
31 #include "GeoDataLinearRing.h"
32 #include "GeoDataPlacemark.h"
33 
34 #include "GeoParser.h"
35 
36 namespace Marble
37 {
38 namespace kml
39 {
40 KML_DEFINE_TAG_HANDLER( extrude )
41 
42 GeoNode* KmlextrudeTagHandler::parse( GeoParser& parser ) const
43 {
44  Q_ASSERT( parser.isStartElement() && parser.isValidElement( kmlTag_extrude ) );
45  GeoStackItem parentItem = parser.parentElement();
46 
47  GeoDataGeometry* geometry;
48  bool validParents = false;
49 
50  if( parentItem.is<GeoDataPoint>() ) {
51  geometry = parentItem.nodeAs<GeoDataPoint>();
52  validParents = true;
53  } else if( parentItem.is<GeoDataPlacemark>() ) {
54  geometry = parentItem.nodeAs<GeoDataPlacemark>()->geometry();
55  validParents = true;
56  } else if( parentItem.is<GeoDataPolygon>() ) {
57  geometry = parentItem.nodeAs<GeoDataPolygon>();
58  validParents = true;
59  } else if( parentItem.is<GeoDataLineString>() ) {
60  geometry = parentItem.nodeAs<GeoDataLineString>();
61  validParents = true;
62  } else if( parentItem.is<GeoDataLinearRing>() ) {
63  geometry = parentItem.nodeAs<GeoDataLinearRing>();
64  validParents = true;
65  }
66 
67  if( validParents ) {
68  QString content = parser.readElementText().trimmed();
69 
70  if( content == QString( "1" ) ) {
71  geometry->setExtrude( true );
72  } else {
73  geometry->setExtrude( false );
74  }
75  }
76 
77  return 0;
78 }
79 
80 }
81 }
Marble::GeoDataPoint
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:47
Marble::GeoDataLinearRing
A LinearRing that allows to store a closed, contiguous set of line segments.
Definition: GeoDataLinearRing.h:68
Marble::kml::kmlTag_extrude
const char * kmlTag_extrude
Definition: KmlElementDictionary.cpp:68
GeoDataPolygon.h
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoParser.h
Marble::GeoDataGeometry::setExtrude
void setExtrude(bool extrude)
Definition: GeoDataGeometry.cpp:105
Marble::GeoDataGeometry
A base class for all geodata features.
Definition: GeoDataGeometry.h:47
MarbleDebug.h
Marble::GeoParser
Definition: GeoParser.h:40
KmlExtrudeTagHandler.h
KmlElementDictionary.h
Marble::GeoDataPolygon
A polygon that can have "holes".
Definition: GeoDataPolygon.h:81
QString::trimmed
QString trimmed() const
GeoDataLineString.h
Marble::GeoStackItem
Definition: GeoParser.h:97
KML_DEFINE_TAG_HANDLER
#define KML_DEFINE_TAG_HANDLER(Name)
Definition: KmlElementDictionary.h:242
QString
GeoDataPlacemark.h
Marble::GeoDataLineString
A LineString that allows to store a contiguous set of line segments.
Definition: GeoDataLineString.h:75
GeoDataLinearRing.h
GeoDataPoint.h
GeoDataGeometry.h
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::kml::KmlextrudeTagHandler
Definition: KmlExtrudeTagHandler.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal