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
8// Own
9#include "GeoSceneParser.h"
10
11// Marble
12#include "MarbleDebug.h"
13
14// Geodata
15#include "GeoDocument.h"
16#include "GeoSceneDocument.h"
17#include "GeoTagHandler.h"
18
19// DGML support
20#include "DgmlElementDictionary.h"
21
22namespace Marble
23{
24
25GeoSceneParser::GeoSceneParser(GeoSceneSourceType source)
26 : GeoParser(source)
27{
28}
29
30GeoSceneParser::~GeoSceneParser()
31{
32 // nothing to do
33}
34
35bool GeoSceneParser::isValidRootElement()
36{
37 switch ((GeoSceneSourceType) m_source) {
38 case GeoScene_DGML:
39 return isValidElement(dgml::dgmlTag_Dgml);
40 default:
41 Q_ASSERT(false);
42 return false;
43 }
44}
45
46bool GeoSceneParser::isValidElement(const QString& tagName) const
47{
48 if (!GeoParser::isValidElement(tagName))
49 return false;
50
51 switch ((GeoSceneSourceType) m_source) {
52 case GeoScene_DGML:
53 return (namespaceUri() == QLatin1String(dgml::dgmlTag_nameSpace20));
54 default:
55 break;
56 }
57
58 // Should never be reached.
59 Q_ASSERT(false);
60 return false;
61}
62
63GeoDocument* GeoSceneParser::createDocument() const
64{
65 return new GeoSceneDocument;
66}
67
68// Global helper function for the tag handlers
69GeoSceneDocument* geoSceneDoc(GeoParser& parser)
70{
71 GeoDocument* document = parser.activeDocument();
72 Q_ASSERT(document->isGeoSceneDocument());
73 return static_cast<GeoSceneDocument*>(document);
74}
75
76}
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.