Skip to content

Commit

Permalink
Fix double comparison warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 11, 2019
1 parent da7b489 commit 6eec3a7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/core/qgspallabeling.cpp
Expand Up @@ -670,9 +670,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
{
//fallback to older property
double oldMin = layer->customProperty( QStringLiteral( "labeling/distMapUnitMinScale" ), 0.0 ).toDouble();
distMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
distMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0.0 ) ? 1.0 / oldMin : 0;
double oldMax = layer->customProperty( QStringLiteral( "labeling/distMapUnitMaxScale" ), 0.0 ).toDouble();
distMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
distMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0.0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand All @@ -691,9 +691,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
{
//fallback to older property
double oldMin = layer->customProperty( QStringLiteral( "labeling/labelOffsetMapUnitMinScale" ), 0.0 ).toDouble();
labelOffsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
labelOffsetMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0.0 ) ? 1.0 / oldMin : 0;
double oldMax = layer->customProperty( QStringLiteral( "labeling/labelOffsetMapUnitMaxScale" ), 0.0 ).toDouble();
labelOffsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
labelOffsetMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand Down Expand Up @@ -735,9 +735,9 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
{
//fallback to older property
double oldMin = layer->customProperty( QStringLiteral( "labeling/repeatDistanceMapUnitMinScale" ), 0.0 ).toDouble();
repeatDistanceMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
repeatDistanceMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0 ) ? 1.0 / oldMin : 0;
double oldMax = layer->customProperty( QStringLiteral( "labeling/repeatDistanceMapUnitMaxScale" ), 0.0 ).toDouble();
repeatDistanceMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
repeatDistanceMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand Down Expand Up @@ -890,9 +890,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
{
//fallback to older property
double oldMin = placementElem.attribute( QStringLiteral( "distMapUnitMinScale" ), QStringLiteral( "0" ) ).toDouble();
distMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
distMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0 ) ? 1.0 / oldMin : 0;
double oldMax = placementElem.attribute( QStringLiteral( "distMapUnitMaxScale" ), QStringLiteral( "0" ) ).toDouble();
distMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
distMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand All @@ -914,9 +914,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
{
//fallback to older property
double oldMin = placementElem.attribute( QStringLiteral( "labelOffsetMapUnitMinScale" ), QStringLiteral( "0" ) ).toDouble();
labelOffsetMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
labelOffsetMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0.0 ) ? 1.0 / oldMin : 0;
double oldMax = placementElem.attribute( QStringLiteral( "labelOffsetMapUnitMaxScale" ), QStringLiteral( "0" ) ).toDouble();
labelOffsetMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
labelOffsetMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0.0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand Down Expand Up @@ -965,9 +965,9 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext
{
//fallback to older property
double oldMin = placementElem.attribute( QStringLiteral( "repeatDistanceMapUnitMinScale" ), QStringLiteral( "0" ) ).toDouble();
repeatDistanceMapUnitScale.minScale = oldMin != 0 ? 1.0 / oldMin : 0;
repeatDistanceMapUnitScale.minScale = !qgsDoubleNear( oldMin, 0.0 ) ? 1.0 / oldMin : 0;
double oldMax = placementElem.attribute( QStringLiteral( "repeatDistanceMapUnitMaxScale" ), QStringLiteral( "0" ) ).toDouble();
repeatDistanceMapUnitScale.maxScale = oldMax != 0 ? 1.0 / oldMax : 0;
repeatDistanceMapUnitScale.maxScale = !qgsDoubleNear( oldMax, 0.0 ) ? 1.0 / oldMax : 0;
}
else
{
Expand Down

0 comments on commit 6eec3a7

Please sign in to comment.