Marble

KmlShapeTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mohammed Nafees <nafees.technocool@gmail.com>
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
14namespace Marble
15{
16namespace kml
17{
18KML_DEFINE_TAG_HANDLER( shape )
19
20GeoNode* 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.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.