@@ -483,7 +483,6 @@ namespace pal
483
483
unsigned long flags = f->layer ->getArrangementFlags ();
484
484
if ( flags == 0 )
485
485
flags = FLAG_ON_LINE; // default flag
486
- bool reversed = false ;
487
486
488
487
// LinkedList<PointSet*> *shapes_final;
489
488
@@ -594,15 +593,20 @@ namespace pal
594
593
#endif
595
594
if ( f->layer ->arrangement == P_LINE )
596
595
{
597
- // if ( flags & FLAG_MAP_ORIENTATION ) // see bug #3643
598
- reversed = ( alpha > M_PI / 2 || alpha <= -M_PI / 2 );
599
-
600
- if (( !reversed && ( flags & FLAG_ABOVE_LINE ) ) || ( reversed && ( flags & FLAG_BELOW_LINE ) ) )
601
- positions->push_back ( new LabelPosition ( i, bx + cos ( beta ) *distlabel , by + sin ( beta ) *distlabel, xrm, yrm, alpha, cost, this , reversed ) ); // Line
602
- if (( !reversed && ( flags & FLAG_BELOW_LINE ) ) || ( reversed && ( flags & FLAG_ABOVE_LINE ) ) )
603
- positions->push_back ( new LabelPosition ( i, bx - cos ( beta ) *( distlabel + yrm ) , by - sin ( beta ) *( distlabel + yrm ), xrm, yrm, alpha, cost, this , reversed ) ); // Line
596
+ // find out whether the line direction for this candidate is from right to left
597
+ bool isRightToLeft = ( alpha > M_PI / 2 || alpha <= -M_PI / 2 );
598
+ // meaning of above/below may be reversed if using line position dependent orientation
599
+ // and the line has right-to-left direction
600
+ bool reversed = (( flags & FLAG_MAP_ORIENTATION ) ? isRightToLeft : false );
601
+ bool aboveLine = ( !reversed && ( flags & FLAG_ABOVE_LINE ) ) || ( reversed && ( flags & FLAG_BELOW_LINE ) );
602
+ bool belowLine = ( !reversed && ( flags & FLAG_BELOW_LINE ) ) || ( reversed && ( flags & FLAG_ABOVE_LINE ) );
603
+
604
+ if ( aboveLine )
605
+ positions->push_back ( new LabelPosition ( i, bx + cos ( beta ) *distlabel , by + sin ( beta ) *distlabel, xrm, yrm, alpha, cost, this , isRightToLeft ) ); // Line
606
+ if ( belowLine )
607
+ positions->push_back ( new LabelPosition ( i, bx - cos ( beta ) *( distlabel + yrm ) , by - sin ( beta ) *( distlabel + yrm ), xrm, yrm, alpha, cost, this , isRightToLeft ) ); // Line
604
608
if ( flags & FLAG_ON_LINE )
605
- positions->push_back ( new LabelPosition ( i, bx - yrm*cos ( beta ) / 2 , by - yrm*sin ( beta ) / 2 , xrm, yrm, alpha, cost, this , reversed ) ); // Line
609
+ positions->push_back ( new LabelPosition ( i, bx - yrm*cos ( beta ) / 2 , by - yrm*sin ( beta ) / 2 , xrm, yrm, alpha, cost, this , isRightToLeft ) ); // Line
606
610
}
607
611
else if ( f->layer ->arrangement == P_HORIZ )
608
612
{
0 commit comments