Skip to content

Commit

Permalink
[Server][Feature][needs-docs] Add ability to define ResourceURL for WMTS
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Aug 23, 2018
1 parent d9095e0 commit df03b63
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
9 changes: 9 additions & 0 deletions python/server/auto_generated/qgsserverprojectutils.sip.in
Expand Up @@ -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
};

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsprojectproperties.cpp
Expand Up @@ -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" ) );
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/server/qgsserverprojectutils.cpp
Expand Up @@ -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( "/" ), "" );
}
7 changes: 7 additions & 0 deletions src/server/qgsserverprojectutils.h
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/server/services/wmts/qgswmtsutils.cpp
Expand Up @@ -59,7 +59,7 @@ namespace QgsWmts
QString href;
if ( project )
{
href = QgsServerProjectUtils::wmsServiceUrl( *project );
href = QgsServerProjectUtils::wmtsServiceUrl( *project );
}

// Build default url
Expand Down
14 changes: 14 additions & 0 deletions src/ui/qgsprojectpropertiesbase.ui
Expand Up @@ -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>
Expand Down

0 comments on commit df03b63

Please sign in to comment.