@@ -670,9 +670,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
670
670
{
671
671
// fallback to older property
672
672
double oldMin = layer->customProperty ( QStringLiteral ( " labeling/distMapUnitMinScale" ), 0.0 ).toDouble ();
673
- distMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
673
+ distMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0.0 ) ? 1.0 / oldMin : 0 ;
674
674
double oldMax = layer->customProperty ( QStringLiteral ( " labeling/distMapUnitMaxScale" ), 0.0 ).toDouble ();
675
- distMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
675
+ distMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0.0 ) ? 1.0 / oldMax : 0 ;
676
676
}
677
677
else
678
678
{
@@ -691,9 +691,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
691
691
{
692
692
// fallback to older property
693
693
double oldMin = layer->customProperty ( QStringLiteral ( " labeling/labelOffsetMapUnitMinScale" ), 0.0 ).toDouble ();
694
- labelOffsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
694
+ labelOffsetMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0.0 ) ? 1.0 / oldMin : 0 ;
695
695
double oldMax = layer->customProperty ( QStringLiteral ( " labeling/labelOffsetMapUnitMaxScale" ), 0.0 ).toDouble ();
696
- labelOffsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
696
+ labelOffsetMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0 ) ? 1.0 / oldMax : 0 ;
697
697
}
698
698
else
699
699
{
@@ -735,9 +735,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
735
735
{
736
736
// fallback to older property
737
737
double oldMin = layer->customProperty ( QStringLiteral ( " labeling/repeatDistanceMapUnitMinScale" ), 0.0 ).toDouble ();
738
- repeatDistanceMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
738
+ repeatDistanceMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0 ) ? 1.0 / oldMin : 0 ;
739
739
double oldMax = layer->customProperty ( QStringLiteral ( " labeling/repeatDistanceMapUnitMaxScale" ), 0.0 ).toDouble ();
740
- repeatDistanceMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
740
+ repeatDistanceMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0 ) ? 1.0 / oldMax : 0 ;
741
741
}
742
742
else
743
743
{
@@ -890,9 +890,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
890
890
{
891
891
// fallback to older property
892
892
double oldMin = placementElem.attribute ( QStringLiteral ( " distMapUnitMinScale" ), QStringLiteral ( " 0" ) ).toDouble ();
893
- distMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
893
+ distMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0 ) ? 1.0 / oldMin : 0 ;
894
894
double oldMax = placementElem.attribute ( QStringLiteral ( " distMapUnitMaxScale" ), QStringLiteral ( " 0" ) ).toDouble ();
895
- distMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
895
+ distMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0 ) ? 1.0 / oldMax : 0 ;
896
896
}
897
897
else
898
898
{
@@ -914,9 +914,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
914
914
{
915
915
// fallback to older property
916
916
double oldMin = placementElem.attribute ( QStringLiteral ( " labelOffsetMapUnitMinScale" ), QStringLiteral ( " 0" ) ).toDouble ();
917
- labelOffsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
917
+ labelOffsetMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0.0 ) ? 1.0 / oldMin : 0 ;
918
918
double oldMax = placementElem.attribute ( QStringLiteral ( " labelOffsetMapUnitMaxScale" ), QStringLiteral ( " 0" ) ).toDouble ();
919
- labelOffsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
919
+ labelOffsetMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0.0 ) ? 1.0 / oldMax : 0 ;
920
920
}
921
921
else
922
922
{
@@ -965,9 +965,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
965
965
{
966
966
// fallback to older property
967
967
double oldMin = placementElem.attribute ( QStringLiteral ( " repeatDistanceMapUnitMinScale" ), QStringLiteral ( " 0" ) ).toDouble ();
968
- repeatDistanceMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0 ;
968
+ repeatDistanceMapUnitScale.minScale = ! qgsDoubleNear ( oldMin, 0.0 ) ? 1.0 / oldMin : 0 ;
969
969
double oldMax = placementElem.attribute ( QStringLiteral ( " repeatDistanceMapUnitMaxScale" ), QStringLiteral ( " 0" ) ).toDouble ();
970
- repeatDistanceMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0 ;
970
+ repeatDistanceMapUnitScale.maxScale = ! qgsDoubleNear ( oldMax, 0.0 ) ? 1.0 / oldMax : 0 ;
971
971
}
972
972
else
973
973
{
0 commit comments