File indexing completed on 2025-01-05 03:59:10
0001 /* 0002 SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 0008 // Own 0009 #include "GeoSceneParser.h" 0010 0011 // Marble 0012 #include "digikam_debug.h" 0013 0014 // Geodata 0015 #include "GeoDocument.h" 0016 #include "GeoSceneDocument.h" 0017 #include "GeoTagHandler.h" 0018 0019 // DGML support 0020 #include "DgmlElementDictionary.h" 0021 0022 namespace Marble 0023 { 0024 0025 GeoSceneParser::GeoSceneParser(GeoSceneSourceType source) 0026 : GeoParser(source) 0027 { 0028 } 0029 0030 GeoSceneParser::~GeoSceneParser() 0031 { 0032 // nothing to do 0033 } 0034 0035 bool GeoSceneParser::isValidRootElement() 0036 { 0037 switch ((GeoSceneSourceType) m_source) { 0038 case GeoScene_DGML: 0039 return isValidElement(QString::fromUtf8(dgml::dgmlTag_Dgml)); 0040 default: 0041 Q_ASSERT(false); 0042 return false; 0043 } 0044 } 0045 0046 bool GeoSceneParser::isValidElement(const QString& tagName) const 0047 { 0048 if (!GeoParser::isValidElement(tagName)) 0049 return false; 0050 0051 switch ((GeoSceneSourceType) m_source) { 0052 case GeoScene_DGML: 0053 return (namespaceUri() == QLatin1String(dgml::dgmlTag_nameSpace20)); 0054 default: 0055 break; 0056 } 0057 0058 // Should never be reached. 0059 Q_ASSERT(false); 0060 return false; 0061 } 0062 0063 GeoDocument* GeoSceneParser::createDocument() const 0064 { 0065 return new GeoSceneDocument; 0066 } 0067 0068 // Global helper function for the tag handlers 0069 GeoSceneDocument* geoSceneDoc(GeoParser& parser) 0070 { 0071 GeoDocument* document = parser.activeDocument(); 0072 Q_ASSERT(document->isGeoSceneDocument()); 0073 return static_cast<GeoSceneDocument*>(document); 0074 } 0075 0076 }