File indexing completed on 2024-05-12 03:51:44
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2011 Niko Sams <niko.sams@gmail.com> 0004 // 0005 0006 #include "GPXtimeTagHandler.h" 0007 0008 #include "MarbleDebug.h" 0009 0010 #include "GPXElementDictionary.h" 0011 #include "GeoParser.h" 0012 #include "GeoDataPoint.h" 0013 #include "GeoDataTrack.h" 0014 0015 #include <QDateTime> 0016 0017 namespace Marble 0018 { 0019 namespace gpx 0020 { 0021 GPX_DEFINE_TAG_HANDLER(time) 0022 0023 GeoNode* GPXtimeTagHandler::parse(GeoParser& parser) const 0024 { 0025 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(gpxTag_time))); 0026 0027 GeoStackItem parentItem = parser.parentElement(); 0028 if (parentItem.represents(gpxTag_trkpt)) 0029 { 0030 GeoDataTrack* track = parentItem.nodeAs<GeoDataTrack>(); 0031 QDateTime dateTime = QDateTime::fromString( parser.readElementText().trimmed(), Qt::ISODate ); 0032 track->appendWhen( dateTime ); 0033 } 0034 return nullptr; 0035 } 0036 0037 } // namespace gpx 0038 0039 } // namespace Marble