70 QStringList typeNameList;
71 QDomDocument queryDoc;
73 if ( queryDoc.setContent( request.
data(),
true, &errorMsg ) )
76 const QDomElement queryDocElem = queryDoc.documentElement();
77 const QDomNodeList docChildNodes = queryDocElem.childNodes();
78 if ( docChildNodes.size() )
80 for (
int i = 0; i < docChildNodes.size(); i++ )
82 const QDomElement docChildElem = docChildNodes.at( i ).toElement();
83 if ( docChildElem.tagName() == QLatin1String(
"TypeName" ) )
85 const QString
typeName = docChildElem.text().trimmed();
87 typeNameList <<
typeName.section(
':', 1, 1 );
105 fieldName = field.
name();
107 const thread_local QRegularExpression sCleanTagNameRegExp( QStringLiteral(
"[^\\w\\.-_]" ), QRegularExpression::PatternOption::UseUnicodePropertiesOption );
108 fieldName.replace(
' ',
'_' ).replace( sCleanTagNameRegExp, QString() );
110 const QVariant::Type attributeType = field.
type();
112 if ( attributeType == QVariant::Int )
114 fieldType = QStringLiteral(
"int" );
116 else if ( attributeType == QVariant::UInt )
118 fieldType = QStringLiteral(
"unsignedInt" );
120 else if ( attributeType == QVariant::LongLong )
122 fieldType = QStringLiteral(
"long" );
124 else if ( attributeType == QVariant::ULongLong )
126 fieldType = QStringLiteral(
"unsignedLong" );
128 else if ( attributeType == QVariant::Double )
131 fieldType = QStringLiteral(
"integer" );
133 fieldType = QStringLiteral(
"decimal" );
135 else if ( attributeType == QVariant::Bool )
137 fieldType = QStringLiteral(
"boolean" );
139 else if ( attributeType == QVariant::Date )
141 fieldType = QStringLiteral(
"date" );
143 else if ( attributeType == QVariant::Time )
145 fieldType = QStringLiteral(
"time" );
147 else if ( attributeType == QVariant::DateTime )
149 fieldType = QStringLiteral(
"dateTime" );
153 fieldType = QStringLiteral(
"string" );
157 if ( setup.
type() == QStringLiteral(
"DateTime" ) )
160 const QVariantMap config = setup.
config();
162 const QString fieldFormat = config.value(
163 QStringLiteral(
"field_format" ),
168 fieldType = QStringLiteral(
"time" );
170 fieldType = QStringLiteral(
"date" );
172 fieldType = QStringLiteral(
"dateTime" );
174 fieldType = QStringLiteral(
"dateTime" );
176 else if ( setup.
type() == QStringLiteral(
"Range" ) )
178 const QVariantMap config = setup.
config();
179 if ( config.contains( QStringLiteral(
"Precision" ) ) )
184 const int configPrec( config[ QStringLiteral(
"Precision" ) ].toInt( &ok ) );
185 if ( ok && configPrec != field.
precision() )
187 if ( configPrec == 0 )
188 fieldType = QStringLiteral(
"integer" );
190 fieldType = QStringLiteral(
"decimal" );
void writeDescribeFeatureType(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WFS GetCapabilities response.