Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[labeling] Move minium/maximum angle settings for curved labels out o…
…f PAL
- Loading branch information
1 parent
5106d41
commit 700cee2
Showing
5 changed files
with
55 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,21 +27,24 @@ | |
* | ||
*/ | ||
|
||
#include "qgsgeometry.h" | ||
#include "pal.h" | ||
#include "layer.h" | ||
#include "feature.h" | ||
#include "geomfunction.h" | ||
#include "labelposition.h" | ||
#include "pointset.h" | ||
#include "util.h" | ||
#include "costcalculator.h" | ||
|
||
#include "qgis.h" | ||
#include "qgsgeometry.h" | ||
#include "qgsgeos.h" | ||
#include "qgstextlabelfeature.h" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nyalldawson
Collaborator
|
||
#include "qgsmessagelog.h" | ||
#include "costcalculator.h" | ||
#include "qgsgeometryutils.h" | ||
#include "qgslabeling.h" | ||
#include "qgspolygon.h" | ||
|
||
#include <QLinkedList> | ||
#include <cmath> | ||
#include <cfloat> | ||
|
@@ -1310,6 +1313,8 @@ std::unique_ptr< LabelPosition > FeaturePart::curvedPlacementAtOffset( PointSet | |
double angle = std::atan2( -dy, dx ); | ||
|
||
const int characterCount = li->count(); | ||
const double maximumCharacterAngleInside = qgis::down_cast< QgsTextLabelFeature *>( mLF )->maximumCharacterAngleInside(); | ||
const double maximumCharacterAngleOutside = qgis::down_cast< QgsTextLabelFeature *>( mLF )->maximumCharacterAngleOutside(); | ||
for ( int i = 0; i < characterCount; i++ ) | ||
{ | ||
double last_character_angle = angle; | ||
|
@@ -1338,10 +1343,10 @@ std::unique_ptr< LabelPosition > FeaturePart::curvedPlacementAtOffset( PointSet | |
angleDelta -= 2 * M_PI; | ||
while ( angleDelta < -M_PI ) | ||
angleDelta += 2 * M_PI; | ||
if ( applyAngleConstraints && ( ( li->maxCharAngleInsideRadians > 0 && angleDelta > 0 | ||
&& angleDelta > li->maxCharAngleInsideRadians ) | ||
|| ( li->maxCharAngleOutsideRadians < 0 && angleDelta < 0 | ||
&& angleDelta < li->maxCharAngleOutsideRadians ) ) ) | ||
if ( applyAngleConstraints && ( ( maximumCharacterAngleInside > 0 && angleDelta > 0 | ||
&& angleDelta > maximumCharacterAngleInside ) | ||
|| ( maximumCharacterAngleOutside < 0 && angleDelta < 0 | ||
&& angleDelta < maximumCharacterAngleOutside ) ) ) | ||
{ | ||
return nullptr; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@nirvn @nyalldawson this breaks today's nightly build. looks like you need some additional include here?