Record whether a callout corresponds to a feature which has all parts labeled in the callout context

This is useful information for dictating how a callout should be rendered
This commit is contained in:
Nyall Dawson 2019-07-28 07:19:10 +10:00
parent fcd952efe9
commit bb9267d11b
3 changed files with 4 additions and 4 deletions

View File

@ -160,7 +160,7 @@ The default order is QgsCallout.OrderBelowIndividualLabels.
struct QgsCalloutContext
{
bool temporary;
bool allFeaturePartsLabeled;
};
void render( QgsRenderContext &context, QRectF rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext );

View File

@ -183,9 +183,8 @@ class CORE_EXPORT QgsCallout
*/
struct CORE_EXPORT QgsCalloutContext
{
///@cond PRIVATE
bool temporary = false; // Temporary member only, required for building on some platforms
///@endcond
//! TRUE if all parts of associated feature were labeled
bool allFeaturePartsLabeled = false;
};
/**

View File

@ -305,6 +305,7 @@ void QgsVectorLayerLabelProvider::drawCallout( QgsRenderContext &context, pal::L
QgsGeometry g( QgsGeos::fromGeos( label->getFeaturePart()->feature()->geometry() ) );
g.transform( xform.transform() );
QgsCallout::QgsCalloutContext calloutContext;
calloutContext.allFeaturePartsLabeled = label->getFeaturePart()->feature()->labelAllParts();
mSettings.callout()->render( context, rect, label->getAlpha() * 180 / M_PI, g, calloutContext );
}
}