68 QStringList typeNameList;
69 QDomDocument queryDoc;
71 if ( queryDoc.setContent( request.
data(),
true, &errorMsg ) )
74 const QDomElement queryDocElem = queryDoc.documentElement();
75 const QDomNodeList docChildNodes = queryDocElem.childNodes();
76 if ( docChildNodes.size() )
78 for (
int i = 0; i < docChildNodes.size(); i++ )
80 const QDomElement docChildElem = docChildNodes.at( i ).toElement();
81 if ( docChildElem.tagName() == QLatin1String(
"TypeName" ) )
83 const QString typeName = docChildElem.text().trimmed();
84 if ( typeName.contains(
':' ) )
85 typeNameList << typeName.section(
':', 1, 1 );
87 typeNameList << typeName;
103 fieldName = field.
name();
105 const thread_local QRegularExpression sCleanTagNameRegExp( QStringLiteral(
"[^\\w\\.-_]" ), QRegularExpression::PatternOption::UseUnicodePropertiesOption );
106 fieldName.replace(
' ',
'_' ).replace( sCleanTagNameRegExp, QString() );
108 const QMetaType::Type attributeType = field.
type();
110 if ( attributeType == QMetaType::Type::Int )
112 fieldType = QStringLiteral(
"int" );
114 else if ( attributeType == QMetaType::Type::UInt )
116 fieldType = QStringLiteral(
"unsignedInt" );
118 else if ( attributeType == QMetaType::Type::LongLong )
120 fieldType = QStringLiteral(
"long" );
122 else if ( attributeType == QMetaType::Type::ULongLong )
124 fieldType = QStringLiteral(
"unsignedLong" );
126 else if ( attributeType == QMetaType::Type::Double )
129 fieldType = QStringLiteral(
"integer" );
131 fieldType = QStringLiteral(
"decimal" );
133 else if ( attributeType == QMetaType::Type::Bool )
135 fieldType = QStringLiteral(
"boolean" );
137 else if ( attributeType == QMetaType::Type::QDate )
139 fieldType = QStringLiteral(
"date" );
141 else if ( attributeType == QMetaType::Type::QTime )
143 fieldType = QStringLiteral(
"time" );
145 else if ( attributeType == QMetaType::Type::QDateTime )
147 fieldType = QStringLiteral(
"dateTime" );
151 fieldType = QStringLiteral(
"string" );
155 if ( setup.
type() == QLatin1String(
"DateTime" ) )
158 const QVariantMap config = setup.
config();
160 const QString fieldFormat = config.value(
161 QStringLiteral(
"field_format" ),
167 fieldType = QStringLiteral(
"time" );
169 fieldType = QStringLiteral(
"date" );
171 fieldType = QStringLiteral(
"dateTime" );
173 fieldType = QStringLiteral(
"dateTime" );
175 else if ( setup.
type() == QLatin1String(
"Range" ) )
177 const QVariantMap config = setup.
config();
178 if ( config.contains( QStringLiteral(
"Precision" ) ) )
183 const int configPrec( config[QStringLiteral(
"Precision" )].toInt( &ok ) );
184 if ( ok && configPrec != field.
precision() )
186 if ( configPrec == 0 )
187 fieldType = QStringLiteral(
"integer" );
189 fieldType = QStringLiteral(
"decimal" );
void writeDescribeFeatureType(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WFS GetCapabilities response.