@@ -422,7 +422,7 @@ std::unique_ptr<LabelPosition> FeaturePart::createCandidatePointOnSurface( Point
422
422
return nullptr ;
423
423
}
424
424
425
- return qgis::make_unique< LabelPosition >( 0 , px, py, getLabelWidth (), getLabelHeight (), 0.0 , 0.0 , this );
425
+ return qgis::make_unique< LabelPosition >( 0 , px, py, getLabelWidth (), getLabelHeight (), 0.0 , 0.0 , this , false , LabelPosition::QuadrantOver );
426
426
}
427
427
428
428
void createCandidateAtOrderedPositionOverPoint ( double &labelX, double &labelY, LabelPosition::Quadrant &quadrant, double x, double y, double labelWidth, double labelHeight, QgsPalLayerSettings::PredefinedPointPosition position, double distanceToLabel, const QgsMargins &visualMargin, double symbolWidthOffset, double symbolHeightOffset )
@@ -784,7 +784,7 @@ std::size_t FeaturePart::createHorizontalCandidatesAlongLine( std::vector<std::u
784
784
double cost = std::fabs ( totalLineLength / 2 - currentDistanceAlongLine ) / totalLineLength; // <0, 0.5>
785
785
cost /= 1000 ; // < 0, 0.0005 >
786
786
787
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateCenterX - labelWidth / 2 , candidateCenterY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this ) );
787
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateCenterX - labelWidth / 2 , candidateCenterY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this , false , LabelPosition::QuadrantOver ) );
788
788
789
789
currentDistanceAlongLine += lineStepDistance;
790
790
@@ -987,29 +987,29 @@ std::size_t FeaturePart::createCandidatesAlongLineNearStraightSegments( std::vec
987
987
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle ) )
988
988
{
989
989
const double candidateCost = cost + ( reversed ? 0 : 0.001 );
990
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
990
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
991
991
}
992
992
}
993
993
if ( aboveLine )
994
994
{
995
995
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle ) )
996
996
{
997
997
const double candidateCost = cost + ( !reversed ? 0 : 0.001 ); // no extra cost for above line placements
998
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
998
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
999
999
}
1000
1000
}
1001
1001
if ( flags & QgsLabeling::LinePlacementFlag::OnLine )
1002
1002
{
1003
1003
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle ) )
1004
1004
{
1005
1005
const double candidateCost = cost + 0.002 ;
1006
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
1006
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
1007
1007
}
1008
1008
}
1009
1009
}
1010
1010
else if ( mLF ->layer ()->arrangement () == QgsPalLayerSettings::Horizontal )
1011
1011
{
1012
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2 , candidateStartY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this ) ); // Line
1012
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2 , candidateStartY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this , false , LabelPosition::QuadrantOver ) ); // Line
1013
1013
}
1014
1014
else
1015
1015
{
@@ -1144,29 +1144,29 @@ std::size_t FeaturePart::createCandidatesAlongLineNearMidpoint( std::vector< std
1144
1144
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle ) )
1145
1145
{
1146
1146
const double candidateCost = cost + ( !reversed ? 0 : 0.001 ); // no extra cost for above line placements
1147
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
1147
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX + std::cos ( beta ) *distanceLineToLabel, candidateStartY + std::sin ( beta ) *distanceLineToLabel, labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
1148
1148
}
1149
1149
}
1150
1150
if ( belowLine )
1151
1151
{
1152
1152
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle ) )
1153
1153
{
1154
1154
const double candidateCost = cost + ( !reversed ? 0.001 : 0 );
1155
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
1155
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - std::cos ( beta ) * ( distanceLineToLabel + labelHeight ), candidateStartY - std::sin ( beta ) * ( distanceLineToLabel + labelHeight ), labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
1156
1156
}
1157
1157
}
1158
1158
if ( flags & QgsLabeling::LinePlacementFlag::OnLine )
1159
1159
{
1160
1160
if ( !mLF ->permissibleZonePrepared () || GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle ) )
1161
1161
{
1162
1162
const double candidateCost = cost + 0.002 ;
1163
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft ) ); // Line
1163
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelHeight * std::cos ( beta ) / 2 , candidateStartY - labelHeight * std::sin ( beta ) / 2 , labelWidth, labelHeight, angle, candidateCost, this , isRightToLeft, LabelPosition::QuadrantOver ) ); // Line
1164
1164
}
1165
1165
}
1166
1166
}
1167
1167
else if ( mLF ->layer ()->arrangement () == QgsPalLayerSettings::Horizontal )
1168
1168
{
1169
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2 , candidateStartY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this ) ); // Line
1169
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2 , candidateStartY - labelHeight / 2 , labelWidth, labelHeight, 0 , cost, this , false , LabelPosition::QuadrantOver ) ); // Line
1170
1170
}
1171
1171
else
1172
1172
{
@@ -1333,7 +1333,7 @@ std::unique_ptr< LabelPosition > FeaturePart::curvedPlacementAtOffset( PointSet
1333
1333
render_angle += M_PI;
1334
1334
}
1335
1335
1336
- std::unique_ptr< LabelPosition > tmp = qgis::make_unique< LabelPosition >( 0 , render_x /* - xBase*/ , render_y /* - yBase*/ , ci.width , string_height, -render_angle, 0.0001 , this );
1336
+ std::unique_ptr< LabelPosition > tmp = qgis::make_unique< LabelPosition >( 0 , render_x /* - xBase*/ , render_y /* - yBase*/ , ci.width , string_height, -render_angle, 0.0001 , this , false , LabelPosition::QuadrantOver );
1337
1337
tmp->setPartId ( orientation > 0 ? i : li->char_num - i - 1 );
1338
1338
LabelPosition *next = tmp.get ();
1339
1339
if ( !slp )
@@ -1752,7 +1752,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
1752
1752
if ( GeomFunction::containsCandidate ( mLF ->permissibleZonePrepared (), rx - dlx, ry - dly, labelWidth, labelHeight, alpha ) )
1753
1753
{
1754
1754
// cost is set to minimal value, evaluated later
1755
- lPos.emplace_back ( qgis::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001 , this ) );
1755
+ lPos.emplace_back ( qgis::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001 , this , false , LabelPosition::QuadrantOver ) );
1756
1756
numberCandidatesGenerated++;
1757
1757
}
1758
1758
}
@@ -1764,7 +1764,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
1764
1764
// but the bugs noted in CostCalculator currently prevent this
1765
1765
if ( mapShape->containsPoint ( rx, ry ) )
1766
1766
{
1767
- std::unique_ptr< LabelPosition > potentialCandidate = qgis::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001 , this );
1767
+ std::unique_ptr< LabelPosition > potentialCandidate = qgis::make_unique< LabelPosition >( id++, rx - dlx, ry - dly, labelWidth, labelHeight, alpha, 0.0001 , this , false , LabelPosition::QuadrantOver );
1768
1768
// cost is set to minimal value, evaluated later
1769
1769
lPos.emplace_back ( std::move ( potentialCandidate ) );
1770
1770
numberCandidatesGenerated++;
0 commit comments