Skip to content

Commit 6eec3a7

Browse files
committedMar 11, 2019
Fix double comparison warnings
1 parent da7b489 commit 6eec3a7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

‎src/core/qgspallabeling.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
670670
{
671671
//fallback to older property
672672
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;
674674
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;
676676
}
677677
else
678678
{
@@ -691,9 +691,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
691691
{
692692
//fallback to older property
693693
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;
695695
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;
697697
}
698698
else
699699
{
@@ -735,9 +735,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
735735
{
736736
//fallback to older property
737737
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;
739739
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;
741741
}
742742
else
743743
{
@@ -890,9 +890,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
890890
{
891891
//fallback to older property
892892
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;
894894
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;
896896
}
897897
else
898898
{
@@ -914,9 +914,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
914914
{
915915
//fallback to older property
916916
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;
918918
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;
920920
}
921921
else
922922
{
@@ -965,9 +965,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
965965
{
966966
//fallback to older property
967967
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;
969969
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;
971971
}
972972
else
973973
{

0 commit comments

Comments
 (0)
Please sign in to comment.