Skip to content

Commit

Permalink
[Server][Feature][needs-docs] Add ability to define min. scale for WMTS
Browse files Browse the repository at this point in the history
  • Loading branch information
rldhont committed Aug 23, 2018
1 parent df03b63 commit 355a387
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/qgsprojectproperties.cpp
Expand Up @@ -663,6 +663,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}

mWMTSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), QLatin1String( "" ) ) );
mWMTSMinScaleLineEdit->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), 5000 ) );

bool wmtsProject = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMTSLayers" ), QStringLiteral( "Project" ) );
bool wmtsPngProject = QgsProject::instance()->readBoolEntry( QStringLiteral( "WMTSPngLayers" ), QStringLiteral( "Project" ) );
Expand Down Expand Up @@ -1265,6 +1266,7 @@ void QgsProjectProperties::apply()
}

QgsProject::instance()->writeEntry( QStringLiteral( "WMTSUrl" ), QStringLiteral( "/" ), mWMTSUrlLineEdit->text() );
QgsProject::instance()->writeEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), mWMTSMinScaleLineEdit->value() );
bool wmtsProject = false;
bool wmtsPngProject = false;
bool wmtsJpegProject = false;
Expand Down
6 changes: 5 additions & 1 deletion src/server/services/wmts/qgswmtsutils.cpp
Expand Up @@ -192,7 +192,11 @@ namespace QgsWmts
{
QList< tileMatrixSetDef > tmsList;

double minScale = getProjectMinScale( project );
double minScale = project->readNumEntry( QStringLiteral( "WMTSMinScale" ), QStringLiteral( "/" ), -1.0 );
if ( minScale == -1.0 )
{
minScale = getProjectMinScale( project );
}

QStringList crsList = QgsServerProjectUtils::wmsOutputCrsList( *project );
for ( const QString &crsStr : crsList )
Expand Down
27 changes: 27 additions & 0 deletions src/ui/qgsprojectpropertiesbase.ui
Expand Up @@ -2503,6 +2503,30 @@
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="mWMTSMinScaleLabel">
<property name="text">
<string>Minimum scale</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mWMTSMinScaleLineEdit">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000000000</number>
</property>
<property name="value">
<number>5000</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QLabel" name="mWMTSUrlLabel">
Expand Down Expand Up @@ -2968,6 +2992,9 @@
<tabstop>mMaxWidthLineEdit</tabstop>
<tabstop>mMaxHeightLineEdit</tabstop>
<tabstop>mWMSImageQualitySpinBox</tabstop>
<tabstop>twWmtsLayers</tabstop>
<tabstop>mWMTSMinScaleLineEdit</tabstop>
<tabstop>mWMTSUrlLineEdit</tabstop>
<tabstop>twWFSLayers</tabstop>
<tabstop>pbnWFSLayersSelectAll</tabstop>
<tabstop>pbnWFSLayersDeselectAll</tabstop>
Expand Down

0 comments on commit 355a387

Please sign in to comment.