Skip to content

Commit

Permalink
[Server] Fix QgsServerProjectUtils readListEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed May 26, 2017
1 parent 0f00a52 commit 6feca53
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
29 changes: 27 additions & 2 deletions src/server/qgsserverprojectutils.cpp
Expand Up @@ -34,7 +34,20 @@ QString QgsServerProjectUtils::owsServiceAbstract( const QgsProject &project )

QStringList QgsServerProjectUtils::owsServiceKeywords( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ) );
QStringList keywordList;
QStringList list = project.readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ), QStringList() );
if ( !list.isEmpty() )
{
for ( int i = 0; i < list.size(); ++i )
{
QString keyword = list.at( i );
if ( !keyword.isEmpty() )
{
keywordList.append( keyword );
}
}
}
return keywordList;
}

QString QgsServerProjectUtils::owsServiceOnlineResource( const QgsProject &project )
Expand Down Expand Up @@ -141,7 +154,19 @@ QStringList QgsServerProjectUtils::wmsRestrictedComposers( const QgsProject &pro

QStringList QgsServerProjectUtils::wmsOutputCrsList( const QgsProject &project )
{
QStringList crsList = project.readListEntry( QStringLiteral( "WMSCrsList" ), QStringLiteral( "/" ), QStringList() );
QStringList crsList;
QStringList wmsCrsList = project.readListEntry( QStringLiteral( "WMSCrsList" ), QStringLiteral( "/" ), QStringList() );
if ( !wmsCrsList.isEmpty() )
{
for ( int i = 0; i < wmsCrsList.size(); ++i )
{
QString crs = wmsCrsList.at( i );
if ( !crs.isEmpty() )
{
crsList.append( crs );
}
}
}
if ( crsList.isEmpty() )
{
QStringList valueList = project.readListEntry( QStringLiteral( "WMSEpsgList" ), QStringLiteral( "/" ), QStringList() );
Expand Down
3 changes: 0 additions & 3 deletions tests/testdata/qgis_server/wcs_getcapabilities.txt
Expand Up @@ -6,9 +6,6 @@ Content-Type: text/xml; charset=utf-8
<name>WCS</name>
<label>QGIS Server test</label>
<description><![CDATA[Simple test app.]]></description>
<keywords>
<keyword></keyword>
</keywords>
<responsibleParty>
<individualName>Stéphane Brunner</individualName>
<organisationName>QGIS</organisationName>
Expand Down

0 comments on commit 6feca53

Please sign in to comment.