7#include "KmlSimpleFieldTagHandler.h"
9#include "MarbleDebug.h"
11#include "GeoDataSchema.h"
12#include "KmlElementDictionary.h"
20KML_DEFINE_TAG_HANDLER(SimpleField)
22GeoNode *KmlSimpleFieldTagHandler::parse(GeoParser &parser)
const
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_SimpleField)));
26 GeoStackItem parentItem = parser.parentElement();
28 if (parentItem.represents(kmlTag_Schema)) {
29 GeoDataSimpleField simpleField;
31 QString
type = parser.attribute(
"type").trimmed();
32 simpleField.setName(name);
33 GeoDataSimpleField::SimpleFieldType fieldType = resolveType(type);
34 simpleField.setType(fieldType);
35 parentItem.nodeAs<GeoDataSchema>()->addSimpleField(simpleField);
36 return &parentItem.nodeAs<GeoDataSchema>()->simpleField(name);
42GeoDataSimpleField::SimpleFieldType KmlSimpleFieldTagHandler::resolveType(
const QString &type)
44 GeoDataSimpleField::SimpleFieldType fieldType;
45 if (type == QLatin1StringView(
"string")) {
46 fieldType = GeoDataSimpleField::String;
47 }
else if (type == QLatin1StringView(
"int")) {
48 fieldType = GeoDataSimpleField::Int;
49 }
else if (type == QLatin1StringView(
"unit")) {
50 fieldType = GeoDataSimpleField::UInt;
51 }
else if (type == QLatin1StringView(
"short")) {
52 fieldType = GeoDataSimpleField::Short;
53 }
else if (type == QLatin1StringView(
"ushort")) {
54 fieldType = GeoDataSimpleField::UShort;
55 }
else if (type == QLatin1StringView(
"float")) {
56 fieldType = GeoDataSimpleField::Float;
57 }
else if (type == QLatin1StringView(
"double")) {
58 fieldType = GeoDataSimpleField::Double;
60 fieldType = GeoDataSimpleField::Bool;
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QString name(StandardAction id)
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const