48 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer );
50 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
53 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
54 bool considerMapExtent =
false );
56 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet );
58 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
61 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
65 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
67 const QStringList &constrainedCrsList,
const QgsProject *project );
69 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
70 const QString &crsText );
72 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
73 const QStringList &crsList,
const QStringList &constrainedCrsList );
75 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
78 void appendLayersFromTreeGroup( QDomDocument &doc,
79 QDomElement &parentLayer,
82 const QString &version,
85 bool projectSettings );
87 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();
109 #ifdef HAVE_SERVER_PYTHON_PLUGINS 113 QString cacheKey = cacheKeyList.join(
'-' );
115 #ifdef HAVE_SERVER_PYTHON_PLUGINS 117 if ( cacheManager && cacheManager->
getCachedDocument( &doc, project, request, accessControl ) )
119 capabilitiesDocument = &doc;
122 if ( !capabilitiesDocument && cache )
127 if ( !capabilitiesDocument )
129 QgsMessageLog::logMessage( QStringLiteral(
"WMS capabilities document not found in cache" ), QStringLiteral(
"Server" ) );
131 doc =
getCapabilities( serverIface, project, version, request, projectSettings );
133 #ifdef HAVE_SERVER_PYTHON_PLUGINS 137 capabilitiesDocument = &doc;
141 if ( !capabilitiesDocument )
146 if ( !capabilitiesDocument )
148 capabilitiesDocument = &doc;
160 response.
setHeader( QStringLiteral(
"Content-Type" ), QStringLiteral(
"text/xml; charset=utf-8" ) );
161 response.
write( capabilitiesDocument->toByteArray() );
166 bool projectSettings )
169 QDomElement wmsCapabilitiesElement;
177 QString hrefString = href.toString();
178 hrefString.append( href.hasQuery() ?
"&" :
"?" );
181 QDomProcessingInstruction xmlDeclaration = doc.createProcessingInstruction( QStringLiteral(
"xml" ),
182 QStringLiteral(
"version=\"1.0\" encoding=\"utf-8\"" ) );
185 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
187 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
188 formatElem.appendChild( doc.createTextNode( format ) );
189 elem.appendChild( formatElem );
192 if ( version == QLatin1String(
"1.1.1" ) )
194 doc = QDomDocument( QStringLiteral(
"WMT_MS_Capabilities SYSTEM 'http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd'" ) );
195 doc.appendChild( xmlDeclaration );
196 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMT_MS_Capabilities" ) );
200 doc.appendChild( xmlDeclaration );
201 wmsCapabilitiesElement = doc.createElement( QStringLiteral(
"WMS_Capabilities" ) );
202 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns" ), QStringLiteral(
"http://www.opengis.net/wms" ) );
203 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:sld" ), QStringLiteral(
"http://www.opengis.net/sld" ) );
204 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:qgs" ), QStringLiteral(
"http://www.qgis.org/wms" ) );
205 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
206 QString schemaLocation = QStringLiteral(
"http://www.opengis.net/wms" );
207 schemaLocation += QLatin1String(
" http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd" );
208 schemaLocation += QLatin1String(
" http://www.opengis.net/sld" );
209 schemaLocation += QLatin1String(
" http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd" );
212 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_common" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/common/1.0" ) );
213 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:inspire_vs" ), QStringLiteral(
"http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" ) );
214 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" );
215 schemaLocation += QLatin1String(
" http://inspire.ec.europa.eu/schemas/inspire_vs/1.0/inspire_vs.xsd" );
218 schemaLocation +=
" " + hrefString +
"SERVICE=WMS&REQUEST=GetSchemaExtension";
219 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"xsi:schemaLocation" ), schemaLocation );
221 wmsCapabilitiesElement.setAttribute( QStringLiteral(
"version" ), version );
222 doc.appendChild( wmsCapabilitiesElement );
225 wmsCapabilitiesElement.appendChild(
getServiceElement( doc, project, version, request ) );
228 QDomElement capabilityElement =
getCapabilityElement( doc, project, version, request, projectSettings );
229 wmsCapabilitiesElement.appendChild( capabilityElement );
231 if ( projectSettings )
240 capabilityElement.appendChild(
244 if ( projectSettings )
246 appendDrawingOrder( doc, capabilityElement, serverIface, project );
256 QDomElement serviceElem = doc.createElement( QStringLiteral(
"Service" ) );
259 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
260 QDomText nameText = doc.createTextNode( QStringLiteral(
"WMS" ) );
261 nameElem.appendChild( nameText );
262 serviceElem.appendChild( nameElem );
265 if ( !title.isEmpty() )
267 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
268 QDomText titleText = doc.createTextNode( title );
269 titleElem.appendChild( titleText );
270 serviceElem.appendChild( titleElem );
274 if ( !
abstract.isEmpty() )
276 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
277 QDomText abstractText = doc.createCDATASection(
abstract );
278 abstractElem.appendChild( abstractText );
279 serviceElem.appendChild( abstractElem );
282 addKeywordListElement( project, doc, serviceElem );
285 if ( onlineResource.isEmpty() )
287 onlineResource =
serviceUrl( request, project ).toString();
289 QDomElement onlineResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
290 onlineResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
291 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
292 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), onlineResource );
293 serviceElem.appendChild( onlineResourceElem );
300 if ( !contactPerson.isEmpty() ||
301 !contactOrganization.isEmpty() ||
302 !contactPosition.isEmpty() ||
303 !contactMail.isEmpty() ||
304 !contactPhone.isEmpty() )
307 QDomElement contactInfoElem = doc.createElement( QStringLiteral(
"ContactInformation" ) );
310 if ( !contactPerson.isEmpty() ||
311 !contactOrganization.isEmpty() ||
312 !contactPosition.isEmpty() )
314 QDomElement contactPersonPrimaryElem = doc.createElement( QStringLiteral(
"ContactPersonPrimary" ) );
316 if ( !contactPerson.isEmpty() )
318 QDomElement contactPersonElem = doc.createElement( QStringLiteral(
"ContactPerson" ) );
319 QDomText contactPersonText = doc.createTextNode( contactPerson );
320 contactPersonElem.appendChild( contactPersonText );
321 contactPersonPrimaryElem.appendChild( contactPersonElem );
324 if ( !contactOrganization.isEmpty() )
326 QDomElement contactOrganizationElem = doc.createElement( QStringLiteral(
"ContactOrganization" ) );
327 QDomText contactOrganizationText = doc.createTextNode( contactOrganization );
328 contactOrganizationElem.appendChild( contactOrganizationText );
329 contactPersonPrimaryElem.appendChild( contactOrganizationElem );
332 if ( !contactPosition.isEmpty() )
334 QDomElement contactPositionElem = doc.createElement( QStringLiteral(
"ContactPosition" ) );
335 QDomText contactPositionText = doc.createTextNode( contactPosition );
336 contactPositionElem.appendChild( contactPositionText );
337 contactPersonPrimaryElem.appendChild( contactPositionElem );
340 contactInfoElem.appendChild( contactPersonPrimaryElem );
343 if ( !contactPhone.isEmpty() )
345 QDomElement phoneElem = doc.createElement( QStringLiteral(
"ContactVoiceTelephone" ) );
346 QDomText phoneText = doc.createTextNode( contactPhone );
347 phoneElem.appendChild( phoneText );
348 contactInfoElem.appendChild( phoneElem );
351 if ( !contactMail.isEmpty() )
353 QDomElement mailElem = doc.createElement( QStringLiteral(
"ContactElectronicMailAddress" ) );
354 QDomText mailText = doc.createTextNode( contactMail );
355 mailElem.appendChild( mailText );
356 contactInfoElem.appendChild( mailElem );
359 serviceElem.appendChild( contactInfoElem );
362 QDomElement feesElem = doc.createElement( QStringLiteral(
"Fees" ) );
363 QDomText feesText = doc.createTextNode( QStringLiteral(
"None" ) );
365 if ( !fees.isEmpty() )
367 feesText = doc.createTextNode( fees );
369 feesElem.appendChild( feesText );
370 serviceElem.appendChild( feesElem );
372 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral(
"AccessConstraints" ) );
373 QDomText accessConstraintsText = doc.createTextNode( QStringLiteral(
"None" ) );
375 if ( !accessConstraints.isEmpty() )
377 accessConstraintsText = doc.createTextNode( accessConstraints );
379 accessConstraintsElem.appendChild( accessConstraintsText );
380 serviceElem.appendChild( accessConstraintsElem );
382 if ( version == QLatin1String(
"1.3.0" ) )
387 QDomElement maxWidthElem = doc.createElement( QStringLiteral(
"MaxWidth" ) );
388 QDomText maxWidthText = doc.createTextNode( QString::number( maxWidth ) );
389 maxWidthElem.appendChild( maxWidthText );
390 serviceElem.appendChild( maxWidthElem );
396 QDomElement maxHeightElem = doc.createElement( QStringLiteral(
"MaxHeight" ) );
397 QDomText maxHeightText = doc.createTextNode( QString::number( maxHeight ) );
398 maxHeightElem.appendChild( maxHeightText );
399 serviceElem.appendChild( maxHeightElem );
408 bool projectSettings )
416 QString hrefString = href.toString();
417 hrefString.append( href.hasQuery() ?
"&" :
"?" );
419 QDomElement capabilityElem = doc.createElement( QStringLiteral(
"Capability" ) );
422 QDomElement requestElem = doc.createElement( QStringLiteral(
"Request" ) );
423 capabilityElem.appendChild( requestElem );
425 QDomElement dcpTypeElem = doc.createElement( QStringLiteral(
"DCPType" ) );
426 QDomElement httpElem = doc.createElement( QStringLiteral(
"HTTP" ) );
427 dcpTypeElem.appendChild( httpElem );
430 std::function < void ( QDomElement &, const QString & ) > appendFormat = [&doc]( QDomElement & elem,
const QString & format )
432 QDomElement formatElem = doc.createElement( QStringLiteral(
"Format" ) );
433 formatElem.appendChild( doc.createTextNode( format ) );
434 elem.appendChild( formatElem );
440 elem = doc.createElement( QStringLiteral(
"GetCapabilities" ) );
441 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.wms_xml" :
"text/xml" ) );
442 elem.appendChild( dcpTypeElem );
443 requestElem.appendChild( elem );
448 if ( parameters.value( QStringLiteral(
"SERVICE" ) ).compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) != 0 )
450 QDomElement soapElem = doc.createElement( QStringLiteral(
"SOAP" ) );
451 httpElem.appendChild( soapElem );
452 QDomElement soapResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
453 soapResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
454 soapResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
455 soapResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
456 soapElem.appendChild( soapResourceElem );
460 QDomElement getElem = doc.createElement( QStringLiteral(
"Get" ) );
461 httpElem.appendChild( getElem );
462 QDomElement olResourceElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
463 olResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
464 olResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
465 olResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
466 getElem.appendChild( olResourceElem );
469 elem = doc.createElement( QStringLiteral(
"GetMap" ) );
470 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
471 appendFormat( elem, QStringLiteral(
"image/png" ) );
472 appendFormat( elem, QStringLiteral(
"image/png; mode=16bit" ) );
473 appendFormat( elem, QStringLiteral(
"image/png; mode=8bit" ) );
474 appendFormat( elem, QStringLiteral(
"image/png; mode=1bit" ) );
475 appendFormat( elem, QStringLiteral(
"application/dxf" ) );
476 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
477 requestElem.appendChild( elem );
480 elem = doc.createElement( QStringLiteral(
"GetFeatureInfo" ) );
481 appendFormat( elem, QStringLiteral(
"text/plain" ) );
482 appendFormat( elem, QStringLiteral(
"text/html" ) );
483 appendFormat( elem, QStringLiteral(
"text/xml" ) );
484 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml" ) );
485 appendFormat( elem, QStringLiteral(
"application/vnd.ogc.gml/3.1.1" ) );
486 appendFormat( elem, QStringLiteral(
"application/json" ) );
487 appendFormat( elem, QStringLiteral(
"application/geo+json" ) );
488 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
489 requestElem.appendChild( elem );
492 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetLegendGraphic" :
"sld:GetLegendGraphic" ) );
493 appendFormat( elem, QStringLiteral(
"image/jpeg" ) );
494 appendFormat( elem, QStringLiteral(
"image/png" ) );
495 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
496 requestElem.appendChild( elem );
499 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"DescribeLayer" :
"sld:DescribeLayer" ) );
500 appendFormat( elem, QStringLiteral(
"text/xml" ) );
501 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
502 requestElem.appendChild( elem );
505 elem = doc.createElement( ( version == QLatin1String(
"1.1.1" ) ?
"GetStyles" :
"qgs:GetStyles" ) );
506 appendFormat( elem, QStringLiteral(
"text/xml" ) );
507 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
508 requestElem.appendChild( elem );
510 if ( projectSettings )
513 elem = doc.createElement( QStringLiteral(
"GetPrint" ) );
514 appendFormat( elem, QStringLiteral(
"svg" ) );
515 appendFormat( elem, QStringLiteral(
"png" ) );
516 appendFormat( elem, QStringLiteral(
"pdf" ) );
517 elem.appendChild( dcpTypeElem.cloneNode().toElement() );
518 requestElem.appendChild( elem );
522 elem = doc.createElement( QStringLiteral(
"Exception" ) );
523 appendFormat( elem, ( version == QLatin1String(
"1.1.1" ) ?
"application/vnd.ogc.se_xml" :
"XML" ) );
524 capabilityElem.appendChild( elem );
527 if ( version == QLatin1String(
"1.3.0" ) )
529 elem = doc.createElement( QStringLiteral(
"sld:UserDefinedSymbolization" ) );
530 elem.setAttribute( QStringLiteral(
"SupportSLD" ), QStringLiteral(
"1" ) );
531 elem.setAttribute( QStringLiteral(
"UserLayer" ), QStringLiteral(
"0" ) );
532 elem.setAttribute( QStringLiteral(
"UserStyle" ), QStringLiteral(
"1" ) );
533 elem.setAttribute( QStringLiteral(
"RemoteWFS" ), QStringLiteral(
"0" ) );
534 elem.setAttribute( QStringLiteral(
"InlineFeature" ), QStringLiteral(
"0" ) );
535 elem.setAttribute( QStringLiteral(
"RemoteWCS" ), QStringLiteral(
"0" ) );
536 capabilityElem.appendChild( elem );
544 return capabilityElem;
549 QDomElement inspireCapabilitiesElem;
552 return inspireCapabilitiesElem;
554 inspireCapabilitiesElem = doc.createElement( QStringLiteral(
"inspire_vs:ExtendedCapabilities" ) );
558 if ( !inspireMetadataUrl.isEmpty() )
560 QDomElement inspireCommonMetadataUrlElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataUrl" ) );
561 inspireCommonMetadataUrlElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:resourceLocatorType" ) );
563 QDomElement inspireCommonMetadataUrlUrlElem = doc.createElement( QStringLiteral(
"inspire_common:URL" ) );
564 inspireCommonMetadataUrlUrlElem.appendChild( doc.createTextNode( inspireMetadataUrl ) );
565 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlUrlElem );
568 if ( !inspireMetadataUrlType.isNull() )
570 QDomElement inspireCommonMetadataUrlMediaTypeElem = doc.createElement( QStringLiteral(
"inspire_common:MediaType" ) );
571 inspireCommonMetadataUrlMediaTypeElem.appendChild( doc.createTextNode( inspireMetadataUrlType ) );
572 inspireCommonMetadataUrlElem.appendChild( inspireCommonMetadataUrlMediaTypeElem );
575 inspireCapabilitiesElem.appendChild( inspireCommonMetadataUrlElem );
579 QDomElement inspireCommonResourceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:ResourceType" ) );
580 inspireCommonResourceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"service" ) ) );
581 inspireCapabilitiesElem.appendChild( inspireCommonResourceTypeElem );
583 QDomElement inspireCommonSpatialDataServiceTypeElem = doc.createElement( QStringLiteral(
"inspire_common:SpatialDataServiceType" ) );
584 inspireCommonSpatialDataServiceTypeElem.appendChild( doc.createTextNode( QStringLiteral(
"view" ) ) );
585 inspireCapabilitiesElem.appendChild( inspireCommonSpatialDataServiceTypeElem );
588 if ( !inspireTemporalReference.isNull() )
590 QDomElement inspireCommonTemporalReferenceElem = doc.createElement( QStringLiteral(
"inspire_common:TemporalReference" ) );
591 QDomElement inspireCommonDateOfLastRevisionElem = doc.createElement( QStringLiteral(
"inspire_common:DateOfLastRevision" ) );
592 inspireCommonDateOfLastRevisionElem.appendChild( doc.createTextNode( inspireTemporalReference ) );
593 inspireCommonTemporalReferenceElem.appendChild( inspireCommonDateOfLastRevisionElem );
594 inspireCapabilitiesElem.appendChild( inspireCommonTemporalReferenceElem );
597 QDomElement inspireCommonMetadataPointOfContactElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataPointOfContact" ) );
600 QDomElement inspireCommonOrganisationNameElem = doc.createElement( QStringLiteral(
"inspire_common:OrganisationName" ) );
601 if ( !contactOrganization.isNull() )
603 inspireCommonOrganisationNameElem.appendChild( doc.createTextNode( contactOrganization ) );
605 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonOrganisationNameElem );
608 QDomElement inspireCommonEmailAddressElem = doc.createElement( QStringLiteral(
"inspire_common:EmailAddress" ) );
609 if ( !contactMail.isNull() )
611 inspireCommonEmailAddressElem.appendChild( doc.createTextNode( contactMail ) );
613 inspireCommonMetadataPointOfContactElem.appendChild( inspireCommonEmailAddressElem );
615 inspireCapabilitiesElem.appendChild( inspireCommonMetadataPointOfContactElem );
618 if ( !inspireMetadataDate.isNull() )
620 QDomElement inspireCommonMetadataDateElem = doc.createElement( QStringLiteral(
"inspire_common:MetadataDate" ) );
621 inspireCommonMetadataDateElem.appendChild( doc.createTextNode( inspireMetadataDate ) );
622 inspireCapabilitiesElem.appendChild( inspireCommonMetadataDateElem );
627 QDomElement inspireCommonSupportedLanguagesElem = doc.createElement( QStringLiteral(
"inspire_common:SupportedLanguages" ) );
628 inspireCommonSupportedLanguagesElem.setAttribute( QStringLiteral(
"xsi:type" ), QStringLiteral(
"inspire_common:supportedLanguagesType" ) );
630 QDomElement inspireCommonLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:Language" ) );
633 QDomElement inspireCommonDefaultLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:DefaultLanguage" ) );
634 inspireCommonDefaultLanguageElem.appendChild( inspireCommonLanguageElem );
635 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonDefaultLanguageElem );
639 QDomElement inspireCommonSupportedLanguageElem = doc.createElement(
"inspire_common:SupportedLanguage" );
640 inspireCommonSupportedLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
641 inspireCommonSupportedLanguagesElem.appendChild( inspireCommonSupportedLanguageElem );
644 inspireCapabilitiesElem.appendChild( inspireCommonSupportedLanguagesElem );
646 QDomElement inspireCommonResponseLanguageElem = doc.createElement( QStringLiteral(
"inspire_common:ResponseLanguage" ) );
647 inspireCommonResponseLanguageElem.appendChild( inspireCommonLanguageElem.cloneNode().toElement() );
648 inspireCapabilitiesElem.appendChild( inspireCommonResponseLanguageElem );
650 return inspireCapabilitiesElem;
656 if ( projectComposers.size() == 0 )
657 return QDomElement();
661 QDomElement composerTemplatesElem = doc.createElement( QStringLiteral(
"ComposerTemplates" ) );
662 QList<QgsPrintLayout *>::const_iterator cIt = projectComposers.constBegin();
663 for ( ; cIt != projectComposers.constEnd(); ++cIt )
666 if ( restrictedComposers.contains( layout->
name() ) )
678 QDomElement composerTemplateElem = doc.createElement( QStringLiteral(
"ComposerTemplate" ) );
679 composerTemplateElem.setAttribute( QStringLiteral(
"name" ), layout->
name() );
682 composerTemplateElem.setAttribute( QStringLiteral(
"width" ), width.length() );
683 composerTemplateElem.setAttribute( QStringLiteral(
"height" ), height.
length() );
687 if ( atlas && atlas->
enabled() )
689 composerTemplateElem.setAttribute( QStringLiteral(
"atlasEnabled" ), QStringLiteral(
"1" ) );
696 layerName = cLayer->
id();
698 else if ( layerName.isEmpty() )
700 layerName = cLayer->
name();
702 composerTemplateElem.setAttribute( QStringLiteral(
"atlasCoverageLayer" ), layerName );
707 QList<QgsLayoutItemMap *> layoutMapList;
709 QList<QgsLayoutItemMap *>::const_iterator cmIt = layoutMapList.constBegin();
712 for ( ; cmIt != layoutMapList.constEnd(); ++cmIt )
716 QDomElement composerMapElem = doc.createElement( QStringLiteral(
"ComposerMap" ) );
717 composerMapElem.setAttribute( QStringLiteral(
"name" ), QStringLiteral(
"map%1" ).arg( mapId ) );
719 composerMapElem.setAttribute( QStringLiteral(
"width" ), composerMap->rect().width() );
720 composerMapElem.setAttribute( QStringLiteral(
"height" ), composerMap->rect().height() );
721 composerTemplateElem.appendChild( composerMapElem );
725 QList<QgsLayoutItemLabel *> composerLabelList;
727 QList<QgsLayoutItemLabel *>::const_iterator clIt = composerLabelList.constBegin();
728 for ( ; clIt != composerLabelList.constEnd(); ++clIt )
731 QString
id = composerLabel->
id();
735 QDomElement composerLabelElem = doc.createElement( QStringLiteral(
"ComposerLabel" ) );
736 composerLabelElem.setAttribute( QStringLiteral(
"name" ),
id );
737 composerTemplateElem.appendChild( composerLabelElem );
741 QList<QgsLayoutItemHtml *> composerHtmlList;
743 QList<QgsLayoutItemHtml *>::const_iterator chIt = composerHtmlList.constBegin();
744 for ( ; chIt != composerHtmlList.constEnd(); ++chIt )
750 QString
id = composerHtml->
frame( 0 )->
id();
754 QDomElement composerHtmlElem = doc.createElement( QStringLiteral(
"ComposerHtml" ) );
755 composerHtmlElem.setAttribute( QStringLiteral(
"name" ),
id );
756 composerTemplateElem.appendChild( composerHtmlElem );
759 composerTemplatesElem.appendChild( composerTemplateElem );
762 if ( composerTemplatesElem.childNodes().size() == 0 )
763 return QDomElement();
765 return composerTemplatesElem;
771 if ( wfsLayerIds.size() == 0 )
772 return QDomElement();
774 QDomElement wfsLayersElem = doc.createElement( QStringLiteral(
"WFSLayers" ) );
775 for (
int i = 0; i < wfsLayerIds.size(); ++i )
783 QDomElement wfsLayerElem = doc.createElement( QStringLiteral(
"WFSLayer" ) );
786 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
id() );
790 wfsLayerElem.setAttribute( QStringLiteral(
"name" ), layer->
name() );
792 wfsLayersElem.appendChild( wfsLayerElem );
795 return wfsLayersElem;
799 const QgsProject *project,
const QString &version,
804 QDomElement layerParentElem = doc.createElement( QStringLiteral(
"Layer" ) );
806 if ( !project->
title().isEmpty() )
809 QDomElement layerParentTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
810 QDomText layerParentTitleText = doc.createTextNode( project->
title() );
811 layerParentTitleElem.appendChild( layerParentTitleText );
812 layerParentElem.appendChild( layerParentTitleElem );
815 QDomElement layerParentAbstElem = doc.createElement( QStringLiteral(
"Abstract" ) );
816 QDomText layerParentAbstText = doc.createTextNode( project->
title() );
817 layerParentAbstElem.appendChild( layerParentAbstText );
818 layerParentElem.appendChild( layerParentAbstElem );
823 if ( rootLayerName.isEmpty() && !project->
title().isEmpty() )
825 rootLayerName = project->
title();
828 if ( !rootLayerName.isEmpty() )
830 QDomElement layerParentNameElem = doc.createElement( QStringLiteral(
"Name" ) );
831 QDomText layerParentNameText = doc.createTextNode( rootLayerName );
832 layerParentNameElem.appendChild( layerParentNameText );
833 layerParentElem.appendChild( layerParentNameElem );
837 addKeywordListElement( project, doc, layerParentElem );
840 if ( projectSettings )
842 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
843 QDomText treeNameText = doc.createTextNode( project->
title() );
844 treeNameElem.appendChild( treeNameText );
845 layerParentElem.appendChild( treeNameElem );
850 layerParentElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
854 layerParentElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
857 appendLayersFromTreeGroup( doc, layerParentElem, serverIface, project, version, request, projectLayerTreeRoot, projectSettings );
859 combineExtentAndCrsOfGroupChildren( doc, layerParentElem, project,
true );
861 return layerParentElem;
867 void appendLayersFromTreeGroup( QDomDocument &doc,
868 QDomElement &parentLayer,
871 const QString &version,
874 bool projectSettings )
880 QList< QgsLayerTreeNode * > layerTreeGroupChildren = layerTreeGroup->
children();
881 for (
int i = 0; i < layerTreeGroupChildren.size(); ++i )
884 QDomElement layerElem = doc.createElement( QStringLiteral(
"Layer" ) );
886 if ( projectSettings )
888 layerElem.setAttribute( QStringLiteral(
"visible" ), treeNode->
isVisible() );
895 QString name = treeGroupChild->
name();
896 if ( restrictedLayers.contains( name ) )
901 if ( projectSettings )
903 layerElem.setAttribute( QStringLiteral(
"mutuallyExclusive" ), treeGroupChild->
isMutuallyExclusive() );
906 QString shortName = treeGroupChild->
customProperty( QStringLiteral(
"wmsShortName" ) ).toString();
907 QString title = treeGroupChild->
customProperty( QStringLiteral(
"wmsTitle" ) ).toString();
909 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
911 if ( !shortName.isEmpty() )
912 nameText = doc.createTextNode( shortName );
914 nameText = doc.createTextNode( name );
915 nameElem.appendChild( nameText );
916 layerElem.appendChild( nameElem );
918 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
920 if ( !title.isEmpty() )
921 titleText = doc.createTextNode( title );
923 titleText = doc.createTextNode( name );
924 titleElem.appendChild( titleText );
925 layerElem.appendChild( titleElem );
927 QString
abstract = treeGroupChild->
customProperty( QStringLiteral(
"wmsAbstract" ) ).toString();
928 if ( !
abstract.isEmpty() )
930 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
931 QDomText abstractText = doc.createTextNode(
abstract );
932 abstractElem.appendChild( abstractText );
933 layerElem.appendChild( abstractElem );
937 if ( projectSettings )
939 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
940 QDomText treeNameText = doc.createTextNode( name );
941 treeNameElem.appendChild( treeNameText );
942 layerElem.appendChild( treeNameElem );
948 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
952 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
955 appendLayersFromTreeGroup( doc, layerElem, serverIface, project, version, request, treeGroupChild, projectSettings );
957 combineExtentAndCrsOfGroupChildren( doc, layerElem, project );
963 if ( restrictedLayers.contains( l->
name() ) )
968 #ifdef HAVE_SERVER_PYTHON_PLUGINS 975 QString wmsName = l->
name();
988 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"0" ) );
992 layerElem.setAttribute( QStringLiteral(
"queryable" ), QStringLiteral(
"1" ) );
995 QDomElement nameElem = doc.createElement( QStringLiteral(
"Name" ) );
996 QDomText nameText = doc.createTextNode( wmsName );
997 nameElem.appendChild( nameText );
998 layerElem.appendChild( nameElem );
1000 QDomElement titleElem = doc.createElement( QStringLiteral(
"Title" ) );
1001 QString title = l->
title();
1002 if ( title.isEmpty() )
1006 QDomText titleText = doc.createTextNode( title );
1007 titleElem.appendChild( titleText );
1008 layerElem.appendChild( titleElem );
1011 if ( !
abstract.isEmpty() )
1013 QDomElement abstractElem = doc.createElement( QStringLiteral(
"Abstract" ) );
1014 QDomText abstractText = doc.createTextNode(
abstract );
1015 abstractElem.appendChild( abstractText );
1016 layerElem.appendChild( abstractElem );
1022 QStringList keywordStringList = l->
keywordList().split(
',' );
1024 QDomElement keywordListElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1025 for (
int i = 0; i < keywordStringList.size(); ++i )
1027 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1028 QDomText keywordText = doc.createTextNode( keywordStringList.at( i ).trimmed() );
1029 keywordElem.appendChild( keywordText );
1032 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1034 keywordListElem.appendChild( keywordElem );
1036 layerElem.appendChild( keywordListElem );
1040 bool geometryLayer =
true;
1048 geometryLayer =
false;
1054 if ( geometryLayer )
1056 QStringList crsList;
1059 appendCrsElementsToLayer( doc, layerElem, crsList, outputCrsList );
1077 else if ( vl->
crs() != project->
crs() )
1082 extent = ct.transform( extent );
1086 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent for layer %1: %2" ).arg( vl->
name() ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1093 appendLayerBoundingBoxes( doc, layerElem, extent, l->
crs(), crsList, outputCrsList, project );
1097 appendLayerStyles( doc, layerElem, l, project, version, request );
1102 if ( version == QLatin1String(
"1.1.1" ) )
1105 double SCALE_TO_SCALEHINT = OGC_PX_M * M_SQRT2;
1107 QDomElement scaleHintElem = doc.createElement( QStringLiteral(
"ScaleHint" ) );
1108 scaleHintElem.setAttribute( QStringLiteral(
"min" ), QString::number( l->
maximumScale() * SCALE_TO_SCALEHINT ) );
1109 scaleHintElem.setAttribute( QStringLiteral(
"max" ), QString::number( l->
minimumScale() * SCALE_TO_SCALEHINT ) );
1110 layerElem.appendChild( scaleHintElem );
1114 QString minScaleString = QString::number( l->
maximumScale() );
1115 QDomElement minScaleElem = doc.createElement( QStringLiteral(
"MinScaleDenominator" ) );
1116 QDomText minScaleText = doc.createTextNode( minScaleString );
1117 minScaleElem.appendChild( minScaleText );
1118 layerElem.appendChild( minScaleElem );
1120 QString maxScaleString = QString::number( l->
minimumScale() );
1121 QDomElement maxScaleElem = doc.createElement( QStringLiteral(
"MaxScaleDenominator" ) );
1122 QDomText maxScaleText = doc.createTextNode( maxScaleString );
1123 maxScaleElem.appendChild( maxScaleText );
1124 layerElem.appendChild( maxScaleElem );
1129 QString dataUrl = l->
dataUrl();
1130 if ( !dataUrl.isEmpty() )
1132 QDomElement dataUrlElem = doc.createElement( QStringLiteral(
"DataURL" ) );
1133 QDomElement dataUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1135 QDomText dataUrlFormatText = doc.createTextNode( dataUrlFormat );
1136 dataUrlFormatElem.appendChild( dataUrlFormatText );
1137 dataUrlElem.appendChild( dataUrlFormatElem );
1138 QDomElement dataORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1139 dataORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1140 dataORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1141 dataORElem.setAttribute( QStringLiteral(
"xlink:href" ), dataUrl );
1142 dataUrlElem.appendChild( dataORElem );
1143 layerElem.appendChild( dataUrlElem );
1148 if ( !attribution.isEmpty() )
1150 QDomElement attribElem = doc.createElement( QStringLiteral(
"Attribution" ) );
1151 QDomElement attribTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1152 QDomText attribText = doc.createTextNode( attribution );
1153 attribTitleElem.appendChild( attribText );
1154 attribElem.appendChild( attribTitleElem );
1156 if ( !attributionUrl.isEmpty() )
1158 QDomElement attribORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1159 attribORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1160 attribORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1161 attribORElem.setAttribute( QStringLiteral(
"xlink:href" ), attributionUrl );
1162 attribElem.appendChild( attribORElem );
1164 layerElem.appendChild( attribElem );
1169 if ( !metadataUrl.isEmpty() )
1171 QDomElement metaUrlElem = doc.createElement( QStringLiteral(
"MetadataURL" ) );
1173 if ( version == QLatin1String(
"1.1.1" ) )
1175 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1177 else if ( metadataUrlType == QLatin1String(
"FGDC" ) )
1179 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"FGDC:1998" ) );
1181 else if ( metadataUrlType == QLatin1String(
"TC211" ) )
1183 metaUrlElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ISO19115:2003" ) );
1187 metaUrlElem.setAttribute( QStringLiteral(
"type" ), metadataUrlType );
1190 if ( !metadataUrlFormat.isEmpty() )
1192 QDomElement metaUrlFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1193 QDomText metaUrlFormatText = doc.createTextNode( metadataUrlFormat );
1194 metaUrlFormatElem.appendChild( metaUrlFormatText );
1195 metaUrlElem.appendChild( metaUrlFormatElem );
1197 QDomElement metaUrlORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1198 metaUrlORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1199 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1200 metaUrlORElem.setAttribute( QStringLiteral(
"xlink:href" ), metadataUrl );
1201 metaUrlElem.appendChild( metaUrlORElem );
1202 layerElem.appendChild( metaUrlElem );
1205 if ( projectSettings )
1207 appendLayerProjectSettings( doc, layerElem, l );
1211 parentLayer.appendChild( layerElem );
1215 void appendLayerStyles( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer,
1222 QString hrefString = href.toString();
1223 hrefString.append( href.hasQuery() ?
"&" :
"?" );
1226 QDomElement styleElem = doc.createElement( QStringLiteral(
"Style" ) );
1227 QDomElement styleNameElem = doc.createElement( QStringLiteral(
"Name" ) );
1228 QDomText styleNameText = doc.createTextNode( styleName );
1229 styleNameElem.appendChild( styleNameText );
1230 QDomElement styleTitleElem = doc.createElement( QStringLiteral(
"Title" ) );
1231 QDomText styleTitleText = doc.createTextNode( styleName );
1232 styleTitleElem.appendChild( styleTitleText );
1233 styleElem.appendChild( styleNameElem );
1234 styleElem.appendChild( styleTitleElem );
1237 QDomElement getLayerLegendGraphicElem = doc.createElement( QStringLiteral(
"LegendURL" ) );
1239 QString customHrefString = currentLayer->
legendUrl();
1241 QStringList getLayerLegendGraphicFormats;
1242 if ( !customHrefString.isEmpty() )
1248 getLayerLegendGraphicFormats << QStringLiteral(
"image/png" );
1251 for (
int i = 0; i < getLayerLegendGraphicFormats.size(); ++i )
1253 QDomElement getLayerLegendGraphicFormatElem = doc.createElement( QStringLiteral(
"Format" ) );
1254 QString getLayerLegendGraphicFormat = getLayerLegendGraphicFormats[i];
1255 QDomText getLayerLegendGraphicFormatText = doc.createTextNode( getLayerLegendGraphicFormat );
1256 getLayerLegendGraphicFormatElem.appendChild( getLayerLegendGraphicFormatText );
1257 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicFormatElem );
1261 if ( customHrefString.isEmpty() )
1263 QString layerName = currentLayer->
name();
1265 layerName = currentLayer->
id();
1266 else if ( !currentLayer->
shortName().isEmpty() )
1268 QUrlQuery mapUrl( hrefString );
1269 mapUrl.addQueryItem( QStringLiteral(
"SERVICE" ), QStringLiteral(
"WMS" ) );
1270 mapUrl.addQueryItem( QStringLiteral(
"VERSION" ), version );
1271 mapUrl.addQueryItem( QStringLiteral(
"REQUEST" ), QStringLiteral(
"GetLegendGraphic" ) );
1272 mapUrl.addQueryItem( QStringLiteral(
"LAYER" ), layerName );
1273 mapUrl.addQueryItem( QStringLiteral(
"FORMAT" ), QStringLiteral(
"image/png" ) );
1274 mapUrl.addQueryItem( QStringLiteral(
"STYLE" ), styleNameText.data() );
1275 if ( version == QLatin1String(
"1.3.0" ) )
1277 mapUrl.addQueryItem( QStringLiteral(
"SLD_VERSION" ), QStringLiteral(
"1.1.0" ) );
1279 customHrefString = mapUrl.toString();
1282 QDomElement getLayerLegendGraphicORElem = doc.createElement( QStringLiteral(
"OnlineResource" ) );
1283 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
1284 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
1285 getLayerLegendGraphicORElem.setAttribute( QStringLiteral(
"xlink:href" ), customHrefString );
1286 getLayerLegendGraphicElem.appendChild( getLayerLegendGraphicORElem );
1287 styleElem.appendChild( getLayerLegendGraphicElem );
1289 layerElem.appendChild( styleElem );
1293 void appendCrsElementsToLayer( QDomDocument &doc, QDomElement &layerElement,
1294 const QStringList &crsList,
const QStringList &constrainedCrsList )
1296 if ( layerElement.isNull() )
1302 QDomElement titleElement = layerElement.firstChildElement( QStringLiteral(
"Title" ) );
1303 QDomElement abstractElement = layerElement.firstChildElement( QStringLiteral(
"Abstract" ) );
1304 QDomElement CRSPrecedingElement = abstractElement.isNull() ? titleElement : abstractElement;
1306 if ( CRSPrecedingElement.isNull() )
1309 const QDomElement keyElement = layerElement.firstChildElement( QStringLiteral(
"KeywordList" ) );
1310 CRSPrecedingElement = keyElement;
1314 if ( !constrainedCrsList.isEmpty() )
1316 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1318 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, constrainedCrsList.at( i ) );
1323 for (
const QString &
crs : crsList )
1325 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement,
crs );
1330 appendCrsElementToLayer( doc, layerElement, CRSPrecedingElement, QString(
"CRS:84" ) );
1333 void appendCrsElementToLayer( QDomDocument &doc, QDomElement &layerElement,
const QDomElement &precedingElement,
1334 const QString &crsText )
1336 if ( crsText.isEmpty() )
1338 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1339 QDomElement crsElement = doc.createElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1340 QDomText crsTextNode = doc.createTextNode( crsText );
1341 crsElement.appendChild( crsTextNode );
1342 layerElement.insertAfter( crsElement, precedingElement );
1345 void appendLayerBoundingBoxes( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &lExtent,
1347 const QStringList &constrainedCrsList,
const QgsProject *project )
1349 if ( layerElem.isNull() )
1358 layerExtent.
grow( 0.000001 );
1363 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1366 QDomElement ExGeoBBoxElement;
1369 if ( !layerExtent.
isNull() )
1378 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1383 if ( version == QLatin1String(
"1.1.1" ) )
1385 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"LatLonBoundingBox" ) );
1386 ExGeoBBoxElement.setAttribute( QStringLiteral(
"minx" ), QString::number( wgs84BoundingRect.
xMinimum() ) );
1387 ExGeoBBoxElement.setAttribute( QStringLiteral(
"maxx" ), QString::number( wgs84BoundingRect.
xMaximum() ) );
1388 ExGeoBBoxElement.setAttribute( QStringLiteral(
"miny" ), QString::number( wgs84BoundingRect.
yMinimum() ) );
1389 ExGeoBBoxElement.setAttribute( QStringLiteral(
"maxy" ), QString::number( wgs84BoundingRect.
yMaximum() ) );
1393 ExGeoBBoxElement = doc.createElement( QStringLiteral(
"EX_GeographicBoundingBox" ) );
1394 QDomElement wBoundLongitudeElement = doc.createElement( QStringLiteral(
"westBoundLongitude" ) );
1395 QDomText wBoundLongitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
xMinimum() ) );
1396 wBoundLongitudeElement.appendChild( wBoundLongitudeText );
1397 ExGeoBBoxElement.appendChild( wBoundLongitudeElement );
1398 QDomElement eBoundLongitudeElement = doc.createElement( QStringLiteral(
"eastBoundLongitude" ) );
1399 QDomText eBoundLongitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
xMaximum() ) );
1400 eBoundLongitudeElement.appendChild( eBoundLongitudeText );
1401 ExGeoBBoxElement.appendChild( eBoundLongitudeElement );
1402 QDomElement sBoundLatitudeElement = doc.createElement( QStringLiteral(
"southBoundLatitude" ) );
1403 QDomText sBoundLatitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
yMinimum() ) );
1404 sBoundLatitudeElement.appendChild( sBoundLatitudeText );
1405 ExGeoBBoxElement.appendChild( sBoundLatitudeElement );
1406 QDomElement nBoundLatitudeElement = doc.createElement( QStringLiteral(
"northBoundLatitude" ) );
1407 QDomText nBoundLatitudeText = doc.createTextNode( QString::number( wgs84BoundingRect.
yMaximum() ) );
1408 nBoundLatitudeElement.appendChild( nBoundLatitudeText );
1409 ExGeoBBoxElement.appendChild( nBoundLatitudeElement );
1412 if ( !wgs84BoundingRect.
isNull() )
1414 QDomElement lastCRSElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS" );
1415 if ( !lastCRSElem.isNull() )
1417 layerElem.insertAfter( ExGeoBBoxElement, lastCRSElem );
1421 layerElem.appendChild( ExGeoBBoxElement );
1426 if ( !constrainedCrsList.isEmpty() )
1428 for (
int i = constrainedCrsList.size() - 1; i >= 0; --i )
1430 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS, constrainedCrsList.at( i ), project );
1435 for (
const QString &
crs : crsList )
1437 appendLayerBoundingBox( doc, layerElem, layerExtent, layerCRS,
crs, project );
1443 void appendLayerBoundingBox( QDomDocument &doc, QDomElement &layerElem,
const QgsRectangle &layerExtent,
1447 if ( layerElem.isNull() )
1452 if ( crsText.isEmpty() )
1457 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1463 if ( !layerExtent.
isNull() )
1472 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1477 if ( crsExtent.
isNull() )
1483 QDomElement bBoxElement = doc.createElement( QStringLiteral(
"BoundingBox" ) );
1486 bBoxElement.setAttribute( version == QLatin1String(
"1.1.1" ) ?
"SRS" :
"CRS", crs.
authid() );
1494 bBoxElement.setAttribute( QStringLiteral(
"minx" ), QString::number( crsExtent.
xMinimum() ) );
1495 bBoxElement.setAttribute( QStringLiteral(
"miny" ), QString::number( crsExtent.
yMinimum() ) );
1496 bBoxElement.setAttribute( QStringLiteral(
"maxx" ), QString::number( crsExtent.
xMaximum() ) );
1497 bBoxElement.setAttribute( QStringLiteral(
"maxy" ), QString::number( crsExtent.
yMaximum() ) );
1499 QDomElement lastBBoxElem = layerElem.lastChildElement( QStringLiteral(
"BoundingBox" ) );
1500 if ( !lastBBoxElem.isNull() )
1502 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1506 lastBBoxElem = layerElem.lastChildElement( version == QLatin1String(
"1.1.1" ) ?
"LatLonBoundingBox" :
"EX_GeographicBoundingBox" );
1507 if ( !lastBBoxElem.isNull() )
1509 layerElem.insertAfter( bBoxElement, lastBBoxElem );
1513 layerElem.appendChild( bBoxElement );
1518 QgsRectangle layerBoundingBoxInProjectCrs(
const QDomDocument &doc,
const QDomElement &layerElem,
1522 if ( layerElem.isNull() )
1528 QDomElement boundingBoxElem = layerElem.firstChildElement( QStringLiteral(
"BoundingBox" ) );
1529 if ( boundingBoxElem.isNull() )
1534 double minx, miny, maxx, maxy;
1536 minx = boundingBoxElem.attribute( QStringLiteral(
"minx" ) ).toDouble( &conversionOk );
1537 if ( !conversionOk )
1541 miny = boundingBoxElem.attribute( QStringLiteral(
"miny" ) ).toDouble( &conversionOk );
1542 if ( !conversionOk )
1546 maxx = boundingBoxElem.attribute( QStringLiteral(
"maxx" ) ).toDouble( &conversionOk );
1547 if ( !conversionOk )
1551 maxy = boundingBoxElem.attribute( QStringLiteral(
"maxy" ) ).toDouble( &conversionOk );
1552 if ( !conversionOk )
1558 QString version = doc.documentElement().attribute( QStringLiteral(
"version" ) );
1572 if ( version != QLatin1String(
"1.1.1" ) && layerCrs.
hasAxisInverted() )
1583 BBox = t.transformBoundingBox( BBox );
1587 QgsMessageLog::logMessage( QStringLiteral(
"Error transforming extent: %1" ).arg( cse.
what() ), QStringLiteral(
"Server" ), Qgis::MessageLevel::Warning );
1594 bool crsSetFromLayerElement(
const QDomElement &layerElement, QSet<QString> &crsSet )
1596 if ( layerElement.isNull() )
1603 QDomNodeList crsNodeList;
1604 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"CRS" ) );
1605 for (
int i = 0; i < crsNodeList.size(); ++i )
1607 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1610 crsNodeList = layerElement.elementsByTagName( QStringLiteral(
"SRS" ) );
1611 for (
int i = 0; i < crsNodeList.size(); ++i )
1613 crsSet.insert( crsNodeList.at( i ).toElement().text() );
1619 void combineExtentAndCrsOfGroupChildren( QDomDocument &doc, QDomElement &groupElem,
const QgsProject *project,
1620 bool considerMapExtent )
1623 QSet<QString> combinedCRSSet;
1624 bool firstBBox =
true;
1625 bool firstCRSSet =
true;
1627 QDomNodeList layerChildren = groupElem.childNodes();
1628 for (
int j = 0; j < layerChildren.size(); ++j )
1630 QDomElement childElem = layerChildren.at( j ).toElement();
1632 if ( childElem.tagName() != QLatin1String(
"Layer" ) )
1635 QgsRectangle bbox = layerBoundingBoxInProjectCrs( doc, childElem, project );
1645 combinedBBox = bbox;
1655 QSet<QString> crsSet;
1656 if ( crsSetFromLayerElement( childElem, crsSet ) )
1660 combinedCRSSet = crsSet;
1661 firstCRSSet =
false;
1665 combinedCRSSet.intersect( crsSet );
1671 appendCrsElementsToLayer( doc, groupElem, combinedCRSSet.toList(), outputCrsList );
1674 if ( considerMapExtent )
1679 combinedBBox = mapRect;
1682 appendLayerBoundingBoxes( doc, groupElem, combinedBBox, groupCRS, combinedCRSSet.toList(), outputCrsList, project );
1686 void appendDrawingOrder( QDomDocument &doc, QDomElement &parentElem,
QgsServerInterface *serverIface,
1689 #ifdef HAVE_SERVER_PYTHON_PLUGINS 1692 ( void )serverIface;
1697 QStringList layerList;
1700 QList< QgsMapLayer * > projectLayerOrder = projectLayerTreeRoot->
layerOrder();
1701 for (
int i = 0; i < projectLayerOrder.size(); ++i )
1705 if ( restrictedLayers.contains( l->
name() ) )
1709 #ifdef HAVE_SERVER_PYTHON_PLUGINS 1715 QString wmsName = l->
name();
1725 layerList << wmsName;
1728 if ( !layerList.isEmpty() )
1730 QStringList reversedList;
1731 reversedList.reserve( layerList.size() );
1732 for (
int i = layerList.size() - 1; i >= 0; --i )
1733 reversedList << layerList[ i ];
1735 QDomElement layerDrawingOrderElem = doc.createElement( QStringLiteral(
"LayerDrawingOrder" ) );
1736 QDomText drawingOrderText = doc.createTextNode( reversedList.join(
',' ) );
1737 layerDrawingOrderElem.appendChild( drawingOrderText );
1738 parentElem.appendChild( layerDrawingOrderElem );
1742 void appendLayerProjectSettings( QDomDocument &doc, QDomElement &layerElem,
QgsMapLayer *currentLayer )
1744 if ( !currentLayer )
1750 QDomElement treeNameElem = doc.createElement( QStringLiteral(
"TreeName" ) );
1751 QDomText treeNameText = doc.createTextNode( currentLayer->
name() );
1752 treeNameElem.appendChild( treeNameText );
1753 layerElem.appendChild( treeNameElem );
1755 switch ( currentLayer->
type() )
1762 int displayFieldIdx = -1;
1763 QString displayField = QStringLiteral(
"maptip" );
1765 if ( exp.isField() )
1772 QDomElement attributesElem = doc.createElement( QStringLiteral(
"Attributes" ) );
1774 for (
int idx = 0; idx < layerFields.
count(); ++idx )
1777 if ( excludedAttributes.contains( field.
name() ) )
1782 if ( idx == displayFieldIdx )
1786 QDomElement attributeElem = doc.createElement( QStringLiteral(
"Attribute" ) );
1787 attributeElem.setAttribute( QStringLiteral(
"name" ), field.
name() );
1788 attributeElem.setAttribute( QStringLiteral(
"type" ), QVariant::typeToName( field.
type() ) );
1789 attributeElem.setAttribute( QStringLiteral(
"typeName" ), field.
typeName() );
1790 QString alias = field.
alias();
1791 if ( !alias.isEmpty() )
1793 attributeElem.setAttribute( QStringLiteral(
"alias" ), alias );
1797 attributeElem.setAttribute( QStringLiteral(
"editType" ), vLayer->
editorWidgetSetup( idx ).
type() );
1798 attributeElem.setAttribute( QStringLiteral(
"comment" ), field.
comment() );
1799 attributeElem.setAttribute( QStringLiteral(
"length" ), field.
length() );
1800 attributeElem.setAttribute( QStringLiteral(
"precision" ), field.
precision() );
1801 attributesElem.appendChild( attributeElem );
1805 layerElem.setAttribute( QStringLiteral(
"displayField" ), displayField );
1809 if ( pkAttributes.size() > 0 )
1811 QDomElement pkElem = doc.createElement( QStringLiteral(
"PrimaryKey" ) );
1812 QgsAttributeList::const_iterator pkIt = pkAttributes.constBegin();
1813 for ( ; pkIt != pkAttributes.constEnd(); ++pkIt )
1815 QDomElement pkAttributeElem = doc.createElement( QStringLiteral(
"PrimaryKeyAttribute" ) );
1816 QDomText pkAttName = doc.createTextNode( layerFields.
at( *pkIt ).
name() );
1817 pkAttributeElem.appendChild( pkAttName );
1818 pkElem.appendChild( pkAttributeElem );
1820 layerElem.appendChild( pkElem );
1826 layerElem.appendChild( attributesElem );
1833 if ( provider && provider->
name() ==
"wms" )
1836 QVariant wmsBackgroundLayer = currentLayer->
customProperty( QStringLiteral(
"WMSBackgroundLayer" ),
false );
1837 QDomElement wmsBackgroundLayerElem = doc.createElement(
"WMSBackgroundLayer" );
1838 QDomText wmsBackgroundLayerText = doc.createTextNode( wmsBackgroundLayer.toBool() ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
1839 wmsBackgroundLayerElem.appendChild( wmsBackgroundLayerText );
1840 layerElem.appendChild( wmsBackgroundLayerElem );
1843 QVariant wmsPublishDataSourceUrl = currentLayer->
customProperty( QStringLiteral(
"WMSPublishDataSourceUrl" ),
false );
1844 if ( wmsPublishDataSourceUrl.toBool() )
1847 ? !qobject_cast< const QgsRasterDataProvider * >( provider )->
nativeResolutions().isEmpty()
1850 QDomElement dataSourceElem = doc.createElement( tiled ? QStringLiteral(
"WMTSDataSource" ) : QStringLiteral(
"WMSDataSource" ) );
1851 QDomText dataSourceUri = doc.createTextNode( provider->
dataSourceUri() );
1852 dataSourceElem.appendChild( dataSourceUri );
1853 layerElem.appendChild( dataSourceElem );
1857 QVariant wmsPrintLayer = currentLayer->
customProperty( QStringLiteral(
"WMSPrintLayer" ) );
1858 if ( wmsPrintLayer.isValid() )
1860 QDomElement wmsPrintLayerElem = doc.createElement(
"WMSPrintLayer" );
1861 QDomText wmsPrintLayerText = doc.createTextNode( wmsPrintLayer.toString() );
1862 wmsPrintLayerElem.appendChild( wmsPrintLayerText );
1863 layerElem.appendChild( wmsPrintLayerElem );
1874 void addKeywordListElement(
const QgsProject *project, QDomDocument &doc, QDomElement &parent )
1878 QDomElement keywordsElem = doc.createElement( QStringLiteral(
"KeywordList" ) );
1880 QDomElement keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1881 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"ISO" ) );
1882 QDomText keywordText = doc.createTextNode( QStringLiteral(
"infoMapAccessService" ) );
1883 keywordElem.appendChild( keywordText );
1884 keywordsElem.appendChild( keywordElem );
1885 parent.appendChild( keywordsElem );
1887 for (
const QString &keyword : qgis::as_const( keywords ) )
1889 if ( !keyword.isEmpty() )
1891 keywordElem = doc.createElement( QStringLiteral(
"Keyword" ) );
1892 keywordText = doc.createTextNode( keyword );
1893 keywordElem.appendChild( keywordText );
1896 keywordElem.setAttribute( QStringLiteral(
"vocabulary" ), QStringLiteral(
"SIA_Geo405" ) );
1898 keywordsElem.appendChild( keywordElem );
1901 parent.appendChild( keywordsElem );
1909 for (
int j = 0; j < childNode->
children().size(); ++j )
1919 const auto l { treeLayer->
layer() };
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.
QgsMapLayerType type() const
Returns the type of the layer.
virtual QgsDataProvider * dataProvider()
Returns the layer's data provider, it may be nullptr.
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.
bool hasQueryableChildren(const QgsLayerTreeNode *childNode, const QStringList &wmsRestrictedLayers)
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...
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...
virtual QList< double > nativeResolutions() const
Returns a list of native resolutions if available, i.e.
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).
QgsCoordinateTransformContext transformContext
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...
Leaf node pointing to a layer.
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.
Base class for raster data providers.
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.