Skip to content

Commit c05d779

Browse files
authored
Merge pull request #4630 from rldhont/server-wms-configparser-getcontext
[Server] WMS GetContext refactoring
2 parents 8c873b1 + ce3cbeb commit c05d779

9 files changed

Lines changed: 488 additions & 17 deletions

File tree

python/server/qgsserverprojectutils.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ namespace QgsServerProjectUtils
127127
* \param project the QGIS project
128128
* \returns if Inspire is activated.
129129
*/
130-
bool wmsInspireActivated( const QgsProject &project );
130+
bool wmsInspireActivate( const QgsProject &project );
131131

132132
/** Returns the Inspire language.
133133
* \param project the QGIS project

src/server/qgsserverprojectutils.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@ QString QgsServerProjectUtils::owsServiceAbstract( const QgsProject &project )
3434

3535
QStringList QgsServerProjectUtils::owsServiceKeywords( const QgsProject &project )
3636
{
37-
return project.readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ) );
37+
QStringList keywordList;
38+
QStringList list = project.readListEntry( QStringLiteral( "WMSKeywordList" ), QStringLiteral( "/" ), QStringList() );
39+
if ( !list.isEmpty() )
40+
{
41+
for ( int i = 0; i < list.size(); ++i )
42+
{
43+
QString keyword = list.at( i );
44+
if ( !keyword.isEmpty() )
45+
{
46+
keywordList.append( keyword );
47+
}
48+
}
49+
}
50+
return keywordList;
3851
}
3952

4053
QString QgsServerProjectUtils::owsServiceOnlineResource( const QgsProject &project )
@@ -104,7 +117,7 @@ bool QgsServerProjectUtils::wmsInfoFormatSia2045( const QgsProject &project )
104117
return false;
105118
}
106119

107-
bool QgsServerProjectUtils::wmsInspireActivated( const QgsProject &project )
120+
bool QgsServerProjectUtils::wmsInspireActivate( const QgsProject &project )
108121
{
109122
return project.readBoolEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/activated" ) );
110123
}
@@ -141,7 +154,19 @@ QStringList QgsServerProjectUtils::wmsRestrictedComposers( const QgsProject &pro
141154

142155
QStringList QgsServerProjectUtils::wmsOutputCrsList( const QgsProject &project )
143156
{
144-
QStringList crsList = project.readListEntry( QStringLiteral( "WMSCrsList" ), QStringLiteral( "/" ), QStringList() );
157+
QStringList crsList;
158+
QStringList wmsCrsList = project.readListEntry( QStringLiteral( "WMSCrsList" ), QStringLiteral( "/" ), QStringList() );
159+
if ( !wmsCrsList.isEmpty() )
160+
{
161+
for ( int i = 0; i < wmsCrsList.size(); ++i )
162+
{
163+
QString crs = wmsCrsList.at( i );
164+
if ( !crs.isEmpty() )
165+
{
166+
crsList.append( crs );
167+
}
168+
}
169+
}
145170
if ( crsList.isEmpty() )
146171
{
147172
QStringList valueList = project.readListEntry( QStringLiteral( "WMSEpsgList" ), QStringLiteral( "/" ), QStringList() );

src/server/qgsserverprojectutils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace QgsServerProjectUtils
129129
* \param project the QGIS project
130130
* \returns if Inspire is activated.
131131
*/
132-
SERVER_EXPORT bool wmsInspireActivated( const QgsProject &project );
132+
SERVER_EXPORT bool wmsInspireActivate( const QgsProject &project );
133133

134134
/** Returns the Inspire language.
135135
* \param project the QGIS project

src/server/services/wms/qgswmsgetcapabilities.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
#include "qgslayertreelayer.h"
3535
#include "qgslayertreemodel.h"
3636
#include "qgslayertree.h"
37+
#include "qgsmaplayerstylemanager.h"
3738

3839
#include "qgscsexception.h"
3940
#include "qgsexpressionnodeimpl.h"
40-
#include "qgsmaplayerstylemanager.h"
4141

4242

4343
namespace QgsWms
@@ -180,7 +180,7 @@ namespace QgsWms
180180
schemaLocation += QLatin1String( " http://www.opengis.net/sld" );
181181
schemaLocation += QLatin1String( " http://schemas.opengis.net/sld/1.1.0/sld_capabilities.xsd" );
182182
schemaLocation += QLatin1String( " http://www.qgis.org/wms" );
183-
if ( QgsServerProjectUtils::wmsInspireActivated( *project ) )
183+
if ( QgsServerProjectUtils::wmsInspireActivate( *project ) )
184184
{
185185
wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:inspire_common" ), QStringLiteral( "http://inspire.ec.europa.eu/schemas/common/1.0" ) );
186186
wmsCapabilitiesElement.setAttribute( QStringLiteral( "xmlns:inspire_vs" ), QStringLiteral( "http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" ) );
@@ -533,7 +533,7 @@ namespace QgsWms
533533
elem.setAttribute( QStringLiteral( "RemoteWCS" ), QStringLiteral( "0" ) );
534534
capabilityElem.appendChild( elem );
535535

536-
if ( QgsServerProjectUtils::wmsInspireActivated( *project ) )
536+
if ( QgsServerProjectUtils::wmsInspireActivate( *project ) )
537537
{
538538
capabilityElem.appendChild( getInspireCapabilitiesElement( doc, project ) );
539539
}
@@ -546,7 +546,7 @@ namespace QgsWms
546546
{
547547
QDomElement inspireCapabilitiesElem;
548548

549-
if ( !QgsServerProjectUtils::wmsInspireActivated( *project ) )
549+
if ( !QgsServerProjectUtils::wmsInspireActivate( *project ) )
550550
return inspireCapabilitiesElem;
551551

552552
inspireCapabilitiesElem = doc.createElement( QStringLiteral( "inspire_vs:ExtendedCapabilities" ) );
@@ -993,7 +993,7 @@ namespace QgsWms
993993
// add details about supported styles of the layer
994994
appendLayerStyles( doc, layerElem, l, project, version, request );
995995

996-
//min/max scale denominatormScaleBasedVisibility
996+
//min/max scale denominatorScaleBasedVisibility
997997
if ( l->hasScaleBasedVisibility() )
998998
{
999999
if ( version == QLatin1String( "1.1.1" ) )

0 commit comments

Comments
 (0)