51 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer );
53 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
56 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
57 bool considerMapExtent =
false );
59 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet );
61 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
64 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
68 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
70 const QStringList &constrainedCrsList,
const QgsProject *project );
72 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
73 const QString &crsText );
75 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
76 const QStringList &crsList,
const QStringList &constrainedCrsList );
78 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
81 void appendLayersFromTreeGroup( QDomDocument &doc,
82 QDomElement &parentLayer,
85 const QString &version,
88 bool projectSettings );
90 void addKeywordListElement(
const QgsProject *project, QDomDocument &doc, QDomElement &parent );
97 #ifdef HAVE_SERVER_PYTHON_PLUGINS 102 const QDomDocument *capabilitiesDocument =
nullptr;
107 QStringList cacheKeyList;
108 cacheKeyList << ( projectSettings ? QStringLiteral(
"projectSettings" ) : version );
109 cacheKeyList << request.
url().host();
112 #ifdef HAVE_SERVER_PYTHON_PLUGINS 116 QString cacheKey = cacheKeyList.join(
'-' );
118 #ifdef HAVE_SERVER_PYTHON_PLUGINS 120 if ( cacheManager && cacheManager->
getCachedDocument( &doc, project, request, accessControl ) )
122 capabilitiesDocument = &doc;
126 if ( !capabilitiesDocument && cache )
131 if ( !capabilitiesDocument )
133 QgsMessageLog::logMessage( QStringLiteral(
"WMS capabilities document not found in cache" ), QStringLiteral(
"Server" ) );
135 doc =
getCapabilities( serverIface, project, version, request, projectSettings );
137 #ifdef HAVE_SERVER_PYTHON_PLUGINS 141 capabilitiesDocument = &doc;
145 if ( !capabilitiesDocument )
151 if ( !capabilitiesDocument )
153 capabilitiesDocument = &doc;
165 response.
setHeader( QStringLiteral(
"Content-Type" ), QStringLiteral(
"text/xml; charset=utf-8" ) );
166 response.
write( capabilitiesDocument->toByteArray() );
171 bool projectSettings )
174 QDomElement wmsCapabilitiesElement;
182 QString hrefString = href.toString();
183 hrefString.append( href.hasQuery() ?
"&" :
"?" );
186 QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( QStringLiteral(
"xml" ),
187 QStringLiteral(
"version=\"1.0\" encoding=\"utf-8\"" ) );
190 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
192 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
193 formatElem.appendChild( doc.createTextNode( format ) );
194 elem.appendChild( formatElem );
197 if ( version == QLatin1String(
"1.1.1" ) )
199 doc = QDomDocument( QStringLiteral(
"WMT_MS_Capabilities SYSTEM 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd'" ) );
200 doc.appendChild( xmlDeclaration );
201 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMT_MS_Capabilities" ) );
205 doc.appendChild( xmlDeclaration );
206 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMS_Capabilities" ) );
207 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns" ), QStringLiteral(
"http://www.opengis.net/wms" ) );
208 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:sld" ), QStringLiteral(
"http://www.opengis.net/sld" ) );
209 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:qgs" ), QStringLiteral(
"http://www.qgis.org/wms" ) );
210 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
211 QString schemaLocation = QStringLiteral(
"http://www.opengis.net/wms" );
212 schemaLocation += QLatin1String(
" http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd" );
213 schemaLocation += QLatin1String(
" http://www.opengis.net/sld" );
214 schemaLocation += QLatin1String(
" http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd" );
218 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_common" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/common/1.0" ) );
219 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_vs" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" ) );
220 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" );
221 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0/inspire_vs.xsd" );
224 schemaLocation += QLatin1String(
" http://www.qgis.org/wms" );
225 schemaLocation +=
" " + hrefString +
"SERVICE=WMS&REQUEST=GetSchemaExtension";
227 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xsi:schemaLocation" ), schemaLocation );
229 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"version" ), version );
230 doc.appendChild( wmsCapabilitiesElement );
233 wmsCapabilitiesElement.appendChild(
getServiceElement( doc, project, version, request ) );
236 QDomElement capabilityElement =
getCapabilityElement( doc, project, version, request, projectSettings );
237 wmsCapabilitiesElement.appendChild( capabilityElement );
239 if ( projectSettings )
248 capabilityElement.appendChild(
252 if ( projectSettings )
254 appendDrawingOrder( doc, capabilityElement, serverIface, project );
264 QDomElement serviceElem = doc.createElement( QStringLiteral(
"Service" ) );
267 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
268 QDomText nameText = doc.createTextNode( QStringLiteral(
"WMS" ) );
269 nameElem.appendChild( nameText );
270 serviceElem.appendChild( nameElem );
273 if ( !title.isEmpty() )
275 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
276 QDomText titleText = doc.createTextNode( title );
277 titleElem.appendChild( titleText );
278 serviceElem.appendChild( titleElem );
282 if ( !
abstract.isEmpty() )
284 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
285 QDomText abstractText = doc.createCDATASection(
abstract );
286 abstractElem.appendChild( abstractText );
287 serviceElem.appendChild( abstractElem );
290 addKeywordListElement( project, doc, serviceElem );
293 if ( onlineResource.isEmpty() )
295 onlineResource =
serviceUrl( request, project ).toString();
297 QDomElement onlineResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
298 onlineResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
299 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
300 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), onlineResource );
301 serviceElem.appendChild( onlineResourceElem );
308 if ( !contactPerson.isEmpty() ||
309 !contactOrganization.isEmpty() ||
310 !contactPosition.isEmpty() ||
311 !contactMail.isEmpty() ||
312 !contactPhone.isEmpty() )
315 QDomElement contactInfoElem = doc.createElement( QStringLiteral(
"ContactInformation" ) );
318 if ( !contactPerson.isEmpty() ||
319 !contactOrganization.isEmpty() ||
320 !contactPosition.isEmpty() )
322 QDomElement contactPersonPrimaryElem = doc.createElement( QStringLiteral(
"ContactPersonPrimary" ) );
324 if ( !contactPerson.isEmpty() )
326 QDomElement contactPersonElem = doc.createElement( QStringLiteral(
"ContactPerson" ) );
327 QDomText contactPersonText = doc.createTextNode( contactPerson );
328 contactPersonElem.appendChild( contactPersonText );
329 contactPersonPrimaryElem.appendChild( contactPersonElem );
332 if ( !contactOrganization.isEmpty() )
334 QDomElement contactOrganizationElem = doc.createElement( QStringLiteral(
"ContactOrganization" ) );
335 QDomText contactOrganizationText = doc.createTextNode( contactOrganization );
336 contactOrganizationElem.appendChild( contactOrganizationText );
337 contactPersonPrimaryElem.appendChild( contactOrganizationElem );
340 if ( !contactPosition.isEmpty() )
342 QDomElement contactPositionElem = doc.createElement( QStringLiteral(
"ContactPosition" ) );
343 QDomText contactPositionText = doc.createTextNode( contactPosition );
344 contactPositionElem.appendChild( contactPositionText );
345 contactPersonPrimaryElem.appendChild( contactPositionElem );
348 contactInfoElem.appendChild( contactPersonPrimaryElem );
351 if ( !contactPhone.isEmpty() )
353 QDomElement phoneElem = doc.createElement( QStringLiteral(
"ContactVoiceTelephone" ) );
354 QDomText phoneText = doc.createTextNode( contactPhone );
355 phoneElem.appendChild( phoneText );
356 contactInfoElem.appendChild( phoneElem );
359 if ( !contactMail.isEmpty() )
361 QDomElement mailElem = doc.createElement( QStringLiteral(
"ContactElectronicMailAddress" ) );
362 QDomText mailText = doc.createTextNode( contactMail );
363 mailElem.appendChild( mailText );
364 contactInfoElem.appendChild( mailElem );
367 serviceElem.appendChild( contactInfoElem );
370 QDomElement feesElem = doc.createElement( QStringLiteral(
"Fees" ) );
371 QDomText feesText = doc.createTextNode( QStringLiteral(
"None" ) );
373 if ( !fees.isEmpty() )
375 feesText = doc.createTextNode( fees );
377 feesElem.appendChild( feesText );
378 serviceElem.appendChild( feesElem );
380 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral(
"AccessConstraints" ) );
381 QDomText accessConstraintsText = doc.createTextNode( QStringLiteral(
"None" ) );
383 if ( !accessConstraints.isEmpty() )
385 accessConstraintsText = doc.createTextNode( accessConstraints );
387 accessConstraintsElem.appendChild( accessConstraintsText );
388 serviceElem.appendChild( accessConstraintsElem );
390 if ( version == QLatin1String(
"1.3.0" ) )
395 QDomElement maxWidthElem = doc.createElement( QStringLiteral(
"MaxWidth" ) );
396 QDomText maxWidthText = doc.createTextNode( QString::number( maxWidth ) );
397 maxWidthElem.appendChild( maxWidthText );
398 serviceElem.appendChild( maxWidthElem );
404 QDomElement maxHeightElem = doc.createElement( QStringLiteral(
"MaxHeight" ) );
405 QDomText maxHeightText = doc.createTextNode( QString::number( maxHeight ) );
406 maxHeightElem.appendChild( maxHeightText );
407 serviceElem.appendChild( maxHeightElem );
416 bool projectSettings )
424 QString hrefString = href.toString();
425 hrefString.append( href.hasQuery() ?
"&" :
"?" );
427 QDomElement capabilityElem = doc.createElement( QStringLiteral(
"Capability" ) );
430 QDomElement requestElem = doc.createElement( QStringLiteral(
"Request" ) );
431 capabilityElem.appendChild( requestElem );
433 QDomElement dcpTypeElem = doc.createElement( QStringLiteral(
"DCPType" ) );
434 QDomElement httpElem = doc.createElement( QStringLiteral(
"HTTP" ) );
435 dcpTypeElem.appendChild( httpElem );
438 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
440 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
441 formatElem.appendChild( doc.createTextNode( format ) );
442 elem.appendChild( formatElem );
448 elem = doc.createElement( QStringLiteral(
"GetCapabilities" ) );
449 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.wms_xml" :
"text/xml" ) );
450 elem.appendChild( dcpTypeElem );
451 requestElem.appendChild( elem );
456 if ( parameters.value( QStringLiteral(
"SERVICE" ) ).compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) != 0 )
458 QDomElement soapElem = doc.createElement( QStringLiteral(
"SOAP" ) );
459 httpElem.appendChild( soapElem );
460 QDomElement soapResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
461 soapResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
462 soapResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
463 soapResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
464 soapElem.appendChild( soapResourceElem );
468 QDomElement getElem = doc.createElement( QStringLiteral(
"Get" ) );
469 httpElem.appendChild( getElem );
470 QDomElement olResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
471 olResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
472 olResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
473 olResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
474 getElem.appendChild( olResourceElem );
477 elem = doc.createElement( QStringLiteral(
"GetMap" ) );
478 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
479 appendFormat( elem, QStringLiteral(
"image/png" ) );
480 appendFormat( elem, QStringLiteral(
"image/png; mode=16bit" ) );
481 appendFormat( elem, QStringLiteral(
"image/png; mode=8bit" ) );
482 appendFormat( elem, QStringLiteral(
"image/png; mode=1bit" ) );
483 appendFormat( elem, QStringLiteral(
"application/dxf" ) );
484 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
485 requestElem.appendChild( elem );
488 elem = doc.createElement( QStringLiteral(
"GetFeatureInfo" ) );
489 appendFormat( elem, QStringLiteral(
"text/plain" ) );
490 appendFormat( elem, QStringLiteral(
"text/html" ) );
491 appendFormat( elem, QStringLiteral(
"text/xml" ) );
492 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml" ) );
493 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml/3.1.1" ) );
494 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
495 requestElem.appendChild( elem );
498 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetLegendGraphic" :
"sld:GetLegendGraphic" ) );
499 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
500 appendFormat( elem, QStringLiteral(
"image/png" ) );
501 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
502 requestElem.appendChild( elem );
505 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"DescribeLayer" :
"sld:DescribeLayer" ) );
506 appendFormat( elem, QStringLiteral(
"text/xml" ) );
507 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
508 requestElem.appendChild( elem );
511 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetStyles" :
"qgs:GetStyles" ) );
512 appendFormat( elem, QStringLiteral(
"text/xml" ) );
513 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
514 requestElem.appendChild( elem );
516 if ( projectSettings )
519 elem = doc.createElement( QStringLiteral(
"GetPrint" ) );
520 appendFormat( elem, QStringLiteral(
"svg" ) );
521 appendFormat( elem, QStringLiteral(
"png" ) );
522 appendFormat( elem, QStringLiteral(
"pdf" ) );
523 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
524 requestElem.appendChild( elem );
528 elem = doc.createElement( QStringLiteral(
"Exception" ) );
529 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.se_xml" :
"XML" ) );
530 capabilityElem.appendChild( elem );
533 if ( version == QLatin1String(
"1.3.0" ) )
535 elem = doc.createElement( QStringLiteral(
"sld:UserDefinedSymbolization" ) );
536 elem.setAttribute( QStringLiteral(
"SupportSLD" ), QStringLiteral(
"1" ) );
537 elem.setAttribute( QStringLiteral(
"UserLayer" ), QStringLiteral(
"0" ) );
538 elem.setAttribute( QStringLiteral(
"UserStyle" ), QStringLiteral(
"1" ) );
539 elem.setAttribute( QStringLiteral(
"RemoteWFS" ), QStringLiteral(
"0" ) );
540 elem.setAttribute( QStringLiteral(
"InlineFeature" ), QStringLiteral(
"0" ) );
541 elem.setAttribute( QStringLiteral(
"RemoteWCS" ), QStringLiteral(
"0" ) );
542 capabilityElem.appendChild( elem );
550 return capabilityElem;
555 QDomElement inspireCapabilitiesElem;
558 return inspireCapabilitiesElem;
560 inspireCapabilitiesElem = doc.createElement( QStringLiteral(
"inspire_vs:ExtendedCapabilities" ) );
564 if ( !inspireMetadataUrl.isEmpty() )
566 QDomElement inspireCommonMetadataUrlElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataUrl" ) );
567 inspireCommonMetadataUrlElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:resourceLocatorType" ) );
569 QDomElement inspireCommonMetadataUrlUrlElem = doc.createElement( QStringLiteral(
"inspire_common:URL" ) );
570 inspireCommonMetadataUrlUrlElem.appendChild( doc.createTextNode( inspireMetadataUrl ) );
571 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlUrlElem );
574 if ( !inspireMetadataUrlType.isNull() )
576 QDomElement inspireCommonMetadataUrlMediaTypeElem = doc.createElement( QStringLiteral(
"inspire_common:MediaType" ) );
577 inspireCommonMetadataUrlMediaTypeElem.appendChild( doc.createTextNode( inspireMetadataUrlType ) );
578 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlMediaTypeElem );
581 inspireCapabilitiesElem.appendChild( inspireCommonMetadataUrlElem );
585 QDomElement inspireCommonResourceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:ResourceType" ) );
586 inspireCommonResourceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"service" ) ) );
587 inspireCapabilitiesElem.appendChild( inspireCommonResourceTypeElem );
589 QDomElement inspireCommonSpatialDataServiceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:SpatialDataServiceType" ) );
590 inspireCommonSpatialDataServiceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"view" ) ) );
591 inspireCapabilitiesElem.appendChild( inspireCommonSpatialDataServiceTypeElem );
594 if ( !inspireTemporalReference.isNull() )
596 QDomElement inspireCommonTemporalReferenceElem = doc.createElement( QStringLiteral(
"inspire_common:TemporalReference" ) );
597 QDomElement inspireCommonDateOfLastRevisionElem = doc.createElement( QStringLiteral(
"inspire_common:DateOfLastRevision" ) );
598 inspireCommonDateOfLastRevisionElem.appendChild( doc.createTextNode( inspireTemporalReference ) );
599 inspireCommonTemporalReferenceElem.appendChild( inspireCommonDateOfLastRevisionElem );
600 inspireCapabilitiesElem.appendChild( inspireCommonTemporalReferenceElem );
603 QDomElement inspireCommonMetadataPointOfContactElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataPointOfContact" ) );
606 QDomElement inspireCommonOrganisationNameElem = doc.createElement( QStringLiteral(
"inspire_common:OrganisationName" ) );
607 if ( !contactOrganization.isNull() )
609 inspireCommonOrganisationNameElem.appendChild( doc.createTextNode( contactOrganization ) );
611 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonOrganisationNameElem );
614 QDomElement inspireCommonEmailAddressElem = doc.createElement( QStringLiteral(
"inspire_common:EmailAddress" ) );
615 if ( !contactMail.isNull() )
617 inspireCommonEmailAddressElem.appendChild( doc.createTextNode( contactMail ) );
619 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonEmailAddressElem );
621 inspireCapabilitiesElem.appendChild( inspireCommonMetadataPointOfContactElem );
624 if ( !inspireMetadataDate.isNull() )
626 QDomElement inspireCommonMetadataDateElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataDate" ) );
627 inspireCommonMetadataDateElem.appendChild( doc.createTextNode( inspireMetadataDate ) );
628 inspireCapabilitiesElem.appendChild( inspireCommonMetadataDateElem );
633 QDomElement inspireCommonSupportedLanguagesElem = doc.createElement( QStringLiteral(
"inspire_common:SupportedLanguages" ) );
634 inspireCommonSupportedLanguagesElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:supportedLanguagesType" ) );
636 QDomElement inspireCommonLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:Language" ) );
639 QDomElement inspireCommonDefaultLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:DefaultLanguage" ) );
640 inspireCommonDefaultLanguageElem.appendChild( inspireCommonLanguageElem );
641 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonDefaultLanguageElem );
645 QDomElement inspireCommonSupportedLanguageElem = doc.createElement(
"inspire_common:SupportedLanguage" );
646 inspireCommonSupportedLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
647 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonSupportedLanguageElem );
650 inspireCapabilitiesElem.appendChild( inspireCommonSupportedLanguagesElem );
652 QDomElement inspireCommonResponseLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:ResponseLanguage" ) );
653 inspireCommonResponseLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
654 inspireCapabilitiesElem.appendChild( inspireCommonResponseLanguageElem );
656 return inspireCapabilitiesElem;
662 if ( projectComposers.size() == 0 )
663 return QDomElement();
667 QDomElement composerTemplatesElem = doc.createElement( QStringLiteral(
"ComposerTemplates" ) );
668 QList<QgsPrintLayout *>::const_iterator cIt = projectComposers.constBegin();
669 for ( ; cIt != projectComposers.constEnd(); ++cIt )
672 if ( restrictedComposers.contains( layout->
name() ) )
684 QDomElement composerTemplateElem = doc.createElement( QStringLiteral(
"ComposerTemplate" ) );
685 composerTemplateElem.setAttribute( QStringLiteral(
"name" ), layout->
name() );
688 composerTemplateElem.setAttribute( QStringLiteral(
"width" ), width.length() );
689 composerTemplateElem.setAttribute( QStringLiteral(
"height" ), height.
length() );
692 QList<QgsLayoutItemMap *> layoutMapList;
694 QList<QgsLayoutItemMap *>::const_iterator cmIt = layoutMapList.constBegin();
697 for ( ; cmIt != layoutMapList.constEnd(); ++cmIt )
701 QDomElement composerMapElem = doc.createElement( QStringLiteral(
"ComposerMap" ) );
702 composerMapElem.setAttribute( QStringLiteral(
"name" ), QStringLiteral(
"map%1" ).arg( mapId ) );
704 composerMapElem.setAttribute( QStringLiteral(
"width" ), composerMap->rect().width() );
705 composerMapElem.setAttribute( QStringLiteral(
"height" ), composerMap->rect().height() );
706 composerTemplateElem.appendChild( composerMapElem );
710 QList<QgsLayoutItemLabel *> composerLabelList;
712 QList<QgsLayoutItemLabel *>::const_iterator clIt = composerLabelList.constBegin();
713 for ( ; clIt != composerLabelList.constEnd(); ++clIt )
716 QString
id = composerLabel->
id();
720 QDomElement composerLabelElem = doc.createElement( QStringLiteral(
"ComposerLabel" ) );
721 composerLabelElem.setAttribute( QStringLiteral(
"name" ),
id );
722 composerTemplateElem.appendChild( composerLabelElem );
726 QList<QgsLayoutItemHtml *> composerHtmlList;
728 QList<QgsLayoutItemHtml *>::const_iterator chIt = composerHtmlList.constBegin();
729 for ( ; chIt != composerHtmlList.constEnd(); ++chIt )
735 QString
id = composerHtml->
frame( 0 )->
id();
739 QDomElement composerHtmlElem = doc.createElement( QStringLiteral(
"ComposerHtml" ) );
740 composerHtmlElem.setAttribute( QStringLiteral(
"name" ),
id );
741 composerTemplateElem.appendChild( composerHtmlElem );
744 composerTemplatesElem.appendChild( composerTemplateElem );
747 if ( composerTemplatesElem.childNodes().size() == 0 )
748 return QDomElement();
750 return composerTemplatesElem;
756 if ( wfsLayerIds.size() == 0 )
757 return QDomElement();
759 QDomElement wfsLayersElem = doc.createElement( QStringLiteral(
"WFSLayers" ) );
760 for (
int i = 0; i < wfsLayerIds.size(); ++i )
763 if ( layer->
type() != QgsMapLayer::LayerType::VectorLayer )
768 QDomElement wfsLayerElem = doc.createElement( QStringLiteral(
"WFSLayer" ) );
771 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
id() );
775 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
name() );
777 wfsLayersElem.appendChild( wfsLayerElem );
780 return wfsLayersElem;
784 const QgsProject *project,
const QString &version,
789 QDomElement layerParentElem = doc.createElement( QStringLiteral(
"Layer" ) );
791 if ( !project->
title().isEmpty() )
794 QDomElement layerParentTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
795 QDomText layerParentTitleText = doc.createTextNode( project->
title() );
796 layerParentTitleElem.appendChild( layerParentTitleText );
797 layerParentElem.appendChild( layerParentTitleElem );
800 QDomElement layerParentAbstElem = doc.createElement( QStringLiteral(
"Abstract" ) );
801 QDomText layerParentAbstText = doc.createTextNode( project->
title() );
802 layerParentAbstElem.appendChild( layerParentAbstText );
803 layerParentElem.appendChild( layerParentAbstElem );
808 if ( rootLayerName.isEmpty() && !project->
title().isEmpty() )
810 rootLayerName = project->
title();
813 if ( !rootLayerName.isEmpty() )
815 QDomElement layerParentNameElem = doc.createElement( QStringLiteral(
"Name" ) );
816 QDomText layerParentNameText = doc.createTextNode( rootLayerName );
817 layerParentNameElem.appendChild( layerParentNameText );
818 layerParentElem.appendChild( layerParentNameElem );
822 addKeywordListElement( project, doc, layerParentElem );
825 if ( projectSettings )
827 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
828 QDomText treeNameText = doc.createTextNode( project->
title() );
829 treeNameElem.appendChild( treeNameText );
830 layerParentElem.appendChild( treeNameElem );
835 layerParentElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
839 layerParentElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
842 appendLayersFromTreeGroup( doc, layerParentElem, serverIface, project, version, request, projectLayerTreeRoot, projectSettings );
844 combineExtentAndCrsOfGroupChildren( doc, layerParentElem, project,
true );
846 return layerParentElem;
852 void appendLayersFromTreeGroup( QDomDocument &doc,
853 QDomElement &parentLayer,
856 const QString &version,
859 bool projectSettings )
865 QList< QgsLayerTreeNode * > layerTreeGroupChildren = layerTreeGroup->
children();
866 for (
int i = 0; i < layerTreeGroupChildren.size(); ++i )
869 QDomElement layerElem = doc.createElement( QStringLiteral(
"Layer" ) );
871 if ( projectSettings )
873 layerElem.setAttribute( QStringLiteral(
"visible" ), treeNode->
isVisible() );
880 QString name = treeGroupChild->
name();
881 if ( restrictedLayers.contains( name ) )
886 if ( projectSettings )
888 layerElem.setAttribute( QStringLiteral(
"mutuallyExclusive" ), treeGroupChild->
isMutuallyExclusive() );
891 QString shortName = treeGroupChild->
customProperty( QStringLiteral(
"wmsShortName" ) ).toString();
892 QString title = treeGroupChild->
customProperty( QStringLiteral(
"wmsTitle" ) ).toString();
894 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
896 if ( !shortName.isEmpty() )
897 nameText = doc.createTextNode( shortName );
899 nameText = doc.createTextNode( name );
900 nameElem.appendChild( nameText );
901 layerElem.appendChild( nameElem );
903 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
905 if ( !title.isEmpty() )
906 titleText = doc.createTextNode( title );
908 titleText = doc.createTextNode( name );
909 titleElem.appendChild( titleText );
910 layerElem.appendChild( titleElem );
912 QString
abstract = treeGroupChild->
customProperty( QStringLiteral(
"wmsAbstract" ) ).toString();
913 if ( !
abstract.isEmpty() )
915 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
916 QDomText abstractText = doc.createTextNode(
abstract );
917 abstractElem.appendChild( abstractText );
918 layerElem.appendChild( abstractElem );
922 if ( projectSettings )
924 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
925 QDomText treeNameText = doc.createTextNode( name );
926 treeNameElem.appendChild( treeNameText );
927 layerElem.appendChild( treeNameElem );
933 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
937 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
940 appendLayersFromTreeGroup( doc, layerElem, serverIface, project, version, request, treeGroupChild, projectSettings );
942 combineExtentAndCrsOfGroupChildren( doc, layerElem, project );
948 if ( restrictedLayers.contains( l->
name() ) )
959 QString wmsName = l->
name();
972 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
976 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
979 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
980 QDomText nameText = doc.createTextNode( wmsName );
981 nameElem.appendChild( nameText );
982 layerElem.appendChild( nameElem );
984 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
985 QString title = l->
title();
986 if ( title.isEmpty() )
990 QDomText titleText = doc.createTextNode( title );
991 titleElem.appendChild( titleText );
992 layerElem.appendChild( titleElem );
995 if ( !
abstract.isEmpty() )
997 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
998 QDomText abstractText = doc.createTextNode(
abstract );
999 abstractElem.appendChild( abstractText );
1000 layerElem.appendChild( abstractElem );
1006 QStringList keywordStringList = l->
keywordList().split(
',' );
1008 QDomElement keywordListElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1009 for (
int i = 0; i < keywordStringList.size(); ++i )
1011 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1012 QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
1013 keywordElem.appendChild( keywordText );
1016 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1018 keywordListElem.appendChild( keywordElem );
1020 layerElem.appendChild( keywordListElem );
1024 bool geometryLayer =
true;
1032 geometryLayer =
false;
1038 if ( geometryLayer )
1040 QStringList crsList;
1043 appendCrsElementsToLayer( doc, layerElem, crsList, outputCrsList );
1061 else if ( vl->
crs() != project->
crs() )
1066 extent = ct.transform( extent );
1070 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent for layer %1: %2" ).arg( vl->
name() ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1077 appendLayerBoundingBoxes( doc, layerElem, extent, l->
crs(), crsList, outputCrsList, project );
1081 appendLayerStyles( doc, layerElem, l, project, version, request );
1086 if ( version == QLatin1String(
"1.1.1" ) )
1088 double OGC_PX_M = 0.00028;
1089 double SCALE_TO_SCALEHINT = OGC_PX_M * M_SQRT2;
1091 QDomElement scaleHintElem = doc.createElement( QStringLiteral(
"ScaleHint" ) );
1092 scaleHintElem.setAttribute( QStringLiteral(
"min" ), QString::number( l->
maximumScale() * SCALE_TO_SCALEHINT ) );
1093 scaleHintElem.setAttribute( QStringLiteral(
"max" ), QString::number( l->
minimumScale() * SCALE_TO_SCALEHINT ) );
1094 layerElem.appendChild( scaleHintElem );
1098 QString minScaleString = QString::number( l->
maximumScale() );
1099 QDomElement minScaleElem = doc.createElement( QStringLiteral(
"MinScaleDenominator" ) );
1100 QDomText minScaleText = doc.createTextNode( minScaleString );
1101 minScaleElem.appendChild( minScaleText );
1102 layerElem.appendChild( minScaleElem );
1104 QString maxScaleString = QString::number( l->
minimumScale() );
1105 QDomElement maxScaleElem = doc.createElement( QStringLiteral(
"MaxScaleDenominator" ) );
1106 QDomText maxScaleText = doc.createTextNode( maxScaleString );
1107 maxScaleElem.appendChild( maxScaleText );
1108 layerElem.appendChild( maxScaleElem );
1113 QString dataUrl = l->
dataUrl();
1114 if ( !dataUrl.isEmpty() )
1116 QDomElement dataUrlElem = doc.createElement( QStringLiteral(
"DataURL" ) );
1117 QDomElement dataUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1119 QDomText dataUrlFormatText = doc.createTextNode( dataUrlFormat );
1120 dataUrlFormatElem.appendChild( dataUrlFormatText );
1121 dataUrlElem.appendChild( dataUrlFormatElem );
1122 QDomElement dataORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1123 dataORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1124 dataORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1125 dataORElem.setAttribute( QStringLiteral(
"xlink:href" ), dataUrl );
1126 dataUrlElem.appendChild( dataORElem );
1127 layerElem.appendChild( dataUrlElem );
1132 if ( !attribution.isEmpty() )
1134 QDomElement attribElem = doc.createElement( QStringLiteral(
"Attribution" ) );
1135 QDomElement attribTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1136 QDomText attribText = doc.createTextNode( attribution );
1137 attribTitleElem.appendChild( attribText );
1138 attribElem.appendChild( attribTitleElem );
1140 if ( !attributionUrl.isEmpty() )
1142 QDomElement attribORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1143 attribORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1144 attribORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1145 attribORElem.setAttribute( QStringLiteral(
"xlink:href" ), attributionUrl );
1146 attribElem.appendChild( attribORElem );
1148 layerElem.appendChild( attribElem );
1153 if ( !metadataUrl.isEmpty() )
1155 QDomElement metaUrlElem = doc.createElement( QStringLiteral(
"MetadataURL" ) );
1157 if ( version == QLatin1String(
"1.1.1" ) )
1159 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1161 else if ( metadataUrlType == QLatin1String(
"FGDC" ) )
1163 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"FGDC:1998" ) );
1165 else if ( metadataUrlType == QLatin1String(
"TC211" ) )
1167 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ISO19115:2003" ) );
1171 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1174 if ( !metadataUrlFormat.isEmpty() )
1176 QDomElement metaUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1177 QDomText metaUrlFormatText = doc.createTextNode( metadataUrlFormat );
1178 metaUrlFormatElem.appendChild( metaUrlFormatText );
1179 metaUrlElem.appendChild( metaUrlFormatElem );
1181 QDomElement metaUrlORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1182 metaUrlORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1183 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1184 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:href" ), metadataUrl );
1185 metaUrlElem.appendChild( metaUrlORElem );
1186 layerElem.appendChild( metaUrlElem );
1189 if ( projectSettings )
1191 appendLayerProjectSettings( doc, layerElem, l );
1195 parentLayer.appendChild( layerElem );
1199 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
1206 QString hrefString = href.toString();
1207 hrefString.append( href.hasQuery() ?
"&" :
"?" );
1210 QDomElement styleElem = doc.createElement( QStringLiteral(
"Style" ) );
1211 QDomElement styleNameElem = doc.createElement( QStringLiteral(
"Name" ) );
1212 QDomText styleNameText = doc.createTextNode( styleName );
1213 styleNameElem.appendChild( styleNameText );
1214 QDomElement styleTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1215 QDomText styleTitleText = doc.createTextNode( styleName );
1216 styleTitleElem.appendChild( styleTitleText );
1217 styleElem.appendChild( styleNameElem );
1218 styleElem.appendChild( styleTitleElem );
1221 QDomElement getLayerLegendGraphicElem = doc.createElement( QStringLiteral(
"LegendURL" ) );
1223 QString customHrefString = currentLayer->
legendUrl();
1225 QStringList getLayerLegendGraphicFormats;
1226 if ( !customHrefString.isEmpty() )
1232 getLayerLegendGraphicFormats << QStringLiteral(
"image/png" );
1235 for (
int i = 0; i < getLayerLegendGraphicFormats.size(); ++i )
1237 QDomElement getLayerLegendGraphicFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1238 QString getLayerLegendGraphicFormat = getLayerLegendGraphicFormats[i];
1239 QDomText getLayerLegendGraphicFormatText = doc.createTextNode( getLayerLegendGraphicFormat );
1240 getLayerLegendGraphicFormatElem.appendChild( getLayerLegendGraphicFormatText );
1241 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicFormatElem );
1245 if ( customHrefString.isEmpty() )
1247 QString layerName = currentLayer->
name();
1249 layerName = currentLayer->
id();
1250 else if ( !currentLayer->
shortName().isEmpty() )
1252 QUrlQuery mapUrl( hrefString );
1253 mapUrl.addQueryItem( QStringLiteral(
"SERVICE" ), QStringLiteral(
"WMS" ) );
1254 mapUrl.addQueryItem( QStringLiteral(
"VERSION" ), version );
1255 mapUrl.addQueryItem( QStringLiteral(
"REQUEST" ), QStringLiteral(
"GetLegendGraphic" ) );
1256 mapUrl.addQueryItem( QStringLiteral(
"LAYER" ), layerName );
1257 mapUrl.addQueryItem( QStringLiteral(
"FORMAT" ), QStringLiteral(
"image/png" ) );
1258 mapUrl.addQueryItem( QStringLiteral(
"STYLE" ), styleNameText.data() );
1259 if ( version == QLatin1String(
"1.3.0" ) )
1261 mapUrl.addQueryItem( QStringLiteral(
"SLD_VERSION" ), QStringLiteral(
"1.1.0" ) );
1263 customHrefString = mapUrl.toString();
1266 QDomElement getLayerLegendGraphicORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1267 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1268 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1269 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:href" ), customHrefString );
1270 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicORElem );
1271 styleElem.appendChild( getLayerLegendGraphicElem );
1273 layerElem.appendChild( styleElem );
1277 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
1278 const QStringList &crsList,
const QStringList &constrainedCrsList )
1280 if ( layerElement.isNull() )
1286 QDomElement titleElement = layerElement.firstChildElement( QStringLiteral(
"Title" ) );
1287 QDomElement abstractElement = layerElement.firstChildElement( QStringLiteral(
"Abstract" ) );
1288 QDomElement CRSPrecedingElement = abstractElement.isNull() ? titleElement : abstractElement;
1290 if ( CRSPrecedingElement.isNull() )
1293 const QDomElement keyElement = layerElement.firstChildElement( QStringLiteral(
"KeywordList" ) );
1294 CRSPrecedingElement = keyElement;
1298 if ( !constrainedCrsList.isEmpty() )
1300 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1302 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, constrainedCrsList.at( i ) );
1307 for (
const QString &
crs : crsList )
1309 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement,
crs );
1314 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, QString(
"CRS:84" ) );
1317 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
1318 const QString &crsText )
1320 if ( crsText.isEmpty() )
1322 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1323 QDomElement crsElement = doc.createElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1324 QDomText crsTextNode = doc.createTextNode( crsText );
1325 crsElement.appendChild( crsTextNode );
1326 layerElement.insertAfter( crsElement, precedingElement );
1329 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
1331 const QStringList &constrainedCrsList,
const QgsProject *project )
1333 if ( layerElem.isNull() )
1342 layerExtent.
grow( 0.000001 );
1346 int wgs84precision = 6;
1348 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1351 QDomElement ExGeoBBoxElement;
1354 if ( !layerExtent.
isNull() )
1363 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1368 if ( version == QLatin1String(
"1.1.1" ) )
1370 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"LatLonBoundingBox" ) );
1378 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"EX_GeographicBoundingBox" ) );
1379 QDomElement wBoundLongitudeElement = doc.createElement( QStringLiteral(
"westBoundLongitude" ) );
1381 wBoundLongitudeElement.appendChild( wBoundLongitudeText );
1382 ExGeoBBoxElement.appendChild( wBoundLongitudeElement );
1383 QDomElement eBoundLongitudeElement = doc.createElement( QStringLiteral(
"eastBoundLongitude" ) );
1385 eBoundLongitudeElement.appendChild( eBoundLongitudeText );
1386 ExGeoBBoxElement.appendChild( eBoundLongitudeElement );
1387 QDomElement sBoundLatitudeElement = doc.createElement( QStringLiteral(
"southBoundLatitude" ) );
1389 sBoundLatitudeElement.appendChild( sBoundLatitudeText );
1390 ExGeoBBoxElement.appendChild( sBoundLatitudeElement );
1391 QDomElement nBoundLatitudeElement = doc.createElement( QStringLiteral(
"northBoundLatitude" ) );
1393 nBoundLatitudeElement.appendChild( nBoundLatitudeText );
1394 ExGeoBBoxElement.appendChild( nBoundLatitudeElement );
1397 if ( !wgs84BoundingRect.
isNull() )
1399 QDomElement lastCRSElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1400 if ( !lastCRSElem.isNull() )
1402 layerElem.insertAfter( ExGeoBBoxElement, lastCRSElem );
1406 layerElem.appendChild( ExGeoBBoxElement );
1411 if ( !constrainedCrsList.isEmpty() )
1413 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1415 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS, constrainedCrsList.at( i ), project );
1420 for (
const QString &
crs : crsList )
1422 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS,
crs, project );
1428 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
1432 if ( layerElem.isNull() )
1437 if ( crsText.isEmpty() )
1442 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1448 if ( !layerExtent.
isNull() )
1457 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1462 if ( crsExtent.
isNull() )
1474 QDomElement bBoxElement = doc.createElement( QStringLiteral(
"BoundingBox" ) );
1477 bBoxElement.setAttribute( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS", crs.
authid() );
1490 QDomElement lastBBoxElem = layerElem.lastChildElement( QStringLiteral(
"BoundingBox" ) );
1491 if ( !lastBBoxElem.isNull() )
1493 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1497 lastBBoxElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"LatLonBoundingBox" :
"EX_GeographicBoundingBox" );
1498 if ( !lastBBoxElem.isNull() )
1500 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1504 layerElem.appendChild( bBoxElement );
1509 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
1513 if ( layerElem.isNull() )
1519 QDomElement boundingBoxElem = layerElem.firstChildElement( QStringLiteral(
"BoundingBox" ) );
1520 if ( boundingBoxElem.isNull() )
1525 double minx, miny, maxx, maxy;
1527 minx = boundingBoxElem.attribute( QStringLiteral(
"minx" ) ).toDouble( &conversionOk );
1528 if ( !conversionOk )
1532 miny = boundingBoxElem.attribute( QStringLiteral(
"miny" ) ).toDouble( &conversionOk );
1533 if ( !conversionOk )
1537 maxx = boundingBoxElem.attribute( QStringLiteral(
"maxx" ) ).toDouble( &conversionOk );
1538 if ( !conversionOk )
1542 maxy = boundingBoxElem.attribute( QStringLiteral(
"maxy" ) ).toDouble( &conversionOk );
1543 if ( !conversionOk )
1549 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1563 if ( version != QLatin1String(
"1.1.1" ) && layerCrs.
hasAxisInverted() )
1574 BBox = t.transformBoundingBox( BBox );
1578 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1585 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet )
1587 if ( layerElement.isNull() )
1594 QDomNodeList crsNodeList;
1595 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"CRS" ) );
1596 for (
int i = 0; i < crsNodeList.size(); ++i )
1598 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1601 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"SRS" ) );
1602 for (
int i = 0; i < crsNodeList.size(); ++i )
1604 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1610 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
1611 bool considerMapExtent )
1614 QSet<QString> combinedCRSSet;
1615 bool firstBBox =
true;
1616 bool firstCRSSet =
true;
1618 QDomNodeList layerChildren = groupElem.childNodes();
1619 for (
int j = 0; j < layerChildren.size(); ++j )
1621 QDomElement childElem = layerChildren.at( j ).toElement();
1623 if ( childElem.tagName() != QLatin1String(
"Layer" ) )
1626 QgsRectangle bbox = layerBoundingBoxInProjectCrs( doc, childElem, project );
1636 combinedBBox = bbox;
1646 QSet<QString> crsSet;
1647 if ( crsSetFromLayerElement( childElem, crsSet ) )
1651 combinedCRSSet = crsSet;
1652 firstCRSSet =
false;
1656 combinedCRSSet.intersect( crsSet );
1662 appendCrsElementsToLayer( doc, groupElem, combinedCRSSet.toList(), outputCrsList );
1665 if ( considerMapExtent )
1670 combinedBBox = mapRect;
1673 appendLayerBoundingBoxes( doc, groupElem, combinedBBox, groupCRS, combinedCRSSet.toList(), outputCrsList, project );
1677 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
1680 #ifdef HAVE_SERVER_PYTHON_PLUGINS 1683 ( void )serverIface;
1688 QStringList layerList;
1691 QList< QgsMapLayer * > projectLayerOrder = projectLayerTreeRoot->
layerOrder();
1692 for (
int i = 0; i < projectLayerOrder.size(); ++i )
1696 if ( restrictedLayers.contains( l->
name() ) )
1706 QString wmsName = l->
name();
1716 layerList << wmsName;
1719 if ( !layerList.isEmpty() )
1721 QStringList reversedList;
1722 reversedList.reserve( layerList.size() );
1723 for (
int i = layerList.size() - 1; i >= 0; --i )
1724 reversedList << layerList[ i ];
1726 QDomElement layerDrawingOrderElem = doc.createElement( QStringLiteral(
"LayerDrawingOrder" ) );
1727 QDomText drawingOrderText = doc.createTextNode( reversedList.join(
',' ) );
1728 layerDrawingOrderElem.appendChild( drawingOrderText );
1729 parentElem.appendChild( layerDrawingOrderElem );
1733 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer )
1735 if ( !currentLayer )
1741 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
1742 QDomText treeNameText = doc.createTextNode( currentLayer->
name() );
1743 treeNameElem.appendChild( treeNameText );
1744 layerElem.appendChild( treeNameElem );
1751 int displayFieldIdx = -1;
1752 QString displayField = QStringLiteral(
"maptip" );
1754 if ( exp.isField() )
1761 QDomElement attributesElem = doc.createElement( QStringLiteral(
"Attributes" ) );
1763 for (
int idx = 0; idx < layerFields.
count(); ++idx )
1766 if ( excludedAttributes.contains( field.
name() ) )
1771 if ( idx == displayFieldIdx )
1775 QDomElement attributeElem = doc.createElement( QStringLiteral(
"Attribute" ) );
1776 attributeElem.setAttribute( QStringLiteral(
"name" ), field.
name() );
1777 attributeElem.setAttribute( QStringLiteral(
"type" ), QVariant::typeToName( field.
type() ) );
1778 attributeElem.setAttribute( QStringLiteral(
"typeName" ), field.
typeName() );
1779 QString alias = field.
alias();
1780 if ( !alias.isEmpty() )
1782 attributeElem.setAttribute( QStringLiteral(
"alias" ), alias );
1786 attributeElem.setAttribute( QStringLiteral(
"editType" ), vLayer->
editorWidgetSetup( idx ).
type() );
1787 attributeElem.setAttribute( QStringLiteral(
"comment" ), field.
comment() );
1788 attributeElem.setAttribute( QStringLiteral(
"length" ), field.
length() );
1789 attributeElem.setAttribute( QStringLiteral(
"precision" ), field.
precision() );
1790 attributesElem.appendChild( attributeElem );
1794 layerElem.setAttribute( QStringLiteral(
"displayField" ), displayField );
1799 layerElem.appendChild( attributesElem );
1804 if ( provider && provider->
name() ==
"wms" )
1807 QVariant wmsBackgroundLayer = currentLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
1808 QDomElement wmsBackgroundLayerElem = doc.createElement(
"WMSBackgroundLayer" );
1809 QDomText wmsBackgroundLayerText = doc.createTextNode( wmsBackgroundLayer.toBool() ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
1810 wmsBackgroundLayerElem.appendChild( wmsBackgroundLayerText );
1811 layerElem.appendChild( wmsBackgroundLayerElem );
1814 QVariant wmsPublishDataSourceUrl = currentLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
1815 if ( wmsPublishDataSourceUrl.toBool() )
1817 QList< QVariant > resolutionList = provider->property(
"resolutions" ).toList();
1818 bool tiled = resolutionList.size() > 0;
1820 QDomElement dataSourceElem = doc.createElement( tiled ? QStringLiteral(
"WMTSDataSource" ) : QStringLiteral(
"WMSDataSource" ) );
1821 QDomText dataSourceUri = doc.createTextNode( provider->
dataSourceUri() );
1822 dataSourceElem.appendChild( dataSourceUri );
1823 layerElem.appendChild( dataSourceElem );
1827 QVariant wmsPrintLayer = currentLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
1828 if ( wmsPrintLayer.isValid() )
1830 QDomElement wmsPrintLayerElem = doc.createElement(
"WMSPrintLayer" );
1831 QDomText wmsPrintLayerText = doc.createTextNode( wmsPrintLayer.toString() );
1832 wmsPrintLayerElem.appendChild( wmsPrintLayerText );
1833 layerElem.appendChild( wmsPrintLayerElem );
1838 void addKeywordListElement(
const QgsProject *project, QDomDocument &doc, QDomElement &parent )
1842 QDomElement keywordsElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1844 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1845 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"ISO" ) );
1846 QDomText keywordText = doc.createTextNode( QStringLiteral(
"infoMapAccessService" ) );
1847 keywordElem.appendChild( keywordText );
1848 keywordsElem.appendChild( keywordElem );
1849 parent.appendChild( keywordsElem );
1851 for (
const QString &keyword : qgis::as_const( keywords ) )
1853 if ( !keyword.isEmpty() )
1855 keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1856 keywordText = doc.createTextNode( keyword );
1857 keywordElem.appendChild( keywordText );
1860 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1862 keywordsElem.appendChild( keywordElem );
1865 parent.appendChild( keywordsElem );
1873 for (
int j = 0; j < childNode->
children().size(); ++j )
1883 const auto l { treeLayer->
layer() };
bool fillCacheKey(QStringList &cacheKey) const
Fill the capabilities caching key.
int pageCount() const
Returns the number of pages in the collection.
SERVER_EXPORT QString wmsInspireMetadataUrl(const QgsProject &project)
Returns the Inspire metadata URL.
Class for parsing and evaluation of expressions (formerly called "search strings").
Layer tree group node serves as a container for layers and further groups.
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...
SERVER_EXPORT QStringList wmsOutputCrsList(const QgsProject &project)
Returns the WMS output CRS list.
A rectangle specified with double values.
Base class for all map layer types.
QString title() const
Returns the project's title.
bool isEmpty() const
Returns true if the rectangle is empty.
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.
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
QgsMapLayer::LayerType type() const
Returns the type of the layer.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider.
void setXMaximum(double x)
Set the maximum x value.
SERVER_EXPORT QString owsServiceContactPosition(const QgsProject &project)
Returns the owsService contact position defined in project.
SERVER_EXPORT QString owsServiceContactPerson(const QgsProject &project)
Returns the owsService contact person defined in project.
SERVER_EXPORT QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
A layout item subclass for text labels.
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer. Properties are stored in a map and saved in project file...
QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
QgsMapLayer * layer() const
Returns the map layer associated with this node.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
bool isMutuallyExclusive() const
Returns whether the group is mutually exclusive (only one child can be checked at a time) ...
double maximumScale() const
Returns the maximum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QgsEditorWidgetSetup editorWidgetSetup(int index) const
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field ...
SERVER_EXPORT QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
bool hasQueryableChildren(const QgsLayerTreeNode *childNode, const QStringList &wmsRestrictedLayers)
double length() const
Returns the length of the measurement.
void layoutObjects(QList< T * > &objectList) const
Returns a list of layout objects (items and multiframes) of a specific type.
QgsLayoutMeasurement convertFromLayoutUnits(double length, QgsUnitTypes::LayoutUnit unit) const
Converts a length measurement from the layout's native units to a specified target unit...
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QDomElement getServiceElement(QDomDocument &doc, const QgsProject *project, const QString &version, const QgsServerRequest &request)
Create Service element for get capabilities document.
QList< QgsPrintLayout * > printLayouts() const
Returns a list of all print layouts contained in the manager.
Container of fields for a vector layer.
SERVER_EXPORT bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
Abstract base class for spatial data provider implementations.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
const QgsCoordinateReferenceSystem & crs
SERVER_EXPORT QString wmsInspireMetadataDate(const QgsProject &project)
Returns the Inspire metadata date.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device...
virtual QString name() const =0
Returns a provider name.
void insertCapabilitiesDocument(const QString &configFilePath, const QString &key, const QDomDocument *doc)
Inserts new capabilities document (creates a copy of the document, does not take ownership) ...
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
virtual QString configFilePath()=0
Returns the configuration file path.
void layoutItems(QList< T * > &itemList) const
Returns a list of layout items of a specific type.
QDomElement getLayersAndStylesCapabilitiesElement(QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, bool projectSettings)
Create element for get capabilities document.
bool isVisible() const
Returns whether a node is really visible (ie checked and all its ancestors checked as well) ...
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages compositions within the project.
void writeGetCapabilities(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response, bool projectSettings)
Output GetCapabilities response.
Layout graphical items for displaying a map.
QString typeName() const
Gets the field type.
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
int frameCount() const
Returns the number of frames associated with this multiframe.
QgsLayoutItemPage * page(int pageNumber)
Returns a specific page (by pageNumber) from the collection.
virtual QgsCapabilitiesCache * capabilitiesCache()=0
Gets pointer to the capabiblities cache.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
Namespace with helper functions for layer tree operations.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
double xMaximum() const
Returns the x maximum value (right side of rectangle).
void grow(double delta)
Grows the rectangle in place by the specified amount.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout...
QDomElement getComposerTemplatesElement(QDomDocument &doc, const QgsProject *project)
Create ComposerTemplates element for get capabilities document.
SERVER_EXPORT QStringList wmsRestrictedComposers(const QgsProject &project)
Returns the restricted composer list.
QDomDocument getCapabilities(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, bool projectSettings)
Creates the WMS GetCapabilities XML document.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
SERVER_EXPORT double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
void setYMinimum(double y)
Set the minimum y value.
QList< QgsMapLayer * > layerOrder() const
The order in which layers will be rendered on the canvas.
QgsCoordinateReferenceSystem crs
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
SERVER_EXPORT bool wmsInspireActivate(const QgsProject &project)
Returns if Inspire is activated.
SERVER_EXPORT QString wmsInspireTemporalReference(const QgsProject &project)
Returns the Inspire temporal reference.
virtual QString dataSourceUri(bool expandAuthConfig=false) const
Gets the data source specification.
A helper class that centralizes caches accesses given by all the server cache filter plugins...
An expression node which takes it value from a feature's field.
This class is a base class for nodes in a layer tree.
long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Reads and writes project states.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
const QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.
int count() const
Returns number of items.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. ...
SERVER_EXPORT QString wmsInspireLanguage(const QgsProject &project)
Returns the Inspire language.
SERVER_EXPORT QString owsServiceFees(const QgsProject &project)
Returns the owsService fees defined in project.
Encapsulate a field in an attribute table or data source.
SERVER_EXPORT double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QString displayExpression
double minimumScale() const
Returns the minimum map scale (i.e.
SERVER_EXPORT QString owsServiceAccessConstraints(const QgsProject &project)
Returns the owsService access constraints defined in project.
QString attributeDisplayName(int index) const
Convenience function that returns the attribute alias if defined or the field name else...
SERVER_EXPORT QString owsServiceOnlineResource(const QgsProject &project)
Returns the owsService online resource defined in project.
Median cut implementation.
SERVER_EXPORT QString owsServiceContactOrganization(const QgsProject &project)
Returns the owsService contact organization defined in project.
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
QgsCoordinateTransformContext transformContext
void combineExtentWith(const QgsRectangle &rect)
Expands the rectangle so that it covers both the original rectangle and the given rectangle...
A cache for capabilities xml documents (by configuration file path)
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
Leaf node pointing to a layer.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QString legendUrl() const
Returns the URL for the layer's legend.
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
void setYMaximum(double y)
Set the maximum y value.
QDomElement getInspireCapabilitiesElement(QDomDocument &doc, const QgsProject *project)
Create InspireCapabilities element for get capabilities document.
SERVER_EXPORT QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
QDomElement getCapabilityElement(QDomDocument &doc, const QgsProject *project, const QString &version, const QgsServerRequest &request, bool projectSettings)
Create Capability element for get capabilities document.
QgsLayoutFrame * frame(int index) const
Returns the child frame at a specified index from the multiframe.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
SERVER_EXPORT QString wmsInspireMetadataUrlType(const QgsProject &project)
Returns the Inspire metadata URL type.
This class represents a coordinate reference system (CRS).
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
QString authid() const
Returns the authority identifier for the CRS.
static QString displayString(Type type)
Returns a display string type for a WKB type, e.g., the geometry name used in WKT geometry representa...
virtual QgsServerCacheManager * cacheManager() const =0
Gets the registered server cache filters.
QUrl serviceUrl(const QgsServerRequest &request, const QgsProject *project)
Returns WMS service URL.
A helper class that centralizes restrictions given by all the access control filter plugins...
QString id() const
Returns the item's ID name.
const QDomDocument * searchCapabilitiesDocument(const QString &configFilePath, const QString &key)
Returns cached capabilities document (or 0 if document for configuration file not in cache) ...
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
QString name() const override
Returns the group's name.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
Custom exception class for Coordinate Reference System related exceptions.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
SERVER_EXPORT QString owsServiceContactMail(const QgsProject &project)
Returns the owsService contact mail defined in project.
QgsLayerTree * layerTreeRoot() const
Returns pointer to the root (invisible) node of the project's layer tree.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
SERVER_EXPORT QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
Container of other groups and layers.
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
SERVER_EXPORT QString wmsRootName(const QgsProject &project)
Returns the WMS root layer name defined in a QGIS project.
Represents a vector layer which manages a vector based data sets.
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
bool isGeographic() const
Returns whether the CRS is a geographic CRS (using lat/lon coordinates)
double xMinimum() const
Returns the x minimum value (left side of rectangle).
A layout multiframe subclass for HTML content.
If the layer is identifiable using the identify map tool and as a WMS layer.
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
SERVER_EXPORT QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
QDomElement getWFSLayersElement(QDomDocument &doc, const QgsProject *project)
Create WFSLayers element for get capabilities document.
void setXMinimum(double x)
Set the minimum x value.
QgsCoordinateReferenceSystem crs
bool hasAxisInverted() const
Returns whether axis is inverted (e.g., for WMS 1.3) for the CRS.
void invert()
Swap x/y coordinates in the rectangle.
QMap< QString, QString > Parameters
Layer tree node points to a map layer.
SERVER_EXPORT QString owsServiceContactPhone(const QgsProject &project)
Returns the owsService contact phone defined in project.
SERVER_EXPORT int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.
SERVER_EXPORT bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
QStringList styles() const
Returns list of all defined style names.
QgsRectangle bounds() const
Returns the approximate bounds for the region the CRS is usable within.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.