[Server][Feature][needs-docs] Add ability to define ResourceURL for WMTS

This commit is contained in:
rldhont 2018-08-23 12:23:16 +02:00
parent d9095e0b1e
commit df03b63bc4
6 changed files with 39 additions and 1 deletions

View File

@ -413,6 +413,15 @@ Returns the Layer ids list defined in a QGIS project as published in WCS.
:param project: the QGIS project
:return: the Layer ids list.
%End
QString wmtsServiceUrl( const QgsProject &project );
%Docstring
Returns the WMTS service url defined in a QGIS project.
:param project: the QGIS project
:return: url if defined in project, an empty string otherwise.
%End
};

View File

@ -662,6 +662,8 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mWMSImageQualitySpinBox->setValue( imageQuality );
}
mWMTSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), QLatin1String( "" ) ) );
bool wmtsProject = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMTSLayers" ), QStringLiteral( "Project" ) );
bool wmtsPngProject = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMTSPngLayers" ), QStringLiteral( "Project" ) );
bool wmtsJpegProject = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMTSJpegLayers" ), QStringLiteral( "Project" ) );
@ -1262,6 +1264,7 @@ void QgsProjectProperties::apply()
QgsProject::instance()->writeEntry( QStringLiteral( "WMSImageQuality" ), QStringLiteral( "/" ), imageQualityValue );
}
QgsProject::instance()->writeEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), mWMTSUrlLineEdit->text() );
bool wmtsProject = false;
bool wmtsPngProject = false;
bool wmtsJpegProject = false;

View File

@ -331,3 +331,8 @@ QStringList QgsServerProjectUtils::wcsLayerIds( const QgsProject &project )
{
return project.readListEntry( QStringLiteral( "WCSLayers" ), QStringLiteral( "/" ) );
}
QString QgsServerProjectUtils::wmtsServiceUrl( const QgsProject &project )
{
return project.readEntry( QStringLiteral( "WMTSSUrl" ), QStringLiteral( "/" ), "" );
}

View File

@ -347,6 +347,13 @@ namespace QgsServerProjectUtils
* \returns the Layer ids list.
*/
SERVER_EXPORT QStringList wcsLayerIds( const QgsProject &project );
/**
* Returns the WMTS service url defined in a QGIS project.
* \param project the QGIS project
* \returns url if defined in project, an empty string otherwise.
*/
SERVER_EXPORT QString wmtsServiceUrl( const QgsProject &project );
};
#endif

View File

@ -59,7 +59,7 @@ namespace QgsWmts
QString href;
if ( project )
{
href = QgsServerProjectUtils::wmsServiceUrl( *project );
href = QgsServerProjectUtils::wmtsServiceUrl( *project );
}
// Build default url

View File

@ -2502,6 +2502,20 @@
</column>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QLabel" name="mWMTSUrlLabel">
<property name="text">
<string>Advertised URL</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mWMTSUrlLineEdit"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>