7#include "KmlSimpleFieldTagHandler.h"
9#include "MarbleDebug.h"
11#include "KmlElementDictionary.h"
12#include "GeoDataSchema.h"
20KML_DEFINE_TAG_HANDLER( SimpleField )
22GeoNode* KmlSimpleFieldTagHandler::parse( GeoParser& parser )
const
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(
QLatin1String(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;
46 fieldType = GeoDataSimpleField::String;
49 fieldType = GeoDataSimpleField::Int;
52 fieldType = GeoDataSimpleField::UInt;
55 fieldType = GeoDataSimpleField::Short;
58 fieldType = GeoDataSimpleField::UShort;
61 fieldType = GeoDataSimpleField::Float;
64 fieldType = GeoDataSimpleField::Double;
67 fieldType = GeoDataSimpleField::Bool;
Type type(const QSqlDatabase &db)
QString name(StandardShortcut id)
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const