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 )
90 if ( layer->
type() != QgsMapLayer::LayerType::VectorLayer )
107 QDomNodeList fidNodes = filterElem.elementsByTagName( QStringLiteral(
"FeatureId" ) );
108 QDomNodeList goidNodes = filterElem.elementsByTagName( QStringLiteral(
"GmlObjectId" ) );
109 if ( !fidNodes.isEmpty() )
113 for (
int f = 0; f < fidNodes.size(); f++ )
115 fidElem = fidNodes.at( f ).toElement();
116 if ( !fidElem.hasAttribute( QStringLiteral(
"fid" ) ) )
121 QString fid = fidElem.attribute( QStringLiteral(
"fid" ) );
122 if ( fid.contains( QLatin1String(
"." ) ) )
124 if ( fid.section( QStringLiteral(
"." ), 0, 0 ) !=
typeName )
126 fid = fid.section( QStringLiteral(
"." ), 1, 1 );
128 fids.insert( fid.toInt() );
131 if ( !fids.isEmpty() )
142 else if ( !goidNodes.isEmpty() )
145 QDomElement goidElem;
146 for (
int f = 0; f < goidNodes.size(); f++ )
148 goidElem = goidNodes.at( f ).toElement();
149 if ( !goidElem.hasAttribute( QStringLiteral(
"id" ) ) && !goidElem.hasAttribute( QStringLiteral(
"gml:id" ) ) )
154 QString fid = goidElem.attribute( QStringLiteral(
"id" ) );
156 fid = goidElem.attribute( QStringLiteral(
"gml:id" ) );
157 if ( fid.contains( QLatin1String(
"." ) ) )
159 if ( fid.section( QStringLiteral(
"." ), 0, 0 ) !=
typeName )
161 fid = fid.section( QStringLiteral(
"." ), 1, 1 );
163 fids.insert( fid.toInt() );
166 if ( !fids.isEmpty() )
177 else if ( filterElem.firstChildElement().tagName() == QLatin1String(
"BBOX" ) )
179 QDomElement bboxElem = filterElem.firstChildElement();
180 QDomElement childElem = bboxElem.firstChildElement();
182 while ( !childElem.isNull() )
184 if ( childElem.tagName() == QLatin1String(
"Box" ) )
188 else if ( childElem.tagName() != QLatin1String(
"PropertyName" ) )
193 childElem = childElem.nextSiblingElement();
199 else if ( filterElem.firstChildElement().tagName() == QLatin1String(
"And" ) &&
200 !filterElem.firstChildElement().firstChildElement( QLatin1String(
"BBOX" ) ).isNull() )
202 QDomElement childElem = filterElem.firstChildElement().firstChildElement();
203 while ( !childElem.isNull() )
205 QDomElement childFilterElement = filterElem.ownerDocument().createElement( QLatin1String(
"Filter" ) );
206 childFilterElement.appendChild( childElem.cloneNode(
true ) );
208 if ( childElem.tagName() == QLatin1String(
"BBOX" ) )
234 childElem = childElem.nextSiblingElement();
242 if ( project !=
nullptr )
249 if ( filter->hasParserError() )
254 if ( filter->needsGeometry() )
Class for parsing and evaluation of expressions (formerly called "search strings").
Base class for all map layer types.
QSet< QgsFeatureId > QgsFeatureIds
Use exact geometry intersection (slower) instead of bounding boxes.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QgsVectorLayer * layerByTypeName(const QgsProject *project, const QString &typeName)
Retrieve a layer by typename.
A geometry is the spatial representation of a feature.
virtual QgsExpressionNode * clone() const =0
Generate a clone of this node.
QUrl originalUrl() const
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS s...
QgsMapLayer::LayerType type() const
Returns the type of the layer.
const QgsRectangle & filterRect() const
Returns the rectangle from which features will be taken.
QString layerTypeName(const QgsMapLayer *layer)
Returns typename from vector layer.
static QgsRectangle rectangleFromGMLBox(const QDomNode &boxNode)
Read rectangle from GML2 Box.
QgsExpression * filterExpression() const
Returns the filter expression if set.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
QString serviceUrl(const QgsServerRequest &request, const QgsProject *project)
Service URL string.
bool isEmpty() const
Returns true if the rectangle is empty.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
QgsFeatureRequest parseFilterElement(const QString &typeName, QDomElement &filterElem, const QgsProject *project)
Transform a Filter element to a feature request.
Reads and writes project states.
QString implementationVersion()
Returns the highest version supported by this implementation.
Abstract base class for all nodes that can appear in an expression.
QString expression() const
Returns the original, unmodified expression string.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
static QgsGeometry geometryFromGML(const QString &xmlString)
Static method that creates geometry from GML.
QgsFeatureRequest & setFilterFids(const QgsFeatureIds &fids)
Sets feature IDs that should be fetched.
const QgsExpressionNode * rootNode() const
Returns root node of the expression. Root node is null is parsing has failed.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
static QgsExpression * expressionFromOgcFilter(const QDomElement &element, QgsVectorLayer *layer=nullptr)
Parse XML with OGC filter into QGIS expression.
Represents a vector layer which manages a vector based data sets.
SERVER_EXPORT QString wfsServiceUrl(const QgsProject &project)
Returns the WFS service url defined in a QGIS project.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.