23 double scaleFactor = std::pow( 10.0, places );
24 return ( std::ceil( number * scaleFactor ) / scaleFactor );
29 double scaleFactor = std::pow( 10.0, places );
30 return ( std::floor( number * scaleFactor ) / scaleFactor );
35 return project.
readBoolEntry( QStringLiteral(
"WMSServiceCapabilities" ), QStringLiteral(
"/" ),
false );
40 QString title = project.
readEntry( QStringLiteral(
"WMSServiceTitle" ), QStringLiteral(
"/" ) );
41 if ( title.isEmpty() )
43 title = project.
title();
45 if ( title.isEmpty() )
47 title = QObject::tr(
"Untitled" );
54 return project.
readEntry( QStringLiteral(
"WMSServiceAbstract" ), QStringLiteral(
"/" ) );
59 QStringList keywordList;
60 QStringList list = project.
readListEntry( QStringLiteral(
"WMSKeywordList" ), QStringLiteral(
"/" ), QStringList() );
61 if ( !list.isEmpty() )
63 for (
int i = 0; i < list.size(); ++i )
65 QString keyword = list.at( i );
66 if ( !keyword.isEmpty() )
68 keywordList.append( keyword );
77 QString wmsOnlineResource = project.
readEntry( QStringLiteral(
"WMSOnlineResource" ), QStringLiteral(
"/" ) );
83 return wmsOnlineResourceProperty.
valueAsString( context, wmsOnlineResource );
86 return wmsOnlineResource;
91 return project.
readEntry( QStringLiteral(
"WMSContactOrganization" ), QStringLiteral(
"/" ) );
96 return project.
readEntry( QStringLiteral(
"WMSContactPosition" ), QStringLiteral(
"/" ) );
101 return project.
readEntry( QStringLiteral(
"WMSContactPerson" ), QStringLiteral(
"/" ) );
106 return project.
readEntry( QStringLiteral(
"WMSContactMail" ), QStringLiteral(
"/" ) );
111 return project.
readEntry( QStringLiteral(
"WMSContactPhone" ), QStringLiteral(
"/" ) );
116 return project.
readEntry( QStringLiteral(
"WMSFees" ), QStringLiteral(
"/" ) );
121 return project.
readEntry( QStringLiteral(
"WMSAccessConstraints" ), QStringLiteral(
"/" ) );
126 return project.
readNumEntry( QStringLiteral(
"WMSMaxWidth" ), QStringLiteral(
"/" ), -1 );
131 return project.
readNumEntry( QStringLiteral(
"WMSMaxHeight" ), QStringLiteral(
"/" ), -1 );
136 return project.
readBoolEntry( QStringLiteral(
"WMSUseLayerIDs" ), QStringLiteral(
"/" ),
false );
141 return project.
readNumEntry( QStringLiteral(
"WMSImageQuality" ), QStringLiteral(
"/" ), -1 );
146 return project.
readNumEntry( QStringLiteral(
"WMSTileBuffer" ), QStringLiteral(
"/" ), 0 );
151 return project.
readNumEntry( QStringLiteral(
"WMSMaxAtlasFeatures" ), QStringLiteral(
"/" ), 1 );
156 return project.
readDoubleEntry( QStringLiteral(
"WMSDefaultMapUnitsPerMm" ), QStringLiteral(
"/" ), 1 );
161 QString sia2045 = project.
readEntry( QStringLiteral(
"WMSInfoFormatSIA2045" ), QStringLiteral(
"/" ),
"" );
163 return sia2045.compare( QLatin1String(
"enabled" ), Qt::CaseInsensitive ) == 0
164 || sia2045.compare( QLatin1String(
"true" ), Qt::CaseInsensitive ) == 0;
169 QString wktGeom = project.
readEntry( QStringLiteral(
"WMSAddWktGeometry" ), QStringLiteral(
"/" ),
"" );
171 return wktGeom.compare( QLatin1String(
"enabled" ), Qt::CaseInsensitive ) == 0
172 || wktGeom.compare( QLatin1String(
"true" ), Qt::CaseInsensitive ) == 0;
177 QString useFormSettings = project.
readEntry( QStringLiteral(
"WMSFeatureInfoUseAttributeFormSettings" ), QStringLiteral(
"/" ),
"" );
178 return useFormSettings.compare( QLatin1String(
"enabled" ), Qt::CaseInsensitive ) == 0
179 || useFormSettings.compare( QLatin1String(
"true" ), Qt::CaseInsensitive ) == 0;
184 QString segmGeom = project.
readEntry( QStringLiteral(
"WMSSegmentizeFeatureInfoGeometry" ), QStringLiteral(
"/" ),
"" );
186 return segmGeom.compare( QLatin1String(
"enabled" ), Qt::CaseInsensitive ) == 0
187 || segmGeom.compare( QLatin1String(
"true" ), Qt::CaseInsensitive ) == 0;
192 return project.
readNumEntry( QStringLiteral(
"WMSPrecision" ), QStringLiteral(
"/" ), 6 );
197 return project.
readEntry( QStringLiteral(
"WMSFeatureInfoDocumentElement" ), QStringLiteral(
"/" ),
"" );
202 return project.
readEntry( QStringLiteral(
"WMSFeatureInfoDocumentElementNS" ), QStringLiteral(
"/" ),
"" );
207 return project.
readEntry( QStringLiteral(
"WMSFeatureInfoSchema" ), QStringLiteral(
"/" ),
"" );
212 QHash<QString, QString> aliasMap;
215 QStringList aliasLayerStringList = project.
readListEntry( QStringLiteral(
"WMSFeatureInfoAliasLayers" ), QStringLiteral(
"/value" ), QStringList() );
216 if ( aliasLayerStringList.isEmpty() )
222 QStringList layerAliasStringList = project.
readListEntry( QStringLiteral(
"WMSFeatureInfoLayerAliases" ), QStringLiteral(
"/value" ), QStringList() );
223 if ( layerAliasStringList.isEmpty() )
228 int nMapEntries = std::min( aliasLayerStringList.size(), layerAliasStringList.size() );
229 for (
int i = 0; i < nMapEntries; ++i )
231 aliasMap.insert( aliasLayerStringList.at( i ), layerAliasStringList.at( i ) );
239 return project.
readBoolEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/activated" ) );
244 return project.
readEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/language" ) );
249 return project.
readEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/metadataUrl" ) );
254 return project.
readEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/metadataUrlType" ) );
259 return project.
readEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/temporalReference" ) );
264 return project.
readEntry( QStringLiteral(
"WMSInspire" ), QStringLiteral(
"/metadataDate" ) );
269 return project.
readListEntry( QStringLiteral(
"WMSRestrictedComposers" ), QStringLiteral(
"/" ), QStringList() );
275 QStringList wmsCrsList = project.
readListEntry( QStringLiteral(
"WMSCrsList" ), QStringLiteral(
"/" ), QStringList() );
276 if ( !wmsCrsList.isEmpty() )
278 for (
int i = 0; i < wmsCrsList.size(); ++i )
280 QString
crs = wmsCrsList.at( i );
281 if ( !
crs.isEmpty() )
283 crsList.append(
crs );
287 if ( crsList.isEmpty() )
289 QStringList valueList = project.
readListEntry( QStringLiteral(
"WMSEpsgList" ), QStringLiteral(
"/" ), QStringList() );
291 for (
int i = 0; i < valueList.size(); ++i )
293 int epsgNr = valueList.at( i ).toInt( &conversionOk );
296 crsList.append( QStringLiteral(
"EPSG:%1" ).arg( epsgNr ) );
300 if ( crsList.isEmpty() )
303 QString projectCrsId = project.
crs().
authid();
304 crsList.append( projectCrsId );
305 if ( projectCrsId.compare( QLatin1String(
"EPSG:4326" ), Qt::CaseInsensitive ) != 0 )
307 crsList.append( QStringLiteral(
"EPSG:%1" ).arg( 4326 ) );
309 if ( projectCrsId.compare( QLatin1String(
"EPSG:3857" ), Qt::CaseInsensitive ) != 0 )
311 crsList.append( QStringLiteral(
"EPSG:%1" ).arg( 3857 ) );
319 return project.
readEntry( QStringLiteral(
"WMSUrl" ), QStringLiteral(
"/" ),
"" );
324 return project.
readEntry( QStringLiteral(
"WMSRootName" ), QStringLiteral(
"/" ),
"" );
329 return project.
readListEntry( QStringLiteral(
"WMSRestrictedLayers" ), QStringLiteral(
"/" ), QStringList() );
335 QStringList values = project.
readListEntry( QStringLiteral(
"WMSExtent" ), QStringLiteral(
"/" ), QStringList(), &ok );
336 if ( !ok || values.size() != 4 )
341 double xmin = values[ 0 ].toDouble();
342 double ymin = values[ 1 ].toDouble();
343 double xmax = values[ 2 ].toDouble();
344 double ymax = values[ 3 ].toDouble();
350 return project.
readEntry( QStringLiteral(
"WFSUrl" ), QStringLiteral(
"/" ),
"" );
355 return project.
readListEntry( QStringLiteral(
"WFSLayers" ), QStringLiteral(
"/" ) );
360 return project.
readNumEntry( QStringLiteral(
"WFSLayersPrecision" ),
"/" + layerId, 6 );
365 return project.
readListEntry( QStringLiteral(
"WFSTLayers" ), QStringLiteral(
"Update" ) );
370 return project.
readListEntry( QStringLiteral(
"WFSTLayers" ), QStringLiteral(
"Insert" ) );
375 return project.
readListEntry( QStringLiteral(
"WFSTLayers" ), QStringLiteral(
"Delete" ) );
380 return project.
readEntry( QStringLiteral(
"WCSUrl" ), QStringLiteral(
"/" ),
"" );
385 return project.
readListEntry( QStringLiteral(
"WCSLayers" ), QStringLiteral(
"/" ) );
390 return project.
readEntry( QStringLiteral(
"WMTSUrl" ), QStringLiteral(
"/" ),
"" );
395 return project.
readBoolEntry( QStringLiteral(
"RenderMapTile" ), QStringLiteral(
"/" ),
false );
QString authid() const
Returns the authority identifier for the CRS.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
QString title() const
Returns the project's title.
QgsPropertyCollection dataDefinedServerProperties() const
Returns the data defined properties used for overrides in user defined server parameters.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
QString readEntry(const QString &scope, const QString &key, const QString &def=QString(), bool *ok=nullptr) const
Reads a string from the specified scope and key.
bool readBoolEntry(const QString &scope, const QString &key, bool def=false, bool *ok=nullptr) const
Reads a boolean from the specified scope and key.
QgsCoordinateReferenceSystem crs
double readDoubleEntry(const QString &scope, const QString &key, double def=0, bool *ok=nullptr) const
Reads a double from the specified scope and key.
QStringList readListEntry(const QString &scope, const QString &key, const QStringList &def=QStringList(), bool *ok=nullptr) const
Reads a string list from the specified scope and key.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
A store for object properties.
QString expressionString() const
Returns the expression used for the property value.
QString valueAsString(const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a string.
bool isActive() const
Returns whether the property is currently active.
A rectangle specified with double values.
SERVER_EXPORT QString wcsServiceUrl(const QgsProject &project)
Returns the WCS service url defined in a QGIS project.
SERVER_EXPORT QString wmsFeatureInfoSchema(const QgsProject &project)
Returns the schema URL for XML GetFeatureInfo request.
SERVER_EXPORT int wmsTileBuffer(const QgsProject &project)
Returns the tile buffer in pixels for WMS images defined in a QGIS project.
SERVER_EXPORT QString wmsRootName(const QgsProject &project)
Returns the WMS root layer name defined in a QGIS project.
SERVER_EXPORT bool wmsInfoFormatSia2045(const QgsProject &project)
Returns if the info format is SIA20145.
SERVER_EXPORT QString wmsServiceUrl(const QgsProject &project)
Returns the WMS service url defined in a QGIS project.
SERVER_EXPORT QString wmsInspireMetadataUrl(const QgsProject &project)
Returns the Inspire metadata URL.
SERVER_EXPORT QString wmtsServiceUrl(const QgsProject &project)
Returns the WMTS service url defined in a QGIS project.
SERVER_EXPORT int wmsFeatureInfoPrecision(const QgsProject &project)
Returns the geometry precision for GetFeatureInfo request.
SERVER_EXPORT QString wfsServiceUrl(const QgsProject &project)
Returns the WFS service url defined in a QGIS project.
SERVER_EXPORT double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
SERVER_EXPORT QString wmsFeatureInfoDocumentElementNs(const QgsProject &project)
Returns the document element namespace for XML GetFeatureInfo request.
SERVER_EXPORT QStringList wmsRestrictedComposers(const QgsProject &project)
Returns the restricted composer list.
SERVER_EXPORT QgsRectangle wmsExtent(const QgsProject &project)
Returns the WMS Extent restriction.
SERVER_EXPORT bool wmsUseLayerIds(const QgsProject &project)
Returns if layer ids are used as name in WMS.
SERVER_EXPORT bool wmsFeatureInfoSegmentizeWktGeometry(const QgsProject &project)
Returns if the geometry has to be segmentize in GetFeatureInfo request.
SERVER_EXPORT QString owsServiceAccessConstraints(const QgsProject &project)
Returns the owsService access constraints defined in project.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
SERVER_EXPORT bool wmsRenderMapTiles(const QgsProject &project)
Returns true if WMS requests should use the QgsMapSettings::RenderMapTile flag, so that no visible ar...
SERVER_EXPORT QString owsServiceOnlineResource(const QgsProject &project)
Returns the owsService online resource defined in project.
SERVER_EXPORT QString owsServiceFees(const QgsProject &project)
Returns the owsService fees defined in project.
SERVER_EXPORT QStringList owsServiceKeywords(const QgsProject &project)
Returns the owsService keywords defined in project.
SERVER_EXPORT QString owsServiceContactPosition(const QgsProject &project)
Returns the owsService contact position defined in project.
SERVER_EXPORT QStringList wfstUpdateLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities.
SERVER_EXPORT bool wmsFeatureInfoUseAttributeFormSettings(const QgsProject &project)
Returns if feature form settings should be considered for the format of the feature info response.
SERVER_EXPORT QStringList wfstInsertLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities.
SERVER_EXPORT QString wmsInspireTemporalReference(const QgsProject &project)
Returns the Inspire temporal reference.
SERVER_EXPORT QStringList wmsOutputCrsList(const QgsProject &project)
Returns the WMS output CRS list.
SERVER_EXPORT QString wmsInspireMetadataDate(const QgsProject &project)
Returns the Inspire metadata date.
SERVER_EXPORT QString owsServiceContactOrganization(const QgsProject &project)
Returns the owsService contact organization defined in project.
SERVER_EXPORT QHash< QString, QString > wmsFeatureInfoLayerAliasMap(const QgsProject &project)
Returns the mapping between layer name and wms layer name for GetFeatureInfo request.
SERVER_EXPORT bool wmsFeatureInfoAddWktGeometry(const QgsProject &project)
Returns if the geometry is displayed as Well Known Text in GetFeatureInfo request.
SERVER_EXPORT QStringList wmsRestrictedLayers(const QgsProject &project)
Returns the restricted layer name list.
SERVER_EXPORT int wmsImageQuality(const QgsProject &project)
Returns the quality for WMS images defined in a QGIS project.
SERVER_EXPORT QString wmsInspireLanguage(const QgsProject &project)
Returns the Inspire language.
SERVER_EXPORT QString wmsInspireMetadataUrlType(const QgsProject &project)
Returns the Inspire metadata URL type.
SERVER_EXPORT double wmsDefaultMapUnitsPerMm(const QgsProject &project)
Returns the default number of map units per millimeters in case of the scale is not given.
SERVER_EXPORT bool owsServiceCapabilities(const QgsProject &project)
Returns if owsService capabilities are enabled.
SERVER_EXPORT bool wmsInspireActivate(const QgsProject &project)
Returns if Inspire is activated.
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
SERVER_EXPORT QString owsServiceTitle(const QgsProject &project)
Returns the owsService title defined in project.
SERVER_EXPORT QString owsServiceContactMail(const QgsProject &project)
Returns the owsService contact mail defined in project.
SERVER_EXPORT QString owsServiceAbstract(const QgsProject &project)
Returns the owsService abstract defined in project.
SERVER_EXPORT double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
SERVER_EXPORT QStringList wfstDeleteLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities.
SERVER_EXPORT int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.
SERVER_EXPORT QStringList wcsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WCS.
SERVER_EXPORT QString wmsFeatureInfoDocumentElement(const QgsProject &project)
Returns the document element name for XML GetFeatureInfo request.
SERVER_EXPORT int wmsMaxAtlasFeatures(const QgsProject &project)
Returns the maximum number of atlas features which can be printed in a request.
SERVER_EXPORT QString owsServiceContactPhone(const QgsProject &project)
Returns the owsService contact phone defined in project.
SERVER_EXPORT int wfsLayerPrecision(const QgsProject &project, const QString &layerId)
Returns the Layer precision defined in a QGIS project for the WFS GetFeature.
SERVER_EXPORT QString owsServiceContactPerson(const QgsProject &project)
Returns the owsService contact person defined in project.
const QgsCoordinateReferenceSystem & crs