Skip to content

Commit 10cbad7

Browse files
committedJan 5, 2019
Get pk attributes from layer instead of provider
1 parent 69de8f9 commit 10cbad7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎src/server/services/wms/qgswmsrenderer.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,8 @@ namespace QgsWms
395395
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
396396
QStringLiteral( "The atlas has no coverage layer" ) );
397397
}
398-
QgsVectorDataProvider *cProvider = cLayer->dataProvider();
399-
if ( !cProvider )
400-
{
401-
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
402-
QStringLiteral( "An error occured during the Atlas print" ) );
403-
}
404398

405-
QgsAttributeList pkIndexes = cProvider->pkAttributeIndexes();
399+
QgsAttributeList pkIndexes = cLayer->primaryKeyAttributes();
406400
if ( pkIndexes.size() < 1 )
407401
{
408402
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
@@ -411,7 +405,7 @@ namespace QgsWms
411405
QStringList pkAttributeNames;
412406
for ( int i = 0; i < pkIndexes.size(); ++i )
413407
{
414-
pkAttributeNames.append( cProvider->fields()[pkIndexes.at( i )].name() );
408+
pkAttributeNames.append( cLayer->fields()[pkIndexes.at( i )].name() );
415409
}
416410

417411
int nAtlasFeatures = atlasPk.size() / pkIndexes.size();

0 commit comments

Comments
 (0)
Please sign in to comment.