QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
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 appendOwsLayersFromTreeGroup( doc, parentLayer, serverIface, project, request, treeGroupChild, combinedBBox, group );
251 }
252 else
253 {
254 QgsLayerTreeLayer *treeLayer = static_cast<QgsLayerTreeLayer *>( treeNode );
255 QgsMapLayer *l = treeLayer->layer();
256 if ( restrictedLayers.contains( l->name() ) ) //unpublished layer
257 {
258 continue;
259 }
260#ifdef HAVE_SERVER_PYTHON_PLUGINS
261 QgsAccessControl *accessControl = serverIface->accessControls();
262 if ( accessControl && !accessControl->layerReadPermission( l ) )
263 {
264 continue;
265 }
266#endif
267 QDomElement layerElem = doc.createElement( u"Layer"_s );
268
269 // queryable layer
270 if ( !l->flags().testFlag( QgsMapLayer::Identifiable ) )
271 {
272 layerElem.setAttribute( u"queryable"_s, u"false"_s );
273 }
274 else
275 {
276 layerElem.setAttribute( u"queryable"_s, u"true"_s );
277 }
278
279 // visibility
280 if ( treeLayer->itemVisibilityChecked() )
281 {
282 layerElem.setAttribute( u"hidden"_s, u"false"_s );
283 }
284 else
285 {
286 layerElem.setAttribute( u"hidden"_s, u"true"_s );
287 }
288
289 // layer group
290 if ( !strGroup.isEmpty() )
291 {
292 layerElem.setAttribute( u"group"_s, strGroup );
293 }
294
295 // Because Layer transparency is used for the rendering
296 // OWSContext Layer opacity is set to 1
297 layerElem.setAttribute( u"opacity"_s, 1 );
298
299 QString wmsName = l->name();
301 {
302 wmsName = l->id();
303 }
304 else if ( !l->serverProperties()->shortName().isEmpty() )
305 {
306 wmsName = l->serverProperties()->shortName();
307 }
308 // layer wms name
309 layerElem.setAttribute( u"name"_s, wmsName );
310 // define an id based on layer wms name
311 const thread_local QRegularExpression sRegEx( u"[\\W]"_s, QRegularExpression::UseUnicodePropertiesOption );
312 layerElem.setAttribute( u"id"_s, wmsName.replace( sRegEx, u"_"_s ) );
313
314 // layer title
315 QDomElement titleElem = doc.createElement( u"ows:Title"_s );
316 QString title = l->serverProperties()->title();
317 if ( title.isEmpty() )
318 {
319 title = l->name();
320 }
321 const QDomText titleText = doc.createTextNode( title );
322 titleElem.appendChild( titleText );
323 layerElem.appendChild( titleElem );
324
325 // WMS GetMap output format
326 QDomElement formatElem = doc.createElement( u"ows:OutputFormat"_s );
327 const QDomText formatText = doc.createTextNode( u"image/png"_s );
328 formatElem.appendChild( formatText );
329 layerElem.appendChild( formatElem );
330
331 // Get WMS service URL for Server Element
332 const QUrl href = serviceUrl( request, project, *serverIface->serverSettings() );
333
334 //href needs to be a prefix
335 QString hrefString = href.toString();
336 hrefString.append( href.hasQuery() ? "&" : "?" );
337
338 // COntext Server Element with WMS service URL
339 QDomElement serverElem = doc.createElement( u"Server"_s );
340 serverElem.setAttribute( u"service"_s, u"urn:ogc:serviceType:WMS"_s );
341 serverElem.setAttribute( u"version"_s, u"1.3.0"_s );
342 serverElem.setAttribute( u"default"_s, u"true"_s );
343 QDomElement orServerElem = doc.createElement( u"OnlineResource"_s );
344 orServerElem.setAttribute( u"xlink:href"_s, hrefString );
345 serverElem.appendChild( orServerElem );
346 layerElem.appendChild( serverElem );
347
348 const QString abstract = l->serverProperties()->abstract();
349 if ( !abstract.isEmpty() )
350 {
351 QDomElement abstractElem = doc.createElement( u"ows:Abstract"_s );
352 const QDomText abstractText = doc.createTextNode( abstract );
353 abstractElem.appendChild( abstractText );
354 layerElem.appendChild( abstractElem );
355 }
356
357 //min/max scale denominatorScaleBasedVisibility
358 if ( l->hasScaleBasedVisibility() )
359 {
360 const QString minScaleString = QString::number( l->maximumScale() );
361 const QString maxScaleString = QString::number( l->minimumScale() );
362 QDomElement minScaleElem = doc.createElement( u"sld:MinScaleDenominator"_s );
363 const QDomText minScaleText = doc.createTextNode( minScaleString );
364 minScaleElem.appendChild( minScaleText );
365 layerElem.appendChild( minScaleElem );
366 QDomElement maxScaleElem = doc.createElement( u"sld:MaxScaleDenominator"_s );
367 const QDomText maxScaleText = doc.createTextNode( maxScaleString );
368 maxScaleElem.appendChild( maxScaleText );
369 layerElem.appendChild( maxScaleElem );
370 }
371
372 // Style list
373 appendOwsLayerStyles( doc, layerElem, l );
374
375 //keyword list
376 if ( !l->serverProperties()->keywordList().isEmpty() )
377 {
378 const QStringList keywordStringList = l->serverProperties()->keywordList().split( ',' );
379 const bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );
380
381 QDomElement keywordsElem = doc.createElement( u"ows:Keywords"_s );
382 for ( int i = 0; i < keywordStringList.size(); ++i )
383 {
384 QDomElement keywordElem = doc.createElement( u"ows:Keyword"_s );
385 const QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
386 keywordElem.appendChild( keywordText );
387 if ( sia2045 )
388 {
389 keywordElem.setAttribute( u"vocabulary"_s, u"SIA_Geo405"_s );
390 }
391 keywordsElem.appendChild( keywordElem );
392 }
393 layerElem.appendChild( keywordsElem );
394 }
395
396 // layer data URL
397 const QString dataUrl = l->serverProperties()->dataUrl();
398 if ( !dataUrl.isEmpty() )
399 {
400 QDomElement dataUrlElem = doc.createElement( u"DataURL"_s );
401 const QString dataUrlFormat = l->serverProperties()->dataUrlFormat();
402 dataUrlElem.setAttribute( u"format"_s, dataUrlFormat );
403 QDomElement dataORElem = doc.createElement( u"OnlineResource"_s );
404 dataORElem.setAttribute( u"xmlns:xlink"_s, u"http://www.w3.org/1999/xlink"_s );
405 dataORElem.setAttribute( u"xlink:type"_s, u"simple"_s );
406 dataORElem.setAttribute( u"xlink:href"_s, dataUrl );
407 dataUrlElem.appendChild( dataORElem );
408 layerElem.appendChild( dataUrlElem );
409 }
410
411 // layer metadata URL
412 const QList<QgsMapLayerServerProperties::MetadataUrl> urls = l->serverProperties()->metadataUrls();
413 for ( const QgsMapLayerServerProperties::MetadataUrl &url : urls )
414 {
415 QDomElement metaUrlElem = doc.createElement( u"MetadataURL"_s );
416 metaUrlElem.setAttribute( u"format"_s, url.format );
417 QDomElement metaUrlORElem = doc.createElement( u"OnlineResource"_s );
418 metaUrlORElem.setAttribute( u"xmlns:xlink"_s, u"http://www.w3.org/1999/xlink"_s );
419 metaUrlORElem.setAttribute( u"xlink:type"_s, u"simple"_s );
420 metaUrlORElem.setAttribute( u"xlink:href"_s, url.url );
421 metaUrlElem.appendChild( metaUrlORElem );
422 layerElem.appendChild( metaUrlElem );
423 }
424
425 // update combineBBox
426 try
427 {
428 const QgsCoordinateTransform t( l->crs(), project->crs(), project );
429 const QgsRectangle BBox = t.transformBoundingBox( l->extent() );
430 if ( combinedBBox.isEmpty() )
431 {
432 combinedBBox = BBox;
433 }
434 else
435 {
436 combinedBBox.combineExtentWith( BBox );
437 }
438 }
439 catch ( const QgsCsException &cse )
440 {
441 Q_UNUSED( cse )
442 }
443
444 if ( parentLayer.hasChildNodes() )
445 {
446 parentLayer.insertBefore( layerElem, parentLayer.firstChild() );
447 }
448 else
449 {
450 parentLayer.appendChild( layerElem );
451 }
452 } // end of treeNode type
453 } // end of for
454 }
455
456 void appendOwsLayerStyles( QDomDocument &doc, QDomElement &layerElem, QgsMapLayer *currentLayer )
457 {
458 for ( const QString &styleName : currentLayer->styleManager()->styles() )
459 {
460 QDomElement styleListElem = doc.createElement( u"StyleList"_s );
461 //only one default style in project file mode
462 QDomElement styleElem = doc.createElement( u"Style"_s );
463 styleElem.setAttribute( u"current"_s, u"true"_s );
464 QDomElement styleNameElem = doc.createElement( u"Name"_s );
465 const QDomText styleNameText = doc.createTextNode( styleName );
466 styleNameElem.appendChild( styleNameText );
467 QDomElement styleTitleElem = doc.createElement( u"Title"_s );
468 const QDomText styleTitleText = doc.createTextNode( styleName );
469 styleTitleElem.appendChild( styleTitleText );
470 styleElem.appendChild( styleNameElem );
471 styleElem.appendChild( styleTitleElem );
472 styleListElem.appendChild( styleElem );
473 layerElem.appendChild( styleListElem );
474 }
475 }
476 } // namespace
477
478} // namespace QgsWms
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.
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 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:113
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:119
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.