Skip to content

Commit a9a7d3c

Browse files
committed
Swap QgsMapLayer min/max scale API definitions
setMaximumScale() and setMinimumScale(), maximumScale() and minimumScale() had the opposite meaning to other min/max scales in the API, and were the opposite to how these settings were exposed in the GUI. This lead to very confusing API!! Their definitions have now been swapped. setMaximumScale now sets the maximum (i.e. largest scale, or most zoomed in) at which the layer will appear, and setMinimumScale now sets the minimum (i.e. smallest scale, or most zoomed out) at which the layer will appear. The same is true for the maximumScale and minimumScale getters.
1 parent 0f2a49d commit a9a7d3c

19 files changed

+144
-109
lines changed

doc/api_break.dox

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,9 @@ screenUpdateRequested() were removed. These members have had no effect for a num
15151515
- readXml() and writeXml() expect QgsReadWriteContext reference as the last argument
15161516
- the invalidTransformInput() slot was removed - calling this slot had no effect
15171517
- metadata() was renamed to htmlMetadata()
1518+
- setMaximumScale() and setMinimumScale(), maximumScale() and minimumScale() had the opposite meaning to other min/max scales in the API, and their definitions have now been swapped. setMaximumScale
1519+
now sets the maximum (i.e. largest scale, or most zoomed in) at which the layer will appear, and setMinimumScale now sets the minimum (i.e. smallest scale,
1520+
or most zoomed out) at which the layer will appear. The same is true for the maximumScale and minimumScale getters.
15181521

15191522

