6#include "KmlWhenTagHandler.h"
8#include "MarbleDebug.h"
11#include "GeoDataTimeStamp.h"
12#include "GeoDataTrack.h"
14#include "KmlElementDictionary.h"
20KML_DEFINE_TAG_HANDLER(when)
22GeoNode *KmlwhenTagHandler::parse(GeoParser &parser)
const
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(
QLatin1StringView(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);
48GeoDataTimeStamp KmlwhenTagHandler::parseTimestamp(
const QString &dateTime)
50 GeoDataTimeStamp result;
52 result.setResolution(modify(input));
53 result.setWhen(parse(input));
57GeoDataTimeStamp::TimeResolution KmlwhenTagHandler::modify(
QString &whenString)
59 switch (whenString.
length()) {
62 return GeoDataTimeStamp::YearResolution;
65 return GeoDataTimeStamp::MonthResolution;
67 return GeoDataTimeStamp::DayResolution;
69 return GeoDataTimeStamp::SecondResolution;
72 return GeoDataTimeStamp::SecondResolution;
Binds a QML item to a specific geodetic location in screen coordinates.
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
qsizetype length() const const
QString trimmed() const const