Skip to content
Permalink
Browse files

fix #6170

  • Loading branch information
jef-n committed Aug 8, 2012
1 parent e552707 commit 928da6e3bb435da0112bb373096871597012e212
Showing with 21 additions and 19 deletions.
  1. +18 −16 src/core/pal/costcalculator.cpp
  2. +1 −1 src/core/pal/feature.cpp
  3. +2 −2 src/core/pal/pal.h
34 src/core/pal/costcalculator.cpp 100644 → 100755
@@ -37,10 +37,12 @@ namespace pal
int n = 0;
double dist;
double distlabel = lp->feature->getLabelDistance();
/*unit_convert( double( lp->feature->distlabel ),
pal::PIXEL,
pal->map_unit,
pal->dpi, scale, 1 );*/
#if 0
unit_convert( double( lp->feature->distlabel ),
pal::PIXEL,
pal->map_unit,
pal->dpi, scale, 1 );
#endif

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

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

while ( beta < 0 )
while ( beta < 0.0 )
{
beta += 2 * M_PI;
}

double a45 = M_PI / 4;

int i = ( int )( beta / a45 );
int i = ( int ) floor( beta / M_PI_4 ) % 8;

for ( int j = 0; j < 2; j++, i = ( i + 1 ) % 8 )
{
@@ -287,7 +287,7 @@ namespace pal
}
else
{
std::cout << "this shouldn't occurs !!!" << std::endl;
std::cout << "this shouldn't occur!!!" << std::endl;
}
}
}
@@ -334,14 +334,14 @@ namespace pal

for ( i = 0; i < 8; i++ )
{
/*
#if 0
if ( i == 0 || i == 4 ) // horizontal directions
dist[i] -= lp->w / 2;
else if (i == 2 || i == 6 ) // vertical directions
else if ( i == 2 || i == 6 ) // vertical directions
dist[i] -= lp->h / 2;
else // other directions
dist[i] -= ( lp->w / 2 ) / cos( M_PI / 4 );
*/
dist[i] -= ( lp->w / 2 ) / cos( M_PI_4 );
#endif

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

//if (a!=EPSILON || b!=EPSILON || c!=EPSILON || d!=EPSILON)
// std::cout << "res " << (a*b*c*d) << " " << a << " " << b << " " << c << " " << d << std::endl;
#if 0
if ( a != EPSILON || b != EPSILON || c != EPSILON || d != EPSILON )
std::cout << "res " << ( a*b*c*d ) << " " << a << " " << b << " " << c << " " << d << std::endl;
#endif
return ( a*b*c*d );
}

@@ -1053,7 +1053,7 @@ namespace pal

if (( box->length * box->width ) > ( xmax - xmin ) *( ymax - ymin ) *5 )
{
std::cout << "Very Large BBOX (should never occurs : bug-report please)" << std::endl;
std::cout << "Very Large BBOX (should never occur : bug-report please)" << std::endl;
std::cout << " Box size: " << box->length << "/" << box->width << std::endl;
std::cout << " Alpha: " << alpha << " " << alpha * 180 / M_PI << std::endl;
std::cout << " Dx;Dy: " << dx << " " << dy << std::endl;
@@ -302,7 +302,7 @@ namespace pal
* @param scale map scale is 1:scale
* @param bbox map extent
* @param stats A PalStat object (can be NULL)
* @param displayAll if true, all feature will be labelled evan though overlaps occurs
* @param displayAll if true, all feature will be labelled even though overlaps occur
*
* @return A list of label to display on map
*/
@@ -320,7 +320,7 @@ namespace pal
* @param scale map scale is '1:scale'
* @param bbox map extent
* @param stat will be filled with labelling process statistics, can be NULL
* @param displayAll if true, all feature will be labelled evan though overlaps occurs
* @param displayAll if true, all feature will be labelled even though overlaps occur
*
* @todo UnknownLayer will be ignored ? should throw exception or not ???
*

0 comments on commit 928da6e

Please sign in to comment.
You can’t perform that action at this time.