Skip to content

Commit 928da6e

Browse files
committed
fix #6170
1 parent e552707 commit 928da6e

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

src/core/pal/costcalculator.cpp

100644100755
+18-16
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ namespace pal
3737
int n = 0;
3838
double dist;
3939
double distlabel = lp->feature->getLabelDistance();
40-
/*unit_convert( double( lp->feature->distlabel ),
41-
pal::PIXEL,
42-
pal->map_unit,
43-
pal->dpi, scale, 1 );*/
40+
#if 0
41+
unit_convert( double( lp->feature->distlabel ),
42+
pal::PIXEL,
43+
pal->map_unit,
44+
pal->dpi, scale, 1 );
45+
#endif
4446

4547
switch ( feat->getGeosType() )
4648
{
@@ -230,7 +232,7 @@ namespace pal
230232
*/
231233

232234
double alpha = lp->getAlpha();
233-
for ( i = 0; i < 8; i++, alpha += M_PI / 4 )
235+
for ( i = 0; i < 8; i++, alpha += M_PI_4 )
234236
{
235237
dist[i] = DBL_MAX;
236238
ok[i] = false;
@@ -261,14 +263,12 @@ namespace pal
261263
{
262264
double beta = atan2( pset->y[0] - py, pset->x[0] - px ) - lp->getAlpha();
263265

264-
while ( beta < 0 )
266+
while ( beta < 0.0 )
265267
{
266268
beta += 2 * M_PI;
267269
}
268270

269-
double a45 = M_PI / 4;
270-
271-
int i = ( int )( beta / a45 );
271+
int i = ( int ) floor( beta / M_PI_4 ) % 8;
272272

273273
for ( int j = 0; j < 2; j++, i = ( i + 1 ) % 8 )
274274
{
@@ -287,7 +287,7 @@ namespace pal
287287
}
288288
else
289289
{
290-
std::cout << "this shouldn't occurs !!!" << std::endl;
290+
std::cout << "this shouldn't occur!!!" << std::endl;
291291
}
292292
}
293293
}
@@ -334,14 +334,14 @@ namespace pal
334334

335335
for ( i = 0; i < 8; i++ )
336336
{
337-
/*
337+
#if 0
338338
if ( i == 0 || i == 4 ) // horizontal directions
339339
dist[i] -= lp->w / 2;
340-
else if (i == 2 || i == 6 ) // vertical directions
340+
else if ( i == 2 || i == 6 ) // vertical directions
341341
dist[i] -= lp->h / 2;
342342
else // other directions
343-
dist[i] -= ( lp->w / 2 ) / cos( M_PI / 4 );
344-
*/
343+
dist[i] -= ( lp->w / 2 ) / cos( M_PI_4 );
344+
#endif
345345

346346
if ( !ok[i] || dist[i] < EPSILON )
347347
{
@@ -356,8 +356,10 @@ namespace pal
356356
c = min( dist[2], dist[6] );
357357
d = min( dist[3], dist[7] );
358358

359-
//if (a!=EPSILON || b!=EPSILON || c!=EPSILON || d!=EPSILON)
360-
// std::cout << "res " << (a*b*c*d) << " " << a << " " << b << " " << c << " " << d << std::endl;
359+
#if 0
360+
if ( a != EPSILON || b != EPSILON || c != EPSILON || d != EPSILON )
361+
std::cout << "res " << ( a*b*c*d ) << " " << a << " " << b << " " << c << " " << d << std::endl;
362+
#endif
361363
return ( a*b*c*d );
362364
}
363365

src/core/pal/feature.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ namespace pal
10531053

10541054
if (( box->length * box->width ) > ( xmax - xmin ) *( ymax - ymin ) *5 )
10551055
{
1056-
std::cout << "Very Large BBOX (should never occurs : bug-report please)" << std::endl;
1056+
std::cout << "Very Large BBOX (should never occur : bug-report please)" << std::endl;
10571057
std::cout << " Box size: " << box->length << "/" << box->width << std::endl;
10581058
std::cout << " Alpha: " << alpha << " " << alpha * 180 / M_PI << std::endl;
10591059
std::cout << " Dx;Dy: " << dx << " " << dy << std::endl;

src/core/pal/pal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ namespace pal
302302
* @param scale map scale is 1:scale
303303
* @param bbox map extent
304304
* @param stats A PalStat object (can be NULL)
305-
* @param displayAll if true, all feature will be labelled evan though overlaps occurs
305+
* @param displayAll if true, all feature will be labelled even though overlaps occur
306306
*
307307
* @return A list of label to display on map
308308
*/
@@ -320,7 +320,7 @@ namespace pal
320320
* @param scale map scale is '1:scale'
321321
* @param bbox map extent
322322
* @param stat will be filled with labelling process statistics, can be NULL
323-
* @param displayAll if true, all feature will be labelled evan though overlaps occurs
323+
* @param displayAll if true, all feature will be labelled even though overlaps occur
324324
*
325325
* @todo UnknownLayer will be ignored ? should throw exception or not ???
326326
*

0 commit comments

Comments
 (0)