Skip to content
Permalink
Browse files

Possibility to restrict number of atlas features (default: 1)

  • Loading branch information
mhugent committed Jan 5, 2019
1 parent 9ed7b0d commit 2e7bf12ee181219b1be96e8b382b1609c2287725
@@ -154,6 +154,8 @@ Returns the quality for WMS images defined in a QGIS project.
:return: quality if defined in project, -1 otherwise.
%End

int wmsMaxAtlasFeatures( const QgsProject &project );

bool wmsUseLayerIds( const QgsProject &project );
%Docstring
Returns if layer ids are used as name in WMS.
@@ -637,6 +637,8 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mWMSImageQualitySpinBox->setValue( imageQuality );
}

mWMSMaxAtlasFeaturesSpinBox->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), 1 ) );

mWMTSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), QString() ) );
mWMTSMinScaleLineEdit->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), 5000 ) );

@@ -1260,6 +1262,9 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( QStringLiteral( "WMSImageQuality" ), QStringLiteral( "/" ), imageQualityValue );
}

int maxAtlasFeatures = mWMSMaxAtlasFeaturesSpinBox->value();
QgsProject::instance()->writeEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), maxAtlasFeatures );

QgsProject::instance()->writeEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), mWMTSUrlLineEdit->text() );
QgsProject::instance()->writeEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), mWMTSMinScaleLineEdit->value() );
bool wmtsProject = false;
@@ -111,6 +111,11 @@ int QgsServerProjectUtils::wmsImageQuality( const QgsProject &project )
return project.readNumEntry( QStringLiteral( "WMSImageQuality" ), QStringLiteral( "/" ), -1 );
}

int QgsServerProjectUtils::wmsMaxAtlasFeatures( const QgsProject &project )
{
return project.readNumEntry( QStringLiteral( "WMSMaxAtlasFeatures" ), QStringLiteral( "/" ), 1 );
}

bool QgsServerProjectUtils::wmsInfoFormatSia2045( const QgsProject &project )
{
QString sia2045 = project.readEntry( QStringLiteral( "WMSInfoFormatSIA2045" ), QStringLiteral( "/" ), "" );
@@ -147,6 +147,8 @@ namespace QgsServerProjectUtils
*/
SERVER_EXPORT int wmsImageQuality( const QgsProject &project );

SERVER_EXPORT int wmsMaxAtlasFeatures( const QgsProject &project );

/**
* Returns if layer ids are used as name in WMS.
* \param project the QGIS project
@@ -415,8 +415,13 @@ namespace QgsWms
QStringLiteral( "Wrong number of ATLAS_PK parameters" ) );
}

//number of atlas features might be restricted
int maxAtlasFeatures = QgsServerProjectUtils::wmsMaxAtlasFeatures( *mProject );
nAtlasFeatures = std::min( nAtlasFeatures, maxAtlasFeatures );

QString filterString;
int currentAtlasPk = 0;

for ( int i = 0; i < nAtlasFeatures; ++i )
{
if ( i > 0 )

0 comments on commit 2e7bf12

Please sign in to comment.
You can’t perform that action at this time.