File indexing completed on 2025-01-05 03:59:14

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Shou Ya <shouyatf@gmail.com>
0004 //
0005 
0006 #include "KmlTimeSpanWriter.h"
0007 
0008 #include "GeoDataTimeSpan.h"
0009 #include "GeoDataTypes.h"
0010 #include "GeoWriter.h"
0011 #include "KmlElementDictionary.h"
0012 #include "KmlTimeStampTagWriter.h"
0013 #include "KmlObjectTagWriter.h"
0014 
0015 namespace Marble
0016 {
0017 
0018 static GeoTagWriterRegistrar s_writerLookAt(
0019     GeoTagWriter::QualifiedName( QString::fromUtf8(GeoDataTypes::GeoDataTimeSpanType),
0020                  QString::fromUtf8(kml::kmlTag_nameSpaceOgc22) ),
0021     new KmlTimeSpanWriter );
0022 
0023 bool KmlTimeSpanWriter::write( const GeoNode *node,
0024                    GeoWriter& writer ) const
0025 {
0026     Q_ASSERT(dynamic_cast<const GeoDataTimeSpan *>(node));
0027     const GeoDataTimeSpan *timespan = static_cast<const GeoDataTimeSpan *>(node);
0028 
0029     writer.writeStartElement( QString::fromUtf8(kml::kmlTag_TimeSpan) );
0030     KmlObjectTagWriter::writeIdentifiers( writer, timespan );
0031 
0032     writer.writeTextElement( QLatin1String("begin"), KmlTimeStampTagWriter::toString( timespan->begin() ) );
0033     writer.writeTextElement( QLatin1String("end"), KmlTimeStampTagWriter::toString( timespan->end() ) );
0034 
0035     writer.writeEndElement();
0036 
0037     return true;
0038 }
0039 
0040 }
0041