Skip to content

Commit

Permalink
Merge pull request #4415 from rldhont/server-wms-configparser-getcapa…
Browse files Browse the repository at this point in the history
…bilities-part1

[Server] WMS GetCapabilities refactoring - Part 1
  • Loading branch information
rldhont committed Apr 25, 2017
2 parents 96151e7 + 27a9053 commit 70a21d4
Show file tree
Hide file tree
Showing 7 changed files with 614 additions and 67 deletions.
52 changes: 52 additions & 0 deletions src/server/qgsserverprojectutils.cpp
Expand Up @@ -87,6 +87,58 @@ int QgsServerProjectUtils::wmsMaxHeight( const QgsProject &project )
return project.readNumEntry( QStringLiteral( "WMSMaxHeight" ), QStringLiteral( "/" ), -1 );
}

bool QgsServerProjectUtils::wmsUseLayerIds( const QgsProject &project )
{
return project.readBoolEntry( QStringLiteral( "WMSUseLayerIDs" ), QStringLiteral( "/" ) );
}

bool QgsServerProjectUtils::wmsInfoFormatSIA2045( const QgsProject &project )
{
QString sia2045 = project.readEntry( QStringLiteral( "WMSInfoFormatSIA2045" ), QStringLiteral( "/" ), "" );

if ( sia2045.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
|| sia2045.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 )
{
return true;
}
return false;
}

bool QgsServerProjectUtils::wmsInspireActivated( const QgsProject &project )
{
return project.readBoolEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/activated" ) );
}

QString QgsServerProjectUtils::wmsInspireLanguage( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/language" ) );
}

QString QgsServerProjectUtils::wmsInspireMetadataUrl( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrl" ) );
}

QString QgsServerProjectUtils::wmsInspireMetadataUrlType( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrlType" ) );
}

QString QgsServerProjectUtils::wmsInspireTemporalReference( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/temporalReference" ) );
}

QString QgsServerProjectUtils::wmsInspireMetadataDate( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataDate" ) );
}

QStringList QgsServerProjectUtils::wmsRestrictedComposers( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WMSRestrictedComposers" ), QStringLiteral( "/" ), QStringList() );
}

QString QgsServerProjectUtils::wmsServiceUrl( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMSUrl" ), QStringLiteral( "/" ), "" );
Expand Down
54 changes: 54 additions & 0 deletions src/server/qgsserverprojectutils.h
Expand Up @@ -113,6 +113,60 @@ namespace QgsServerProjectUtils
*/
SERVER_EXPORT int wmsMaxHeight( const QgsProject &project );

/** Returns if layer ids are used as name in WMS.
* \param project the QGIS project
* \returns if layer ids are used as name.
*/
SERVER_EXPORT bool wmsUseLayerIds( const QgsProject &project );

/** Returns if the info format is SIA20145.
* \param project the QGIS project
* \returns if the info format is SIA20145.
*/
SERVER_EXPORT bool wmsInfoFormatSIA2045( const QgsProject &project );

/** Returns if Inspire is activated.
* \param project the QGIS project
* \returns if Inspire is activated.
*/
SERVER_EXPORT bool wmsInspireActivated( const QgsProject &project );

/** Returns the Inspire language.
* \param project the QGIS project
* \returns the Inspire language if defined in project.
*/
SERVER_EXPORT QString wmsInspireLanguage( const QgsProject &project );

/** Returns the Inspire metadata URL.
* \param project the QGIS project
* \returns the Inspire metadata URL if defined in project.
*/
SERVER_EXPORT QString wmsInspireMetadataUrl( const QgsProject &project );

/** Returns the Inspire metadata URL type.
* \param project the QGIS project
* \returns the Inspire metadata URL type if defined in project.
*/
SERVER_EXPORT QString wmsInspireMetadataUrlType( const QgsProject &project );

/** Returns the Inspire temporal reference.
* \param project the QGIS project
* \returns the Inspire temporal reference if defined in project.
*/
SERVER_EXPORT QString wmsInspireTemporalReference( const QgsProject &project );

/** Returns the Inspire metadata date.
* \param project the QGIS project
* \returns the Inspire metadata date if defined in project.
*/
SERVER_EXPORT QString wmsInspireMetadataDate( const QgsProject &project );

/** Returns the restricted composer list.
* \param project the QGIS project
* \returns the restricted composer list if defined in project.
*/
SERVER_EXPORT QStringList wmsRestrictedComposers( const QgsProject &project );

/** Returns the WMS service url defined in a QGIS project.
* \param project the QGIS project
* \returns url if defined in project, an empty string otherwise.
Expand Down

0 comments on commit 70a21d4

Please sign in to comment.