27
27
*
28
28
*/
29
29
30
- #define _CRT_SECURE_NO_DEPRECATE
31
-
32
-
33
30
#if defined(_VERBOSE_) || defined(_DEBUG_)
34
31
#include < iostream>
35
32
#endif
@@ -250,18 +247,18 @@ namespace pal
250
247
double xdiff = -labelW / 2.0 ;
251
248
double ydiff = -labelH / 2.0 ;
252
249
253
- if ( mLF ->quadOffset ().x () != 0 )
250
+ if ( ! qgsDoubleNear ( mLF ->quadOffset ().x (), 0.0 ) )
254
251
{
255
252
xdiff += labelW / 2.0 * mLF ->quadOffset ().x ();
256
253
}
257
- if ( mLF ->quadOffset ().y () != 0 )
254
+ if ( ! qgsDoubleNear ( mLF ->quadOffset ().y (), 0.0 ) )
258
255
{
259
256
ydiff += labelH / 2.0 * mLF ->quadOffset ().y ();
260
257
}
261
258
262
259
if ( ! mLF ->hasFixedPosition () )
263
260
{
264
- if ( angle != 0 )
261
+ if ( ! qgsDoubleNear ( angle, 0.0 ) )
265
262
{
266
263
double xd = xdiff * cos ( angle ) - ydiff * sin ( angle );
267
264
double yd = xdiff * sin ( angle ) + ydiff * cos ( angle );
@@ -290,11 +287,11 @@ namespace pal
290
287
}
291
288
else
292
289
{
293
- if ( mLF ->positionOffset ().x () != 0 )
290
+ if ( ! qgsDoubleNear ( mLF ->positionOffset ().x (), 0.0 ) )
294
291
{
295
292
xdiff += mLF ->positionOffset ().x ();
296
293
}
297
- if ( mLF ->positionOffset ().y () != 0 )
294
+ if ( ! qgsDoubleNear ( mLF ->positionOffset ().y (), 0.0 ) )
298
295
{
299
296
ydiff += mLF ->positionOffset ().y ();
300
297
}
@@ -359,7 +356,7 @@ namespace pal
359
356
gamma2 = a90 / 3.0 ;
360
357
361
358
362
- if ( gamma1 == 0 || gamma2 == 0 )
359
+ if ( qgsDoubleNear ( gamma1, 0.0 ) || qgsDoubleNear ( gamma2, 0.0 ) )
363
360
{
364
361
std::cout << " Oups... label size error..." << std::endl;
365
362
}
@@ -538,7 +535,7 @@ namespace pal
538
535
ad[line->nbPoints -1 ] = ll;
539
536
540
537
541
- nbls = ( int ) ( ll / xrm ); // ratio bw line length and label width
538
+ nbls = static_cast < int > ( ll / xrm ); // ratio bw line length and label width
542
539
543
540
#ifdef _DEBUG_FULL_
544
541
std::cout << " line length :" << ll << std::endl;
@@ -707,7 +704,7 @@ namespace pal
707
704
double dy = new_y - old_y;
708
705
709
706
double segment_length = path_distances[index ];
710
- if ( segment_length == 0 )
707
+ if ( qgsDoubleNear ( segment_length, 0.0 ) )
711
708
{
712
709
// Not allowed to place across on 0 length segments or discontinuities
713
710
return nullptr ;
@@ -732,7 +729,7 @@ namespace pal
732
729
LabelInfo::CharacterInfo& ci = ( orientation > 0 ? li->char_info [i] : li->char_info [li->char_num -i-1 ] );
733
730
734
731
// Coordinates this character will start at
735
- if ( segment_length == 0 )
732
+ if ( qgsDoubleNear ( segment_length, 0.0 ) )
736
733
{
737
734
// Not allowed to place across on 0 length segments or discontinuities
738
735
delete slp;
@@ -895,7 +892,7 @@ namespace pal
895
892
total_distance += path_distances[i];
896
893
}
897
894
898
- if ( total_distance == 0 )
895
+ if ( qgsDoubleNear ( total_distance, 0.0 ) )
899
896
{
900
897
delete[] path_distances;
901
898
return 0 ;
0 commit comments