47 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer );
49 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
52 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
53 bool considerMapExtent =
false );
55 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet );
57 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
60 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
64 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
66 const QStringList &constrainedCrsList,
const QgsProject *project );
68 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
69 const QString &crsText );
71 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
72 const QStringList &crsList,
const QStringList &constrainedCrsList );
74 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
77 void appendLayersFromTreeGroup( QDomDocument &doc,
78 QDomElement &parentLayer,
81 const QString &version,
84 bool projectSettings );
86 void addKeywordListElement(
const QgsProject *project, QDomDocument &doc, QDomElement &parent );
94 #ifdef HAVE_SERVER_PYTHON_PLUGINS 99 const QDomDocument *capabilitiesDocument =
nullptr;
104 QStringList cacheKeyList;
105 cacheKeyList << ( projectSettings ? QStringLiteral(
"projectSettings" ) : version );
106 cacheKeyList << request.
url().host();
110 QString cacheKey = cacheKeyList.join(
'-' );
113 #ifdef HAVE_SERVER_PYTHON_PLUGINS 116 if ( cacheManager && cacheManager->
getCachedDocument( &doc, project, request, accessControl ) )
118 capabilitiesDocument = &doc;
121 if ( !capabilitiesDocument && cache )
126 if ( !capabilitiesDocument )
130 doc =
getCapabilities( serverIface, project, version, request, projectSettings );
135 capabilitiesDocument = &doc;
142 if ( !capabilitiesDocument )
144 capabilitiesDocument = &doc;
156 response.
setHeader( QStringLiteral(
"Content-Type" ), QStringLiteral(
"text/xml; charset=utf-8" ) );
157 response.
write( capabilitiesDocument->toByteArray() );
162 bool projectSettings )
165 QDomElement wmsCapabilitiesElement;
173 QString hrefString = href.toString();
174 hrefString.append( href.hasQuery() ?
"&" :
"?" );
177 QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( QStringLiteral(
"xml" ),
178 QStringLiteral(
"version=\"1.0\" encoding=\"utf-8\"" ) );
181 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
183 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
184 formatElem.appendChild( doc.createTextNode( format ) );
185 elem.appendChild( formatElem );
188 if ( version == QLatin1String(
"1.1.1" ) )
190 doc = QDomDocument( QStringLiteral(
"WMT_MS_Capabilities SYSTEM 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd'" ) );
191 doc.appendChild( xmlDeclaration );
192 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMT_MS_Capabilities" ) );
196 doc.appendChild( xmlDeclaration );
197 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMS_Capabilities" ) );
198 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns" ), QStringLiteral(
"http://www.opengis.net/wms" ) );
199 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:sld" ), QStringLiteral(
"http://www.opengis.net/sld" ) );
200 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:qgs" ), QStringLiteral(
"http://www.qgis.org/wms" ) );
201 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
202 QString schemaLocation = QStringLiteral(
"http://www.opengis.net/wms" );
203 schemaLocation += QLatin1String(
" http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd" );
204 schemaLocation += QLatin1String(
" http://www.opengis.net/sld" );
205 schemaLocation += QLatin1String(
" http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd" );
208 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_common" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/common/1.0" ) );
209 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_vs" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" ) );
210 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" );
211 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0/inspire_vs.xsd" );
214 schemaLocation +=
" " + hrefString +
"SERVICE=WMS&REQUEST=GetSchemaExtension";
215 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xsi:schemaLocation" ), schemaLocation );
217 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"version" ), version );
218 doc.appendChild( wmsCapabilitiesElement );
221 wmsCapabilitiesElement.appendChild(
getServiceElement( doc, project, version, request ) );
224 QDomElement capabilityElement =
getCapabilityElement( doc, project, version, request, projectSettings );
225 wmsCapabilitiesElement.appendChild( capabilityElement );
227 if ( projectSettings )
236 capabilityElement.appendChild(
240 if ( projectSettings )
242 appendDrawingOrder( doc, capabilityElement, serverIface, project );
252 QDomElement serviceElem = doc.createElement( QStringLiteral(
"Service" ) );
255 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
256 QDomText nameText = doc.createTextNode( QStringLiteral(
"WMS" ) );
257 nameElem.appendChild( nameText );
258 serviceElem.appendChild( nameElem );
261 if ( !title.isEmpty() )
263 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
264 QDomText titleText = doc.createTextNode( title );
265 titleElem.appendChild( titleText );
266 serviceElem.appendChild( titleElem );
270 if ( !
abstract.isEmpty() )
272 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
273 QDomText abstractText = doc.createCDATASection(
abstract );
274 abstractElem.appendChild( abstractText );
275 serviceElem.appendChild( abstractElem );
278 addKeywordListElement( project, doc, serviceElem );
281 if ( onlineResource.isEmpty() )
283 onlineResource =
serviceUrl( request, project ).toString();
285 QDomElement onlineResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
286 onlineResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
287 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
288 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), onlineResource );
289 serviceElem.appendChild( onlineResourceElem );
296 if ( !contactPerson.isEmpty() ||
297 !contactOrganization.isEmpty() ||
298 !contactPosition.isEmpty() ||
299 !contactMail.isEmpty() ||
300 !contactPhone.isEmpty() )
303 QDomElement contactInfoElem = doc.createElement( QStringLiteral(
"ContactInformation" ) );
306 if ( !contactPerson.isEmpty() ||
307 !contactOrganization.isEmpty() ||
308 !contactPosition.isEmpty() )
310 QDomElement contactPersonPrimaryElem = doc.createElement( QStringLiteral(
"ContactPersonPrimary" ) );
312 if ( !contactPerson.isEmpty() )
314 QDomElement contactPersonElem = doc.createElement( QStringLiteral(
"ContactPerson" ) );
315 QDomText contactPersonText = doc.createTextNode( contactPerson );
316 contactPersonElem.appendChild( contactPersonText );
317 contactPersonPrimaryElem.appendChild( contactPersonElem );
320 if ( !contactOrganization.isEmpty() )
322 QDomElement contactOrganizationElem = doc.createElement( QStringLiteral(
"ContactOrganization" ) );
323 QDomText contactOrganizationText = doc.createTextNode( contactOrganization );
324 contactOrganizationElem.appendChild( contactOrganizationText );
325 contactPersonPrimaryElem.appendChild( contactOrganizationElem );
328 if ( !contactPosition.isEmpty() )
330 QDomElement contactPositionElem = doc.createElement( QStringLiteral(
"ContactPosition" ) );
331 QDomText contactPositionText = doc.createTextNode( contactPosition );
332 contactPositionElem.appendChild( contactPositionText );
333 contactPersonPrimaryElem.appendChild( contactPositionElem );
336 contactInfoElem.appendChild( contactPersonPrimaryElem );
339 if ( !contactPhone.isEmpty() )
341 QDomElement phoneElem = doc.createElement( QStringLiteral(
"ContactVoiceTelephone" ) );
342 QDomText phoneText = doc.createTextNode( contactPhone );
343 phoneElem.appendChild( phoneText );
344 contactInfoElem.appendChild( phoneElem );
347 if ( !contactMail.isEmpty() )
349 QDomElement mailElem = doc.createElement( QStringLiteral(
"ContactElectronicMailAddress" ) );
350 QDomText mailText = doc.createTextNode( contactMail );
351 mailElem.appendChild( mailText );
352 contactInfoElem.appendChild( mailElem );
355 serviceElem.appendChild( contactInfoElem );
358 QDomElement feesElem = doc.createElement( QStringLiteral(
"Fees" ) );
359 QDomText feesText = doc.createTextNode( QStringLiteral(
"None" ) );
361 if ( !fees.isEmpty() )
363 feesText = doc.createTextNode( fees );
365 feesElem.appendChild( feesText );
366 serviceElem.appendChild( feesElem );
368 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral(
"AccessConstraints" ) );
369 QDomText accessConstraintsText = doc.createTextNode( QStringLiteral(
"None" ) );
371 if ( !accessConstraints.isEmpty() )
373 accessConstraintsText = doc.createTextNode( accessConstraints );
375 accessConstraintsElem.appendChild( accessConstraintsText );
376 serviceElem.appendChild( accessConstraintsElem );
378 if ( version == QLatin1String(
"1.3.0" ) )
383 QDomElement maxWidthElem = doc.createElement( QStringLiteral(
"MaxWidth" ) );
384 QDomText maxWidthText = doc.createTextNode( QString::number( maxWidth ) );
385 maxWidthElem.appendChild( maxWidthText );
386 serviceElem.appendChild( maxWidthElem );
392 QDomElement maxHeightElem = doc.createElement( QStringLiteral(
"MaxHeight" ) );
393 QDomText maxHeightText = doc.createTextNode( QString::number( maxHeight ) );
394 maxHeightElem.appendChild( maxHeightText );
395 serviceElem.appendChild( maxHeightElem );
404 bool projectSettings )
412 QString hrefString = href.toString();
413 hrefString.append( href.hasQuery() ?
"&" :
"?" );
415 QDomElement capabilityElem = doc.createElement( QStringLiteral(
"Capability" ) );
418 QDomElement requestElem = doc.createElement( QStringLiteral(
"Request" ) );
419 capabilityElem.appendChild( requestElem );
421 QDomElement dcpTypeElem = doc.createElement( QStringLiteral(
"DCPType" ) );
422 QDomElement httpElem = doc.createElement( QStringLiteral(
"HTTP" ) );
423 dcpTypeElem.appendChild( httpElem );
426 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
428 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
429 formatElem.appendChild( doc.createTextNode( format ) );
430 elem.appendChild( formatElem );
436 elem = doc.createElement( QStringLiteral(
"GetCapabilities" ) );
437 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.wms_xml" :
"text/xml" ) );
438 elem.appendChild( dcpTypeElem );
439 requestElem.appendChild( elem );
444 if ( parameters.value( QStringLiteral(
"SERVICE" ) ).compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) != 0 )
446 QDomElement soapElem = doc.createElement( QStringLiteral(
"SOAP" ) );
447 httpElem.appendChild( soapElem );
448 QDomElement soapResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
449 soapResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
450 soapResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
451 soapResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
452 soapElem.appendChild( soapResourceElem );
456 QDomElement getElem = doc.createElement( QStringLiteral(
"Get" ) );
457 httpElem.appendChild( getElem );
458 QDomElement olResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
459 olResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
460 olResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
461 olResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
462 getElem.appendChild( olResourceElem );
465 elem = doc.createElement( QStringLiteral(
"GetMap" ) );
466 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
467 appendFormat( elem, QStringLiteral(
"image/png" ) );
468 appendFormat( elem, QStringLiteral(
"image/png; mode=16bit" ) );
469 appendFormat( elem, QStringLiteral(
"image/png; mode=8bit" ) );
470 appendFormat( elem, QStringLiteral(
"image/png; mode=1bit" ) );
471 appendFormat( elem, QStringLiteral(
"application/dxf" ) );
472 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
473 requestElem.appendChild( elem );
476 elem = doc.createElement( QStringLiteral(
"GetFeatureInfo" ) );
477 appendFormat( elem, QStringLiteral(
"text/plain" ) );
478 appendFormat( elem, QStringLiteral(
"text/html" ) );
479 appendFormat( elem, QStringLiteral(
"text/xml" ) );
480 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml" ) );
481 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml/3.1.1" ) );
482 appendFormat( elem, QStringLiteral(
"application/json" ) );
483 appendFormat( elem, QStringLiteral(
"application/geo+json" ) );
484 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
485 requestElem.appendChild( elem );
488 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetLegendGraphic" :
"sld:GetLegendGraphic" ) );
489 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
490 appendFormat( elem, QStringLiteral(
"image/png" ) );
491 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
492 requestElem.appendChild( elem );
495 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"DescribeLayer" :
"sld:DescribeLayer" ) );
496 appendFormat( elem, QStringLiteral(
"text/xml" ) );
497 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
498 requestElem.appendChild( elem );
501 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetStyles" :
"qgs:GetStyles" ) );
502 appendFormat( elem, QStringLiteral(
"text/xml" ) );
503 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
504 requestElem.appendChild( elem );
506 if ( projectSettings )
509 elem = doc.createElement( QStringLiteral(
"GetPrint" ) );
510 appendFormat( elem, QStringLiteral(
"svg" ) );
511 appendFormat( elem, QStringLiteral(
"png" ) );
512 appendFormat( elem, QStringLiteral(
"pdf" ) );
513 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
514 requestElem.appendChild( elem );
518 elem = doc.createElement( QStringLiteral(
"Exception" ) );
519 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.se_xml" :
"XML" ) );
520 capabilityElem.appendChild( elem );
523 if ( version == QLatin1String(
"1.3.0" ) )
525 elem = doc.createElement( QStringLiteral(
"sld:UserDefinedSymbolization" ) );
526 elem.setAttribute( QStringLiteral(
"SupportSLD" ), QStringLiteral(
"1" ) );
527 elem.setAttribute( QStringLiteral(
"UserLayer" ), QStringLiteral(
"0" ) );
528 elem.setAttribute( QStringLiteral(
"UserStyle" ), QStringLiteral(
"1" ) );
529 elem.setAttribute( QStringLiteral(
"RemoteWFS" ), QStringLiteral(
"0" ) );
530 elem.setAttribute( QStringLiteral(
"InlineFeature" ), QStringLiteral(
"0" ) );
531 elem.setAttribute( QStringLiteral(
"RemoteWCS" ), QStringLiteral(
"0" ) );
532 capabilityElem.appendChild( elem );
540 return capabilityElem;
545 QDomElement inspireCapabilitiesElem;
548 return inspireCapabilitiesElem;
550 inspireCapabilitiesElem = doc.createElement( QStringLiteral(
"inspire_vs:ExtendedCapabilities" ) );
554 if ( !inspireMetadataUrl.isEmpty() )
556 QDomElement inspireCommonMetadataUrlElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataUrl" ) );
557 inspireCommonMetadataUrlElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:resourceLocatorType" ) );
559 QDomElement inspireCommonMetadataUrlUrlElem = doc.createElement( QStringLiteral(
"inspire_common:URL" ) );
560 inspireCommonMetadataUrlUrlElem.appendChild( doc.createTextNode( inspireMetadataUrl ) );
561 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlUrlElem );
564 if ( !inspireMetadataUrlType.isNull() )
566 QDomElement inspireCommonMetadataUrlMediaTypeElem = doc.createElement( QStringLiteral(
"inspire_common:MediaType" ) );
567 inspireCommonMetadataUrlMediaTypeElem.appendChild( doc.createTextNode( inspireMetadataUrlType ) );
568 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlMediaTypeElem );
571 inspireCapabilitiesElem.appendChild( inspireCommonMetadataUrlElem );
575 QDomElement inspireCommonResourceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:ResourceType" ) );
576 inspireCommonResourceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"service" ) ) );
577 inspireCapabilitiesElem.appendChild( inspireCommonResourceTypeElem );
579 QDomElement inspireCommonSpatialDataServiceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:SpatialDataServiceType" ) );
580 inspireCommonSpatialDataServiceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"view" ) ) );
581 inspireCapabilitiesElem.appendChild( inspireCommonSpatialDataServiceTypeElem );
584 if ( !inspireTemporalReference.isNull() )
586 QDomElement inspireCommonTemporalReferenceElem = doc.createElement( QStringLiteral(
"inspire_common:TemporalReference" ) );
587 QDomElement inspireCommonDateOfLastRevisionElem = doc.createElement( QStringLiteral(
"inspire_common:DateOfLastRevision" ) );
588 inspireCommonDateOfLastRevisionElem.appendChild( doc.createTextNode( inspireTemporalReference ) );
589 inspireCommonTemporalReferenceElem.appendChild( inspireCommonDateOfLastRevisionElem );
590 inspireCapabilitiesElem.appendChild( inspireCommonTemporalReferenceElem );
593 QDomElement inspireCommonMetadataPointOfContactElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataPointOfContact" ) );
596 QDomElement inspireCommonOrganisationNameElem = doc.createElement( QStringLiteral(
"inspire_common:OrganisationName" ) );
597 if ( !contactOrganization.isNull() )
599 inspireCommonOrganisationNameElem.appendChild( doc.createTextNode( contactOrganization ) );
601 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonOrganisationNameElem );
604 QDomElement inspireCommonEmailAddressElem = doc.createElement( QStringLiteral(
"inspire_common:EmailAddress" ) );
605 if ( !contactMail.isNull() )
607 inspireCommonEmailAddressElem.appendChild( doc.createTextNode( contactMail ) );
609 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonEmailAddressElem );
611 inspireCapabilitiesElem.appendChild( inspireCommonMetadataPointOfContactElem );
614 if ( !inspireMetadataDate.isNull() )
616 QDomElement inspireCommonMetadataDateElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataDate" ) );
617 inspireCommonMetadataDateElem.appendChild( doc.createTextNode( inspireMetadataDate ) );
618 inspireCapabilitiesElem.appendChild( inspireCommonMetadataDateElem );
623 QDomElement inspireCommonSupportedLanguagesElem = doc.createElement( QStringLiteral(
"inspire_common:SupportedLanguages" ) );
624 inspireCommonSupportedLanguagesElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:supportedLanguagesType" ) );
626 QDomElement inspireCommonLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:Language" ) );
629 QDomElement inspireCommonDefaultLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:DefaultLanguage" ) );
630 inspireCommonDefaultLanguageElem.appendChild( inspireCommonLanguageElem );
631 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonDefaultLanguageElem );
635 QDomElement inspireCommonSupportedLanguageElem = doc.createElement(
"inspire_common:SupportedLanguage" );
636 inspireCommonSupportedLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
637 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonSupportedLanguageElem );
640 inspireCapabilitiesElem.appendChild( inspireCommonSupportedLanguagesElem );
642 QDomElement inspireCommonResponseLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:ResponseLanguage" ) );
643 inspireCommonResponseLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
644 inspireCapabilitiesElem.appendChild( inspireCommonResponseLanguageElem );
646 return inspireCapabilitiesElem;
652 if ( projectComposers.size() == 0 )
653 return QDomElement();
657 QDomElement composerTemplatesElem = doc.createElement( QStringLiteral(
"ComposerTemplates" ) );
658 QList<QgsPrintLayout *>::const_iterator cIt = projectComposers.constBegin();
659 for ( ; cIt != projectComposers.constEnd(); ++cIt )
662 if ( restrictedComposers.contains( layout->
name() ) )
674 QDomElement composerTemplateElem = doc.createElement( QStringLiteral(
"ComposerTemplate" ) );
675 composerTemplateElem.setAttribute( QStringLiteral(
"name" ), layout->
name() );
678 composerTemplateElem.setAttribute( QStringLiteral(
"width" ), width.length() );
679 composerTemplateElem.setAttribute( QStringLiteral(
"height" ), height.
length() );
683 if ( atlas && atlas->
enabled() )
685 composerTemplateElem.setAttribute( QStringLiteral(
"atlasEnabled" ), QStringLiteral(
"1" ) );
692 layerName = cLayer->
id();
694 else if ( layerName.isEmpty() )
696 layerName = cLayer->
name();
698 composerTemplateElem.setAttribute( QStringLiteral(
"atlasCoverageLayer" ), layerName );
703 QList<QgsLayoutItemMap *> layoutMapList;
705 QList<QgsLayoutItemMap *>::const_iterator cmIt = layoutMapList.constBegin();
708 for ( ; cmIt != layoutMapList.constEnd(); ++cmIt )
712 QDomElement composerMapElem = doc.createElement( QStringLiteral(
"ComposerMap" ) );
713 composerMapElem.setAttribute( QStringLiteral(
"name" ), QStringLiteral(
"map%1" ).arg( mapId ) );
715 composerMapElem.setAttribute( QStringLiteral(
"width" ), composerMap->rect().width() );
716 composerMapElem.setAttribute( QStringLiteral(
"height" ), composerMap->rect().height() );
717 composerTemplateElem.appendChild( composerMapElem );
721 QList<QgsLayoutItemLabel *> composerLabelList;
723 QList<QgsLayoutItemLabel *>::const_iterator clIt = composerLabelList.constBegin();
724 for ( ; clIt != composerLabelList.constEnd(); ++clIt )
727 QString
id = composerLabel->
id();
731 QDomElement composerLabelElem = doc.createElement( QStringLiteral(
"ComposerLabel" ) );
732 composerLabelElem.setAttribute( QStringLiteral(
"name" ),
id );
733 composerTemplateElem.appendChild( composerLabelElem );
737 QList<QgsLayoutItemHtml *> composerHtmlList;
739 QList<QgsLayoutItemHtml *>::const_iterator chIt = composerHtmlList.constBegin();
740 for ( ; chIt != composerHtmlList.constEnd(); ++chIt )
746 QString
id = composerHtml->
frame( 0 )->
id();
750 QDomElement composerHtmlElem = doc.createElement( QStringLiteral(
"ComposerHtml" ) );
751 composerHtmlElem.setAttribute( QStringLiteral(
"name" ),
id );
752 composerTemplateElem.appendChild( composerHtmlElem );
755 composerTemplatesElem.appendChild( composerTemplateElem );
758 if ( composerTemplatesElem.childNodes().size() == 0 )
759 return QDomElement();
761 return composerTemplatesElem;
767 if ( wfsLayerIds.size() == 0 )
768 return QDomElement();
770 QDomElement wfsLayersElem = doc.createElement( QStringLiteral(
"WFSLayers" ) );
771 for (
int i = 0; i < wfsLayerIds.size(); ++i )
774 if ( layer->
type() != QgsMapLayer::LayerType::VectorLayer )
779 QDomElement wfsLayerElem = doc.createElement( QStringLiteral(
"WFSLayer" ) );
782 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
id() );
786 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
name() );
788 wfsLayersElem.appendChild( wfsLayerElem );
791 return wfsLayersElem;
795 const QgsProject *project,
const QString &version,
800 QDomElement layerParentElem = doc.createElement( QStringLiteral(
"Layer" ) );
802 if ( !project->
title().isEmpty() )
805 QDomElement layerParentTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
806 QDomText layerParentTitleText = doc.createTextNode( project->
title() );
807 layerParentTitleElem.appendChild( layerParentTitleText );
808 layerParentElem.appendChild( layerParentTitleElem );
811 QDomElement layerParentAbstElem = doc.createElement( QStringLiteral(
"Abstract" ) );
812 QDomText layerParentAbstText = doc.createTextNode( project->
title() );
813 layerParentAbstElem.appendChild( layerParentAbstText );
814 layerParentElem.appendChild( layerParentAbstElem );
819 if ( rootLayerName.isEmpty() && !project->
title().isEmpty() )
821 rootLayerName = project->
title();
824 if ( !rootLayerName.isEmpty() )
826 QDomElement layerParentNameElem = doc.createElement( QStringLiteral(
"Name" ) );
827 QDomText layerParentNameText = doc.createTextNode( rootLayerName );
828 layerParentNameElem.appendChild( layerParentNameText );
829 layerParentElem.appendChild( layerParentNameElem );
833 addKeywordListElement( project, doc, layerParentElem );
836 if ( projectSettings )
838 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
839 QDomText treeNameText = doc.createTextNode( project->
title() );
840 treeNameElem.appendChild( treeNameText );
841 layerParentElem.appendChild( treeNameElem );
844 appendLayersFromTreeGroup( doc, layerParentElem, serverIface, project, version, request, projectLayerTreeRoot, projectSettings );
846 combineExtentAndCrsOfGroupChildren( doc, layerParentElem, project,
true );
848 return layerParentElem;
854 void appendLayersFromTreeGroup( QDomDocument &doc,
855 QDomElement &parentLayer,
858 const QString &version,
861 bool projectSettings )
867 QList< QgsLayerTreeNode * > layerTreeGroupChildren = layerTreeGroup->
children();
868 for (
int i = 0; i < layerTreeGroupChildren.size(); ++i )
871 QDomElement layerElem = doc.createElement( QStringLiteral(
"Layer" ) );
873 if ( projectSettings )
875 layerElem.setAttribute( QStringLiteral(
"visible" ), treeNode->
isVisible() );
882 QString name = treeGroupChild->
name();
883 if ( restrictedLayers.contains( name ) )
888 if ( projectSettings )
890 layerElem.setAttribute( QStringLiteral(
"mutuallyExclusive" ), treeGroupChild->
isMutuallyExclusive() );
893 QString shortName = treeGroupChild->
customProperty( QStringLiteral(
"wmsShortName" ) ).toString();
894 QString title = treeGroupChild->
customProperty( QStringLiteral(
"wmsTitle" ) ).toString();
896 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
898 if ( !shortName.isEmpty() )
899 nameText = doc.createTextNode( shortName );
901 nameText = doc.createTextNode( name );
902 nameElem.appendChild( nameText );
903 layerElem.appendChild( nameElem );
905 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
907 if ( !title.isEmpty() )
908 titleText = doc.createTextNode( title );
910 titleText = doc.createTextNode( name );
911 titleElem.appendChild( titleText );
912 layerElem.appendChild( titleElem );
914 QString
abstract = treeGroupChild->
customProperty( QStringLiteral(
"wmsAbstract" ) ).toString();
915 if ( !
abstract.isEmpty() )
917 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
918 QDomText abstractText = doc.createTextNode(
abstract );
919 abstractElem.appendChild( abstractText );
920 layerElem.appendChild( abstractElem );
924 if ( projectSettings )
926 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
927 QDomText treeNameText = doc.createTextNode( name );
928 treeNameElem.appendChild( treeNameText );
929 layerElem.appendChild( treeNameElem );
932 appendLayersFromTreeGroup( doc, layerElem, serverIface, project, version, request, treeGroupChild, projectSettings );
934 combineExtentAndCrsOfGroupChildren( doc, layerElem, project );
940 if ( restrictedLayers.contains( l->
name() ) )
951 QString wmsName = l->
name();
964 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
968 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
971 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
972 QDomText nameText = doc.createTextNode( wmsName );
973 nameElem.appendChild( nameText );
974 layerElem.appendChild( nameElem );
976 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
977 QString title = l->
title();
978 if ( title.isEmpty() )
982 QDomText titleText = doc.createTextNode( title );
983 titleElem.appendChild( titleText );
984 layerElem.appendChild( titleElem );
987 if ( !
abstract.isEmpty() )
989 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
990 QDomText abstractText = doc.createTextNode(
abstract );
991 abstractElem.appendChild( abstractText );
992 layerElem.appendChild( abstractElem );
998 QStringList keywordStringList = l->
keywordList().split(
',' );
1000 QDomElement keywordListElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1001 for (
int i = 0; i < keywordStringList.size(); ++i )
1003 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1004 QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
1005 keywordElem.appendChild( keywordText );
1008 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1010 keywordListElem.appendChild( keywordElem );
1012 layerElem.appendChild( keywordListElem );
1016 bool geometryLayer =
true;
1024 geometryLayer =
false;
1030 if ( geometryLayer )
1032 QStringList crsList;
1035 appendCrsElementsToLayer( doc, layerElem, crsList, outputCrsList );
1055 appendLayerBoundingBoxes( doc, layerElem, extent, l->
crs(), crsList, outputCrsList, project );
1059 appendLayerStyles( doc, layerElem, l, project, version, request );
1064 if ( version == QLatin1String(
"1.1.1" ) )
1066 double OGC_PX_M = 0.00028;
1067 double SCALE_TO_SCALEHINT = OGC_PX_M * M_SQRT2;
1069 QDomElement scaleHintElem = doc.createElement( QStringLiteral(
"ScaleHint" ) );
1070 scaleHintElem.setAttribute( QStringLiteral(
"min" ), QString::number( l->
maximumScale() * SCALE_TO_SCALEHINT ) );
1071 scaleHintElem.setAttribute( QStringLiteral(
"max" ), QString::number( l->
minimumScale() * SCALE_TO_SCALEHINT ) );
1072 layerElem.appendChild( scaleHintElem );
1076 QString minScaleString = QString::number( l->
maximumScale() );
1077 QDomElement minScaleElem = doc.createElement( QStringLiteral(
"MinScaleDenominator" ) );
1078 QDomText minScaleText = doc.createTextNode( minScaleString );
1079 minScaleElem.appendChild( minScaleText );
1080 layerElem.appendChild( minScaleElem );
1082 QString maxScaleString = QString::number( l->
minimumScale() );
1083 QDomElement maxScaleElem = doc.createElement( QStringLiteral(
"MaxScaleDenominator" ) );
1084 QDomText maxScaleText = doc.createTextNode( maxScaleString );
1085 maxScaleElem.appendChild( maxScaleText );
1086 layerElem.appendChild( maxScaleElem );
1091 QString dataUrl = l->
dataUrl();
1092 if ( !dataUrl.isEmpty() )
1094 QDomElement dataUrlElem = doc.createElement( QStringLiteral(
"DataURL" ) );
1095 QDomElement dataUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1097 QDomText dataUrlFormatText = doc.createTextNode( dataUrlFormat );
1098 dataUrlFormatElem.appendChild( dataUrlFormatText );
1099 dataUrlElem.appendChild( dataUrlFormatElem );
1100 QDomElement dataORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1101 dataORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1102 dataORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1103 dataORElem.setAttribute( QStringLiteral(
"xlink:href" ), dataUrl );
1104 dataUrlElem.appendChild( dataORElem );
1105 layerElem.appendChild( dataUrlElem );
1110 if ( !attribution.isEmpty() )
1112 QDomElement attribElem = doc.createElement( QStringLiteral(
"Attribution" ) );
1113 QDomElement attribTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1114 QDomText attribText = doc.createTextNode( attribution );
1115 attribTitleElem.appendChild( attribText );
1116 attribElem.appendChild( attribTitleElem );
1118 if ( !attributionUrl.isEmpty() )
1120 QDomElement attribORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1121 attribORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1122 attribORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1123 attribORElem.setAttribute( QStringLiteral(
"xlink:href" ), attributionUrl );
1124 attribElem.appendChild( attribORElem );
1126 layerElem.appendChild( attribElem );
1131 if ( !metadataUrl.isEmpty() )
1133 QDomElement metaUrlElem = doc.createElement( QStringLiteral(
"MetadataURL" ) );
1135 if ( version == QLatin1String(
"1.1.1" ) )
1137 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1139 else if ( metadataUrlType == QLatin1String(
"FGDC" ) )
1141 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"FGDC:1998" ) );
1143 else if ( metadataUrlType == QLatin1String(
"TC211" ) )
1145 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ISO19115:2003" ) );
1149 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1152 if ( !metadataUrlFormat.isEmpty() )
1154 QDomElement metaUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1155 QDomText metaUrlFormatText = doc.createTextNode( metadataUrlFormat );
1156 metaUrlFormatElem.appendChild( metaUrlFormatText );
1157 metaUrlElem.appendChild( metaUrlFormatElem );
1159 QDomElement metaUrlORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1160 metaUrlORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1161 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1162 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:href" ), metadataUrl );
1163 metaUrlElem.appendChild( metaUrlORElem );
1164 layerElem.appendChild( metaUrlElem );
1167 if ( projectSettings )
1169 appendLayerProjectSettings( doc, layerElem, l );
1173 parentLayer.appendChild( layerElem );
1177 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
1184 QString hrefString = href.toString();
1185 hrefString.append( href.hasQuery() ?
"&" :
"?" );
1188 QDomElement styleElem = doc.createElement( QStringLiteral(
"Style" ) );
1189 QDomElement styleNameElem = doc.createElement( QStringLiteral(
"Name" ) );
1190 QDomText styleNameText = doc.createTextNode( styleName );
1191 styleNameElem.appendChild( styleNameText );
1192 QDomElement styleTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1193 QDomText styleTitleText = doc.createTextNode( styleName );
1194 styleTitleElem.appendChild( styleTitleText );
1195 styleElem.appendChild( styleNameElem );
1196 styleElem.appendChild( styleTitleElem );
1199 QDomElement getLayerLegendGraphicElem = doc.createElement( QStringLiteral(
"LegendURL" ) );
1201 QString customHrefString = currentLayer->
legendUrl();
1203 QStringList getLayerLegendGraphicFormats;
1204 if ( !customHrefString.isEmpty() )
1210 getLayerLegendGraphicFormats << QStringLiteral(
"image/png" );
1213 for (
int i = 0; i < getLayerLegendGraphicFormats.size(); ++i )
1215 QDomElement getLayerLegendGraphicFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1216 QString getLayerLegendGraphicFormat = getLayerLegendGraphicFormats[i];
1217 QDomText getLayerLegendGraphicFormatText = doc.createTextNode( getLayerLegendGraphicFormat );
1218 getLayerLegendGraphicFormatElem.appendChild( getLayerLegendGraphicFormatText );
1219 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicFormatElem );
1223 if ( customHrefString.isEmpty() )
1225 QString layerName = currentLayer->
name();
1227 layerName = currentLayer->
id();
1228 else if ( !currentLayer->
shortName().isEmpty() )
1230 QUrlQuery mapUrl( hrefString );
1231 mapUrl.addQueryItem( QStringLiteral(
"SERVICE" ), QStringLiteral(
"WMS" ) );
1232 mapUrl.addQueryItem( QStringLiteral(
"VERSION" ), version );
1233 mapUrl.addQueryItem( QStringLiteral(
"REQUEST" ), QStringLiteral(
"GetLegendGraphic" ) );
1234 mapUrl.addQueryItem( QStringLiteral(
"LAYER" ), layerName );
1235 mapUrl.addQueryItem( QStringLiteral(
"FORMAT" ), QStringLiteral(
"image/png" ) );
1236 mapUrl.addQueryItem( QStringLiteral(
"STYLE" ), styleNameText.data() );
1237 if ( version == QLatin1String(
"1.3.0" ) )
1239 mapUrl.addQueryItem( QStringLiteral(
"SLD_VERSION" ), QStringLiteral(
"1.1.0" ) );
1241 customHrefString = mapUrl.toString();
1244 QDomElement getLayerLegendGraphicORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1245 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1246 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1247 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:href" ), customHrefString );
1248 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicORElem );
1249 styleElem.appendChild( getLayerLegendGraphicElem );
1251 layerElem.appendChild( styleElem );
1255 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
1256 const QStringList &crsList,
const QStringList &constrainedCrsList )
1258 if ( layerElement.isNull() )
1264 QDomElement titleElement = layerElement.firstChildElement( QStringLiteral(
"Title" ) );
1265 QDomElement abstractElement = layerElement.firstChildElement( QStringLiteral(
"Abstract" ) );
1266 QDomElement CRSPrecedingElement = abstractElement.isNull() ? titleElement : abstractElement;
1268 if ( CRSPrecedingElement.isNull() )
1271 const QDomElement keyElement = layerElement.firstChildElement( QStringLiteral(
"KeywordList" ) );
1272 CRSPrecedingElement = keyElement;
1276 if ( !constrainedCrsList.isEmpty() )
1278 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1280 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, constrainedCrsList.at( i ) );
1285 for (
const QString &
crs : crsList )
1287 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement,
crs );
1292 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, QString(
"CRS:84" ) );
1295 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
1296 const QString &crsText )
1298 if ( crsText.isEmpty() )
1300 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1301 QDomElement crsElement = doc.createElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1302 QDomText crsTextNode = doc.createTextNode( crsText );
1303 crsElement.appendChild( crsTextNode );
1304 layerElement.insertAfter( crsElement, precedingElement );
1307 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
1309 const QStringList &constrainedCrsList,
const QgsProject *project )
1311 if ( layerElem.isNull() )
1320 layerExtent.
grow( 0.000001 );
1325 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1328 QDomElement ExGeoBBoxElement;
1331 if ( !layerExtent.
isNull() )
1344 if ( version == QLatin1String(
"1.1.1" ) )
1346 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"LatLonBoundingBox" ) );
1347 ExGeoBBoxElement.setAttribute( QStringLiteral(
"minx" ), QString::number( wgs84BoundingRect.
xMinimum() ) );
1348 ExGeoBBoxElement.setAttribute( QStringLiteral(
"maxx" ), QString::number( wgs84BoundingRect.
xMaximum() ) );
1349 ExGeoBBoxElement.setAttribute( QStringLiteral(
"miny" ), QString::number( wgs84BoundingRect.
yMinimum() ) );
1350 ExGeoBBoxElement.setAttribute( QStringLiteral(
"maxy" ), QString::number( wgs84BoundingRect.
yMaximum() ) );
1354 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"EX_GeographicBoundingBox" ) );
1355 QDomElement wBoundLongitudeElement = doc.createElement( QStringLiteral(
"westBoundLongitude" ) );
1356 QDomText wBoundLongitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
xMinimum() ) );
1357 wBoundLongitudeElement.appendChild( wBoundLongitudeText );
1358 ExGeoBBoxElement.appendChild( wBoundLongitudeElement );
1359 QDomElement eBoundLongitudeElement = doc.createElement( QStringLiteral(
"eastBoundLongitude" ) );
1360 QDomText eBoundLongitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
xMaximum() ) );
1361 eBoundLongitudeElement.appendChild( eBoundLongitudeText );
1362 ExGeoBBoxElement.appendChild( eBoundLongitudeElement );
1363 QDomElement sBoundLatitudeElement = doc.createElement( QStringLiteral(
"southBoundLatitude" ) );
1364 QDomText sBoundLatitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
yMinimum() ) );
1365 sBoundLatitudeElement.appendChild( sBoundLatitudeText );
1366 ExGeoBBoxElement.appendChild( sBoundLatitudeElement );
1367 QDomElement nBoundLatitudeElement = doc.createElement( QStringLiteral(
"northBoundLatitude" ) );
1368 QDomText nBoundLatitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
yMaximum() ) );
1369 nBoundLatitudeElement.appendChild( nBoundLatitudeText );
1370 ExGeoBBoxElement.appendChild( nBoundLatitudeElement );
1373 if ( !wgs84BoundingRect.
isNull() )
1375 QDomElement lastCRSElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1376 if ( !lastCRSElem.isNull() )
1378 layerElem.insertAfter( ExGeoBBoxElement, lastCRSElem );
1382 layerElem.appendChild( ExGeoBBoxElement );
1387 if ( !constrainedCrsList.isEmpty() )
1389 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1391 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS, constrainedCrsList.at( i ), project );
1396 for (
const QString &
crs : crsList )
1398 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS,
crs, project );
1404 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
1408 if ( layerElem.isNull() )
1413 if ( crsText.isEmpty() )
1418 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1424 if ( !layerExtent.
isNull() )
1438 if ( crsExtent.
isNull() )
1444 QDomElement bBoxElement = doc.createElement( QStringLiteral(
"BoundingBox" ) );
1447 bBoxElement.setAttribute( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS", crs.
authid() );
1455 bBoxElement.setAttribute( QStringLiteral(
"minx" ), QString::number( crsExtent.
xMinimum() ) );
1456 bBoxElement.setAttribute( QStringLiteral(
"miny" ), QString::number( crsExtent.
yMinimum() ) );
1457 bBoxElement.setAttribute( QStringLiteral(
"maxx" ), QString::number( crsExtent.
xMaximum() ) );
1458 bBoxElement.setAttribute( QStringLiteral(
"maxy" ), QString::number( crsExtent.
yMaximum() ) );
1460 QDomElement lastBBoxElem = layerElem.lastChildElement( QStringLiteral(
"BoundingBox" ) );
1461 if ( !lastBBoxElem.isNull() )
1463 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1467 lastBBoxElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"LatLonBoundingBox" :
"EX_GeographicBoundingBox" );
1468 if ( !lastBBoxElem.isNull() )
1470 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1474 layerElem.appendChild( bBoxElement );
1479 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
1483 if ( layerElem.isNull() )
1489 QDomElement boundingBoxElem = layerElem.firstChildElement( QStringLiteral(
"BoundingBox" ) );
1490 if ( boundingBoxElem.isNull() )
1495 double minx, miny, maxx, maxy;
1497 minx = boundingBoxElem.attribute( QStringLiteral(
"minx" ) ).toDouble( &conversionOk );
1498 if ( !conversionOk )
1502 miny = boundingBoxElem.attribute( QStringLiteral(
"miny" ) ).toDouble( &conversionOk );
1503 if ( !conversionOk )
1507 maxx = boundingBoxElem.attribute( QStringLiteral(
"maxx" ) ).toDouble( &conversionOk );
1508 if ( !conversionOk )
1512 maxy = boundingBoxElem.attribute( QStringLiteral(
"maxy" ) ).toDouble( &conversionOk );
1513 if ( !conversionOk )
1519 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1533 if ( version != QLatin1String(
"1.1.1" ) && layerCrs.
hasAxisInverted() )
1544 BBox = t.transformBoundingBox( BBox );
1554 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet )
1556 if ( layerElement.isNull() )
1563 QDomNodeList crsNodeList;
1564 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"CRS" ) );
1565 for (
int i = 0; i < crsNodeList.size(); ++i )
1567 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1570 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"SRS" ) );
1571 for (
int i = 0; i < crsNodeList.size(); ++i )
1573 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1579 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
1580 bool considerMapExtent )
1583 QSet<QString> combinedCRSSet;
1584 bool firstBBox =
true;
1585 bool firstCRSSet =
true;
1587 QDomNodeList layerChildren = groupElem.childNodes();
1588 for (
int j = 0; j < layerChildren.size(); ++j )
1590 QDomElement childElem = layerChildren.at( j ).toElement();
1592 if ( childElem.tagName() != QLatin1String(
"Layer" ) )
1595 QgsRectangle bbox = layerBoundingBoxInProjectCrs( doc, childElem, project );
1605 combinedBBox = bbox;
1615 QSet<QString> crsSet;
1616 if ( crsSetFromLayerElement( childElem, crsSet ) )
1620 combinedCRSSet = crsSet;
1621 firstCRSSet =
false;
1625 combinedCRSSet.intersect( crsSet );
1631 appendCrsElementsToLayer( doc, groupElem, combinedCRSSet.toList(), outputCrsList );
1634 if ( considerMapExtent )
1639 combinedBBox = mapRect;
1642 appendLayerBoundingBoxes( doc, groupElem, combinedBBox, groupCRS, combinedCRSSet.toList(), outputCrsList, project );
1646 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
1653 QStringList layerList;
1656 QList< QgsMapLayer * > projectLayerOrder = projectLayerTreeRoot->
layerOrder();
1657 for (
int i = 0; i < projectLayerOrder.size(); ++i )
1661 if ( restrictedLayers.contains( l->
name() ) )
1671 QString wmsName = l->
name();
1681 layerList << wmsName;
1684 if ( !layerList.isEmpty() )
1686 QStringList reversedList;
1687 reversedList.reserve( layerList.size() );
1688 for (
int i = layerList.size() - 1; i >= 0; --i )
1689 reversedList << layerList[ i ];
1691 QDomElement layerDrawingOrderElem = doc.createElement( QStringLiteral(
"LayerDrawingOrder" ) );
1692 QDomText drawingOrderText = doc.createTextNode( reversedList.join(
',' ) );
1693 layerDrawingOrderElem.appendChild( drawingOrderText );
1694 parentElem.appendChild( layerDrawingOrderElem );
1698 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer )
1700 if ( !currentLayer )
1706 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
1707 QDomText treeNameText = doc.createTextNode( currentLayer->
name() );
1708 treeNameElem.appendChild( treeNameText );
1709 layerElem.appendChild( treeNameElem );
1711 switch ( currentLayer->
type() )
1718 int displayFieldIdx = -1;
1719 QString displayField = QStringLiteral(
"maptip" );
1721 if ( exp.isField() )
1728 QDomElement attributesElem = doc.createElement( QStringLiteral(
"Attributes" ) );
1730 for (
int idx = 0; idx < layerFields.
count(); ++idx )
1733 if ( excludedAttributes.contains( field.
name() ) )
1738 if ( idx == displayFieldIdx )
1742 QDomElement attributeElem = doc.createElement( QStringLiteral(
"Attribute" ) );
1743 attributeElem.setAttribute( QStringLiteral(
"name" ), field.
name() );
1744 attributeElem.setAttribute( QStringLiteral(
"type" ), QVariant::typeToName( field.
type() ) );
1745 attributeElem.setAttribute( QStringLiteral(
"typeName" ), field.
typeName() );
1746 QString alias = field.
alias();
1747 if ( !alias.isEmpty() )
1749 attributeElem.setAttribute( QStringLiteral(
"alias" ), alias );
1753 attributeElem.setAttribute( QStringLiteral(
"editType" ), vLayer->
editorWidgetSetup( idx ).
type() );
1754 attributeElem.setAttribute( QStringLiteral(
"comment" ), field.
comment() );
1755 attributeElem.setAttribute( QStringLiteral(
"length" ), field.
length() );
1756 attributeElem.setAttribute( QStringLiteral(
"precision" ), field.
precision() );
1757 attributesElem.appendChild( attributeElem );
1761 layerElem.setAttribute( QStringLiteral(
"displayField" ), displayField );
1765 if ( pkAttributes.size() > 0 )
1767 QDomElement pkElem = doc.createElement( QStringLiteral(
"PrimaryKey" ) );
1768 QgsAttributeList::const_iterator pkIt = pkAttributes.constBegin();
1769 for ( ; pkIt != pkAttributes.constEnd(); ++pkIt )
1771 QDomElement pkAttributeElem = doc.createElement( QStringLiteral(
"PrimaryKeyAttribute" ) );
1772 QDomText pkAttName = doc.createTextNode( layerFields.
at( *pkIt ).
name() );
1773 pkAttributeElem.appendChild( pkAttName );
1774 pkElem.appendChild( pkAttributeElem );
1776 layerElem.appendChild( pkElem );
1782 layerElem.appendChild( attributesElem );
1789 if ( provider && provider->
name() ==
"wms" )
1792 QVariant wmsBackgroundLayer = currentLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
1793 QDomElement wmsBackgroundLayerElem = doc.createElement(
"WMSBackgroundLayer" );
1794 QDomText wmsBackgroundLayerText = doc.createTextNode( wmsBackgroundLayer.toBool() ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
1795 wmsBackgroundLayerElem.appendChild( wmsBackgroundLayerText );
1796 layerElem.appendChild( wmsBackgroundLayerElem );
1799 QVariant wmsPublishDataSourceUrl = currentLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
1800 if ( wmsPublishDataSourceUrl.toBool() )
1802 QList< QVariant > resolutionList = provider->property(
"resolutions" ).toList();
1803 bool tiled = resolutionList.size() > 0;
1805 QDomElement dataSourceElem = doc.createElement( tiled ? QStringLiteral(
"WMTSDataSource" ) : QStringLiteral(
"WMSDataSource" ) );
1806 QDomText dataSourceUri = doc.createTextNode( provider->
dataSourceUri() );
1807 dataSourceElem.appendChild( dataSourceUri );
1808 layerElem.appendChild( dataSourceElem );
1812 QVariant wmsPrintLayer = currentLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
1813 if ( wmsPrintLayer.isValid() )
1815 QDomElement wmsPrintLayerElem = doc.createElement(
"WMSPrintLayer" );
1816 QDomText wmsPrintLayerText = doc.createTextNode( wmsPrintLayer.toString() );
1817 wmsPrintLayerElem.appendChild( wmsPrintLayerText );
1818 layerElem.appendChild( wmsPrintLayerElem );
1829 void addKeywordListElement(
const QgsProject *project, QDomDocument &doc, QDomElement &parent )
1833 QDomElement keywordsElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1835 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1836 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"ISO" ) );
1837 QDomText keywordText = doc.createTextNode( QStringLiteral(
"infoMapAccessService" ) );
1838 keywordElem.appendChild( keywordText );
1839 keywordsElem.appendChild( keywordElem );
1840 parent.appendChild( keywordsElem );
1842 for (
const QString &keyword : qgis::as_const( keywords ) )
1844 if ( !keyword.isEmpty() )
1846 keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1847 keywordText = doc.createTextNode( keyword );
1848 keywordElem.appendChild( keywordText );
1851 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1853 keywordsElem.appendChild( keywordElem );
1856 parent.appendChild( keywordsElem );
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
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.
bool fillCacheKey(QStringList &cacheKey) const
Fill the capabilities caching key.
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...
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
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.
QStringList styles() const
Returns list of all defined style names.
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
void layoutObjects(QList< T *> &objectList) const
Returns a list of layout objects (items and multiframes) of a specific type.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be null.
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.
QSet< QString > excludeAttributesWms() const
A set of attributes that are not advertised in WMS requests with QGIS server.
A layout item subclass for text labels.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QgsWkbTypes::Type wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
SERVER_EXPORT QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. ...
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
QDomElement getServiceElement(QDomDocument &doc, const QgsProject *project, const QString &version, const QgsServerRequest &request)
Create Service element for get capabilities document.
Container of fields for a vector layer.
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
SERVER_EXPORT bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
bool isVisible() const
Returns whether a node is really visible (ie checked and all its ancestors checked as well) ...
Abstract base class for spatial data provider implementations.
QList< QgsPrintLayout *> printLayouts() const
Returns a list of all print layouts contained in the manager.
int frameCount() const
Returns the number of frames associated with this multiframe.
const QgsCoordinateReferenceSystem & crs
SERVER_EXPORT QString wmsInspireMetadataDate(const QgsProject &project)
Returns the Inspire metadata date.
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device...
QgsMapLayer::LayerType type() const
Returns the type of the layer.
int count() const
Returns number of items.
bool isMutuallyExclusive() const
Returns whether the group is mutually exclusive (only one child can be checked at a time) ...
virtual QString name() const =0
Returns a provider name.
virtual QgsRectangle extent() const
Returns the extent of the layer.
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) ...
virtual QString configFilePath()=0
Returns the configuration file path.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QDomElement getLayersAndStylesCapabilitiesElement(QDomDocument &doc, QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, bool projectSettings)
Create element for get capabilities document.
void layoutItems(QList< T *> &itemList) const
Returns a list of layout items of a specific type.
QString metadataUrlFormat() const
Returns the metadata format of the layer used by QGIS Server in GetCapabilities request.
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 id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
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.
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...
void grow(double delta)
Grows the rectangle in place by the specified amount.
bool isEmpty() const
Returns true if the rectangle is empty.
QString typeName() const
Gets the field type.
QgsLayoutPageCollection * pageCollection()
Returns a pointer to the layout's page collection, which stores and manages page items in the layout...
long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
QDomElement getComposerTemplatesElement(QDomDocument &doc, const QgsProject *project)
Create ComposerTemplates element for get capabilities document.
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
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.
void setYMinimum(double y)
Set the minimum y value.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
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).
virtual QString dataSourceUri(bool expandAuthConfig=false) const
Gets the data source specification.
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
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...
QgsAttributeList primaryKeyAttributes() const
Returns the list of attributes which make up the layer's primary keys.
SERVER_EXPORT bool wmsInspireActivate(const QgsProject &project)
Returns if Inspire is activated.
SERVER_EXPORT QString wmsInspireTemporalReference(const QgsProject &project)
Returns the Inspire temporal reference.
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.
QString legendUrl() const
Returns the URL for the layer's legend.
This class is a base class for nodes in a layer tree.
Reads and writes project states.
const QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.
QString id() const
Returns the item's ID name.
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.
double minimumScale() const
Returns the minimum map scale (i.e.
double maximumScale() const
Returns the maximum map scale (i.e.
QgsLayoutAtlas * atlas()
Returns the print layout's atlas.
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.
QString displayExpression
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
SERVER_EXPORT QString owsServiceAccessConstraints(const QgsProject &project)
Returns the owsService access constraints defined in project.
NodeType nodeType() const
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
const QgsLayoutManager * layoutManager() const
Returns the project's layout manager, which manages compositions within the project.
SERVER_EXPORT QString owsServiceOnlineResource(const QgsProject &project)
Returns the owsService online resource defined in project.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Median cut implementation.
SERVER_EXPORT QString owsServiceContactOrganization(const QgsProject &project)
Returns the owsService contact organization defined in project.
int pageCount() const
Returns the number of pages in the collection.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
QgsLayoutFrame * frame(int index) const
Returns the child frame at a specified index from the multiframe.
QgsLayerTree * layerTreeRoot() const
Returns pointer to the root (invisible) node of the project's layer tree.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
QgsMapLayer * layer() const
Returns the map layer associated with this node.
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...
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
QList< QgsMapLayer * > layerOrder() const
The order in which layers will be rendered on the canvas.
double length() const
Returns the length of the measurement.
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
QgsEditorWidgetSetup editorWidgetSetup(int index) const
The editor widget setup defines which QgsFieldFormatter and editor widget will be used for the field ...
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the 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.
bool hasAxisInverted() const
Returns whether axis is inverted (e.g., for WMS 1.3) for the CRS.
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).
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
bool setCachedDocument(const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl) const
Updates or inserts the document in cache like capabilities.
QgsLayoutMeasurement convertFromLayoutUnits(double length, QgsUnitTypes::LayoutUnit unit) const
Converts a length measurement from the layout's native units to a specified target unit...
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.
double xMinimum() const
Returns the x minimum value (left side of rectangle).
bool enabled() const
Returns whether the atlas generation is enabled.
A helper class that centralizes restrictions given by all the access control filter plugins...
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QgsVectorLayer * coverageLayer() const
Returns the coverage layer used for the atlas features.
QString metadataUrl() const
Returns the metadata URL of the layer used by QGIS Server in GetCapabilities request.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
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.
Custom exception class for Coordinate Reference System related exceptions.
QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
QString title() const
Returns the project's title.
SERVER_EXPORT QString owsServiceContactMail(const QgsProject &project)
Returns the owsService contact mail defined in project.
QList< int > QgsAttributeList
Print layout, a QgsLayout subclass for static or atlas-based layouts.
QgsRectangle bounds() const
Returns the approximate bounds for the region the CRS is usable within.
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.
A layout multiframe subclass for HTML content.
QString attributeDisplayName(int index) const
Convenience function that returns the attribute alias if defined or the field name else...
If the layer is identifiable using the identify map tool and as a WMS layer.
QString authid() const
Returns the authority identifier for the CRS.
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
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
QString metadataUrlType() const
Returns the metadata type of the layer used by QGIS Server in GetCapabilities request.
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.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
SERVER_EXPORT bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.