Skip to content
Permalink
Browse files

draw smaller diagrams on top

  • Loading branch information
m-kuhn committed Aug 9, 2012
1 parent d6f62fa commit 48bc5c5ccdc4ab1b1512ba1d87ea0bb21ab8fd3e
Showing with 21 additions and 0 deletions.
  1. +19 −0 src/core/pal/problem.cpp
  2. +2 −0 src/core/pal/problem.h
@@ -2939,20 +2939,39 @@ namespace pal
//#undef _DEBUG_FULL_
#endif

bool Problem::compareLabelArea( pal::LabelPosition* l1, pal::LabelPosition* l2 )
{
return l1->getWidth() * l1->getHeight() > l2->getWidth() * l2->getHeight();
}

std::list<LabelPosition*> * Problem::getSolution( bool returnInactive )
{

int i;
std::list<LabelPosition*> *solList = new std::list<LabelPosition*>();

if ( nbft == 0 )
{
return solList;
}

for ( i = 0; i < nbft; i++ )
{
if ( sol->s[i] != -1 )
{
solList->push_back( labelpositions[sol->s[i]] ); // active labels
}
else if ( returnInactive )
{
solList->push_back( labelpositions[featStartId[i]] ); // unplaced label
}
}

// if features collide, order by size, so smaller ones appear on top
if ( returnInactive )
{
solList->sort( compareLabelArea );
}

return solList;
}
@@ -225,6 +225,8 @@ namespace pal
void init_sol_empty();
void init_sol_falp();

static bool compareLabelArea( pal::LabelPosition* l1, pal::LabelPosition* l2 );

#ifdef _EXPORT_MAP_
void drawLabels( std::ofstream &svgmap );
#endif

0 comments on commit 48bc5c5

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