QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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 "qgswmsutils.h"
22#include "qgswmsrequest.h"
23#include "qgswmsgetcontext.h"
25
26#include "qgslayertreenode.h"
27#include "qgslayertreegroup.h"
28#include "qgslayertreelayer.h"
29#include "qgslayertree.h"
31
32#include "qgsexception.h"
33
34#include <QRegularExpression>
35
36namespace QgsWms
37{
38 namespace
39 {
40 void appendOwsLayerStyles( QDomDocument &doc, QDomElement &layerElem, QgsMapLayer *currentLayer );
41
42 void appendOwsLayersFromTreeGroup( QDomDocument &doc,
43 QDomElement &parentLayer,
44 QgsServerInterface *serverIface,
45 const QgsProject *project,
46 const QgsWmsRequest &request,
47 const QgsLayerTreeGroup *layerTreeGroup,
48 QgsRectangle &combinedBBox,
49 const QString &strGroup );
50
51 void appendOwsGeneralAndResourceList( QDomDocument &doc, QDomElement &parentElement,
52 QgsServerInterface *serverIface, const QgsProject *project,
53 const QgsWmsRequest &request );
54 }
55
56 void writeGetContext( QgsServerInterface *serverIface, const QgsProject *project,
57 const QgsWmsRequest &request,
58 QgsServerResponse &response )
59 {
60#ifdef HAVE_SERVER_PYTHON_PLUGINS
61 QgsAccessControl *accessControl = serverIface->accessControls();
62#endif
63
64 QDomDocument doc;
65 const QDomDocument *contextDocument = nullptr;
66
67#ifdef HAVE_SERVER_PYTHON_PLUGINS
68 QgsServerCacheManager *cacheManager = serverIface->cacheManager();
69 if ( cacheManager && cacheManager->getCachedDocument( &doc, project, request, accessControl ) )
70 {
71 contextDocument = &doc;
72 }
73 else //context xml not in cache. Create a new one
74 {
75 doc = getContext( serverIface, project, request );
76
77 if ( cacheManager )
78 {
79 cacheManager->setCachedDocument( &doc, project, request, accessControl );
80 }
81 contextDocument = &doc;
82 }
83#else
84 doc = getContext( serverIface, project, request );
85 contextDocument = &doc;
86#endif
87 response.setHeader( QStringLiteral( "Content-Type" ), QStringLiteral( "text/xml; charset=utf-8" ) );
88 response.write( contextDocument->toByteArray() );
89 }
90
91
92 QDomDocument getContext( QgsServerInterface *serverIface,
93 const QgsProject *project,
94 const QgsWmsRequest &request )
95 {
96 QDomDocument doc;
97 const QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( QStringLiteral( "xml" ),
98 QStringLiteral( "version=\"1.0\" encoding=\"utf-8\"" ) );
99
100 doc.appendChild( xmlDeclaration );
101
102 QDomElement owsContextElem = doc.createElement( QStringLiteral( "OWSContext" ) );
103 owsContextElem.setAttribute( QStringLiteral( "xmlns" ), QStringLiteral( "http://www.opengis.net/ows-context" ) );
104 owsContextElem.setAttribute( QStringLiteral( "xmlns:ows-context" ), QStringLiteral( "http://www.opengis.net/ows-context" ) );
105 owsContextElem.setAttribute( QStringLiteral( "xmlns:context" ), QStringLiteral( "http://www.opengis.net/context" ) );
106 owsContextElem.setAttribute( QStringLiteral( "xmlns:ows" ), QStringLiteral( "http://www.opengis.net/ows" ) );
107 owsContextElem.setAttribute( QStringLiteral( "xmlns:sld" ), QStringLiteral( "http://www.opengis.net/sld" ) );
108 owsContextElem.setAttribute( QStringLiteral( "xmlns:ogc" ), QStringLiteral( "http://www.opengis.net/ogc" ) );
109 owsContextElem.setAttribute( QStringLiteral( "xmlns:gml" ), QStringLiteral( "http://www.opengis.net/gml" ) );
110 owsContextElem.setAttribute( QStringLiteral( "xmlns:kml" ), QStringLiteral( "http://www.opengis.net/kml/2.2" ) );
111 owsContextElem.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
112 owsContextElem.setAttribute( QStringLiteral( "xmlns:ns9" ), QStringLiteral( "http://www.w3.org/2005/Atom" ) );
113 owsContextElem.setAttribute( QStringLiteral( "xmlns:xal" ), QStringLiteral( "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" ) );
114 owsContextElem.setAttribute( QStringLiteral( "xmlns:ins" ), QStringLiteral( "http://www.inspire.org" ) );
115 owsContextElem.setAttribute( QStringLiteral( "version" ), QStringLiteral( "0.3.1" ) );
116 doc.appendChild( owsContextElem );
117
118 appendOwsGeneralAndResourceList( doc, owsContextElem, serverIface, project, request );
119
120 return doc;
121 }
122 namespace
123 {
124 void appendOwsGeneralAndResourceList( QDomDocument &doc, QDomElement &parentElement,
125 QgsServerInterface *serverIface, const QgsProject *project,
126 const QgsWmsRequest &request )
127 {
128 parentElement.setAttribute( QStringLiteral( "id" ), "ows-context-" + project->baseName() );
129
130 // OWSContext General element
131 QDomElement generalElem = doc.createElement( QStringLiteral( "General" ) );
132
133 // OWSContext Window element
134 QDomElement windowElem = doc.createElement( QStringLiteral( "Window" ) );
135 windowElem.setAttribute( QStringLiteral( "height" ), QStringLiteral( "600" ) );
136 windowElem.setAttribute( QStringLiteral( "width" ), QStringLiteral( "800" ) );
137 generalElem.appendChild( windowElem );
138
139 //OWS title
140 const QString title = QgsServerProjectUtils::owsServiceTitle( *project );
141 QDomElement titleElem = doc.createElement( QStringLiteral( "ows:Title" ) );
142 const QDomText titleText = doc.createTextNode( title );
143 titleElem.appendChild( titleText );
144 generalElem.appendChild( titleElem );
145
146 //OWS abstract
147 const QString abstract = QgsServerProjectUtils::owsServiceAbstract( *project );
148 if ( !abstract.isEmpty() )
149 {
150 QDomElement abstractElem = doc.createElement( QStringLiteral( "ows:Abstract" ) );
151 const QDomText abstractText = doc.createCDATASection( abstract );
152 abstractElem.appendChild( abstractText );
153 generalElem.appendChild( abstractElem );
154 }
155
156 //OWS Keywords
157 const QStringList keywords = QgsServerProjectUtils::owsServiceKeywords( *project );
158 if ( !keywords.isEmpty() )
159 {
160 const bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );
161
162 QDomElement keywordsElem = doc.createElement( QStringLiteral( "ows:Keywords" ) );
163
164 for ( int i = 0; i < keywords.size(); ++i )
165 {
166 const QString keyword = keywords.at( i );
167 if ( !keyword.isEmpty() )
168 {
169 QDomElement keywordElem = doc.createElement( QStringLiteral( "ows:Keyword" ) );
170 const QDomText keywordText = doc.createTextNode( keyword );
171 keywordElem.appendChild( keywordText );
172 if ( sia2045 )
173 {
174 keywordElem.setAttribute( QStringLiteral( "vocabulary" ), QStringLiteral( "SIA_Geo405" ) );
175 }
176 keywordsElem.appendChild( keywordElem );
177 }
178 }
179 generalElem.appendChild( keywordsElem );
180 }
181
182 // OWSContext General element is complete
183 parentElement.appendChild( generalElem );
184
185 // OWSContext ResourceList element
186 QDomElement resourceListElem = doc.createElement( QStringLiteral( "ResourceList" ) );
187 const QgsLayerTree *projectLayerTreeRoot = project->layerTreeRoot();
188 QgsRectangle combinedBBox;
189 appendOwsLayersFromTreeGroup( doc, resourceListElem, serverIface, project, request, projectLayerTreeRoot, combinedBBox, QString() );
190 parentElement.appendChild( resourceListElem );
191
192 // OWSContext BoundingBox
193 const QgsCoordinateReferenceSystem projectCrs = project->crs();
195 if ( mapRect.isEmpty() )
196 {
197 mapRect = combinedBBox;
198 }
199 QDomElement bboxElem = doc.createElement( QStringLiteral( "ows:BoundingBox" ) );
200 bboxElem.setAttribute( QStringLiteral( "crs" ), projectCrs.authid() );
201 if ( projectCrs.hasAxisInverted() )
202 {
203 mapRect.invert();
204 }
205 QDomElement lowerCornerElem = doc.createElement( QStringLiteral( "ows:LowerCorner" ) );
206 const QDomText lowerCornerText = doc.createTextNode( QString::number( mapRect.xMinimum() ) + " " + QString::number( mapRect.yMinimum() ) );
207 lowerCornerElem.appendChild( lowerCornerText );
208 bboxElem.appendChild( lowerCornerElem );
209 QDomElement upperCornerElem = doc.createElement( QStringLiteral( "ows:UpperCorner" ) );
210 const QDomText upperCornerText = doc.createTextNode( QString::number( mapRect.xMaximum() ) + " " + QString::number( mapRect.yMaximum() ) );
211 upperCornerElem.appendChild( upperCornerText );
212 bboxElem.appendChild( upperCornerElem );
213 generalElem.appendChild( bboxElem );
214 }
215
216 void appendOwsLayersFromTreeGroup( QDomDocument &doc,
217 QDomElement &parentLayer,
218 QgsServerInterface *serverIface,
219 const QgsProject *project,
220 const QgsWmsRequest &request,
221 const QgsLayerTreeGroup *layerTreeGroup,
222 QgsRectangle &combinedBBox,
223 const QString &strGroup )
224 {
225 const QStringList restrictedLayers = QgsServerProjectUtils::wmsRestrictedLayers( *project );
226
227 const QList< QgsLayerTreeNode * > layerTreeGroupChildren = layerTreeGroup->children();
228 for ( int i = 0; i < layerTreeGroupChildren.size(); ++i )
229 {
230 QgsLayerTreeNode *treeNode = layerTreeGroupChildren.at( i );
231
232 if ( treeNode->nodeType() == QgsLayerTreeNode::NodeGroup )
233 {
234 QgsLayerTreeGroup *treeGroupChild = static_cast<QgsLayerTreeGroup *>( treeNode );
235
236 const QString name = treeGroupChild->name();
237 if ( restrictedLayers.contains( name ) ) //unpublished group
238 {
239 continue;
240 }
241
242 QString group;
243 if ( strGroup.isEmpty() )
244 {
245 group = name;
246 }
247 else
248 {
249 group = strGroup + "/" + name;
250 }
251
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( QStringLiteral( "Layer" ) );
270
271 // queryable layer
272 if ( !l->flags().testFlag( QgsMapLayer::Identifiable ) )
273 {
274 layerElem.setAttribute( QStringLiteral( "queryable" ), QStringLiteral( "false" ) );
275 }
276 else
277 {
278 layerElem.setAttribute( QStringLiteral( "queryable" ), QStringLiteral( "true" ) );
279 }
280
281 // visibility
282 if ( treeLayer->itemVisibilityChecked() )
283 {
284 layerElem.setAttribute( QStringLiteral( "hidden" ), QStringLiteral( "false" ) );
285 }
286 else
287 {
288 layerElem.setAttribute( QStringLiteral( "hidden" ), QStringLiteral( "true" ) );
289 }
290
291 // layer group
292 if ( !strGroup.isEmpty() )
293 {
294 layerElem.setAttribute( QStringLiteral( "group" ), strGroup );
295 }
296
297 // Because Layer transparency is used for the rendering
298 // OWSContext Layer opacity is set to 1
299 layerElem.setAttribute( QStringLiteral( "opacity" ), 1 );
300
301 QString wmsName = l->name();
303 {
304 wmsName = l->id();
305 }
306 else if ( !l->shortName().isEmpty() )
307 {
308 wmsName = l->shortName();
309 }
310 // layer wms name
311 layerElem.setAttribute( QStringLiteral( "name" ), wmsName );
312 // define an id based on layer wms name
313 const thread_local QRegularExpression sRegEx( QStringLiteral( "[\\W]" ), QRegularExpression::UseUnicodePropertiesOption );
314 layerElem.setAttribute( QStringLiteral( "id" ), wmsName.replace( sRegEx, QStringLiteral( "_" ) ) );
315
316 // layer title
317 QDomElement titleElem = doc.createElement( QStringLiteral( "ows:Title" ) );
318 QString title = l->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( QStringLiteral( "ows:OutputFormat" ) );
329 const QDomText formatText = doc.createTextNode( QStringLiteral( "image/png" ) );
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( QStringLiteral( "Server" ) );
342 serverElem.setAttribute( QStringLiteral( "service" ), QStringLiteral( "urn:ogc:serviceType:WMS" ) );
343 serverElem.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.3.0" ) );
344 serverElem.setAttribute( QStringLiteral( "default" ), QStringLiteral( "true" ) );
345 QDomElement orServerElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
346 orServerElem.setAttribute( QStringLiteral( "xlink:href" ), hrefString );
347 serverElem.appendChild( orServerElem );
348 layerElem.appendChild( serverElem );
349
350 const QString abstract = l->abstract();
351 if ( !abstract.isEmpty() )
352 {
353 QDomElement abstractElem = doc.createElement( QStringLiteral( "ows:Abstract" ) );
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( QStringLiteral( "sld:MinScaleDenominator" ) );
365 const QDomText minScaleText = doc.createTextNode( minScaleString );
366 minScaleElem.appendChild( minScaleText );
367 layerElem.appendChild( minScaleElem );
368 QDomElement maxScaleElem = doc.createElement( QStringLiteral( "sld:MaxScaleDenominator" ) );
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->keywordList().isEmpty() )
379 {
380 const QStringList keywordStringList = l->keywordList().split( ',' );
381 const bool sia2045 = QgsServerProjectUtils::wmsInfoFormatSia2045( *project );
382
383 QDomElement keywordsElem = doc.createElement( QStringLiteral( "ows:Keywords" ) );
384 for ( int i = 0; i < keywordStringList.size(); ++i )
385 {
386 QDomElement keywordElem = doc.createElement( QStringLiteral( "ows:Keyword" ) );
387 const QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
388 keywordElem.appendChild( keywordText );
389 if ( sia2045 )
390 {
391 keywordElem.setAttribute( QStringLiteral( "vocabulary" ), QStringLiteral( "SIA_Geo405" ) );
392 }
393 keywordsElem.appendChild( keywordElem );
394 }
395 layerElem.appendChild( keywordsElem );
396 }
397
398 // layer data URL
399 const QString dataUrl = l->dataUrl();
400 if ( !dataUrl.isEmpty() )
401 {
402 QDomElement dataUrlElem = doc.createElement( QStringLiteral( "DataURL" ) );
403 const QString dataUrlFormat = l->dataUrlFormat();
404 dataUrlElem.setAttribute( QStringLiteral( "format" ), dataUrlFormat );
405 QDomElement dataORElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
406 dataORElem.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
407 dataORElem.setAttribute( QStringLiteral( "xlink:type" ), QStringLiteral( "simple" ) );
408 dataORElem.setAttribute( QStringLiteral( "xlink:href" ), 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( QStringLiteral( "MetadataURL" ) );
418 metaUrlElem.setAttribute( QStringLiteral( "format" ), url.format );
419 QDomElement metaUrlORElem = doc.createElement( QStringLiteral( "OnlineResource" ) );
420 metaUrlORElem.setAttribute( QStringLiteral( "xmlns:xlink" ), QStringLiteral( "http://www.w3.org/1999/xlink" ) );
421 metaUrlORElem.setAttribute( QStringLiteral( "xlink:type" ), QStringLiteral( "simple" ) );
422 metaUrlORElem.setAttribute( QStringLiteral( "xlink:href" ), 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( QStringLiteral( "StyleList" ) );
463 //only one default style in project file mode
464 QDomElement styleElem = doc.createElement( QStringLiteral( "Style" ) );
465 styleElem.setAttribute( QStringLiteral( "current" ), QStringLiteral( "true" ) );
466 QDomElement styleNameElem = doc.createElement( QStringLiteral( "Name" ) );
467 const QDomText styleNameText = doc.createTextNode( styleName );
468 styleNameElem.appendChild( styleNameText );
469 QDomElement styleTitleElem = doc.createElement( QStringLiteral( "Title" ) );
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 }
479
480} // 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.
This class represents a coordinate reference system (CRS).
bool hasAxisInverted() const
Returns whether axis is inverted (e.g., for WMS 1.3) for the CRS.
Class for doing transforms between two map coordinate systems.
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:66
Layer tree group node serves as a container for layers and further groups.
QString name() const override
Returns the group's name.
Layer tree node points to a map layer.
QgsMapLayer * layer() const
Returns the map layer associated with this node.
This class is a base class for nodes in a layer tree.
@ 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)
Namespace with helper functions for layer tree operations.
Definition: qgslayertree.h:33
QStringList styles() const
Returns list of all defined style names.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
QString name
Definition: qgsmaplayer.h:76
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
QgsCoordinateReferenceSystem crs
Definition: qgsmaplayer.h:79
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
Definition: qgsmaplayer.h:426
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:326
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:380
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:310
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:362
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.
Definition: qgsmaplayer.h:145
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.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:342
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:104
QString baseName() const
Returns the base name of the project file without the path and without extension - derived from fileN...
Definition: qgsproject.cpp:831
QgsLayerTree * layerTreeRoot() const
Returns pointer to the root (invisible) node of the project's layer tree.
QgsCoordinateReferenceSystem crs
Definition: qgsproject.h:109
A rectangle specified with double values.
Definition: qgsrectangle.h:42
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
Definition: qgsrectangle.h:193
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
Definition: qgsrectangle.h:183
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
Definition: qgsrectangle.h:188
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
Definition: qgsrectangle.h:198
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle.
Definition: qgsrectangle.h:391
bool isEmpty() const
Returns true if the rectangle is empty.
Definition: qgsrectangle.h:469
void invert()
Swap x/y coordinates in the rectangle.
Definition: qgsrectangle.h:575
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.
QgsServerInterface Class defining 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.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
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...
Class defining request interface passed to WMS service.
Definition: qgswmsrequest.h:35
SERVER_EXPORT bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
SERVER_EXPORT QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
SERVER_EXPORT bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
SERVER_EXPORT QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
SERVER_EXPORT QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
SERVER_EXPORT QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
SERVER_EXPORT QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
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.
Definition: qgswmsutils.cpp:38