QGIS API Documentation 4.1.0-Master (9af12b5a203)
Loading...
Searching...
No Matches
qgswmsgetcontext.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgswmsgetcontext.cpp
3 -------------------------
4 begin : December 20 , 2016
5 copyright : (C) 2007 by Marco Hugentobler (original code)
6 (C) 2014 by Alessandro Pasotti (original code)
7 (C) 2016 by David Marteau
8 email : marco dot hugentobler at karto dot baug dot ethz dot ch
9 a dot pasotti at itopen dot it
10 david dot marteau at 3liz dot com
11 ***************************************************************************/
12
13/***************************************************************************
14 * *
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
19 * *
20 ***************************************************************************/
21#include "qgswmsgetcontext.h"
22
24#include "qgsexception.h"
25#include "qgslayertree.h"
26#include "qgslayertreegroup.h"
27#include "qgslayertreelayer.h"
28#include "qgslayertreenode.h"
31#include "qgswmsrequest.h"
32#include "qgswmsutils.h"
33
34#include <QRegularExpression>
35#include <QString>
36
37using namespace Qt::StringLiterals;
38
39namespace QgsWms
40{
41 namespace
42 {
43 void appendOwsLayerStyles( QDomDocument &doc, QDomElement &layerElem, QgsMapLayer *currentLayer );
44
45 void appendOwsLayersFromTreeGroup(
46 QDomDocument &doc,
47 QDomElement &parentLayer,
48 QgsServerInterface *serverIface,
49 const QgsProject *project,
50 const QgsWmsRequest &request,
51 const QgsLayerTreeGroup *layerTreeGroup,
52 QgsRectangle &combinedBBox,
53 const QString &strGroup
54 );
55
56 void appendOwsGeneralAndResourceList( QDomDocument &doc, QDomElement &parentElement, QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request );
57 } // namespace
58
59 void writeGetContext( QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request, QgsServerResponse &response )
60 {
61#ifdef HAVE_SERVER_PYTHON_PLUGINS
62 QgsAccessControl *accessControl = serverIface->accessControls();
63#endif
64
65 QDomDocument doc;
66 const QDomDocument *contextDocument = nullptr;
67
68#ifdef HAVE_SERVER_PYTHON_PLUGINS
69 QgsServerCacheManager *cacheManager = serverIface->cacheManager();
70 if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
71 {
72 contextDocument = &doc;
73 }
74 else //context xml not in cache. Create a new one
75 {
76 doc = getContext( serverIface, project, request );
77
78 if ( cacheManager )
79 {
80 cacheManager->setCachedDocument( &doc, project, request, accessControl );
81 }
82 contextDocument = &doc;
83 }
84#else
85 doc = getContext( serverIface, project, request );
86 contextDocument = &doc;
87#endif
88 response.setHeader( u"Content-Type"_s, u"text/xml; charset=utf-8"_s );
89 response.write( contextDocument->toByteArray() );
90 }
91
92
93 QDomDocument getContext( QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request )
94 {
95 QDomDocument doc;
96 const QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( u"xml"_s, u"version=\"1.0\" encoding=\"utf-8\""_s );
97
98 doc.appendChild( xmlDeclaration );
99
100 QDomElement owsContextElem = doc.createElement( u"OWSContext"_s );
101 owsContextElem.setAttribute( u"xmlns"_s, u"http://www.opengis.net/ows-context"_s );
102 owsContextElem.setAttribute( u"xmlns:ows-context"_s, u"http://www.opengis.net/ows-context"_s );
103 owsContextElem.setAttribute( u"xmlns:context"_s, u"http://www.opengis.net/context"_s );
104 owsContextElem.setAttribute( u"xmlns:ows"_s, u"http://www.opengis.net/ows"_s );
105 owsContextElem.setAttribute( u"xmlns:sld"_s, u"http://www.opengis.net/sld"_s );
106 owsContextElem.setAttribute( u"xmlns:ogc"_s, u"http://www.opengis.net/ogc"_s );
107 owsContextElem.setAttribute( u"xmlns:gml"_s, u"http://www.opengis.net/gml"_s );
108 owsContextElem.setAttribute( u"xmlns:kml"_s, u"http://www.opengis.net/kml/2.2"_s );
109 owsContextElem.setAttribute( u"xmlns:xlink"_s, u"http://www.w3.org/1999/xlink"_s );
110 owsContextElem.setAttribute( u"xmlns:ns9"_s, u"http://www.w3.org/2005/Atom"_s );
111 owsContextElem.setAttribute( u"xmlns:xal"_s, u"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"_s );
112 owsContextElem.setAttribute( u"xmlns:ins"_s, u"http://www.inspire.org"_s );
113 owsContextElem.setAttribute( u"version"_s, u"0.3.1"_s );
114 doc.appendChild( owsContextElem );
115
116 appendOwsGeneralAndResourceList( doc, owsContextElem, serverIface, project, request );
117
118 return doc;
119 }
120 namespace
121 {
122 void appendOwsGeneralAndResourceList( QDomDocument &doc, QDomElement &parentElement, QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request )
123 {
124 parentElement.setAttribute( u"id"_s, "ows-context-" + project->baseName() );
125
126 // OWSContext General element
127 QDomElement generalElem = doc.createElement( u"General"_s );
128
129 // OWSContext Window element
130 QDomElement windowElem = doc.createElement( u"Window"_s );
131 windowElem.setAttribute( u"height"_s, u"600"_s );
132 windowElem.setAttribute( u"width"_s, u"800"_s );
133 generalElem.appendChild( windowElem );
134
135 //OWS title
136 const QString title = QgsServerProjectUtils::owsServiceTitle( *project );
137 QDomElement titleElem = doc.createElement( u"ows:Title"_s );
138 const QDomText titleText = doc.createTextNode( title );
139 titleElem.appendChild( titleText );
140 generalElem.appendChild( titleElem );
141
142 //OWS abstract
143 const QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
144 if ( !abstract.isEmpty() )
145 {
146 QDomElement abstractElem = doc.createElement( u"ows:Abstract"_s );
147 const QDomText abstractText = doc.createCDATASection( abstract );
148 abstractElem.appendChild( abstractText );
149 generalElem.appendChild( abstractElem );
150 }
151
152 //OWS Keywords
153 const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
154 if ( !keywords.isEmpty() )
155 {
156 const bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );
157
158 QDomElement keywordsElem = doc.createElement( u"ows:Keywords"_s );
159
160 for ( int i = 0; i < keywords.size(); ++i )
161 {
162 const QString keyword = keywords.at( i );
163 if ( !keyword.isEmpty() )
164 {
165 QDomElement keywordElem = doc.createElement( u"ows:Keyword"_s );
166 const QDomText keywordText = doc.createTextNode( keyword );
167 keywordElem.appendChild( keywordText );
168 if ( sia2045 )
169 {
170 keywordElem.setAttribute( u"vocabulary"_s, u"SIA_Geo405"_s );
171 }
172 keywordsElem.appendChild( keywordElem );
173 }
174 }
175 generalElem.appendChild( keywordsElem );
176 }
177
178 // OWSContext General element is complete
179 parentElement.appendChild( generalElem );
180
181 // OWSContext ResourceList element
182 QDomElement resourceListElem = doc.createElement( u"ResourceList"_s );
183 const QgsLayerTree *projectLayerTreeRoot = project->layerTreeRoot();
184 QgsRectangle combinedBBox;
185 appendOwsLayersFromTreeGroup( doc, resourceListElem, serverIface, project, request, projectLayerTreeRoot, combinedBBox, QString() );
186 parentElement.appendChild( resourceListElem );
187
188 // OWSContext BoundingBox
189 const QgsCoordinateReferenceSystem projectCrs = project->crs();
190 QgsRectangle mapRect = QgsServerProjectUtils::wmsExtent( *project );
191 if ( mapRect.isEmpty() )
192 {
193 mapRect = combinedBBox;
194 }
195 QDomElement bboxElem = doc.createElement( u"ows:BoundingBox"_s );
196 bboxElem.setAttribute( u"crs"_s, projectCrs.authid() );
197 if ( projectCrs.hasAxisInverted() )
198 {
199 mapRect.invert();
200 }
201 QDomElement lowerCornerElem = doc.createElement( u"ows:LowerCorner"_s );
202 const QDomText lowerCornerText = doc.createTextNode( QString::number( mapRect.xMinimum() ) + " " + QString::number( mapRect.yMinimum() ) );
203 lowerCornerElem.appendChild( lowerCornerText );
204 bboxElem.appendChild( lowerCornerElem );
205 QDomElement upperCornerElem = doc.createElement( u"ows:UpperCorner"_s );
206 const QDomText upperCornerText = doc.createTextNode( QString::number( mapRect.xMaximum() ) + " " + QString::number( mapRect.yMaximum() ) );
207 upperCornerElem.appendChild( upperCornerText );
208 bboxElem.appendChild( upperCornerElem );
209 generalElem.appendChild( bboxElem );
210 }
211
212 void appendOwsLayersFromTreeGroup(
213 QDomDocument &doc,
214 QDomElement &parentLayer,
215 QgsServerInterface *serverIface,
216 const QgsProject *project,
217 const QgsWmsRequest &request,
218 const QgsLayerTreeGroup *layerTreeGroup,
219 QgsRectangle &combinedBBox,
220 const QString &strGroup
221 )
222 {
223 const QStringList restrictedLayers = QgsServerProjectUtils::wmsRestrictedLayers( *project );
224
225 const QList<QgsLayerTreeNode *> layerTreeGroupChildren = layerTreeGroup->children();
226 for ( int i = 0; i < layerTreeGroupChildren.size(); ++i )
227 {
228 QgsLayerTreeNode *treeNode = layerTreeGroupChildren.at( i );
229
230 if ( treeNode->nodeType() == QgsLayerTreeNode::NodeGroup )
231 {
232 QgsLayerTreeGroup *treeGroupChild = static_cast<QgsLayerTreeGroup *>( treeNode );
233
234 const QString name = treeGroupChild->name();
235 if ( restrictedLayers.contains( name ) ) //unpublished group
236 {
237 continue;
238 }
239
240 QString group;
241 if ( strGroup.isEmpty() )
242 {
243 group = name;
244 }
245 else
246 {
247 group = strGroup + "/" + name;
248 }
249
250 // when the group is opaque we should not append any child layers
252 appendOwsLayersFromTreeGroup( doc, parentLayer, serverIface, project, request, treeGroupChild, combinedBBox, group );
253 }
254 else
255 {
256 QgsLayerTreeLayer *treeLayer = static_cast<QgsLayerTreeLayer *>( treeNode );
257 QgsMapLayer *l = treeLayer->layer();
258 if ( restrictedLayers.contains( l->name() ) ) //unpublished layer
259 {
260 continue;
261 }
262#ifdef HAVE_SERVER_PYTHON_PLUGINS
263 QgsAccessControl *accessControl = serverIface->accessControls();
264 if ( accessControl && !accessControl->layerReadPermission( l ) )
265 {
266 continue;
267 }
268#endif
269 QDomElement layerElem = doc.createElement( u"Layer"_s );
270
271 // queryable layer
272 if ( !l->flags().testFlag( QgsMapLayer::Identifiable ) )
273 {
274 layerElem.setAttribute( u"queryable"_s, u"false"_s );
275 }
276 else
277 {
278 layerElem.setAttribute( u"queryable"_s, u"true"_s );
279 }
280
281 // visibility
282 if ( treeLayer->itemVisibilityChecked() )
283 {
284 layerElem.setAttribute( u"hidden"_s, u"false"_s );
285 }
286 else
287 {
288 layerElem.setAttribute( u"hidden"_s, u"true"_s );
289 }
290
291 // layer group
292 if ( !strGroup.isEmpty() )
293 {
294 layerElem.setAttribute( u"group"_s, strGroup );
295 }
296
297 // Because Layer transparency is used for the rendering
298 // OWSContext Layer opacity is set to 1
299 layerElem.setAttribute( u"opacity"_s, 1 );
300
301 QString wmsName = l->name();
303 {
304 wmsName = l->id();
305 }
306 else if ( !l->serverProperties()->shortName().isEmpty() )
307 {
308 wmsName = l->serverProperties()->shortName();
309 }
310 // layer wms name
311 layerElem.setAttribute( u"name"_s, wmsName );
312 // define an id based on layer wms name
313 const thread_local QRegularExpression sRegEx( u"[\\W]"_s, QRegularExpression::UseUnicodePropertiesOption );
314 layerElem.setAttribute( u"id"_s, wmsName.replace( sRegEx, u"_"_s ) );
315
316 // layer title
317 QDomElement titleElem = doc.createElement( u"ows:Title"_s );
318 QString title = l->serverProperties()->title();
319 if ( title.isEmpty() )
320 {
321 title = l->name();
322 }
323 const QDomText titleText = doc.createTextNode( title );
324 titleElem.appendChild( titleText );
325 layerElem.appendChild( titleElem );
326
327 // WMS GetMap output format
328 QDomElement formatElem = doc.createElement( u"ows:OutputFormat"_s );
329 const QDomText formatText = doc.createTextNode( u"image/png"_s );
330 formatElem.appendChild( formatText );
331 layerElem.appendChild( formatElem );
332
333 // Get WMS service URL for Server Element
334 const QUrl href = serviceUrl( request, project, *serverIface->serverSettings() );
335
336 //href needs to be a prefix
337 QString hrefString = href.toString();
338 hrefString.append( href.hasQuery() ? "&" : "?" );
339
340 // COntext Server Element with WMS service URL
341 QDomElement serverElem = doc.createElement( u"Server"_s );
342 serverElem.setAttribute( u"service"_s, u"urn:ogc:serviceType:WMS"_s );
343 serverElem.setAttribute( u"version"_s, u"1.3.0"_s );
344 serverElem.setAttribute( u"default"_s, u"true"_s );
345 QDomElement orServerElem = doc.createElement( u"OnlineResource"_s );
346 orServerElem.setAttribute( u"xlink:href"_s, hrefString );
347 serverElem.appendChild( orServerElem );
348 layerElem.appendChild( serverElem );
349
350 const QString abstract = l->serverProperties()->abstract();
351 if ( !abstract.isEmpty() )
352 {
353 QDomElement abstractElem = doc.createElement( u"ows:Abstract"_s );
354 const QDomText abstractText = doc.createTextNode( abstract );
355 abstractElem.appendChild( abstractText );
356 layerElem.appendChild( abstractElem );
357 }
358
359 //min/max scale denominatorScaleBasedVisibility
360 if ( l->hasScaleBasedVisibility() )
361 {
362 const QString minScaleString = QString::number( l->maximumScale() );
363 const QString maxScaleString = QString::number( l->minimumScale() );
364 QDomElement minScaleElem = doc.createElement( u"sld:MinScaleDenominator"_s );
365 const QDomText minScaleText = doc.createTextNode( minScaleString );
366 minScaleElem.appendChild( minScaleText );
367 layerElem.appendChild( minScaleElem );
368 QDomElement maxScaleElem = doc.createElement( u"sld:MaxScaleDenominator"_s );
369 const QDomText maxScaleText = doc.createTextNode( maxScaleString );
370 maxScaleElem.appendChild( maxScaleText );
371 layerElem.appendChild( maxScaleElem );
372 }
373
374 // Style list
375 appendOwsLayerStyles( doc, layerElem, l );
376
377 //keyword list
378 if ( !l->serverProperties()->keywordList().isEmpty() )
379 {
380 const QStringList keywordStringList = l->serverProperties()->keywordList().split( ',' );
381 const bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );
382
383 QDomElement keywordsElem = doc.createElement( u"ows:Keywords"_s );
384 for ( int i = 0; i < keywordStringList.size(); ++i )
385 {
386 QDomElement keywordElem = doc.createElement( u"ows:Keyword"_s );
387 const QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
388 keywordElem.appendChild( keywordText );
389 if ( sia2045 )
390 {
391 keywordElem.setAttribute( u"vocabulary"_s, u"SIA_Geo405"_s );
392 }
393 keywordsElem.appendChild( keywordElem );
394 }
395 layerElem.appendChild( keywordsElem );
396 }
397
398 // layer data URL
399 const QString dataUrl = l->serverProperties()->dataUrl();
400 if ( !dataUrl.isEmpty() )
401 {
402 QDomElement dataUrlElem = doc.createElement( u"DataURL"_s );
403 const QString dataUrlFormat = l->serverProperties()->dataUrlFormat();
404 dataUrlElem.setAttribute( u"format"_s, dataUrlFormat );
405 QDomElement dataORElem = doc.createElement( u"OnlineResource"_s );
406 dataORElem.setAttribute( u"xmlns:xlink"_s, u"http://www.w3.org/1999/xlink"_s );
407 dataORElem.setAttribute( u"xlink:type"_s, u"simple"_s );
408 dataORElem.setAttribute( u"xlink:href"_s, dataUrl );
409 dataUrlElem.appendChild( dataORElem );
410 layerElem.appendChild( dataUrlElem );
411 }
412
413 // layer metadata URL
414 const QList<QgsMapLayerServerProperties::MetadataUrl> urls = l->serverProperties()->metadataUrls();
415 for ( const QgsMapLayerServerProperties::MetadataUrl &url : urls )
416 {
417 QDomElement metaUrlElem = doc.createElement( u"MetadataURL"_s );
418 metaUrlElem.setAttribute( u"format"_s, url.format );
419 QDomElement metaUrlORElem = doc.createElement( u"OnlineResource"_s );
420 metaUrlORElem.setAttribute( u"xmlns:xlink"_s, u"http://www.w3.org/1999/xlink"_s );
421 metaUrlORElem.setAttribute( u"xlink:type"_s, u"simple"_s );
422 metaUrlORElem.setAttribute( u"xlink:href"_s, url.url );
423 metaUrlElem.appendChild( metaUrlORElem );
424 layerElem.appendChild( metaUrlElem );
425 }
426
427 // update combineBBox
428 try
429 {
430 const QgsCoordinateTransform t( l->crs(), project->crs(), project );
431 const QgsRectangle BBox = t.transformBoundingBox( l->extent() );
432 if ( combinedBBox.isEmpty() )
433 {
434 combinedBBox = BBox;
435 }
436 else
437 {
438 combinedBBox.combineExtentWith( BBox );
439 }
440 }
441 catch ( const QgsCsException &cse )
442 {
443 Q_UNUSED( cse )
444 }
445
446 if ( parentLayer.hasChildNodes() )
447 {
448 parentLayer.insertBefore( layerElem, parentLayer.firstChild() );
449 }
450 else
451 {
452 parentLayer.appendChild( layerElem );
453 }
454 } // end of treeNode type
455 } // end of for
456 }
457
458 void appendOwsLayerStyles( QDomDocument &doc, QDomElement &layerElem, QgsMapLayer *currentLayer )
459 {
460 for ( const QString &styleName : currentLayer->styleManager()->styles() )
461 {
462 QDomElement styleListElem = doc.createElement( u"StyleList"_s );
463 //only one default style in project file mode
464 QDomElement styleElem = doc.createElement( u"Style"_s );
465 styleElem.setAttribute( u"current"_s, u"true"_s );
466 QDomElement styleNameElem = doc.createElement( u"Name"_s );
467 const QDomText styleNameText = doc.createTextNode( styleName );
468 styleNameElem.appendChild( styleNameText );
469 QDomElement styleTitleElem = doc.createElement( u"Title"_s );
470 const QDomText styleTitleText = doc.createTextNode( styleName );
471 styleTitleElem.appendChild( styleTitleText );
472 styleElem.appendChild( styleNameElem );
473 styleElem.appendChild( styleTitleElem );
474 styleListElem.appendChild( styleElem );
475 layerElem.appendChild( styleListElem );
476 }
477 }
478 } // namespace
479
480} // namespace QgsWms
@ Opaque
Group can be requested, children cannot (appears like a single layer).
Definition qgis.h:6766
A helper class that centralizes restrictions given by all the access control filter plugins.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
bool hasAxisInverted() const
Returns whether the axis order is inverted for the CRS compared to the order east/north (longitude/la...
QString name() const override
Returns the group's name.
Qgis::WmsGroupRequestMode wmsGroupRequestMode() const
Returns the request mode of the group.
QgsMapLayer * layer() const
Returns the map layer associated with this node.
@ NodeGroup
Container of other groups and layers.
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
bool itemVisibilityChecked() const
Returns whether a node is checked (independently of its ancestors or children).
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
QString keywordList() const
Returns the keyword list of the layerused by QGIS Server in GetCapabilities request.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QString abstract() const
Returns the abstract of the layerused by QGIS Server in GetCapabilities request.
QStringList styles() const
Returns list of all defined style names.
QString name
Definition qgsmaplayer.h:87
virtual Q_INVOKABLE QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
Definition qgsmaplayer.h:90
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
QString id
Definition qgsmaplayer.h:86
QgsMapLayer::LayerFlags flags
Definition qgsmaplayer.h:99
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
@ Identifiable
If the layer is identifiable using the identify map tool and as a WMS layer.
double minimumScale() const
Returns the minimum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
double maximumScale() const
Returns the maximum map scale (i.e.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:114
QString baseName() const
Returns the base name of the project file without the path and without extension - derived from fileN...
QgsLayerTree * layerTreeRoot() const
Returns pointer to the root (invisible) node of the project's layer tree.
QgsCoordinateReferenceSystem crs
Definition qgsproject.h:120
double xMinimum
double yMinimum
double xMaximum
double yMaximum
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
void invert()
Swap x/y coordinates in the rectangle.
A helper class that centralizes caches accesses given by all the server cache filter plugins.
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
bool getCachedDocument(QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Returns cached document (or 0 if document not in cache) like capabilities.
Defines interfaces exposed by QGIS Server and made available to plugins.
virtual QgsServerCacheManager * cacheManager() const =0
Gets the registered server cache filters.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
virtual QgsServerSettings * serverSettings()=0
Returns the server settings.
QList< QgsServerMetadataUrlProperties::MetadataUrl > metadataUrls() const
Returns a list of metadataUrl resources associated for the layer.
static bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
static QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
static bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
static QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
static QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
static QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
static QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
Defines the response interface passed to QgsService.
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device.
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
Defines request interfaces passed to WMS service.
Median cut implementation.
void writeGetContext(QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request, QgsServerResponse &response)
Output GetContext response.
QDomDocument getContext(QgsServerInterface *serverIface, const QgsProject *project, const QgsWmsRequest &request)
Returns XML document for the 'GetContext' request.
QUrl serviceUrl(const QgsServerRequest &request, const QgsProject *project, const QgsServerSettings &settings)
Returns WMS service URL.