Marble
6 #include "KmlWhenTagHandler.h"
8 #include "MarbleDebug.h"
11 #include "KmlElementDictionary.h"
12 #include "GeoDataTimeStamp.h"
13 #include "GeoDataTrack.h"
14 #include "GeoParser.h"
20 KML_DEFINE_TAG_HANDLER( when )
22 GeoNode* KmlwhenTagHandler::parse( GeoParser& parser )
const
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(
QLatin1String(kmlTag_when)));
26 GeoStackItem parentItem = parser.parentElement();
29 GeoDataTimeStamp::TimeResolution resolution = modify( whenString );
31 if( parentItem.represents( kmlTag_TimeStamp ) ) {
32 parentItem.nodeAs<GeoDataTimeStamp>()->setWhen( when );
33 parentItem.nodeAs<GeoDataTimeStamp>()->setResolution( resolution );
34 }
else if ( parentItem.represents( kmlTag_Track ) ) {
35 parentItem.nodeAs<GeoDataTrack>()->appendWhen( when );
48 GeoDataTimeStamp KmlwhenTagHandler::parseTimestamp(
const QString &dateTime )
50 GeoDataTimeStamp result;
52 result.setResolution( modify( input ) );
53 result.setWhen(
parse( input) );
57 GeoDataTimeStamp::TimeResolution KmlwhenTagHandler::modify(
QString& whenString )
59 switch( whenString.
length() )
63 return GeoDataTimeStamp::YearResolution;
66 return GeoDataTimeStamp::MonthResolution;
68 return GeoDataTimeStamp::DayResolution;
70 return GeoDataTimeStamp::SecondResolution;
73 return GeoDataTimeStamp::SecondResolution;
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
QDateTime fromString(const QString &string, Qt::DateFormat format)
QList< QVariant > parse(const QString &message, const QDateTime &externalIssueDateTime=QDateTime())
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:19 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.