34 return QStringLiteral(
"1.1.0" );
49 static QSet<QString> sFilter
51 QStringLiteral(
"REQUEST" ),
52 QStringLiteral(
"VERSION" ),
53 QStringLiteral(
"SERVICE" ),
59 for (
auto param : q.queryItems() )
61 if ( sFilter.contains( param.first.toUpper() ) )
62 q.removeAllQueryItems( param.first );
68 return href.toString();
73 QString name = layer->
name();
76 name = name.replace(
' ',
'_' );
83 for (
const QString &layerId : layerIds )
97 return qobject_cast<QgsVectorLayer *>( layer );
106 QStringList collectedServerFids;
114 QDomNodeList fidNodes = filterElem.elementsByTagName( QStringLiteral(
"FeatureId" ) );
115 QDomNodeList goidNodes = filterElem.elementsByTagName( QStringLiteral(
"GmlObjectId" ) );
116 if ( !fidNodes.isEmpty() )
119 QStringList collectedServerFids;
121 for (
int f = 0; f < fidNodes.size(); f++ )
123 fidElem = fidNodes.at( f ).toElement();
124 if ( !fidElem.hasAttribute( QStringLiteral(
"fid" ) ) )
129 QString serverFid = fidElem.attribute( QStringLiteral(
"fid" ) );
130 if ( serverFid.contains( QLatin1String(
"." ) ) )
132 if ( serverFid.section( QStringLiteral(
"." ), 0, 0 ) !=
typeName )
134 serverFid = serverFid.section( QStringLiteral(
"." ), 1, 1 );
136 collectedServerFids << serverFid;
139 if ( collectedServerFids.isEmpty() )
144 serverFids.append( collectedServerFids );
148 else if ( !goidNodes.isEmpty() )
151 QStringList collectedServerFids;
152 QDomElement goidElem;
153 for (
int f = 0; f < goidNodes.size(); f++ )
155 goidElem = goidNodes.at( f ).toElement();
156 if ( !goidElem.hasAttribute( QStringLiteral(
"id" ) ) && !goidElem.hasAttribute( QStringLiteral(
"gml:id" ) ) )
161 QString serverFid = goidElem.attribute( QStringLiteral(
"id" ) );
162 if ( serverFid.isEmpty() )
163 serverFid = goidElem.attribute( QStringLiteral(
"gml:id" ) );
164 if ( serverFid.contains( QLatin1String(
"." ) ) )
166 if ( serverFid.section( QStringLiteral(
"." ), 0, 0 ) !=
typeName )
168 serverFid = serverFid.section( QStringLiteral(
"." ), 1, 1 );
170 collectedServerFids << serverFid;
173 if ( collectedServerFids.isEmpty() )
178 serverFids.append( collectedServerFids );
182 else if ( filterElem.firstChildElement().tagName() == QLatin1String(
"BBOX" ) )
184 QDomElement bboxElem = filterElem.firstChildElement();
185 QDomElement childElem = bboxElem.firstChildElement();
187 while ( !childElem.isNull() )
189 if ( childElem.tagName() == QLatin1String(
"Box" ) )
193 else if ( childElem.tagName() != QLatin1String(
"PropertyName" ) )
199 childElem = childElem.nextSiblingElement();
206 else if ( filterElem.firstChildElement().tagName() == QLatin1String(
"And" ) &&
207 !filterElem.firstChildElement().firstChildElement( QLatin1String(
"BBOX" ) ).isNull() )
209 int nbChildElem = filterElem.firstChildElement().childNodes().size();
212 QDomElement childFilterElement = filterElem.ownerDocument().createElement( QLatin1String(
"Filter" ) );
213 if ( nbChildElem > 2 )
215 QDomElement childAndElement = filterElem.ownerDocument().createElement( QLatin1String(
"And" ) );
216 childFilterElement.appendChild( childAndElement );
220 QDomElement bboxFilterElement = filterElem.ownerDocument().createElement( QLatin1String(
"Filter" ) );
222 QDomElement childElem = filterElem.firstChildElement().firstChildElement();
223 while ( !childElem.isNull() )
226 if ( childElem.tagName() == QLatin1String(
"BBOX" ) )
229 bboxFilterElement.appendChild( childElem.cloneNode(
true ) );
234 if ( nbChildElem > 2 )
236 childFilterElement.firstChildElement().appendChild( childElem.cloneNode(
true ) );
240 childFilterElement.appendChild( childElem.cloneNode(
true ) );
243 childElem = childElem.nextSiblingElement();
247 QStringList collectedServerFids;
264 if ( !collectedServerFids.isEmpty() )
266 serverFids.append( collectedServerFids );
278 if ( project !=
nullptr )
285 if ( filter->hasParserError() || !filter->parserErrorString().isEmpty() )
290 if ( filter->needsGeometry() )