@@ -372,6 +372,11 @@ namespace pal
372372 double alpha;
373373 double cost;
374374
375+ unsigned long flags = layer->getArrangementFlags ();
376+ if ( flags == 0 )
377+ flags = FLAG_ON_LINE; // default flag
378+ bool reversed = false ;
379+
375380 // LinkedList<PointSet*> *shapes_final;
376381
377382 // shapes_final = new LinkedList<PointSet*>(ptrPSetCompare);
@@ -476,10 +481,18 @@ namespace pal
476481#ifdef _DEBUG_FULL_
477482 std::cout << " Create new label" << std::endl;
478483#endif
479- if ( layer->arrangement == P_LINE_AROUND )
484+ if ( layer->arrangement == P_LINE )
480485 {
481- positions->push_back ( new LabelPosition ( i, bx + cos ( beta ) *distlabel , by + sin ( beta ) *distlabel, xrm, yrm, alpha, cost, this ) ); // Line
482- positions->push_back ( new LabelPosition ( i, bx - cos ( beta ) * ( distlabel + yrm ) , by - sin ( beta ) * ( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
486+ std::cout << alpha*180 /M_PI << std::endl;
487+ if ( flags & FLAG_MAP_ORIENTATION )
488+ reversed = ( alpha >= M_PI/2 || alpha < -M_PI/2 );
489+
490+ if ( (!reversed && (flags & FLAG_ABOVE_LINE)) || (reversed && (flags & FLAG_BELOW_LINE)) )
491+ positions->push_back ( new LabelPosition ( i, bx + cos ( beta ) *distlabel , by + sin ( beta ) *distlabel, xrm, yrm, alpha, cost, this ) ); // Line
492+ if ( (!reversed && (flags & FLAG_BELOW_LINE)) || (reversed && (flags & FLAG_ABOVE_LINE)) )
493+ positions->push_back ( new LabelPosition ( i, bx - cos ( beta ) * ( distlabel + yrm ) , by - sin ( beta ) * ( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
494+ if ( flags & FLAG_ON_LINE )
495+ positions->push_back ( new LabelPosition ( i, bx - yrm*cos ( beta ) / 2 , by - yrm*sin ( beta ) / 2 , xrm, yrm, alpha, cost, this ) ); // Line
483496 }
484497 else if (layer->arrangement == P_HORIZ)
485498 {
@@ -488,7 +501,7 @@ namespace pal
488501 }
489502 else
490503 {
491- positions-> push_back ( new LabelPosition ( i, bx - yrm* cos ( beta ) / 2 , by - yrm* sin ( beta ) / 2 , xrm, yrm, alpha, cost, this ) ); // Line
504+ // an invalid arrangement?
492505 }
493506
494507 l += dist;
@@ -846,7 +859,6 @@ namespace pal
846859 nbp = setPositionForPoint ( cx, cy, scale, lPos, delta );
847860 break ;
848861 case P_LINE:
849- case P_LINE_AROUND:
850862 nbp = setPositionForLine ( scale, lPos, mapShape, delta );
851863 break ;
852864 default :
0 commit comments