Marble

KmlShapeTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Mohammed Nafees <[email protected]>
4 //
5 
6 #include "KmlShapeTagHandler.h"
7 
8 #include "MarbleDebug.h"
9 
10 #include "KmlElementDictionary.h"
11 #include "GeoDataPhotoOverlay.h"
12 #include "GeoDataParser.h"
13 
14 namespace Marble
15 {
16 namespace kml
17 {
18 KML_DEFINE_TAG_HANDLER( shape )
19 
20 GeoNode* KmlshapeTagHandler::parse( GeoParser& parser ) const
21 {
22  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_shape)));
23 
24  GeoStackItem parentItem = parser.parentElement();
25 
26  if (parentItem.represents( kmlTag_PhotoOverlay ))
27  {
28  GeoDataPhotoOverlay::Shape shape;
29  QString shapeText = parser.readElementText();
30 
31  if (shapeText == QLatin1String("rectangle")) {
32  shape = GeoDataPhotoOverlay::Rectangle;
33  } else if (shapeText == QLatin1String("cylinder")) {
34  shape = GeoDataPhotoOverlay::Cylinder;
35  } else if (shapeText == QLatin1String("sphere")) {
36  shape = GeoDataPhotoOverlay::Sphere;
37  } else {
38  mDebug() << "Unknown shape attribute" << shapeText << ", falling back to default value 'rectangle'";
39  shape = GeoDataPhotoOverlay::Rectangle;
40  }
41 
42  parentItem.nodeAs<GeoDataPhotoOverlay>()->setShape( shape );
43  }
44  return nullptr;
45 }
46 
47 }
48 }
Binds a QML item to a specific geodetic location in screen coordinates.
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 04:09:48 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.