Marble

GeoSceneParser.cpp
1/*
2 SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7// Own
8#include "GeoSceneParser.h"
9
10// Geodata
11#include "GeoDocument.h"
12#include "GeoSceneDocument.h"
13
14// DGML support
15#include "DgmlElementDictionary.h"
16
17namespace Marble
18{
19
20GeoSceneParser::GeoSceneParser(GeoSceneSourceType source)
21 : GeoParser(source)
22{
23}
24
25GeoSceneParser::~GeoSceneParser()
26{
27 // nothing to do
28}
29
30bool GeoSceneParser::isValidRootElement()
31{
32 switch ((GeoSceneSourceType)m_source) {
33 case GeoScene_DGML:
34 return isValidElement(QString::fromLatin1(dgml::dgmlTag_Dgml));
35 default:
36 Q_ASSERT(false);
37 return false;
38 }
39}
40
41bool GeoSceneParser::isValidElement(const QString &tagName) const
42{
43 if (!GeoParser::isValidElement(tagName))
44 return false;
45
46 switch ((GeoSceneSourceType)m_source) {
47 case GeoScene_DGML:
48 return (namespaceUri() == QLatin1StringView(dgml::dgmlTag_nameSpace20));
49 default:
50 break;
51 }
52
53 // Should never be reached.
54 Q_ASSERT(false);
55 return false;
56}
57
58GeoDocument *GeoSceneParser::createDocument() const
59{
60 return new GeoSceneDocument;
61}
62
63// Global helper function for the tag handlers
64GeoSceneDocument *geoSceneDoc(GeoParser &parser)
65{
66 GeoDocument *document = parser.activeDocument();
67 Q_ASSERT(document->isGeoSceneDocument());
68 return static_cast<GeoSceneDocument *>(document);
69}
70
71}
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.