15201523
QgsMapLayerActionRegistry {#qgis_api_break_3_0_QgsMapLayerActionRegistry}

python/core/qgsmaplayer.sip

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,12 @@ Return pointer to layer's undo stack
772772

773773
double minimumScale() const;
774774
%Docstring
775-
Returns the minimum scale denominator at which the layer is visible.
776-
Scale based visibility is only used if hasScaleBasedVisibility is true.
777-
:return: minimum scale denominator at which the layer will render
775+
Returns the minimum map scale (i.e. most "zoomed out" scale) at which the layer will be visible.
776+
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
777+
A scale of 0 indicates no minimum scale visibility.
778+
.. note::
779+
780+
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
778781
.. seealso:: setMinimumScale()
779782
.. seealso:: maximumScale()
780783
.. seealso:: hasScaleBasedVisibility()
@@ -784,9 +787,12 @@ Return pointer to layer's undo stack
784787

785788
double maximumScale() const;
786789
%Docstring
787-
Returns the maximum scale denominator at which the layer is visible.
788-
Scale based visibility is only used if hasScaleBasedVisibility is true.
789-
:return: minimum scale denominator at which the layer will render
790+
Returns the maximum map scale (i.e. most "zoomed in" scale) at which the layer will be visible.
791+
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
792+
A scale of 0 indicates no maximum scale visibility.
793+
.. note::
794+
795+
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
790796
.. seealso:: setMaximumScale()
791797
.. seealso:: minimumScale()
792798
.. seealso:: hasScaleBasedVisibility()
@@ -889,22 +895,28 @@ Time stamp of data source in the moment when data/metadata were loaded by provid
889895

890896
void setMinimumScale( double scale );
891897
%Docstring
892-
Sets the minimum scale denominator at which the layer will be visible.
893-
Scale based visibility is only used if setScaleBasedVisibility is set to true.
894-
\param scale minimum scale denominator at which the layer should render
895-
.. seealso:: minimumScale
896-
.. seealso:: setMaximumScale
897-
.. seealso:: setScaleBasedVisibility
898+
Sets the minimum map ``scale`` (i.e. most "zoomed out" scale) at which the layer will be visible.
899+
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
900+
A ``scale`` of 0 indicates no minimum scale visibility.
901+
.. note::
902+
903+
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
904+
.. seealso:: minimumScale()
905+
.. seealso:: setMaximumScale()
906+
.. seealso:: setScaleBasedVisibility()
898907
%End
899908

900909
void setMaximumScale( double scale );
901910
%Docstring
902-
Sets the maximum scale denominator at which the layer will be visible.
903-
Scale based visibility is only used if setScaleBasedVisibility is set to true.
904-
\param scale maximum scale denominator at which the layer should render
905-
.. seealso:: maximumScale
906-
.. seealso:: setMinimumScale
907-
.. seealso:: setScaleBasedVisibility
911+
Sets the maximum map ``scale`` (i.e. most "zoomed in" scale) at which the layer will be visible.
912+
The ``scale`` value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
913+
A ``scale`` of 0 indicates no maximum scale visibility.
914+
.. note::
915+
916+
Scale based visibility is only used if setScaleBasedVisibility() is set to true.
917+
.. seealso:: maximumScale()
918+
.. seealso:: setMinimumScale()
919+
.. seealso:: setScaleBasedVisibility()
908920
%End
909921

910922
void setScaleBasedVisibility( const bool enabled );

src/app/qgisapp.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8979,17 +8979,17 @@ void QgisApp::setLayerScaleVisibility()
89798979
if ( layer )
89808980
{
89818981
dlg->setScaleVisiblity( layer->hasScaleBasedVisibility() );
8982-
dlg->setMinimumScale( 1.0 / layer->maximumScale() );
8983-
dlg->setMaximumScale( 1.0 / layer->minimumScale() );
8982+
dlg->setMinimumScale( 1.0 / layer->minimumScale() );
8983+
dlg->setMaximumScale( 1.0 / layer->maximumScale() );
89848984
}
89858985
if ( dlg->exec() )
89868986
{
89878987
freezeCanvases();
89888988
Q_FOREACH ( QgsMapLayer *layer, layers )
89898989
{
89908990
layer->setScaleBasedVisibility( dlg->hasScaleVisibility() );
8991-
layer->setMinimumScale( 1.0 / dlg->maximumScale() );
8992-
layer->setMaximumScale( 1.0 / dlg->minimumScale() );
8991+
layer->setMaximumScale( 1.0 / dlg->maximumScale() );
8992+
layer->setMinimumScale( 1.0 / dlg->minimumScale() );
89938993
}
89948994
freezeCanvases( false );
89958995
refreshMapCanvas();
@@ -9011,13 +9011,13 @@ void QgisApp::zoomToLayerScale()
90119011
if ( layer && layer->hasScaleBasedVisibility() )
90129012
{
90139013
const double scale = mMapCanvas->scale();
9014-
if ( scale > layer->maximumScale() )
9014+
if ( scale > layer->minimumScale() )
90159015
{
9016-
mMapCanvas->zoomScale( layer->maximumScale() * Qgis::SCALE_PRECISION );
9016+
mMapCanvas->zoomScale( layer->minimumScale() * Qgis::SCALE_PRECISION );
90179017
}
9018-
else if ( scale <= layer->minimumScale() )
9018+
else if ( scale <= layer->maximumScale() )
90199019
{
9020-
mMapCanvas->zoomScale( layer->minimumScale() );
9020+
mMapCanvas->zoomScale( layer->maximumScale() );
90219021
}
90229022
}
90239023
}

src/app/qgsdiagramproperties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer *layer, QWidget *pare
205205
mIncreaseMinimumSizeLabel->setEnabled( false );
206206
mBarWidthSpinBox->setValue( 5 );
207207
mScaleVisibilityGroupBox->setChecked( layer->hasScaleBasedVisibility() );
208-
mScaleRangeWidget->setScaleRange( 1.0 / layer->maximumScale(), 1.0 / layer->minimumScale() ); // caution: layer uses scale denoms, widget uses true scales
208+
mScaleRangeWidget->setScaleRange( 1.0 / layer->minimumScale(), 1.0 / layer->maximumScale() ); // caution: layer uses scale denoms, widget uses true scales
209209
mShowAllCheckBox->setChecked( true );
210210
mCheckBoxAttributeLegend->setChecked( true );
211211
mCheckBoxSizeLegend->setChecked( false );
@@ -266,8 +266,8 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer *layer, QWidget *pare
266266
mPenWidthSpinBox->setValue( settingList.at( 0 ).penWidth );
267267
mDiagramSizeSpinBox->setValue( ( size.width() + size.height() ) / 2.0 );
268268
// caution: layer uses scale denoms, widget uses true scales
269-
mScaleRangeWidget->setScaleRange( 1.0 / ( settingList.at( 0 ).maxScaleDenominator > 0 ? settingList.at( 0 ).maxScaleDenominator : layer->maximumScale() ),
270-
1.0 / ( settingList.at( 0 ).minScaleDenominator > 0 ? settingList.at( 0 ).minScaleDenominator : layer->minimumScale() ) );
269+
mScaleRangeWidget->setScaleRange( 1.0 / ( settingList.at( 0 ).maxScaleDenominator > 0 ? settingList.at( 0 ).maxScaleDenominator : layer->minimumScale() ),
270+
1.0 / ( settingList.at( 0 ).minScaleDenominator > 0 ? settingList.at( 0 ).minScaleDenominator : layer->maximumScale() ) );
271271
mScaleVisibilityGroupBox->setChecked( settingList.at( 0 ).scaleBasedVisibility );
272272
mDiagramUnitComboBox->setUnit( settingList.at( 0 ).sizeType );
273273
mDiagramUnitComboBox->setMapUnitScale( settingList.at( 0 ).sizeScale );

src/app/qgsrasterlayerproperties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv
141141
// set up the scale based layer visibility stuff....
142142
mScaleRangeWidget->setMapCanvas( mMapCanvas );
143143
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
144-
mScaleRangeWidget->setScaleRange( 1.0 / lyr->maximumScale(), 1.0 / lyr->minimumScale() ); // caution: layer uses scale denoms, widget uses true scales
144+
mScaleRangeWidget->setScaleRange( 1.0 / lyr->minimumScale(), 1.0 / lyr->maximumScale() ); // caution: layer uses scale denoms, widget uses true scales
145145

146146
leNoDataValue->setValidator( new QDoubleValidator( -std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 1000, this ) );
147147

@@ -911,8 +911,8 @@ void QgsRasterLayerProperties::apply()
911911
// set up the scale based layer visibility stuff....
912912
mRasterLayer->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
913913
// caution: layer uses scale denoms, widget uses true scales
914-
mRasterLayer->setMaximumScale( 1.0 / mScaleRangeWidget->minimumScale() );
915-
mRasterLayer->setMinimumScale( 1.0 / mScaleRangeWidget->maximumScale() );
914+
mRasterLayer->setMinimumScale( 1.0 / mScaleRangeWidget->minimumScale() );
915+
mRasterLayer->setMaximumScale( 1.0 / mScaleRangeWidget->maximumScale() );
916916

917917
mRasterLayer->setAutoRefreshInterval( mRefreshLayerIntervalSpinBox->value() * 1000.0 );
918918
mRasterLayer->setAutoRefreshEnabled( mRefreshLayerCheckBox->isChecked() );

src/app/qgsvectorlayerproperties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void QgsVectorLayerProperties::syncToLayer()
411411
mDisplayExpressionWidget->setField( mLayer->displayExpression() );
412412

413413
// set up the scale based layer visibility stuff....
414-
mScaleRangeWidget->setScaleRange( 1.0 / mLayer->maximumScale(), 1.0 / mLayer->minimumScale() ); // caution: layer uses scale denoms, widget uses true scales
414+
mScaleRangeWidget->setScaleRange( 1.0 / mLayer->minimumScale(), 1.0 / mLayer->maximumScale() ); // caution: layer uses scale denoms, widget uses true scales
415415
mScaleVisibilityGroupBox->setChecked( mLayer->hasScaleBasedVisibility() );
416416
mScaleRangeWidget->setMapCanvas( QgisApp::instance()->mapCanvas() );
417417

@@ -510,8 +510,8 @@ void QgsVectorLayerProperties::apply()
510510
// set up the scale based layer visibility stuff....
511511
mLayer->setScaleBasedVisibility( mScaleVisibilityGroupBox->isChecked() );
512512
// caution: layer uses scale denoms, widget uses true scales
513-
mLayer->setMaximumScale( mScaleRangeWidget->maximumScaleDenom() );
514-
mLayer->setMinimumScale( mScaleRangeWidget->minimumScaleDenom() );
513+
mLayer->setMinimumScale( mScaleRangeWidget->maximumScaleDenom() );
514+
mLayer->setMaximumScale( mScaleRangeWidget->minimumScaleDenom() );
515515

516516
// provider-specific options
517517
if ( mLayer->dataProvider() )

src/core/expression/qgsexpressionfunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,9 +3361,9 @@ static QVariant fcnGetLayerProperty( const QVariantList &values, const QgsExpres
33613361
else if ( QString::compare( layerProperty, QStringLiteral( "source" ), Qt::CaseInsensitive ) == 0 )
33623362
return layer->publicSource();
33633363
else if ( QString::compare( layerProperty, QStringLiteral( "min_scale" ), Qt::CaseInsensitive ) == 0 )
3364-
return layer->minimumScale();
3365-
else if ( QString::compare( layerProperty, QStringLiteral( "max_scale" ), Qt::CaseInsensitive ) == 0 )
33663364
return layer->maximumScale();
3365+
else if ( QString::compare( layerProperty, QStringLiteral( "max_scale" ), Qt::CaseInsensitive ) == 0 )
3366+
return layer->minimumScale();
33673367
else if ( QString::compare( layerProperty, QStringLiteral( "crs" ), Qt::CaseInsensitive ) == 0 )
33683368
return layer->crs().authid();
33693369
else if ( QString::compare( layerProperty, QStringLiteral( "crs_definition" ), Qt::CaseInsensitive ) == 0 )

src/core/qgsmaplayer.cpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ void QgsMapLayer::clone( QgsMapLayer *layer ) const
106106
layer->setName( name() );
107107
layer->setShortName( shortName() );
108108
layer->setExtent( extent() );
109-
layer->setMinimumScale( minimumScale() );
110109
layer->setMaximumScale( maximumScale() );
110+
layer->setMinimumScale( minimumScale() );
111111
layer->setScaleBasedVisibility( hasScaleBasedVisibility() );
112112
layer->setTitle( title() );
113113
layer->setAbstract( abstract() );
@@ -460,8 +460,17 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, const QgsReadWr
460460

461461
// use scale dependent visibility flag
462462
setScaleBasedVisibility( layerElement.attribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).toInt() == 1 );
463-
setMinimumScale( layerElement.attribute( QStringLiteral( "minimumScale" ) ).toDouble() );
464-
setMaximumScale( layerElement.attribute( QStringLiteral( "maximumScale" ) ).toDouble() );
463+
if ( layerElement.hasAttribute( QStringLiteral( "minimumScale" ) ) )
464+
{
465+
// older element, when scales were reversed
466+
setMaximumScale( layerElement.attribute( QStringLiteral( "minimumScale" ) ).toDouble() );
467+
setMinimumScale( layerElement.attribute( QStringLiteral( "maximumScale" ) ).toDouble() );
468+
}
469+
else
470+
{
471+
setMaximumScale( layerElement.attribute( QStringLiteral( "maxScale" ) ).toDouble() );
472+
setMinimumScale( layerElement.attribute( QStringLiteral( "minScale" ) ).toDouble() );
473+
}
465474

466475
setAutoRefreshInterval( layerElement.attribute( QStringLiteral( "autoRefreshTime" ), 0 ).toInt() );
467476
setAutoRefreshEnabled( layerElement.attribute( QStringLiteral( "autoRefreshEnabled" ), QStringLiteral( "0" ) ).toInt() );
@@ -564,8 +573,8 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume
564573
{
565574
// use scale dependent visibility flag
566575
layerElement.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
567-
layerElement.setAttribute( QStringLiteral( "minimumScale" ), QString::number( minimumScale() ) );
568-
layerElement.setAttribute( QStringLiteral( "maximumScale" ), QString::number( maximumScale() ) );
576+
layerElement.setAttribute( QStringLiteral( "maxScale" ), QString::number( maximumScale() ) );
577+
layerElement.setAttribute( QStringLiteral( "minScale" ), QString::number( minimumScale() ) );
569578

570579
if ( !mExtent.isNull() )
571580
{
@@ -922,18 +931,18 @@ const QgsLayerMetadata &QgsMapLayer::metadata() const
922931
return mMetadata;
923932
}
924933

925-
void QgsMapLayer::setMinimumScale( double scale )
934+
void QgsMapLayer::setMaximumScale( double scale )
926935
{
927936
mMinScale = scale;
928937
}
929938

930-
double QgsMapLayer::minimumScale() const
939+
double QgsMapLayer::maximumScale() const
931940
{
932941
return mMinScale;
933942
}
934943

935944

936-
void QgsMapLayer::setMaximumScale( double scale )
945+
void QgsMapLayer::setMinimumScale( double scale )
937946
{
938947
mMaxScale = scale;
939948
}
@@ -943,7 +952,7 @@ void QgsMapLayer::setScaleBasedVisibility( const bool enabled )
943952
mScaleBasedVisibility = enabled;
944953
}
945954

946-
double QgsMapLayer::maximumScale() const
955+
double QgsMapLayer::minimumScale() const
947956
{
948957
return mMaxScale;
949958
}
@@ -1191,8 +1200,17 @@ bool QgsMapLayer::importNamedStyle( QDomDocument &myDocument, QString &myErrorMe
11911200

11921201
// use scale dependent visibility flag
11931202
setScaleBasedVisibility( myRoot.attribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ) ).toInt() == 1 );
1194-
setMinimumScale( myRoot.attribute( QStringLiteral( "minimumScale" ) ).toDouble() );
1195-
setMaximumScale( myRoot.attribute( QStringLiteral( "maximumScale" ) ).toDouble() );
1203+
if ( myRoot.hasAttribute( QStringLiteral( "minimumScale" ) ) )
1204+
{
1205+
//older scale element, when min/max were reversed
1206+
setMaximumScale( myRoot.attribute( QStringLiteral( "minimumScale" ) ).toDouble() );
1207+
setMinimumScale( myRoot.attribute( QStringLiteral( "maximumScale" ) ).toDouble() );
1208+
}
1209+
else
1210+
{
1211+
setMaximumScale( myRoot.attribute( QStringLiteral( "maxScale" ) ).toDouble() );
1212+
setMinimumScale( myRoot.attribute( QStringLiteral( "minScale" ) ).toDouble() );
1213+
}
11961214

