Skip to content

Commit

Permalink
Avoid creating 3 identical label candidates in offset point mode
Browse files Browse the repository at this point in the history
...should speed up label position calculation
  • Loading branch information
nyalldawson committed Apr 11, 2015
1 parent 790216f commit f7d99d1
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/core/pal/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ namespace pal
{
Q_UNUSED( scale );
Q_UNUSED( delta_width );
int nbp = 3;
int nbp = 1;
*lPos = new LabelPosition *[nbp];

// get from feature
Expand Down Expand Up @@ -349,15 +349,7 @@ namespace pal
lx = x + xdiff;
ly = y + ydiff;

// double offset = label_x / 4;
double offset = 0.0; // don't shift what is supposed to be fixed

// at the center
( *lPos )[0] = new LabelPosition( id, lx, ly, label_x, label_y, angle, cost, this );
// shifted to the sides - with higher cost
cost = 0.0021;
( *lPos )[1] = new LabelPosition( id, lx + offset, ly, label_x, label_y, angle, cost, this );
( *lPos )[2] = new LabelPosition( id, lx - offset, ly, label_x, label_y, angle, cost, this );
return nbp;
}

Expand Down

0 comments on commit f7d99d1

Please sign in to comment.