11971215
return readSymbology( myRoot, myErrorMessage, QgsReadWriteContext() ); // TODO: support relative paths in QML?
11981216
}
@@ -1208,8 +1226,8 @@ void QgsMapLayer::exportNamedStyle( QDomDocument &doc, QString &errorMsg ) const
12081226
myDocument.appendChild( myRootNode );
12091227

12101228
myRootNode.setAttribute( QStringLiteral( "hasScaleBasedVisibilityFlag" ), hasScaleBasedVisibility() ? 1 : 0 );
1211-
myRootNode.setAttribute( QStringLiteral( "minimumScale" ), QString::number( minimumScale() ) );
1212-
myRootNode.setAttribute( QStringLiteral( "maximumScale" ), QString::number( maximumScale() ) );
1229+
myRootNode.setAttribute( QStringLiteral( "maxScale" ), QString::number( maximumScale() ) );
1230+
myRootNode.setAttribute( QStringLiteral( "mincale" ), QString::number( minimumScale() ) );
12131231

12141232
if ( !writeSymbology( myRootNode, myDocument, errorMsg, QgsReadWriteContext() ) ) // TODO: support relative paths in QML?
12151233
{

src/core/qgsmaplayer.h

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -689,19 +689,23 @@ class CORE_EXPORT QgsMapLayer : public QObject
689689
*/
690690
bool isInScaleRange( double scale ) const;
691691

692-
/** Returns the minimum scale denominator at which the layer is visible.
693-
* Scale based visibility is only used if hasScaleBasedVisibility is true.
694-
* \returns minimum scale denominator at which the layer will render
692+
/**
693+
* Returns the minimum map scale (i.e. most "zoomed out" scale) at which the layer will be visible.
694+
* The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
695+
* A scale of 0 indicates no minimum scale visibility.
696+
* \note Scale based visibility is only used if setScaleBasedVisibility() is set to true.
695697
* \see setMinimumScale()
696698
* \see maximumScale()
697699
* \see hasScaleBasedVisibility()
698700
* \see isInScaleRange()
699701
*/
700702
double minimumScale() const;
701703

702-
/** Returns the maximum scale denominator at which the layer is visible.
703-
* Scale based visibility is only used if hasScaleBasedVisibility is true.
704-
* \returns minimum scale denominator at which the layer will render
704+
/**
705+
* Returns the maximum map scale (i.e. most "zoomed in" scale) at which the layer will be visible.
706+
* The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
707+
* A scale of 0 indicates no maximum scale visibility.
708+
* \note Scale based visibility is only used if setScaleBasedVisibility() is set to true.
705709
* \see setMaximumScale()
706710
* \see minimumScale()
707711
* \see hasScaleBasedVisibility()
@@ -792,21 +796,25 @@ class CORE_EXPORT QgsMapLayer : public QObject
792796

793797
public slots:
794798

795-
/** Sets the minimum scale denominator at which the layer will be visible.
796-
* Scale based visibility is only used if setScaleBasedVisibility is set to true.
797-
* \param scale minimum scale denominator at which the layer should render
798-
* \see minimumScale
799-
* \see setMaximumScale
800-
* \see setScaleBasedVisibility
799+
/**
800+
* Sets the minimum map \a scale (i.e. most "zoomed out" scale) at which the layer will be visible.
801+
* The \a scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
802+
* A \a scale of 0 indicates no minimum scale visibility.
803+
* \note Scale based visibility is only used if setScaleBasedVisibility() is set to true.
804+
* \see minimumScale()
805+
* \see setMaximumScale()
806+
* \see setScaleBasedVisibility()
801807
*/
802808
void setMinimumScale( double scale );
803809

804-
/** Sets the maximum scale denominator at which the layer will be visible.
805-
* Scale based visibility is only used if setScaleBasedVisibility is set to true.
806-
* \param scale maximum scale denominator at which the layer should render
807-
* \see maximumScale
808-
* \see setMinimumScale
809-
* \see setScaleBasedVisibility
810+
/**
811+
* Sets the maximum map \a scale (i.e. most "zoomed in" scale) at which the layer will be visible.
812+
* The \a scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
813+
* A \a scale of 0 indicates no maximum scale visibility.
814+
* \note Scale based visibility is only used if setScaleBasedVisibility() is set to true.
815+
* \see maximumScale()
816+
* \see setMinimumScale()
817+
* \see setScaleBasedVisibility()
810818
*/
811819
void setMaximumScale( double scale );
812820

src/core/qgsvectorlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2209,7 +2209,7 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
22092209
QgsStringMap localProps = QgsStringMap( props );
22102210
if ( hasScaleBasedVisibility() )
22112211
{
2212-
QgsSymbolLayerUtils::mergeScaleDependencies( minimumScale(), maximumScale(), localProps );
2212+
QgsSymbolLayerUtils::mergeScaleDependencies( maximumScale(), minimumScale(), localProps );
22132213
}
22142214

22152215
if ( hasGeometryType() )

0 commit comments

Comments
 (0)