32#include <QApplication> 
   35#include <QFontMetrics> 
   40#include <QTextBoundaryFinder> 
   98  if ( !sPropertyDefinitions()->isEmpty() )
 
  101  const QString origin = QStringLiteral( 
"labeling" );
 
  113          "e.g. Helvetica or Helvetica [Cronyx]" ), origin )
 
  117          "e.g. Bold Condensed or Light Italic" ), origin )
 
  158          "<b>Ellipse</b>|<b>Circle</b>|<b>SVG</b>]" ), origin )
 
  182          "<b>Buffer</b>|<b>Background</b>]" ), origin )
 
  198          "<b>3</b>=Left|<b>4</b>=Over|<b>5</b>=Right|<br>" 
  199          "<b>6</b>=Below Left|<b>7</b>=Below|<b>8</b>=Below Right]" ), origin )
 
  219          + QStringLiteral( 
"[<b>TL</b>=Top left|<b>TSL</b>=Top, slightly left|<b>T</b>=Top middle|<br>" 
  220                            "<b>TSR</b>=Top, slightly right|<b>TR</b>=Top right|<br>" 
  221                            "<b>L</b>=Left|<b>R</b>=Right|<br>" 
  222                            "<b>BL</b>=Bottom left|<b>BSL</b>=Bottom, slightly left|<b>B</b>=Bottom middle|<br>" 
  223                            "<b>BSR</b>=Bottom, slightly right|<b>BR</b>=Bottom right]" ), origin )
 
  227          + QStringLiteral( 
"[<b>OL</b>=On line|<b>AL</b>=Above line|<b>BL</b>=Below line|<br>" 
  228                            "<b>LO</b>=Respect line orientation]" ), origin )
 
  237          "<b>Half</b>|<b>Cap</b>|<b>Top</b>]" ), origin )
 
  262  : predefinedPositionOrder( *DEFAULT_PLACEMENT_ORDER() )
 
  265  initPropertyDefinitions();
 
  274  , mDataDefinedProperties( s.mDataDefinedProperties )
 
  309  mPolygonPlacementFlags = s.mPolygonPlacementFlags;
 
  325  mRotationUnit = s.mRotationUnit;
 
  346  mDataDefinedProperties = s.mDataDefinedProperties;
 
  348  mCallout.reset( s.mCallout ? s.mCallout->clone() : 
nullptr );
 
  350  mPlacementSettings = s.mPlacementSettings;
 
  351  mLineSettings = s.mLineSettings;
 
  352  mObstacleSettings = s.mObstacleSettings;
 
  353  mThinningSettings = s.mThinningSettings;
 
  360  mLegendString = s.mLegendString;
 
  362  mUnplacedVisibility = s.mUnplacedVisibility;
 
  412        for ( 
const QString &name : referencedColumns )
 
  414          attributeNames.insert( name );
 
  473    for ( 
const QString &name : referencedColumns )
 
  475      attributeNames.insert( name );
 
  482    const auto referencedColumns = mCallout->referencedFields( context );
 
  483    for ( 
const QString &name : referencedColumns )
 
  485      attributeNames.insert( name );
 
  494  QSet<QString> referenced;
 
  522    referenced.unite( mCallout->referencedFields( context ) );
 
  530  if ( mRenderStarted )
 
  532    qWarning( 
"Start render called for when a previous render was already underway!!" );
 
  545    mCallout->startRender( context );
 
  548  mRenderStarted = 
true;
 
  553  if ( !mRenderStarted )
 
  555    qWarning( 
"Stop render called for QgsPalLayerSettings without a startRender call!" );
 
  561    mCallout->stopRender( context );
 
  564  mRenderStarted = 
false;
 
  574  if ( mRenderStarted )
 
  576    qWarning( 
"stopRender was not called on QgsPalLayerSettings object!" );
 
  587  initPropertyDefinitions();
 
  588  return *sPropertyDefinitions();
 
  602  return mRotationUnit;
 
  607  mRotationUnit = angleUnit;
 
  613  QString newValue = value;
 
  614  if ( !value.isEmpty() && !value.contains( QLatin1String( 
"~~" ) ) )
 
  617    values << QStringLiteral( 
"1" ); 
 
  618    values << QStringLiteral( 
"0" );
 
  621    newValue = values.join( QLatin1String( 
"~~" ) );
 
  629  QString newPropertyName = 
"labeling/dataDefined/" + sPropertyDefinitions()->value( p ).name();
 
  630  QVariant newPropertyField = layer->
customProperty( newPropertyName, QVariant() );
 
  632  if ( !newPropertyField.isValid() )
 
  635  QString ddString = newPropertyField.toString();
 
  637  if ( !ddString.isEmpty() && ddString != QLatin1String( 
"0~~0~~~~" ) )
 
  641    QStringList ddv = newStyleString.split( QStringLiteral( 
"~~" ) );
 
  643    bool active = ddv.at( 0 ).toInt();
 
  644    if ( ddv.at( 1 ).toInt() )
 
  660void QgsPalLayerSettings::readOldDataDefinedPropertyMap( 
QgsVectorLayer *layer, QDomElement *parentElem )
 
  662  if ( !layer && !parentElem )
 
  667  QgsPropertiesDefinition::const_iterator i = sPropertyDefinitions()->constBegin();
 
  668  for ( ; i != sPropertyDefinitions()->constEnd(); ++i )
 
  673      readOldDataDefinedProperty( layer, 
static_cast< Property >( i.key() ) );
 
  675    else if ( parentElem )
 
  678      QDomElement e = parentElem->firstChildElement( i.value().name() );
 
  681        bool active = e.attribute( QStringLiteral( 
"active" ) ).compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0;
 
  682        bool isExpression = e.attribute( QStringLiteral( 
"useExpr" ) ).compare( QLatin1String( 
"true" ), Qt::CaseInsensitive ) == 0;
 
  696void QgsPalLayerSettings::readFromLayerCustomProperties( 
QgsVectorLayer *layer )
 
  698  if ( layer->
customProperty( QStringLiteral( 
"labeling" ) ).toString() != QLatin1String( 
"pal" ) )
 
  723  QDomDocument doc( QStringLiteral( 
"substitutions" ) );
 
  724  doc.setContent( layer->
customProperty( QStringLiteral( 
"labeling/substitutions" ) ).toString() );
 
  725  QDomElement replacementElem = doc.firstChildElement( QStringLiteral( 
"substitutions" ) );
 
  746  mLineSettings.
setPlacementFlags( 
static_cast< QgsLabeling::LinePlacementFlags 
>( layer->
customProperty( QStringLiteral( 
"labeling/placementFlags" ) ).toUInt() ) );
 
  755  if ( layer->
customProperty( QStringLiteral( 
"labeling/distMapUnitScale" ) ).toString().isEmpty() )
 
  758    double oldMin = layer->
customProperty( QStringLiteral( 
"labeling/distMapUnitMinScale" ), 0.0 ).toDouble();
 
  760    double oldMax = layer->
customProperty( QStringLiteral( 
"labeling/distMapUnitMaxScale" ), 0.0 ).toDouble();
 
  771  if ( layer->
customProperty( QStringLiteral( 
"labeling/labelOffsetInMapUnits" ), QVariant( 
true ) ).toBool() )
 
  776  if ( layer->
customProperty( QStringLiteral( 
"labeling/labelOffsetMapUnitScale" ) ).toString().isEmpty() )
 
  779    double oldMin = layer->
customProperty( QStringLiteral( 
"labeling/labelOffsetMapUnitMinScale" ), 0.0 ).toDouble();
 
  781    double oldMax = layer->
customProperty( QStringLiteral( 
"labeling/labelOffsetMapUnitMaxScale" ), 0.0 ).toDouble();
 
  789  QVariant tempAngle = layer->
customProperty( QStringLiteral( 
"labeling/angleOffset" ), QVariant() );
 
  790  if ( tempAngle.isValid() )
 
  792    double oldAngle = layer->
customProperty( QStringLiteral( 
"labeling/angleOffset" ), QVariant( 0.0 ) ).toDouble();
 
  806  switch ( layer->
customProperty( QStringLiteral( 
"labeling/repeatDistanceUnit" ), QVariant( 1 ) ).toUInt() )
 
  821  if ( layer->
customProperty( QStringLiteral( 
"labeling/repeatDistanceMapUnitScale" ) ).toString().isEmpty() )
 
  824    double oldMin = layer->
customProperty( QStringLiteral( 
"labeling/repeatDistanceMapUnitMinScale" ), 0.0 ).toDouble();
 
  826    double oldMax = layer->
customProperty( QStringLiteral( 
"labeling/repeatDistanceMapUnitMaxScale" ), 0.0 ).toDouble();
 
  835  double scalemn = layer->
customProperty( QStringLiteral( 
"labeling/scaleMin" ), QVariant( 0 ) ).toDouble();
 
  836  double scalemx = layer->
customProperty( QStringLiteral( 
"labeling/scaleMax" ), QVariant( 0 ) ).toDouble();
 
  839  QVariant scalevis = layer->
customProperty( QStringLiteral( 
"labeling/scaleVisibility" ), QVariant() );
 
  840  if ( scalevis.isValid() )
 
  846  else if ( scalemn > 0 || scalemx > 0 )
 
  862  if ( layer->
customProperty( QStringLiteral( 
"labeling/displayAll" ), QVariant( 
false ) ).toBool() )
 
  880  mObstacleSettings.
setFactor( layer->
customProperty( QStringLiteral( 
"labeling/obstacleFactor" ), QVariant( 1.0 ) ).toDouble() );
 
  882  zIndex = layer->
customProperty( QStringLiteral( 
"labeling/zIndex" ), QVariant( 0.0 ) ).toDouble();
 
  884  mDataDefinedProperties.
clear();
 
  885  if ( layer->
customProperty( QStringLiteral( 
"labeling/ddProperties" ) ).isValid() )
 
  887    QDomDocument doc( QStringLiteral( 
"dd" ) );
 
  888    doc.setContent( layer->
customProperty( QStringLiteral( 
"labeling/ddProperties" ) ).toString() );
 
  889    QDomElement elem = doc.firstChildElement( QStringLiteral( 
"properties" ) );
 
  890    mDataDefinedProperties.
readXml( elem, *sPropertyDefinitions() );
 
  895    readOldDataDefinedPropertyMap( layer, 
nullptr );
 
  939  QDomElement textStyleElem = elem.firstChildElement( QStringLiteral( 
"text-style" ) );
 
  940  fieldName = textStyleElem.attribute( QStringLiteral( 
"fieldName" ) );
 
  941  isExpression = textStyleElem.attribute( QStringLiteral( 
"isExpression" ) ).toInt();
 
  943  mFormat.
readXml( elem, context );
 
  945  previewBkgrdColor = QColor( textStyleElem.attribute( QStringLiteral( 
"previewBkgrdColor" ), QStringLiteral( 
"#ffffff" ) ) );
 
  948  useSubstitutions = textStyleElem.attribute( QStringLiteral( 
"useSubstitutions" ) ).toInt();
 
  949  mLegendString = textStyleElem.attribute( QStringLiteral( 
"legendString" ), QObject::tr( 
"Aa" ) );
 
  952  QDomElement textFormatElem = elem.firstChildElement( QStringLiteral( 
"text-format" ) );
 
  953  wrapChar = textFormatElem.attribute( QStringLiteral( 
"wrapChar" ) );
 
  954  autoWrapLength = textFormatElem.attribute( QStringLiteral( 
"autoWrapLength" ), QStringLiteral( 
"0" ) ).toInt();
 
  955  useMaxLineLengthForAutoWrap = textFormatElem.attribute( QStringLiteral( 
"useMaxLineLengthForAutoWrap" ), QStringLiteral( 
"1" ) ).toInt();
 
  956  multilineAlign = 
static_cast< Qgis::LabelMultiLineAlignment >( textFormatElem.attribute( QStringLiteral( 
"multilineAlign" ), QString::number( 
static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) ) ).toUInt() );
 
  957  mLineSettings.
setAddDirectionSymbol( textFormatElem.attribute( QStringLiteral( 
"addDirectionSymbol" ) ).toInt() );
 
  958  mLineSettings.
setLeftDirectionSymbol( textFormatElem.attribute( QStringLiteral( 
"leftDirectionSymbol" ), QStringLiteral( 
"<" ) ) );
 
  959  mLineSettings.
setRightDirectionSymbol( textFormatElem.attribute( QStringLiteral( 
"rightDirectionSymbol" ), QStringLiteral( 
">" ) ) );
 
  960  mLineSettings.
setReverseDirectionSymbol( textFormatElem.attribute( QStringLiteral( 
"reverseDirectionSymbol" ) ).toInt() );
 
  962  formatNumbers = textFormatElem.attribute( QStringLiteral( 
"formatNumbers" ) ).toInt();
 
  963  decimals = textFormatElem.attribute( QStringLiteral( 
"decimals" ) ).toInt();
 
  964  plusSign = textFormatElem.attribute( QStringLiteral( 
"plussign" ) ).toInt();
 
  967  QDomElement placementElem = elem.firstChildElement( QStringLiteral( 
"placement" ) );
 
  969  mLineSettings.
setPlacementFlags( 
static_cast< QgsLabeling::LinePlacementFlags 
>( placementElem.attribute( QStringLiteral( 
"placementFlags" ) ).toUInt() ) );
 
  970  mPolygonPlacementFlags = 
static_cast< QgsLabeling::PolygonPlacementFlags 
>( placementElem.attribute( QStringLiteral( 
"polygonPlacementFlags" ), QString::number( 
static_cast< int >( QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon ) ) ).toInt() );
 
  972  centroidWhole = placementElem.attribute( QStringLiteral( 
"centroidWhole" ), QStringLiteral( 
"0" ) ).toInt();
 
  973  centroidInside = placementElem.attribute( QStringLiteral( 
"centroidInside" ), QStringLiteral( 
"0" ) ).toInt();
 
  977  fitInPolygonOnly = placementElem.attribute( QStringLiteral( 
"fitInPolygonOnly" ), QStringLiteral( 
"0" ) ).toInt();
 
  978  dist = placementElem.attribute( QStringLiteral( 
"dist" ) ).toDouble();
 
  979  if ( !placementElem.hasAttribute( QStringLiteral( 
"distUnits" ) ) )
 
  981    if ( placementElem.attribute( QStringLiteral( 
"distInMapUnits" ) ).toInt() )
 
  990  if ( !placementElem.hasAttribute( QStringLiteral( 
"distMapUnitScale" ) ) )
 
  993    double oldMin = placementElem.attribute( QStringLiteral( 
"distMapUnitMinScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
  995    double oldMax = placementElem.attribute( QStringLiteral( 
"distMapUnitMaxScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1003  quadOffset = 
static_cast< Qgis::LabelQuadrantPosition >( placementElem.attribute( QStringLiteral( 
"quadOffset" ), QString::number( 
static_cast< int >( Qgis::LabelQuadrantPosition::Over ) ) ).toUInt() );
 
 1004  xOffset = placementElem.attribute( QStringLiteral( 
"xOffset" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1005  yOffset = placementElem.attribute( QStringLiteral( 
"yOffset" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1006  if ( !placementElem.hasAttribute( QStringLiteral( 
"offsetUnits" ) ) )
 
 1014  if ( !placementElem.hasAttribute( QStringLiteral( 
"labelOffsetMapUnitScale" ) ) )
 
 1017    double oldMin = placementElem.attribute( QStringLiteral( 
"labelOffsetMapUnitMinScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1019    double oldMax = placementElem.attribute( QStringLiteral( 
"labelOffsetMapUnitMaxScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1027  if ( placementElem.hasAttribute( QStringLiteral( 
"angleOffset" ) ) )
 
 1029    double oldAngle = placementElem.attribute( QStringLiteral( 
"angleOffset" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1034    angleOffset = placementElem.attribute( QStringLiteral( 
"rotationAngle" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1037  preserveRotation = placementElem.attribute( QStringLiteral( 
"preserveRotation" ), QStringLiteral( 
"1" ) ).toInt();
 
 1039  maxCurvedCharAngleIn = placementElem.attribute( QStringLiteral( 
"maxCurvedCharAngleIn" ), QStringLiteral( 
"25" ) ).toDouble();
 
 1040  maxCurvedCharAngleOut = placementElem.attribute( QStringLiteral( 
"maxCurvedCharAngleOut" ), QStringLiteral( 
"-25" ) ).toDouble();
 
 1041  priority = placementElem.attribute( QStringLiteral( 
"priority" ) ).toInt();
 
 1042  repeatDistance = placementElem.attribute( QStringLiteral( 
"repeatDistance" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1043  if ( !placementElem.hasAttribute( QStringLiteral( 
"repeatDistanceUnits" ) ) )
 
 1046    switch ( placementElem.attribute( QStringLiteral( 
"repeatDistanceUnit" ), QString::number( 1 ) ).toUInt() )
 
 1066  if ( !placementElem.hasAttribute( QStringLiteral( 
"repeatDistanceMapUnitScale" ) ) )
 
 1069    double oldMin = placementElem.attribute( QStringLiteral( 
"repeatDistanceMapUnitMinScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1071    double oldMax = placementElem.attribute( QStringLiteral( 
"repeatDistanceMapUnitMaxScale" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1079  mLineSettings.
setOverrunDistance( placementElem.attribute( QStringLiteral( 
"overrunDistance" ), QStringLiteral( 
"0" ) ).toDouble() );
 
 1082  mLineSettings.
setLineAnchorPercent( placementElem.attribute( QStringLiteral( 
"lineAnchorPercent" ), QStringLiteral( 
"0.5" ) ).toDouble() );
 
 1088  geometryGenerator = placementElem.attribute( QStringLiteral( 
"geometryGenerator" ) );
 
 1094  mPlacementSettings.
setAllowDegradedPlacement( placementElem.attribute( QStringLiteral( 
"allowDegraded" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1097  QDomElement renderingElem = elem.firstChildElement( QStringLiteral( 
"rendering" ) );
 
 1099  drawLabels = renderingElem.attribute( QStringLiteral( 
"drawLabels" ), QStringLiteral( 
"1" ) ).toInt();
 
 1101  maximumScale = renderingElem.attribute( QStringLiteral( 
"scaleMin" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1102  minimumScale = renderingElem.attribute( QStringLiteral( 
"scaleMax" ), QStringLiteral( 
"0" ) ).toDouble();
 
 1103  scaleVisibility = renderingElem.attribute( QStringLiteral( 
"scaleVisibility" ) ).toInt();
 
 1105  fontLimitPixelSize = renderingElem.attribute( QStringLiteral( 
"fontLimitPixelSize" ), QStringLiteral( 
"0" ) ).toInt();
 
 1106  fontMinPixelSize = renderingElem.attribute( QStringLiteral( 
"fontMinPixelSize" ), QStringLiteral( 
"0" ) ).toInt();
 
 1107  fontMaxPixelSize = renderingElem.attribute( QStringLiteral( 
"fontMaxPixelSize" ), QStringLiteral( 
"10000" ) ).toInt();
 
 1109  if ( placementElem.hasAttribute( QStringLiteral( 
"overlapHandling" ) ) )
 
 1116    if ( renderingElem.attribute( QStringLiteral( 
"displayAll" ), QStringLiteral( 
"0" ) ).toInt() )
 
 1127  upsidedownLabels = 
static_cast< Qgis::UpsideDownLabelHandling >( renderingElem.attribute( QStringLiteral( 
"upsidedownLabels" ), QString::number( 
static_cast< int >( Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels ) ) ).toUInt() );
 
 1129  labelPerPart = renderingElem.attribute( QStringLiteral( 
"labelPerPart" ) ).toInt();
 
 1130  mLineSettings.
setMergeLines( renderingElem.attribute( QStringLiteral( 
"mergeLines" ) ).toInt() );
 
 1131  mThinningSettings.
setMinimumFeatureSize( renderingElem.attribute( QStringLiteral( 
"minFeatureSize" ) ).toDouble() );
 
 1132  mThinningSettings.
setLimitNumberLabelsEnabled( renderingElem.attribute( QStringLiteral( 
"limitNumLabels" ), QStringLiteral( 
"0" ) ).toInt() );
 
 1133  mThinningSettings.
setMaximumNumberLabels( renderingElem.attribute( QStringLiteral( 
"maxNumLabels" ), QStringLiteral( 
"2000" ) ).toInt() );
 
 1134  mObstacleSettings.
setIsObstacle( renderingElem.attribute( QStringLiteral( 
"obstacle" ), QStringLiteral( 
"1" ) ).toInt() );
 
 1135  mObstacleSettings.
setFactor( renderingElem.attribute( QStringLiteral( 
"obstacleFactor" ), QStringLiteral( 
"1" ) ).toDouble() );
 
 1137  zIndex = renderingElem.attribute( QStringLiteral( 
"zIndex" ), QStringLiteral( 
"0.0" ) ).toDouble();
 
 1140  QDomElement ddElem = elem.firstChildElement( QStringLiteral( 
"dd_properties" ) );
 
 1141  if ( !ddElem.isNull() )
 
 1143    mDataDefinedProperties.
readXml( ddElem, *sPropertyDefinitions() );
 
 1148    mDataDefinedProperties.
clear();
 
 1149    QDomElement ddElem = elem.firstChildElement( QStringLiteral( 
"data-defined" ) );
 
 1150    readOldDataDefinedPropertyMap( 
nullptr, &ddElem );
 
 1191  const QString calloutType = elem.attribute( QStringLiteral( 
"calloutType" ) );
 
 1192  if ( calloutType.isEmpty() )
 
 1204  QDomElement textStyleElem = mFormat.
writeXml( doc, context );
 
 1207  textStyleElem.setAttribute( QStringLiteral( 
"fieldName" ), 
fieldName );
 
 1208  textStyleElem.setAttribute( QStringLiteral( 
"isExpression" ), 
isExpression );
 
 1209  QDomElement replacementElem = doc.createElement( QStringLiteral( 
"substitutions" ) );
 
 1211  textStyleElem.appendChild( replacementElem );
 
 1212  textStyleElem.setAttribute( QStringLiteral( 
"useSubstitutions" ), 
useSubstitutions );
 
 1213  textStyleElem.setAttribute( QStringLiteral( 
"legendString" ), mLegendString );
 
 1216  QDomElement textFormatElem = doc.createElement( QStringLiteral( 
"text-format" ) );
 
 1217  textFormatElem.setAttribute( QStringLiteral( 
"wrapChar" ), 
wrapChar );
 
 1218  textFormatElem.setAttribute( QStringLiteral( 
"autoWrapLength" ), 
autoWrapLength );
 
 1220  textFormatElem.setAttribute( QStringLiteral( 
"multilineAlign" ), 
static_cast< unsigned int >( 
multilineAlign ) );
 
 1221  textFormatElem.setAttribute( QStringLiteral( 
"addDirectionSymbol" ), mLineSettings.
addDirectionSymbol() );
 
 1222  textFormatElem.setAttribute( QStringLiteral( 
"leftDirectionSymbol" ), mLineSettings.
leftDirectionSymbol() );
 
 1223  textFormatElem.setAttribute( QStringLiteral( 
"rightDirectionSymbol" ), mLineSettings.
rightDirectionSymbol() );
 
 1224  textFormatElem.setAttribute( QStringLiteral( 
"reverseDirectionSymbol" ), mLineSettings.
reverseDirectionSymbol() );
 
 1225  textFormatElem.setAttribute( QStringLiteral( 
"placeDirectionSymbol" ), 
static_cast< unsigned int >( mLineSettings.
directionSymbolPlacement() ) );
 
 1226  textFormatElem.setAttribute( QStringLiteral( 
"formatNumbers" ), 
formatNumbers );
 
 1227  textFormatElem.setAttribute( QStringLiteral( 
"decimals" ), 
decimals );
 
 1228  textFormatElem.setAttribute( QStringLiteral( 
"plussign" ), 
plusSign );
 
 1231  QDomElement placementElem = doc.createElement( QStringLiteral( 
"placement" ) );
 
 1232  placementElem.setAttribute( QStringLiteral( 
"placement" ), 
static_cast< int >( 
placement ) );
 
 1233  placementElem.setAttribute( QStringLiteral( 
"polygonPlacementFlags" ), 
static_cast< int >( mPolygonPlacementFlags ) );
 
 1234  placementElem.setAttribute( QStringLiteral( 
"placementFlags" ), 
static_cast< unsigned int >( mLineSettings.
placementFlags() ) );
 
 1235  placementElem.setAttribute( QStringLiteral( 
"centroidWhole" ), 
centroidWhole );
 
 1236  placementElem.setAttribute( QStringLiteral( 
"centroidInside" ), 
centroidInside );
 
 1238  placementElem.setAttribute( QStringLiteral( 
"fitInPolygonOnly" ), 
fitInPolygonOnly );
 
 1239  placementElem.setAttribute( QStringLiteral( 
"dist" ), 
dist );
 
 1242  placementElem.setAttribute( QStringLiteral( 
"offsetType" ), 
static_cast< unsigned int >( 
offsetType ) );
 
 1243  placementElem.setAttribute( QStringLiteral( 
"quadOffset" ), 
static_cast< unsigned int >( 
quadOffset ) );
 
 1244  placementElem.setAttribute( QStringLiteral( 
"xOffset" ), 
xOffset );
 
 1245  placementElem.setAttribute( QStringLiteral( 
"yOffset" ), 
yOffset );
 
 1248  placementElem.setAttribute( QStringLiteral( 
"rotationAngle" ), 
angleOffset );
 
 1249  placementElem.setAttribute( QStringLiteral( 
"preserveRotation" ), 
preserveRotation );
 
 1250  placementElem.setAttribute( QStringLiteral( 
"rotationUnit" ), 
qgsEnumValueToKey( mRotationUnit ) );
 
 1253  placementElem.setAttribute( QStringLiteral( 
"priority" ), 
priority );
 
 1254  placementElem.setAttribute( QStringLiteral( 
"repeatDistance" ), 
repeatDistance );
 
 1257  placementElem.setAttribute( QStringLiteral( 
"overrunDistance" ), mLineSettings.
overrunDistance() );
 
 1260  placementElem.setAttribute( QStringLiteral( 
"lineAnchorPercent" ), mLineSettings.
lineAnchorPercent() );
 
 1261  placementElem.setAttribute( QStringLiteral( 
"lineAnchorType" ), 
static_cast< int >( mLineSettings.
anchorType() ) );
 
 1262  placementElem.setAttribute( QStringLiteral( 
"lineAnchorClipping" ), 
static_cast< int >( mLineSettings.
anchorClipping() ) );
 
 1265  placementElem.setAttribute( QStringLiteral( 
"geometryGenerator" ), 
geometryGenerator );
 
 1267  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWkbTypes::GeometryType>() );
 
 1268  placementElem.setAttribute( QStringLiteral( 
"geometryGeneratorType" ), metaEnum.valueToKey( 
geometryGeneratorType ) );
 
 1270  placementElem.setAttribute( QStringLiteral( 
"layerType" ), metaEnum.valueToKey( 
layerType ) );
 
 1273  placementElem.setAttribute( QStringLiteral( 
"allowDegraded" ), mPlacementSettings.
allowDegradedPlacement() ? QStringLiteral( 
"1" ) : QStringLiteral( 
"0" ) );
 
 1276  QDomElement renderingElem = doc.createElement( QStringLiteral( 
"rendering" ) );
 
 1277  renderingElem.setAttribute( QStringLiteral( 
"drawLabels" ), 
drawLabels );
 
 1278  renderingElem.setAttribute( QStringLiteral( 
"scaleVisibility" ), 
scaleVisibility );
 
 1279  renderingElem.setAttribute( QStringLiteral( 
"scaleMin" ), 
maximumScale );
 
 1280  renderingElem.setAttribute( QStringLiteral( 
"scaleMax" ), 
minimumScale );
 
 1281  renderingElem.setAttribute( QStringLiteral( 
"fontLimitPixelSize" ), 
fontLimitPixelSize );
 
 1282  renderingElem.setAttribute( QStringLiteral( 
"fontMinPixelSize" ), 
fontMinPixelSize );
 
 1283  renderingElem.setAttribute( QStringLiteral( 
"fontMaxPixelSize" ), 
fontMaxPixelSize );
 
 1284  renderingElem.setAttribute( QStringLiteral( 
"upsidedownLabels" ), 
static_cast< unsigned int >( 
upsidedownLabels ) );
 
 1286  renderingElem.setAttribute( QStringLiteral( 
"labelPerPart" ), 
labelPerPart );
 
 1287  renderingElem.setAttribute( QStringLiteral( 
"mergeLines" ), mLineSettings.
mergeLines() );
 
 1288  renderingElem.setAttribute( QStringLiteral( 
"minFeatureSize" ), mThinningSettings.
minimumFeatureSize() );
 
 1290  renderingElem.setAttribute( QStringLiteral( 
"maxNumLabels" ), mThinningSettings.
maximumNumberLabels() );
 
 1291  renderingElem.setAttribute( QStringLiteral( 
"obstacle" ), mObstacleSettings.
isObstacle() );
 
 1292  renderingElem.setAttribute( QStringLiteral( 
"obstacleFactor" ), mObstacleSettings.
factor() );
 
 1293  renderingElem.setAttribute( QStringLiteral( 
"obstacleType" ), 
static_cast< unsigned int >( mObstacleSettings.
type() ) );
 
 1294  renderingElem.setAttribute( QStringLiteral( 
"zIndex" ), 
zIndex );
 
 1295  renderingElem.setAttribute( QStringLiteral( 
"unplacedVisibility" ), 
static_cast< int >( mUnplacedVisibility ) );
 
 1297  QDomElement ddElem = doc.createElement( QStringLiteral( 
"dd_properties" ) );
 
 1298  mDataDefinedProperties.
writeXml( ddElem, *sPropertyDefinitions() );
 
 1300  QDomElement elem = doc.createElement( QStringLiteral( 
"settings" ) );
 
 1301  elem.appendChild( textStyleElem );
 
 1302  elem.appendChild( textFormatElem );
 
 1303  elem.appendChild( placementElem );
 
 1304  elem.appendChild( renderingElem );
 
 1305  elem.appendChild( ddElem );
 
 1309    elem.setAttribute( QStringLiteral( 
"calloutType" ), mCallout->type() );
 
 1310    mCallout->saveProperties( doc, elem, context );
 
 1325  QPixmap pixmap( size );
 
 1326  pixmap.fill( Qt::transparent );
 
 1328  painter.begin( &pixmap );
 
 1330  painter.setRenderHint( QPainter::Antialiasing );
 
 1332  QRect rect( 0, 0, size.width(), size.height() );
 
 1335  painter.setPen( Qt::NoPen );
 
 1337  if ( ( background1.lightnessF() < 0.7 ) )
 
 1339    background1 = background1.darker( 125 );
 
 1343    background1 = background1.lighter( 125 );
 
 1346  QLinearGradient linearGrad( QPointF( 0, 0 ), QPointF( 0, rect.height() ) );
 
 1347  linearGrad.setColorAt( 0, background1 );
 
 1348  linearGrad.setColorAt( 1, background2 );
 
 1349  painter.setBrush( QBrush( linearGrad ) );
 
 1350  if ( size.width() > 30 )
 
 1352    painter.drawRoundedRect( rect, 6, 6 );
 
 1357    painter.drawRect( rect );
 
 1359  painter.setBrush( Qt::NoBrush );
 
 1360  painter.setPen( Qt::NoPen );
 
 1369  QWidget *activeWindow = QApplication::activeWindow();
 
 1370  const double logicalDpiX = activeWindow && activeWindow->screen() ? activeWindow->screen()->logicalDotsPerInchX() : 96.0;
 
 1380             ? fontSize * tempFormat.
buffer().
size() / 100
 
 1385  double ytrans = 0.0;
 
 1388                       ? fontSize * tempFormat.
buffer().
size() / 100
 
 1393  const QStringList text = QStringList() << ( previewText.isEmpty() ? settings.
legendString() : previewText );
 
 1395  QRectF textRect = rect;
 
 1396  textRect.setLeft( xtrans + padding );
 
 1397  textRect.setWidth( rect.width() - xtrans - 2 * padding );
 
 1399  if ( textRect.width() > 2000 )
 
 1400    textRect.setWidth( 2000 - 2 * padding );
 
 1402  const double bottom = textRect.height() / 2 + textHeight / 2;
 
 1403  textRect.setTop( bottom - textHeight );
 
 1404  textRect.setBottom( bottom );
 
 1415    QRectF labelRect( textRect.left() + ( textRect.width() - textWidth ) / 2.0, textRect.top(), textWidth, textRect.height() );
 
 1422  if ( size.width() > 30 )
 
 1427          rect.width() - iconWidth * 3, rect.height() - iconWidth * 3,
 
 1428          iconWidth * 2, iconWidth * 2 ), Qt::AlignRight | Qt::AlignBottom );
 
 1432  painter.setBrush( Qt::NoBrush );
 
 1434  if ( size.width() > 30 )
 
 1436    painter.drawRoundedRect( rect, 6, 6 );
 
 1441    painter.drawRect( rect );
 
 1450  return mUnplacedVisibility;
 
 1455  mUnplacedVisibility = visibility;
 
 1460  return QgsPalLabeling::checkMinimumSizeMM( 
ct, geom, minSize );
 
 1470  QString textCopy( text );
 
 1473  std::unique_ptr< QgsRenderContext > scopedRc;
 
 1478      scopedRc->expressionContext().setFeature( *f );
 
 1594  if ( wrapchr.isEmpty() )
 
 1596    wrapchr = QStringLiteral( 
"\n" ); 
 
 1601       && ( !leftDirSymb.isEmpty() || !rightDirSymb.isEmpty() ) )
 
 1603    QString dirSym = leftDirSymb;
 
 1605    if ( fm->horizontalAdvance( rightDirSymb ) > fm->horizontalAdvance( dirSym ) )
 
 1606      dirSym = rightDirSymb;
 
 1608    switch ( placeDirSymb )
 
 1611        textCopy.append( dirSym );
 
 1616        textCopy.prepend( dirSym + QStringLiteral( 
"\n" ) );
 
 1621  double w = 0.0, h = 0.0, rw = 0.0, rh = 0.0;
 
 1622  double labelHeight = fm->ascent() + fm->descent(); 
 
 1624  QStringList multiLineSplit;
 
 1631    const QSizeF size = documentMetrics->
documentSize( Qgis::TextLayoutMode::Labeling, orientation );
 
 1638    const int lines = multiLineSplit.size();
 
 1642    switch ( orientation )
 
 1644      case Qgis::TextOrientation::Horizontal:
 
 1648        for ( 
const QString &line : std::as_const( multiLineSplit ) )
 
 1650          w = std::max( w, fm->horizontalAdvance( line ) );
 
 1655      case Qgis::TextOrientation::Vertical:
 
 1657        double letterSpacing = mFormat.
scaledFont( *context ).letterSpacing();
 
 1658        double labelWidth = fm->maxWidth();
 
 1661        int maxLineLength = 0;
 
 1662        for ( 
const QString &line : std::as_const( multiLineSplit ) )
 
 1664          maxLineLength = std::max( maxLineLength, 
static_cast<int>( line.length() ) );
 
 1666        h = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;
 
 1670      case Qgis::TextOrientation::RotationBased:
 
 1672        double widthHorizontal = 0.0;
 
 1673        for ( 
const QString &line : std::as_const( multiLineSplit ) )
 
 1675          widthHorizontal = std::max( w, fm->horizontalAdvance( line ) );
 
 1678        double widthVertical = 0.0;
 
 1679        double letterSpacing = mFormat.
scaledFont( *context ).letterSpacing();
 
 1680        double labelWidth = fm->maxWidth();
 
 1683        double heightHorizontal = 0.0;
 
 1686        double heightVertical = 0.0;
 
 1687        int maxLineLength = 0;
 
 1688        for ( 
const QString &line : std::as_const( multiLineSplit ) )
 
 1690          maxLineLength = std::max( maxLineLength, 
static_cast<int>( line.length() ) );
 
 1692        heightVertical = fm->ascent() * maxLineLength + ( maxLineLength - 1 ) * letterSpacing;
 
 1694        w = widthHorizontal;
 
 1695        rw = heightVertical;
 
 1696        h = heightHorizontal;
 
 1705  labelX = std::fabs( ptSize.
x() - 
ptZero.
x() );
 
 1706  labelY = std::fabs( ptSize.
y() - 
ptZero.
y() );
 
 1711  if ( rotatedLabelX && rotatedLabelY )
 
 1713    *rotatedLabelX = rw * uPP;
 
 1714    *rotatedLabelY = rh * uPP;
 
 1730  bool isObstacle = mObstacleSettings.
isObstacle();
 
 1738      return registerObstacleFeature( f, context, obstacleGeometry );
 
 1753    if ( obstacleGeometry.
isNull() )
 
 1766  dataDefinedValues.clear();
 
 1783  if ( useScaleVisibility )
 
 1796      maxScale = 1 / std::fabs( maxScale );
 
 1815      minScale = 1 / std::fabs( minScale );
 
 1824  QFont labelFont = mFormat.
font();
 
 1832    QString units = exprVal.toString();
 
 1833    if ( !units.isEmpty() )
 
 1843  double fontSize = mFormat.
size();
 
 1849  if ( fontSize <= 0.0 )
 
 1856  if ( fontPixelSize < 1 )
 
 1860  labelFont.setPixelSize( fontPixelSize );
 
 1872      if ( fontMinPixel > labelFont.pixelSize() || labelFont.pixelSize() > fontMaxPixel )
 
 1884  labelFont.setCapitalization( QFont::MixedCase ); 
 
 1886  parseTextStyle( labelFont, fontunits, context );
 
 1889    parseTextFormatting( context );
 
 1890    parseTextBuffer( context );
 
 1891    parseTextMask( context );
 
 1892    parseShapeBackground( context );
 
 1893    parseDropShadow( context );
 
 1941      QString fcase = exprVal.toString().trimmed();
 
 1942      QgsDebugMsgLevel( QStringLiteral( 
"exprVal FontCase:%1" ).arg( fcase ), 4 );
 
 1944      if ( !fcase.isEmpty() )
 
 1946        if ( fcase.compare( QLatin1String( 
"NoChange" ), Qt::CaseInsensitive ) == 0 )
 
 1950        else if ( fcase.compare( QLatin1String( 
"Upper" ), Qt::CaseInsensitive ) == 0 )
 
 1954        else if ( fcase.compare( QLatin1String( 
"Lower" ), Qt::CaseInsensitive ) == 0 )
 
 1958        else if ( fcase.compare( QLatin1String( 
"Capitalize" ), Qt::CaseInsensitive ) == 0 )
 
 1962        else if ( fcase.compare( QLatin1String( 
"Title" ), Qt::CaseInsensitive ) == 0 )
 
 1966#if defined(HAS_KDE_QT5_SMALL_CAPS_FIX) || QT_VERSION >= QT_VERSION_CHECK(6, 3, 0) 
 1967        else if ( fcase.compare( QLatin1String( 
"SmallCaps" ), Qt::CaseInsensitive ) == 0 )
 
 1971        else if ( fcase.compare( QLatin1String( 
"AllSmallCaps" ), Qt::CaseInsensitive ) == 0 )
 
 1987  if ( evalFormatNumbers )
 
 1991    if ( decimalPlaces <= 0 ) 
 
 1997    QVariant textV( labelText );
 
 1999    double d = textV.toDouble( &ok );
 
 2002      QString numberFormat;
 
 2003      if ( d > 0 && signPlus )
 
 2005        numberFormat.append( 
'+' );
 
 2007      numberFormat.append( 
"%1" );
 
 2008      labelText = numberFormat.arg( d, 0, 
'f', decimalPlaces );
 
 2013  std::unique_ptr<QFontMetricsF> labelFontMetrics( 
new QFontMetricsF( labelFont ) );
 
 2016  double rotatedLabelX;
 
 2017  double rotatedLabelY;
 
 2021  if ( 
format().allowHtmlFormatting() && !labelText.isEmpty() )
 
 2025    calculateLabelSize( labelFontMetrics.get(), labelText, labelWidth, labelHeight, 
mCurFeat, &context, &rotatedLabelX, &rotatedLabelY, &doc, &documentMetrics );
 
 2029    calculateLabelSize( labelFontMetrics.get(), labelText, labelWidth, labelHeight, 
mCurFeat, &context, &rotatedLabelX, &rotatedLabelY, 
nullptr, 
nullptr );
 
 2034  double maxcharanglein = 20.0; 
 
 2035  double maxcharangleout = -20.0; 
 
 2050        maxcharanglein = std::clamp( 
static_cast< double >( maxcharanglePt.x() ), 20.0, 60.0 );
 
 2051        maxcharangleout = std::clamp( 
static_cast< double >( maxcharanglePt.y() ), 20.0, 95.0 );
 
 2055    maxcharangleout = -( std::fabs( maxcharangleout ) );
 
 2065      QString 
str = exprVal.toString().trimmed();
 
 2068      if ( !
str.isEmpty() )
 
 2070        if ( 
str.compare( QLatin1String( 
"Visible" ), Qt::CaseInsensitive ) == 0 )
 
 2072          wholeCentroid = 
false;
 
 2074        else if ( 
str.compare( QLatin1String( 
"Whole" ), Qt::CaseInsensitive ) == 0 )
 
 2076          wholeCentroid = 
true;
 
 2090  std::unique_ptr<QgsGeometry> scopedClonedGeom;
 
 2096    geom = simplifier.
simplify( geom );
 
 2113  bool doClip = 
false;
 
 2114  if ( !centroidPoly || !wholeCentroid )
 
 2120  QgsLabeling::PolygonPlacementFlags polygonPlacement = mPolygonPlacementFlags;
 
 2126      if ( dataDefinedOutside.type() == QVariant::String )
 
 2128        const QString value = dataDefinedOutside.toString().trimmed();
 
 2129        if ( value.compare( QLatin1String( 
"force" ), Qt::CaseInsensitive ) == 0 )
 
 2132          polygonPlacement &= ~static_cast< int >( QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon );
 
 2133          polygonPlacement |= QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon;
 
 2135        else if ( value.compare( QLatin1String( 
"yes" ), Qt::CaseInsensitive ) == 0 )
 
 2138          polygonPlacement |= QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon;
 
 2140        else if ( value.compare( QLatin1String( 
"no" ), Qt::CaseInsensitive ) == 0 )
 
 2143          polygonPlacement &= ~static_cast< int >( QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon );
 
 2148        if ( dataDefinedOutside.toBool() )
 
 2151          polygonPlacement |= QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon;
 
 2156          polygonPlacement &= ~static_cast< int >( QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon );
 
 2184    permissibleZone = geom;
 
 2220  double minimumSize = 0.0;
 
 2230      if ( !checkMinimumSizeMM( context, geom, featureThinningSettings.
minimumFeatureSize() ) )
 
 2235  if ( !geos_geom_clone )
 
 2264  bool layerDefinedRotation = 
false;
 
 2265  bool dataDefinedRotation = 
false;
 
 2266  double xPos = 0.0, yPos = 0.0, 
angle = 0.0;
 
 2267  double quadOffsetX = 0.0, quadOffsetY = 0.0;
 
 2268  double offsetX = 0.0, offsetY = 0.0;
 
 2280  bool ddFixedQuad = 
false;
 
 2289      int quadInt = exprVal.toInt( &ok );
 
 2290      if ( ok && 0 <= quadInt && quadInt <= 8 )
 
 2301    case Qgis::LabelQuadrantPosition::AboveLeft:
 
 2305    case Qgis::LabelQuadrantPosition::Above:
 
 2309    case Qgis::LabelQuadrantPosition::AboveRight:
 
 2313    case Qgis::LabelQuadrantPosition::Left:
 
 2317    case Qgis::LabelQuadrantPosition::Right:
 
 2321    case Qgis::LabelQuadrantPosition::BelowLeft:
 
 2325    case Qgis::LabelQuadrantPosition::Below:
 
 2329    case Qgis::LabelQuadrantPosition::BelowRight:
 
 2333    case Qgis::LabelQuadrantPosition::Over:
 
 2360      QString units = exprVal.toString().trimmed();
 
 2361      if ( !units.isEmpty() )
 
 2367          offUnit = decodedUnits;
 
 2382    layerDefinedRotation = 
true;
 
 2395      const double rotation = exprVal.toDouble( &ok );
 
 2398        dataDefinedRotation = 
true;
 
 2406        angle = ( 360 - rotationDegrees ) * M_PI / 180.0;
 
 2411  bool hasDataDefinedPosition = 
false;
 
 2413    bool ddPosition = 
false;
 
 2425        bool ddXPos = 
false, ddYPos = 
false;
 
 2426        xPos = xPosProperty.toDouble( &ddXPos );
 
 2427        yPos = yPosProperty.toDouble( &ddYPos );
 
 2428        if ( ddXPos && ddYPos )
 
 2429          hasDataDefinedPosition = 
true;
 
 2440        if ( pointPosProperty.userType() == QMetaType::type( 
"QgsReferencedGeometry" ) )
 
 2445          if ( !referencedGeometryPoint.
isNull()
 
 2449        else if ( pointPosProperty.userType() == QMetaType::type( 
"QgsGeometry" ) )
 
 2456          hasDataDefinedPosition = 
true;
 
 2467      if ( hasDataDefinedPosition )
 
 2470        if ( layerDefinedRotation && !dataDefinedRotation )
 
 2481            QString haliString = exprVal.toString();
 
 2482            if ( haliString.compare( QLatin1String( 
"Center" ), Qt::CaseInsensitive ) == 0 )
 
 2484              xdiff -= labelWidth / 2.0;
 
 2486            else if ( haliString.compare( QLatin1String( 
"Right" ), Qt::CaseInsensitive ) == 0 )
 
 2488              xdiff -= labelWidth;
 
 2499            QString valiString = exprVal.toString();
 
 2500            if ( valiString.compare( QLatin1String( 
"Bottom" ), Qt::CaseInsensitive ) != 0 )
 
 2502              if ( valiString.compare( QLatin1String( 
"Top" ), Qt::CaseInsensitive ) == 0 )
 
 2504                ydiff -= labelHeight;;
 
 2508                double descentRatio = labelFontMetrics->descent() / labelFontMetrics->height();
 
 2509                if ( valiString.compare( QLatin1String( 
"Base" ), Qt::CaseInsensitive ) == 0 )
 
 2511                  ydiff -= labelHeight * descentRatio;
 
 2515                  double capHeightRatio = ( labelFontMetrics->boundingRect( 
'H' ).height() + 1 + labelFontMetrics->descent() ) / labelFontMetrics->height();
 
 2516                  ydiff -= labelHeight * capHeightRatio;
 
 2517                  if ( valiString.compare( QLatin1String( 
"Half" ), Qt::CaseInsensitive ) == 0 )
 
 2519                    ydiff += labelHeight * ( capHeightRatio - descentRatio ) / 2.0;
 
 2527        if ( dataDefinedRotation )
 
 2530          double xd = xdiff * std::cos( 
angle ) - ydiff * std::sin( 
angle );
 
 2531          double yd = xdiff * std::sin( 
angle ) + ydiff * std::cos( 
angle );
 
 2541          if ( 
const QgsPoint *point = qgsgeometry_cast< const QgsPoint * >( ddPoint.
constGet() ) )
 
 2549            QgsMessageLog::logMessage( QObject::tr( 
"Invalid data defined label position (%1, %2)" ).arg( xPos ).arg( yPos ), QObject::tr( 
"Labeling" ) );
 
 2550            hasDataDefinedPosition = 
false;
 
 2569  bool alwaysShow = 
false;
 
 2591      QString units = exprVal.toString().trimmed();
 
 2592      if ( !units.isEmpty() )
 
 2598          repeatUnits = decodedUnits;
 
 2624  bool labelAll = 
labelPerPart && !hasDataDefinedPosition;
 
 2625  if ( !hasDataDefinedPosition )
 
 2635  std::unique_ptr< QgsTextLabelFeature > labelFeature = std::make_unique< QgsTextLabelFeature>( feature.
id(), std::move( geos_geom_clone ), QSizeF( labelWidth, labelHeight ) );
 
 2636  labelFeature->setAnchorPosition( anchorPosition );
 
 2637  labelFeature->setFeature( feature );
 
 2638  labelFeature->setSymbol( symbol );
 
 2639  labelFeature->setDocument( doc, documentMetrics );
 
 2641    labelFeature->setRotatedSize( QSizeF( rotatedLabelX, rotatedLabelY ) );
 
 2644  labelFeature->setHasFixedPosition( hasDataDefinedPosition );
 
 2645  labelFeature->setFixedPosition( 
QgsPointXY( xPos, yPos ) );
 
 2647  labelFeature->setHasFixedAngle( dataDefinedRotation || ( !hasDataDefinedPosition && !
qgsDoubleNear( 
angle, 0.0 ) ) );
 
 2648  labelFeature->setFixedAngle( 
angle );
 
 2649  labelFeature->setQuadOffset( QPointF( quadOffsetX, quadOffsetY ) );
 
 2650  labelFeature->setPositionOffset( 
QgsPointXY( offsetX, offsetY ) );
 
 2652  labelFeature->setAlwaysShow( alwaysShow );
 
 2653  labelFeature->setRepeatDistance( repeatDist );
 
 2654  labelFeature->setLabelText( labelText );
 
 2655  labelFeature->setPermissibleZone( permissibleZone );
 
 2656  labelFeature->setOverrunDistance( overrunDistanceEval );
 
 2657  labelFeature->setOverrunSmoothDistance( overrunSmoothDist );
 
 2661  labelFeature->setLabelAllParts( labelAll );
 
 2663  labelFeature->setMinimumSize( minimumSize );
 
 2667    labelFeature->setSymbolSize( QSizeF( obstacleGeometry.
boundingBox().
width(),
 
 2673  double topMargin = std::max( 0.25 * labelFontMetrics->ascent(), 0.0 );
 
 2674  double bottomMargin = 1.0 + labelFontMetrics->descent();
 
 2675  QgsMargins vm( 0.0, topMargin, 0.0, bottomMargin );
 
 2677  labelFeature->setVisualMargin( vm );
 
 2680  QgsDebugMsgLevel( QStringLiteral( 
"PAL font stored definedFont: %1, Style: %2" ).arg( labelFont.toString(), labelFont.styleName() ), 4 );
 
 2681  labelFeature->setDefinedFont( labelFont );
 
 2683  labelFeature->setMaximumCharacterAngleInside( std::clamp( maxcharanglein, 20.0, 60.0 ) * M_PI / 180 );
 
 2684  labelFeature->setMaximumCharacterAngleOutside( std::clamp( maxcharangleout, -95.0, -20.0 ) * M_PI / 180 );
 
 2699      labelFeature->setTextMetrics( 
QgsTextLabelFeature::calculateTextMetrics( 
xform, context, labelFont, *labelFontMetrics, labelFont.letterSpacing(), labelFont.wordSpacing(), labelText, 
format().allowHtmlFormatting() ? &doc : 
nullptr, 
format().allowHtmlFormatting() ? &documentMetrics : 
nullptr ) );
 
 2708  double distance = 
dist;
 
 2722      QString units = exprVal.toString().trimmed();
 
 2723      QgsDebugMsgLevel( QStringLiteral( 
"exprVal DistanceUnits:%1" ).arg( units ), 4 );
 
 2724      if ( !units.isEmpty() )
 
 2730          distUnit = decodedUnits;
 
 2743    distance = ( distance < 0 ? -1 : 1 ) * std::max( std::fabs( distance ), 1.0 );
 
 2751    distance = std::max( distance, 2.0 );
 
 2757    labelFeature->setDistLabel( d );
 
 2762    labelFeature->setHasFixedQuadrant( 
true );
 
 2767  labelFeature->setPolygonPlacementFlags( polygonPlacement );
 
 2776  labelFeature->setZIndex( z );
 
 2786      double priorityD = exprVal.toDouble( &ok );
 
 2789        priorityD = std::clamp( priorityD, 0.0, 10.0 );
 
 2790        priorityD = 1 - priorityD / 10.0; 
 
 2791        labelFeature->setPriority( priorityD );
 
 2804    labelFeature->setAllowDegradedPlacement( allowDegradedPlacement );
 
 2813      const QString cleanedString = handlingString.trimmed();
 
 2814      if ( cleanedString.compare( QLatin1String( 
"prevent" ), Qt::CaseInsensitive ) == 0 )
 
 2816      else if ( cleanedString.compare( QLatin1String( 
"allowifneeded" ), Qt::CaseInsensitive ) == 0 )
 
 2818      else if ( cleanedString.compare( QLatin1String( 
"alwaysallow" ), Qt::CaseInsensitive ) == 0 )
 
 2821    labelFeature->setOverlapHandling( overlapHandling );
 
 2828  labelFeature->setObstacleSettings( os );
 
 2831  if ( positionOrder.isEmpty() )
 
 2832    positionOrder = *DEFAULT_PLACEMENT_ORDER();
 
 2838    if ( !dataDefinedOrder.isEmpty() )
 
 2843  labelFeature->setPredefinedPositionOrder( positionOrder );
 
 2846  labelFeature->setDataDefinedValues( dataDefinedValues );
 
 2848  return labelFeature;
 
 2856  if ( !obstacleGeometry.
isNull() )
 
 2858    geom = obstacleGeometry;
 
 2873    if ( ls->numPoints() < 2 )
 
 2879  std::unique_ptr<QgsGeometry> scopedClonedGeom;
 
 2885    geom = simplifier.
simplify( geom );
 
 2889  std::unique_ptr<QgsGeometry> scopedPreparedGeom;
 
 2897  if ( !geos_geom_clone )
 
 2901  std::unique_ptr< QgsLabelFeature > obstacleFeature = std::make_unique< QgsLabelFeature >( f.
id(), std::move( geos_geom_clone ), QSizeF( 0, 0 ) );
 
 2902  obstacleFeature->setFeature( f );
 
 2907  obstacleFeature->setObstacleSettings( os );
 
 2910  return obstacleFeature;
 
 2913bool QgsPalLayerSettings::dataDefinedValEval( DataDefinedValueType valType,
 
 2917  if ( !mDataDefinedProperties.
isActive( p ) )
 
 2921  exprVal = mDataDefinedProperties.
value( p, context );
 
 2928        bool bol = exprVal.toBool();
 
 2929        dataDefinedValues.insert( p, QVariant( bol ) );
 
 2935        int size = exprVal.toInt( &ok );
 
 2939          dataDefinedValues.insert( p, QVariant( size ) );
 
 2947        int size = exprVal.toInt( &ok );
 
 2949        if ( ok && size > 0 )
 
 2951          dataDefinedValues.insert( p, QVariant( size ) );
 
 2959        double size = exprVal.toDouble( &ok );
 
 2963          dataDefinedValues.insert( p, QVariant( size ) );
 
 2971        double size = exprVal.toDouble( &ok );
 
 2973        if ( ok && size > 0.0 )
 
 2975          dataDefinedValues.insert( p, QVariant( size ) );
 
 2983        double rot = exprVal.toDouble( &ok );
 
 2986          if ( rot < -180.0 && rot >= -360 )
 
 2990          if ( rot > 180.0 && rot <= 360 )
 
 2994          if ( rot >= -180 && rot <= 180 )
 
 2996            dataDefinedValues.insert( p, QVariant( rot ) );
 
 3005        int size = exprVal.toInt( &ok );
 
 3006        if ( ok && size >= 0 && size <= 100 )
 
 3008          dataDefinedValues.insert( p, QVariant( size ) );
 
 3015        QString 
str = exprVal.toString(); 
 
 3017        dataDefinedValues.insert( p, QVariant( 
str ) ); 
 
 3022        QString unitstr = exprVal.toString().trimmed();
 
 3024        if ( !unitstr.isEmpty() )
 
 3033        QString colorstr = exprVal.toString().trimmed();
 
 3036        if ( color.isValid() )
 
 3038          dataDefinedValues.insert( p, QVariant( color ) );
 
 3045        QString joinstr = exprVal.toString().trimmed();
 
 3047        if ( !joinstr.isEmpty() )
 
 3056        QString blendstr = exprVal.toString().trimmed();
 
 3058        if ( !blendstr.isEmpty() )
 
 3071          dataDefinedValues.insert( p, res );
 
 3082          dataDefinedValues.insert( p, res );
 
 3092void QgsPalLayerSettings::parseTextStyle( QFont &labelFont,
 
 3105  QString ddFontFamily;
 
 3112      QString family = exprVal.toString().trimmed();
 
 3113      QgsDebugMsgLevel( QStringLiteral( 
"exprVal Font family:%1" ).arg( family ), 4 );
 
 3116      if ( labelFont.family() != family )
 
 3122          ddFontFamily = family;
 
 3129  QString ddFontStyle;
 
 3135      QString fontstyle = exprVal.toString().trimmed();
 
 3136      QgsDebugMsgLevel( QStringLiteral( 
"exprVal Font style:%1" ).arg( fontstyle ), 4 );
 
 3137      ddFontStyle = fontstyle;
 
 3142  bool ddBold = 
false;
 
 3150  bool ddItalic = 
false;
 
 3160  QFont appFont = QApplication::font();
 
 3161  bool newFontBuilt = 
false;
 
 3162  if ( ddBold || ddItalic )
 
 3165    newFont = QFont( !ddFontFamily.isEmpty() ? ddFontFamily : labelFont.family() );
 
 3166    newFontBuilt = 
true;
 
 3167    newFont.setBold( ddBold );
 
 3168    newFont.setItalic( ddItalic );
 
 3170  else if ( !ddFontStyle.isEmpty()
 
 3171            && ddFontStyle.compare( QLatin1String( 
"Ignore" ), Qt::CaseInsensitive ) != 0 )
 
 3173    if ( !ddFontFamily.isEmpty() )
 
 3177        mFontDB = std::make_unique< QFontDatabase >();
 
 3179      QFont styledfont = mFontDB->font( ddFontFamily, ddFontStyle, appFont.pointSize() );
 
 3180      if ( appFont != styledfont )
 
 3182        newFont = styledfont;
 
 3183        newFontBuilt = 
true;
 
 3190  else if ( !ddFontFamily.isEmpty() )
 
 3192    if ( ddFontStyle.compare( QLatin1String( 
"Ignore" ), Qt::CaseInsensitive ) != 0 )
 
 3196        mFontDB = std::make_unique< QFontDatabase >();
 
 3197      QFont styledfont = mFontDB->font( ddFontFamily, mFormat.
namedStyle(), appFont.pointSize() );
 
 3198      if ( appFont != styledfont )
 
 3200        newFont = styledfont;
 
 3201        newFontBuilt = 
true;
 
 3206      newFont = QFont( ddFontFamily );
 
 3207      newFontBuilt = 
true;
 
 3215    newFont.setPixelSize( labelFont.pixelSize() );
 
 3216    newFont.setUnderline( labelFont.underline() );
 
 3217    newFont.setStrikeOut( labelFont.strikeOut() );
 
 3218    newFont.setWordSpacing( labelFont.wordSpacing() );
 
 3219    newFont.setLetterSpacing( QFont::AbsoluteSpacing, labelFont.letterSpacing() );
 
 3221    labelFont = newFont;
 
 3225  double wordspace = labelFont.wordSpacing();
 
 3234  double letterspace = labelFont.letterSpacing();
 
 3247    labelFont.setStrikeOut( strikeout );
 
 3262    labelFont.setUnderline( underline );
 
 3288    drawBuffer = exprVal.toBool();
 
 3301  double bufrSize = buffer.
size();
 
 3304    bufrSize = exprVal.toDouble();
 
 3308  double bufferOpacity = buffer.
opacity() * 100;
 
 3311    bufferOpacity = exprVal.toDouble();
 
 3314  drawBuffer = ( drawBuffer && bufrSize > 0.0 && bufferOpacity > 0 );
 
 3344  bool maskEnabled = mask.
enabled();
 
 3347    maskEnabled = exprVal.toBool();
 
 3356  double bufrSize = mask.
size();
 
 3359    bufrSize = exprVal.toDouble();
 
 3363  double opacity = mask.
opacity() * 100;
 
 3366    opacity = exprVal.toDouble();
 
 3369  maskEnabled = ( maskEnabled && bufrSize > 0.0 && opacity > 0 );
 
 3394    wrapchr = exprVal.toString();
 
 3400    evalAutoWrapLength = exprVal.toInt();
 
 3413      QString 
str = exprVal.toString().trimmed();
 
 3416      if ( !
str.isEmpty() )
 
 3421        if ( 
str.compare( QLatin1String( 
"Center" ), Qt::CaseInsensitive ) == 0 )
 
 3423          aligntype = Qgis::LabelMultiLineAlignment::Center;
 
 3425        else if ( 
str.compare( QLatin1String( 
"Right" ), Qt::CaseInsensitive ) == 0 )
 
 3427          aligntype = Qgis::LabelMultiLineAlignment::Right;
 
 3429        else if ( 
str.compare( QLatin1String( 
"Follow" ), Qt::CaseInsensitive ) == 0 )
 
 3431          aligntype = Qgis::LabelMultiLineAlignment::FollowPlacement;
 
 3433        else if ( 
str.compare( QLatin1String( 
"Justify" ), Qt::CaseInsensitive ) == 0 )
 
 3435          aligntype = Qgis::LabelMultiLineAlignment::Justify;
 
 3450      QString 
str = exprVal.toString().trimmed();
 
 3451      if ( !
str.isEmpty() )
 
 3460    drawDirSymb = exprVal.toBool();
 
 3475      QString 
str = exprVal.toString().trimmed();
 
 3478      if ( !
str.isEmpty() )
 
 3483        if ( 
str.compare( QLatin1String( 
"Above" ), Qt::CaseInsensitive ) == 0 )
 
 3487        else if ( 
str.compare( QLatin1String( 
"Below" ), Qt::CaseInsensitive ) == 0 )
 
 3509  bool drawShape = background.
enabled();
 
 3512    drawShape = exprVal.toBool();
 
 3521  double shapeOpacity = background.
opacity() * 100;
 
 3524    shapeOpacity = 100.0 * exprVal.toDouble();
 
 3527  drawShape = ( drawShape && shapeOpacity > 0 ); 
 
 3543      QString skind = exprVal.toString().trimmed();
 
 3544      QgsDebugMsgLevel( QStringLiteral( 
"exprVal ShapeKind:%1" ).arg( skind ), 4 );
 
 3546      if ( !skind.isEmpty() )
 
 3555  QString svgPath = background.
svgFile();
 
 3562      QString svgfile = exprVal.toString().trimmed();
 
 3563      QgsDebugMsgLevel( QStringLiteral( 
"exprVal ShapeSVGFile:%1" ).arg( svgfile ), 4 );
 
 3578      QString stype = exprVal.toString().trimmed();
 
 3579      QgsDebugMsgLevel( QStringLiteral( 
"exprVal ShapeSizeType:%1" ).arg( stype ), 4 );
 
 3581      if ( !stype.isEmpty() )
 
 3590  double ddShpSizeX = background.
size().width();
 
 3593    ddShpSizeX = exprVal.toDouble();
 
 3597  double ddShpSizeY = background.
size().height();
 
 3600    ddShpSizeY = exprVal.toDouble();
 
 3606       && ( svgPath.isEmpty()
 
 3607            || ( !svgPath.isEmpty()
 
 3609                 && ddShpSizeX == 0.0 ) ) )
 
 3617                 && ddShpSizeX == 0.0 ) ) )
 
 3624       && ( ddShpSizeX == 0.0 || ddShpSizeY == 0.0 ) )
 
 3649      QString rotstr = exprVal.toString().trimmed();
 
 3650      QgsDebugMsgLevel( QStringLiteral( 
"exprVal ShapeRotationType:%1" ).arg( rotstr ), 4 );
 
 3652      if ( !rotstr.isEmpty() )
 
 3703  bool drawShadow = shadow.
enabled();
 
 3706    drawShadow = exprVal.toBool();
 
 3715  double shadowOpacity = shadow.
opacity() * 100;
 
 3718    shadowOpacity = exprVal.toDouble();
 
 3725    shadowOffDist = exprVal.toDouble();
 
 3732    shadowRad = exprVal.toDouble();
 
 3735  drawShadow = ( drawShadow && shadowOpacity > 0 && !( shadowOffDist == 0.0 && shadowRad == 0.0 ) );
 
 3752      QString 
str = exprVal.toString().trimmed();
 
 3755      if ( !
str.isEmpty() )
 
 3790  switch ( layer->
type() )
 
 3794      const QgsVectorLayer *vl = qobject_cast< const QgsVectorLayer * >( layer );
 
 3805        return !labeling->styles().empty();
 
 3854QStringList 
QgsPalLabeling::splitToLines( 
const QString &text, 
const QString &wrapCharacter, 
const int autoWrapLength, 
const bool useMaxLineLengthWhenAutoWrapping )
 
 3856  QStringList multiLineSplit;
 
 3857  if ( !wrapCharacter.isEmpty() && wrapCharacter != QLatin1String( 
"\n" ) )
 
 3860    const QStringList lines = text.split( wrapCharacter );
 
 3861    for ( 
const QString &line : lines )
 
 3863      multiLineSplit.append( line.split( 
'\n' ) );
 
 3868    multiLineSplit = text.split( 
'\n' );
 
 3872  if ( autoWrapLength != 0 )
 
 3874    QStringList autoWrappedLines;
 
 3875    autoWrappedLines.reserve( multiLineSplit.count() );
 
 3876    for ( 
const QString &line : std::as_const( multiLineSplit ) )
 
 3878      autoWrappedLines.append( 
QgsStringUtils::wordWrap( line, autoWrapLength, useMaxLineLengthWhenAutoWrapping ).split( 
'\n' ) );
 
 3880    multiLineSplit = autoWrappedLines;
 
 3882  return multiLineSplit;
 
 3887  QStringList graphemes;
 
 3888  QTextBoundaryFinder boundaryFinder( QTextBoundaryFinder::Grapheme, text );
 
 3889  int currentBoundary = -1;
 
 3890  int previousBoundary = 0;
 
 3891  while ( ( currentBoundary = boundaryFinder.toNextBoundary() ) > 0 )
 
 3893    graphemes << text.mid( previousBoundary, currentBoundary - previousBoundary );
 
 3894    previousBoundary = currentBoundary;
 
 3924      QgsDebugMsgLevel( QStringLiteral( 
"Ignoring feature due to transformation exception" ), 4 );
 
 3930      return std::isfinite( point.
x() ) && std::isfinite( point.
y() );
 
 3934      cp->removeInvalidRings();
 
 3936    else if ( 
QgsMultiSurface *ms = qgsgeometry_cast< QgsMultiSurface * >( geom.
get() ) )
 
 3938      for ( 
int i = 0; i < ms->numGeometries(); ++i )
 
 3940        if ( 
QgsCurvePolygon *cp = qgsgeometry_cast< QgsCurvePolygon * >( ms->geometryN( i ) ) )
 
 3941          cp->removeInvalidRings();
 
 3953      QgsDebugMsg( QStringLiteral( 
"Error rotating geometry" ).arg( geom.
asWkt() ) );
 
 3958  const bool mustClip = ( !clipGeometry.
isNull() &&
 
 3962  bool mustClipExact = 
false;
 
 3986      QVector< QgsGeometry> parts;
 
 3987      parts.reserve( qgsgeometry_cast< const QgsGeometryCollection * >( geom.
constGet() )->numGeometries() );
 
 3996        parts.append( partGeom );
 
 4004      if ( bufferGeom.
isNull() )
 
 4006        QgsDebugMsg( QStringLiteral( 
"Could not repair geometry: %1" ).arg( bufferGeom.
lastError() ) );
 
 4013  if ( mustClipExact )
 
 4048    double length = geom.
length();
 
 4049    if ( length >= 0.0 )
 
 4051      return ( length >= ( minSize * mapUnitsPerMM ) );
 
 4056    double area = geom.
area();
 
 4059      return ( std::sqrt( area ) >= ( minSize * mapUnitsPerMM ) );
 
 4067    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4070  bool changed = 
false;
 
 4076    format.
setColor( ddColor.value<QColor>() );
 
 4101    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4163    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4166  bool changed = 
false;
 
 4214    buffer.
setColor( ddColor.value<QColor>() );
 
 4241    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4243  if ( ddValues.isEmpty() )
 
 4247  bool changed = 
false;
 
 4307    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4310  bool changed = 
false;
 
 4350    QSizeF size = background.
size();
 
 4357    QSizeF size = background.
size();
 
 4458    const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues )
 
 4461  bool changed = 
false;
 
 4520    shadow.
setColor( ddColor.value<QColor>() );
 
 4560  double cx = lp->
getX() + w / 2.0;
 
 4561  double cy = lp->
getY() + h / 2.0;
 
 4564  double sw = w * scale;
 
 4565  double sh = h * scale;
 
 4566  QRectF rect( -sw / 2, -sh / 2, sw, sh );
 
 4568  painter->translate( xform->
transform( QPointF( cx, cy ) ).toQPointF() );
 
 4572    if ( lp->
getFeaturePart()->getLayer()->getArrangement() != P_POINT &&
 
 4573         lp->
getFeaturePart()->getLayer()->getArrangement() != P_POINT_OVER &&
 
 4576      painter->rotate( rotation );
 
 4579  painter->translate( rect.bottomLeft() );
 
 4580  painter->rotate( -lp->
getAlpha() * 180 / M_PI );
 
 4581  painter->translate( -rect.bottomLeft() );
 
 4584  QRectF rect( 0, 0, outPt2.
x() - outPt.
x(), outPt2.
y() - outPt.
y() );
 
 4585  painter->translate( QPointF( outPt.
x(), outPt.
y() ) );
 
 4586  painter->rotate( -lp->
getAlpha() * 180 / M_PI );
 
 4591    painter->setPen( QColor( 255, 0, 0, 64 ) );
 
 4595    painter->setPen( QColor( 0, 0, 0, 64 ) );
 
 4597  painter->drawRect( rect );
 
 4601  rect.moveTo( outPt.
x(), outPt.
y() );
 
@ Success
Operation succeeded.
 
LabelOffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
 
@ FromPoint
Offset distance applies from point geometry.
 
@ FromSymbolBounds
Offset distance applies from rendered symbol bounds.
 
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
 
@ OverPoint
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point....
 
@ Curved
Arranges candidates following the curvature of a line feature. Applies to line layers only.
 
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
 
@ Line
Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon'...
 
@ Free
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...
 
@ OrderedPositionsAroundPoint
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
 
@ Horizontal
Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only...
 
@ PerimeterCurved
Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only.
 
@ OutsidePolygons
Candidates are placed outside of polygon boundaries. Applies to polygon layers only....
 
@ Warning
Warning message.
 
Capitalization
String capitalization options.
 
@ AllSmallCaps
Force all characters to small caps (since QGIS 3.24)
 
@ MixedCase
Mixed case, ie no change.
 
@ AllLowercase
Convert all characters to lowercase.
 
@ TitleCase
Simple title case conversion - does not fully grammatically parse the text and uses simple rules only...
 
@ SmallCaps
Mixed case small caps (since QGIS 3.24)
 
@ ForceFirstLetterToCapital
Convert just the first letter of each word to uppercase, leave the rest untouched.
 
@ AllUppercase
Convert all characters to uppercase.
 
LabelQuadrantPosition
Label quadrant positions.
 
TextOrientation
Text orientations.
 
UnplacedLabelVisibility
Unplaced label visibility.
 
@ FollowEngineSetting
Respect the label engine setting.
 
LabelMultiLineAlignment
Text alignment for multi-line labels.
 
@ Antialiasing
Use antialiasing while drawing.
 
LabelOverlapHandling
Label overlap handling.
 
@ AllowOverlapAtNoCost
Labels may freely overlap other labels, at no cost.
 
@ AllowOverlapIfRequired
Avoids overlapping labels when possible, but permit overlaps if labels for features cannot otherwise ...
 
@ PreventOverlap
Do not allow labels to overlap other labels.
 
static const double UI_SCALE_FACTOR
UI scaling factor.
 
@ MiddleLeft
Label on left of point.
 
@ TopRight
Label on top-right of point.
 
@ MiddleRight
Label on right of point.
 
@ TopSlightlyRight
Label on top of point, slightly right of center.
 
@ BottomRight
Label on bottom right of point.
 
@ BottomLeft
Label on bottom-left of point.
 
@ BottomSlightlyRight
Label below point, slightly right of center.
 
@ TopLeft
Label on top-left of point.
 
UpsideDownLabelHandling
Handling techniques for upside down labels.
 
virtual QgsAbstractGeometry * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
 
int valueAsInt(int key, const QgsExpressionContext &context, int defaultValue=0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as an integer.
 
bool valueAsBool(int key, const QgsExpressionContext &context, bool defaultValue=false, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as an boolean.
 
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
 
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
 
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string.
 
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
static QgsFontManager * fontManager()
Returns the application font manager, which manages available fonts and font installation for the QGI...
 
static QgsCalloutRegistry * calloutRegistry()
Returns the application's callout registry, used for managing callout types.
 
Registry of available callout classes.
 
static QgsCallout * defaultCallout()
Create a new instance of a callout with default settings.
 
Contains additional contextual information about the context in which a callout is being rendered.
 
Abstract base class for callout renderers.
 
virtual void stopRender(QgsRenderContext &context)
Finalises the callout after a set of rendering operations on the specified render context.
 
void render(QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext)
Renders the callout onto the specified render context.
 
virtual void startRender(QgsRenderContext &context)
Prepares the callout for rendering on the specified render context.
 
bool enabled() const
Returns true if the the callout is enabled.
 
This class represents a coordinate reference system (CRS).
 
QString userFriendlyIdentifier(IdentifierType type=MediumString) const
Returns a user friendly identifier for the CRS.
 
Custom exception class for Coordinate Reference System related exceptions.
 
Curve polygon geometry type.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
 
Class for parsing and evaluation of expressions (formerly called "search strings").
 
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
 
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
 
QString evalErrorString() const
Returns evaluation error.
 
QString parserErrorString() const
Returns parser error.
 
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
 
bool hasEvalError() const
Returns true if an error occurred when evaluating last input.
 
QVariant evaluate()
Evaluate the feature and return the result.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
 
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
 
Container of fields for a vector layer.
 
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
 
QString processFontFamilyName(const QString &name) const
Processes a font family name, applying any matching fontFamilyReplacements() to the name.
 
static bool fontFamilyOnSystem(const QString &family)
Check whether font family is on system in a quick manner, which does not compare [foundry].
 
static bool updateFontViaStyle(QFont &f, const QString &fontstyle, bool fallback=false)
Updates font with named style and retain all font properties.
 
A geometry is the spatial representation of a feature.
 
QgsGeometry clipped(const QgsRectangle &rectangle)
Clips the geometry using the specified rectangle.
 
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
 
double length() const
Returns the planar, 2-dimensional length of geometry.
 
QgsAbstractGeometry::const_part_iterator const_parts_begin() const
Returns STL-style const iterator pointing to the first part of the geometry.
 
static QgsGeometry collectGeometry(const QVector< QgsGeometry > &geometries)
Creates a new multipart geometry from a list of QgsGeometry objects.
 
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
 
bool isAxisParallelRectangle(double maximumDeviation, bool simpleRectanglesOnly=false) const
Returns true if the geometry is a polygon that is almost an axis-parallel rectangle.
 
QgsAbstractGeometry * get()
Returns a modifiable (non-const) reference to the underlying abstract geometry primitive.
 
static QgsGeometry fromRect(const QgsRectangle &rect) SIP_HOLDGIL
Creates a new geometry from a QgsRectangle.
 
bool isMultipart() const SIP_HOLDGIL
Returns true if WKB of the geometry is of WKBMulti* type.
 
bool contains(const QgsPointXY *p) const
Returns true if the geometry contains the point p.
 
QgsPointXY asPoint() const
Returns the contents of the geometry as a 2-dimensional point.
 
void filterVertices(const std::function< bool(const QgsPoint &) > &filter)
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
 
bool isGeosValid(Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const
Checks validity of the geometry using GEOS.
 
static QgsGeometry fromPointXY(const QgsPointXY &point) SIP_HOLDGIL
Creates a new geometry from a QgsPointXY object.
 
QgsWkbTypes::GeometryType type
 
double area() const
Returns the planar, 2-dimensional area of the geometry.
 
QgsGeometry centroid() const
Returns the center of mass of a geometry.
 
QString lastError() const SIP_HOLDGIL
Returns an error string referring to the last error encountered either when this geometry was created...
 
QgsGeometry makeValid(Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false) const SIP_THROW(QgsNotSupportedException)
Attempts to make an invalid geometry valid without losing vertices.
 
QgsGeometry intersection(const QgsGeometry &geometry, const QgsGeometryParameters ¶meters=QgsGeometryParameters()) const
Returns a geometry representing the points shared by this geometry and other.
 
QgsGeometry mergeLines() const
Merges any connected lines in a LineString/MultiLineString geometry and converts them to single line ...
 
bool isEmpty() const
Returns true if the geometry is empty (eg a linestring with no vertices, or a collection with no geom...
 
QgsAbstractGeometry::const_part_iterator const_parts_end() const
Returns STL-style iterator pointing to the imaginary part after the last part of the geometry.
 
QgsGeometry simplify(double tolerance) const
Returns a simplified version of this geometry using a specified tolerance value.
 
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
 
Qgis::GeometryOperationResult rotate(double rotation, const QgsPointXY ¢er)
Rotate this geometry around the Z axis.
 
bool convertGeometryCollectionToSubclass(QgsWkbTypes::GeometryType geomType)
Converts geometry collection to a the desired geometry type subclass (multi-point,...
 
QString asWkt(int precision=17) const
Exports the geometry to WKT.
 
static geos::unique_ptr asGeos(const QgsGeometry &geometry, double precision=0)
Returns a geos geometry - caller takes ownership of the object (should be deleted with GEOSGeom_destr...
 
Represents a label candidate.
 
Contains settings related to how the label engine places and formats labels for line features (or pol...
 
AnchorType
Line anchor types.
 
void setPlacementFlags(QgsLabeling::LinePlacementFlags flags)
Returns the line placement flags, which dictate how line labels can be placed above or below the line...
 
QgsLabeling::LinePlacementFlags placementFlags() const
Returns the line placement flags, which dictate how line labels can be placed above or below the line...
 
bool reverseDirectionSymbol() const
Returns true if direction symbols should be reversed.
 
void setLineAnchorPercent(double percent)
Sets the percent along the line at which labels should be placed.
 
DirectionSymbolPlacement directionSymbolPlacement() const
Returns the placement for direction symbols.
 
AnchorClipping
Clipping behavior for line anchor calculation.
 
@ UseEntireLine
Entire original feature line geometry is used when calculating the line anchor for labels.
 
@ UseVisiblePartsOfLine
Only visible parts of lines are considered when calculating the line anchor for labels.
 
void setDirectionSymbolPlacement(DirectionSymbolPlacement placement)
Sets the placement for direction symbols.
 
AnchorType anchorType() const
Returns the line anchor type, which dictates how the lineAnchorPercent() setting is handled.
 
QString leftDirectionSymbol() const
Returns the string to use for left direction arrows.
 
void setAnchorTextPoint(AnchorTextPoint point)
Sets the line anchor text point, which dictates which part of the label text should be placed at the ...
 
void setLeftDirectionSymbol(const QString &symbol)
Sets the string to use for left direction arrows.
 
QgsMapUnitScale overrunDistanceMapUnitScale() const
Returns the map unit scale for label overrun distance.
 
AnchorTextPoint anchorTextPoint() const
Returns the line anchor text point, which dictates which part of the label text should be placed at t...
 
double overrunDistance() const
Returns the distance which labels are allowed to overrun past the start or end of line features.
 
QgsUnitTypes::RenderUnit overrunDistanceUnit() const
Returns the units for label overrun distance.
 
void setMergeLines(bool merge)
Sets whether connected line features with identical label text should be merged prior to generating l...
 
DirectionSymbolPlacement
Placement options for direction symbols.
 
@ SymbolLeftRight
Place direction symbols on left/right of label.
 
@ SymbolAbove
Place direction symbols on above label.
 
@ SymbolBelow
Place direction symbols on below label.
 
void setRightDirectionSymbol(const QString &symbol)
Sets the string to use for right direction arrows.
 
@ CenterOfText
Anchor using center of text.
 
QString rightDirectionSymbol() const
Returns the string to use for right direction arrows.
 
void setAnchorClipping(AnchorClipping clipping)
Sets the line anchor clipping mode, which dictates how line strings are clipped before calculating th...
 
void setOverrunDistanceMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for label overrun distance.
 
bool addDirectionSymbol() const
Returns true if '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) w...
 
double lineAnchorPercent() const
Returns the percent along the line at which labels should be placed.
 
bool mergeLines() const
Returns true if connected line features with identical label text should be merged prior to generatin...
 
void setAnchorType(AnchorType type)
Sets the line anchor type, which dictates how the lineAnchorPercent() setting is handled.
 
void setOverrunDistance(double distance)
Sets the distance which labels are allowed to overrun past the start or end of line features.
 
AnchorClipping anchorClipping() const
Returns the line anchor clipping mode, which dictates how line strings are clipped before calculating...
 
void setOverrunDistanceUnit(const QgsUnitTypes::RenderUnit &unit)
Sets the unit for label overrun distance.
 
void setReverseDirectionSymbol(bool reversed)
Sets whether the direction symbols should be reversed.
 
void setAddDirectionSymbol(bool enabled)
Sets whether '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will...
 
void updateDataDefinedProperties(const QgsPropertyCollection &properties, QgsExpressionContext &context)
Updates the thinning settings to respect any data defined properties set within the specified propert...
 
Contains settings related to how the label engine treats features as obstacles.
 
double factor() const
Returns the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,...
 
void setType(ObstacleType type)
Controls how features act as obstacles for labels.
 
ObstacleType type() const
Returns how features act as obstacles for labels.
 
void setIsObstacle(bool isObstacle)
Sets whether features are obstacles to labels of other layers.
 
void setFactor(double factor)
Sets the obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,...
 
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels.
 
void updateDataDefinedProperties(const QgsPropertyCollection &properties, QgsExpressionContext &context)
Updates the obstacle settings to respect any data defined properties set within the specified propert...
 
void setObstacleGeometry(const QgsGeometry &obstacleGeom)
Sets the label's obstacle geometry, if different to the feature geometry.
 
bool isObstacle() const
Returns true if the features are obstacles to labels of other layers.
 
void setOverlapHandling(Qgis::LabelOverlapHandling handling)
Sets the technique used to handle overlapping labels.
 
Qgis::LabelOverlapHandling overlapHandling() const
Returns the technique used to handle overlapping labels.
 
bool allowDegradedPlacement() const
Returns true if labels can be placed in inferior fallback positions if they cannot otherwise be place...
 
void setAllowDegradedPlacement(bool allow)
Sets whether labels can be placed in inferior fallback positions if they cannot otherwise be placed.
 
Contains settings related to how the label engine removes candidate label positions and reduces the n...
 
void setMaximumNumberLabels(int number)
Sets the maximum number of labels which should be drawn for this layer.
 
double minimumFeatureSize() const
Returns the minimum feature size (in millimeters) for a feature to be labelled.
 
int maximumNumberLabels() const
Returns the maximum number of labels which should be drawn for this layer.
 
void updateDataDefinedProperties(const QgsPropertyCollection &properties, QgsExpressionContext &context)
Updates the thinning settings to respect any data defined properties set within the specified propert...
 
void setLimitNumberLabelsEnabled(bool enabled)
Sets whether the the number of labels drawn for the layer should be limited.
 
bool limitNumberOfLabelsEnabled() const
Returns true if the number of labels drawn for the layer should be limited.
 
void setMinimumFeatureSize(double size)
Sets the minimum feature size (in millimeters) for a feature to be labelled.
 
static QString encodePredefinedPositionOrder(const QVector< Qgis::LabelPredefinedPointPosition > &positions)
Encodes an ordered list of predefined point label positions to a string.
 
static QVector< Qgis::LabelPredefinedPointPosition > decodePredefinedPositionOrder(const QString &positionString)
Decodes a string to an ordered list of predefined point label positions.
 
Line string geometry type, with support for z-dimension and m-values.
 
Base class for all map layer types.
 
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
 
void removeCustomProperty(const QString &key)
Remove a custom property from layer.
 
T customEnumProperty(const QString &key, const T &defaultValue)
Returns the property value for a property based on an enum.
 
The QgsMapSettings class contains configuration for rendering of the map.
 
const QgsMapToPixel & mapToPixel() const
 
double extentBuffer() const
Returns the buffer in map units to use around the visible extent for rendering symbols whose correspo...
 
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
 
double rotation() const
Returns the rotation of the resulting map image, in degrees clockwise.
 
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
 
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
 
Implementation of GeometrySimplifier using the "MapToPixel" algorithm.
 
SimplifyAlgorithm
Types of simplification algorithms that can be used.
 
@ SimplifyEnvelope
The geometries can be fully simplified by its BoundingBox.
 
QgsGeometry simplify(const QgsGeometry &geometry) const override
Returns a simplified version the specified geometry.
 
Perform transforms between map coordinates and device coordinates.
 
double mapUnitsPerPixel() const
Returns the current map units per pixel.
 
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
 
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
 
double mapRotation() const
Returns the current map rotation in degrees (clockwise).
 
void setParameters(double mapUnitsPerPixel, double centerX, double centerY, int widthPixels, int heightPixels, double rotation)
Sets parameters for use in transforming coordinates.
 
double maxScale
The maximum scale, or 0.0 if unset.
 
double minScale
The minimum scale, or 0.0 if unset.
 
The QgsMargins class defines the four margins of a rectangle.
 
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
 
Multi surface geometry collection.
 
static void drawLabelCandidateRect(pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform, QList< QgsLabelCandidate > *candidates=nullptr)
 
static QStringList splitToLines(const QString &text, const QString &wrapCharacter, int autoWrapLength=0, bool useMaxLineLengthWhenAutoWrapping=true)
Splits a text string to a list of separate lines, using a specified wrap character (wrapCharacter).
 
static QgsGeometry prepareGeometry(const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
Prepares a geometry for registration with PAL.
 
static bool geometryRequiresPreparation(const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
Checks whether a geometry requires preparation before registration with PAL.
 
static bool staticWillUseLayer(const QgsMapLayer *layer)
Called to find out whether a specified layer is used for labeling.
 
static QStringList splitToGraphemes(const QString &text)
Splits a text string to a list of graphemes, which are the smallest allowable character divisions in ...
 
Contains settings for how a map layer will be labeled.
 
bool fitInPolygonOnly
true if only labels which completely fit within a polygon are allowed.
 
double yOffset
Vertical offset of label.
 
QgsMapUnitScale labelOffsetMapUnitScale
Map unit scale for label offset.
 
int fontMaxPixelSize
Maximum pixel size for showing rendered map unit labels (1 - 10000).
 
std::unique_ptr< QgsLabelFeature > registerFeatureWithDetails(const QgsFeature &feature, QgsRenderContext &context, QgsGeometry obstacleGeometry=QgsGeometry(), const QgsSymbol *symbol=nullptr)
Registers a feature for labeling.
 
double maxCurvedCharAngleIn
Maximum angle between inside curved label characters (valid range 20.0 to 60.0).
 
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
 
double zIndex
Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-ind...
 
const QgsMapToPixel * xform
 
void startRender(QgsRenderContext &context)
Prepares the label settings for rendering.
 
QString wrapChar
Wrapping character string.
 
QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns all field names referenced by the configuration (e.g.
 
Qgis::LabelOffsetType offsetType
Offset type for layer (only applies in certain placement modes)
 
double xOffset
Horizontal offset of label.
 
Qgis::LabelPlacement placement
Label placement mode.
 
QgsCoordinateTransform ct
 
bool drawLabels
Whether to draw labels for this layer.
 
bool fontLimitPixelSize
true if label sizes should be limited by pixel size.
 
QgsExpression * getLabelExpression()
Returns the QgsExpression for this label settings.
 
QString legendString() const
legendString
 
double minimumScale
The minimum map scale (i.e.
 
void registerFeature(const QgsFeature &f, QgsRenderContext &context)
Registers a feature for labeling.
 
QgsPalLayerSettings & operator=(const QgsPalLayerSettings &s)
copy operator - only copies the permanent members
 
QgsWkbTypes::GeometryType geometryGeneratorType
The type of the result geometry of the geometry generator.
 
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
 
QgsUnitTypes::RenderUnit offsetUnits
Units for offsets of label.
 
Qgis::LabelQuadrantPosition quadOffset
Sets the quadrant in which to offset labels from feature.
 
bool scaleVisibility
Set to true to limit label visibility to a range of scales.
 
double repeatDistance
Distance for repeating labels for a single feature.
 
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the label's property collection, used for data defined overrides.
 
QgsUnitTypes::AngleUnit rotationUnit() const
Unit for rotation of labels.
 
bool geometryGeneratorEnabled
Defines if the geometry generator is enabled or not. If disabled, the standard geometry will be taken...
 
Qgis::LabelMultiLineAlignment multilineAlign
Horizontal alignment of multi-line labels.
 
bool centroidInside
true if centroid positioned labels must be placed inside their corresponding feature polygon,...
 
int priority
Label priority.
 
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
 
bool labelPerPart
true if every part of a multi-part feature should be labeled.
 
QVector< Qgis::LabelPredefinedPointPosition > predefinedPositionOrder
Ordered list of predefined label positions for points.
 
QgsUnitTypes::RenderUnit distUnits
Units the distance from feature to the label.
 
QgsCallout * callout() const
Returns the label callout renderer, responsible for drawing label callouts.
 
QgsUnitTypes::RenderUnit repeatDistanceUnit
Units for repeating labels for a single feature.
 
int fontMinPixelSize
Minimum pixel size for showing rendered map unit labels (1 - 1000).
 
double angleOffset
Label rotation, in degrees clockwise.
 
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0)
 
Property
Data definable properties.
 
@ MaskEnabled
Whether the mask is enabled.
 
@ LabelRotation
Label rotation.
 
@ PositionY
Y-coordinate data defined label position.
 
@ OverlapHandling
Overlap handling technique (since QGIS 3.26)
 
@ OverrunDistance
Distance which labels can extend past either end of linear features.
 
@ Strikeout
Use strikeout.
 
@ FontStyle
Font style name.
 
@ PositionX
X-coordinate data defined label position.
 
@ CalloutDraw
Show callout.
 
@ Underline
Use underline.
 
@ FontLetterSpacing
Letter spacing.
 
@ MaskJoinStyle
Mask join style.
 
@ PositionPoint
Point-coordinate data defined label position.
 
@ MaxScale
Max scale (deprecated, for old project compatibility only)
 
@ Hali
Horizontal alignment for data defined label position (Left, Center, Right)
 
@ FontStretchFactor
Font stretch factor, since QGIS 3.24.
 
@ FontTransp
Text transparency (deprecated)
 
@ MaskBufferUnit
Mask buffer size unit.
 
@ LabelAllParts
Whether all parts of multi-part features should be labeled.
 
@ AllowDegradedPlacement
Allow degraded label placements (since QGIS 3.26)
 
@ ShadowOpacity
Shadow opacity.
 
@ BufferOpacity
Buffer opacity.
 
@ LineAnchorPercent
Portion along line at which labels should be anchored (since QGIS 3.16)
 
@ ShapeOpacity
Shape opacity.
 
@ FontSizeUnit
Font size units.
 
@ Rotation
Label rotation (deprecated, for old project compatibility only)
 
@ Italic
Use italic style.
 
@ ShapeTransparency
Shape transparency (deprecated)
 
@ PredefinedPositionOrder
 
@ ShadowTransparency
Shadow transparency (deprecated)
 
@ MinScale
Min scale (deprecated, for old project compatibility only)
 
@ FontWordSpacing
Word spacing.
 
@ MaskBufferSize
Mask buffer size.
 
@ LineAnchorType
Line anchor type (since QGIS 3.26)
 
@ LineAnchorClipping
Clipping mode for line anchor calculation (since QGIS 3.20)
 
@ MinimumScale
Minimum map scale (ie most "zoomed out")
 
@ FontBlendMode
Text blend mode.
 
@ MaximumScale
Maximum map scale (ie most "zoomed in")
 
@ MaskOpacity
Mask opacity.
 
@ BufferTransp
Buffer transparency (deprecated)
 
@ PolygonLabelOutside
Whether labels outside a polygon feature are permitted, or should be forced (since QGIS 3....
 
@ FontCase
Label text case.
 
@ LineAnchorTextPoint
Line anchor text point (since QGIS 3.26)
 
@ LinePlacementOptions
Line placement flags.
 
@ Vali
Vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)
 
@ FontOpacity
Text opacity.
 
void setRotationUnit(QgsUnitTypes::AngleUnit angleUnit)
Set unit for rotation of labels.
 
bool isExpression
true if this label is made from a expression string, e.g., FieldName || 'mm'
 
bool preserveRotation
True if label rotation should be preserved during label pin/unpin operations.
 
static QPixmap labelSettingsPreviewPixmap(const QgsPalLayerSettings &settings, QSize size, const QString &previewText=QString(), int padding=0)
Returns a pixmap preview for label settings.
 
bool plusSign
Whether '+' signs should be prepended to positive numeric labels.
 
bool prepare(QgsRenderContext &context, QSet< QString > &attributeNames, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs)
Prepare for registration of features.
 
QString geometryGenerator
The geometry generator expression. Null if disabled.
 
const QgsLabelLineSettings & lineSettings() const
Returns the label line settings, which contain settings related to how the label engine places and fo...
 
QgsMapUnitScale distMapUnitScale
Map unit scale for label feature distance.
 
QgsStringReplacementCollection substitutions
Substitution collection for automatic text substitution with labels.
 
Q_DECL_DEPRECATED QColor previewBkgrdColor
 
const QgsFeature * mCurFeat
 
int decimals
Number of decimal places to show for numeric labels.
 
double dist
Distance from feature to the label.
 
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
 
bool centroidWhole
true if feature centroid should be calculated from the whole feature, or false if only the visible pa...
 
Qgis::UpsideDownLabelHandling upsidedownLabels
Controls whether upside down labels are displayed and how they are handled.
 
QString fieldName
Name of field (or an expression) to use for label text.
 
void calculateLabelSize(const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f=nullptr, QgsRenderContext *context=nullptr, double *rotatedLabelX=nullptr, double *rotatedLabelY=nullptr, QgsTextDocument *document=nullptr, QgsTextDocumentMetrics *documentMetrics=nullptr)
Calculates the space required to render the provided text in map units.
 
bool formatNumbers
Set to true to format numeric label text as numbers (e.g.
 
bool containsAdvancedEffects() const
Returns true if any component of the label settings requires advanced effects such as blend modes,...
 
QgsWkbTypes::GeometryType layerType
Geometry type of layers associated with these settings.
 
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
 
void setCallout(QgsCallout *callout)
Sets the label callout renderer, responsible for drawing label callouts.
 
double maximumScale
The maximum map scale (i.e.
 
int autoWrapLength
If non-zero, indicates that label text should be automatically wrapped to (ideally) the specified num...
 
Qgis::UnplacedLabelVisibility unplacedVisibility() const
Returns the layer's unplaced label visibility.
 
bool useMaxLineLengthForAutoWrap
If true, indicates that when auto wrapping label text the autoWrapLength length indicates the maximum...
 
void setUnplacedVisibility(Qgis::UnplacedLabelVisibility visibility)
Sets the layer's unplaced label visibility.
 
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the labeling property definitions.
 
void stopRender(QgsRenderContext &context)
Finalises the label settings after use.
 
bool useSubstitutions
True if substitutions should be applied.
 
A class to represent a 2D point.
 
double distance(double x, double y) const SIP_HOLDGIL
Returns the distance between this point and a specified x, y coordinate.
 
Point geometry type, with support for z-dimension and m-values.
 
bool isEmpty() const override SIP_HOLDGIL
Returns true if the geometry is empty.
 
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
 
QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const override
Returns the calculated value of the property with the specified key from within the collection.
 
void setProperty(int key, const QgsProperty &property)
Adds a property to the collection and takes ownership of it.
 
QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext(), bool ignoreContext=false) const override
Returns the set of any fields referenced by the active properties from the collection.
 
void clear() override
Removes all properties from the collection.
 
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
 
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
 
bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const override
Prepares the collection against a specified expression context.
 
Definition for a property.
 
@ Double
Double value (including negative values)
 
@ Double0To1
Double value between 0-1 (inclusive)
 
@ StrokeWidth
Line stroke width.
 
@ String
Any string value.
 
@ RenderUnits
Render units (eg mm/pixels/map units)
 
@ PenJoinStyle
Pen join style.
 
@ SvgPath
Path to an SVG file.
 
@ IntegerPositiveGreaterZero
Non-zero positive integer values.
 
@ IntegerPositive
Positive integer values (including 0)
 
@ ColorNoAlpha
Color with no alpha channel.
 
@ Rotation
Rotation (value between 0-360 degrees)
 
@ ColorWithAlpha
Color with alpha channel.
 
@ DoublePositive
Positive double value (including 0)
 
@ Size2D
2D size (width/height different)
 
@ DataTypeString
Property requires a string value.
 
@ DataTypeNumeric
Property requires a numeric value.
 
A store for object properties.
 
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
 
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
 
static QgsProperty fromField(const QString &fieldName, bool isActive=true)
Returns a new FieldBasedProperty created from the specified field name.
 
void setActive(bool active)
Sets whether the property is currently active.
 
The class is used as a container of context for various read/write operations on other objects.
 
A rectangle specified with double values.
 
double height() const SIP_HOLDGIL
Returns the height of the rectangle.
 
void grow(double delta)
Grows the rectangle in place by the specified amount.
 
double width() const SIP_HOLDGIL
Returns the width of the rectangle.
 
bool contains(const QgsRectangle &rect) const SIP_HOLDGIL
Returns true when rectangle contains other rectangle.
 
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
 
QgsCoordinateReferenceSystem crs() const
Returns the associated coordinate reference system, or an invalid CRS if no reference system is set.
 
A QgsGeometry with associated coordinate reference system.
 
Contains information about the context of a rendering operation.
 
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
 
void setScaleFactor(double factor)
Sets the scaling factor for the render to convert painter units to physical sizes.
 
void setUseAdvancedEffects(bool enabled)
Used to enable or disable advanced effects such as blend modes.
 
double rendererScale() const
Returns the renderer map scale.
 
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
 
QgsExpressionContext & expressionContext()
Gets the expression context.
 
QgsGeometry featureClipGeometry() const
Returns the geometry to use to clip features at render time.
 
QgsRectangle mapExtent() const
Returns the original extent of the map being rendered.
 
void setFlag(Qgis::RenderContextFlag flag, bool on=true)
Enable or disable a particular flag (other flags are not affected)
 
const QgsVectorSimplifyMethod & vectorSimplifyMethod() const
Returns the simplification settings to use when rendering vector layers.
 
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
 
void setMapToPixel(const QgsMapToPixel &mtp)
Sets the context's map to pixel transform, which transforms between map coordinates and device coordi...
 
double convertToMapUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to map units.
 
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
 
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
 
const QgsPathResolver & pathResolver() const
Returns the path resolver for conversion between relative and absolute paths during rendering operati...
 
void readXml(const QDomElement &elem)
Reads the collection state from an XML element.
 
QString process(const QString &input) const
Processes a given input string, applying any valid replacements which should be made using QgsStringR...
 
void writeXml(QDomElement &elem, QDomDocument &doc) const
Writes the collection state to an XML element.
 
static QString capitalize(const QString &string, Qgis::Capitalization capitalization)
Converts a string by applying capitalization rules to the string.
 
static QString wordWrap(const QString &string, int length, bool useMaxLineLength=true, const QString &customDelimiter=QString())
Automatically wraps a string by inserting new line characters at appropriate locations in the string.
 
QgsTextFormat defaultTextFormat(QgsStyle::TextFormatContext context=QgsStyle::TextFormatContext::Labeling) const
Returns the default text format to use for new text based objects in the specified context.
 
static QgsStyle * defaultStyle()
Returns default application-wide style.
 
@ Labeling
Text format used in labeling.
 
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
 
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
 
static QColor decodeColor(const QString &str)
 
static QPointF toPoint(const QVariant &value, bool *ok=nullptr)
Converts a value to a point.
 
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
 
static QSizeF toSize(const QVariant &value, bool *ok=nullptr)
Converts a value to a size.
 
static QPainter::CompositionMode decodeBlendMode(const QString &s)
 
static QString encodeSize(QSizeF size)
Encodes a QSizeF to a string.
 
static QString svgSymbolNameToPath(const QString &name, const QgsPathResolver &pathResolver)
Determines an SVG symbol's path from its name.
 
static QString encodeColor(const QColor &color)
 
static QString encodePoint(QPointF point)
Encodes a QPointF to a string.
 
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
 
Abstract base class for all rendered symbols.
 
Container for settings relating to a text background object.
 
QString svgFile() const
Returns the absolute path to the background SVG file, if set.
 
QSizeF size() const
Returns the size of the background shape.
 
QSizeF radii() const
Returns the radii used for rounding the corners of shapes.
 
void setOpacity(double opacity)
Sets the background shape's opacity.
 
void setStrokeColor(const QColor &color)
Sets the color used for outlining the background shape.
 
Qt::PenJoinStyle joinStyle() const
Returns the join style used for drawing the background shape.
 
SizeType
Methods for determining the background shape size.
 
bool enabled() const
Returns whether the background is enabled.
 
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the background shape.
 
void setRadiiUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's radii.
 
double opacity() const
Returns the background shape's opacity.
 
double rotation() const
Returns the rotation for the background shape, in degrees clockwise.
 
QColor fillColor() const
Returns the color used for filing the background shape.
 
void setRadii(QSizeF radii)
Sets the radii used for rounding the corners of shapes.
 
SizeType sizeType() const
Returns the method used to determine the size of the background shape (e.g., fixed size or buffer aro...
 
ShapeType type() const
Returns the type of background shape (e.g., square, ellipse, SVG).
 
double strokeWidth() const
Returns the width of the shape's stroke (stroke).
 
void setSizeType(SizeType type)
Sets the method used to determine the size of the background shape (e.g., fixed size or buffer around...
 
ShapeType
Background shape types.
 
@ ShapeMarkerSymbol
Marker symbol.
 
void setFillColor(const QColor &color)
Sets the color used for filing the background shape.
 
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's stroke width.
 
QColor strokeColor() const
Returns the color used for outlining the background shape.
 
void setRotationType(RotationType type)
Sets the method used for rotating the background shape.
 
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the background shape.
 
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the shape size.
 
void setType(ShapeType type)
Sets the type of background shape to draw (e.g., square, ellipse, SVG).
 
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units used for the shape's size.
 
RotationType
Methods for determining the rotation of the background shape.
 
void setEnabled(bool enabled)
Sets whether the text background will be drawn.
 
QgsMarkerSymbol * markerSymbol() const
Returns the marker symbol to be rendered in the background.
 
void setRotation(double rotation)
Sets the rotation for the background shape, in degrees clockwise.
 
void setOffset(QPointF offset)
Sets the offset used for drawing the background shape.
 
void setSize(QSizeF size)
Sets the size of the background shape.
 
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the shape's size.
 
void setSvgFile(const QString &file)
Sets the path to the background SVG file.
 
void setStrokeWidth(double width)
Sets the width of the shape's stroke (stroke).
 
QPointF offset() const
Returns the offset used for drawing the background shape.
 
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shape's offset.
 
Container for settings relating to a text buffer.
 
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the buffer.
 
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
 
double size() const
Returns the size of the buffer.
 
void setColor(const QColor &color)
Sets the color for the buffer.
 
void setOpacity(double opacity)
Sets the buffer opacity.
 
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the buffer size.
 
bool enabled() const
Returns whether the buffer is enabled.
 
double opacity() const
Returns the buffer opacity.
 
void setEnabled(bool enabled)
Sets whether the text buffer will be drawn.
 
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the buffer size.
 
QColor color() const
Returns the color of the buffer.
 
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
 
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
 
void setSize(double size)
Sets the size of the buffer.
 
Contains pre-calculated metrics of a QgsTextDocument.
 
QSizeF documentSize(Qgis::TextLayoutMode mode, Qgis::TextOrientation orientation) const
Returns the overall size of the document.
 
static QgsTextDocumentMetrics calculateMetrics(const QgsTextDocument &document, const QgsTextFormat &format, const QgsRenderContext &context, double scaleFactor=1.0)
Returns precalculated text metrics for a text document, when rendered using the given base format and...
 
Represents a document consisting of one or more QgsTextBlock objects.
 
void splitLines(const QString &wrapCharacter, int autoWrapLength=0, bool useMaxLineLengthWhenAutoWrapping=true)
Splits lines of text in the document to separate lines, using a specified wrap character (wrapCharact...
 
static QgsTextDocument fromHtml(const QStringList &lines)
Constructor for QgsTextDocument consisting of a set of HTML formatted lines.
 
Container for all settings relating to text rendering.
 
void setColor(const QColor &color)
Sets the color that text will be rendered in.
 
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the text.
 
QgsMapUnitScale sizeMapUnitScale() const
Returns the map unit scale object for the size.
 
void setOrientation(Qgis::TextOrientation orientation)
Sets the orientation for the text.
 
QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns all field names referenced by the configuration (e.g.
 
double lineHeight() const
Returns the line height for text.
 
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the size of rendered text.
 
int stretchFactor() const
Returns the text's stretch factor.
 
void setShadow(const QgsTextShadowSettings &shadowSettings)
Sets the text's drop shadow settings.
 
void setMask(const QgsTextMaskSettings &maskSettings)
Sets the text's masking settings.
 
QFont scaledFont(const QgsRenderContext &context, double scaleFactor=1.0, bool *isZeroSize=nullptr) const
Returns a font with the size scaled to match the format's size settings (including units and map unit...
 
void setOpacity(double opacity)
Sets the text's opacity.
 
void readXml(const QDomElement &elem, const QgsReadWriteContext &context)
Read settings from a DOM element.
 
QgsUnitTypes::RenderUnit lineHeightUnit() const
Returns the units for the line height for text.
 
Qgis::Capitalization capitalization() const
Returns the text capitalization style.
 
QgsTextMaskSettings & mask()
Returns a reference to the masking settings.
 
void setBuffer(const QgsTextBufferSettings &bufferSettings)
Sets the text's buffer settings.
 
QgsTextBackgroundSettings & background()
Returns a reference to the text background settings.
 
double opacity() const
Returns the text's opacity.
 
Qgis::TextOrientation orientation() const
Returns the orientation of the text.
 
QString namedStyle() const
Returns the named style for the font used for rendering text (e.g., "bold").
 
double size() const
Returns the size for rendered text.
 
QgsTextShadowSettings & shadow()
Returns a reference to the text drop shadow settings.
 
void setBackground(const QgsTextBackgroundSettings &backgroundSettings)
Sets the text's background settings.q.
 
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Write settings into a DOM element.
 
QColor color() const
Returns the color that text will be rendered in.
 
QFont font() const
Returns the font used for rendering text.
 
void readFromLayer(QgsVectorLayer *layer)
Reads settings from a layer's custom properties (for QGIS 2.x projects).
 
QColor previewBackgroundColor() const
Returns the background color for text previews.
 
bool containsAdvancedEffects() const
Returns true if any component of the font format requires advanced effects such as blend modes,...
 
QgsTextBufferSettings & buffer()
Returns a reference to the text buffer settings.
 
void setLineHeight(double height)
Sets the line height for text.
 
static QgsPrecalculatedTextMetrics calculateTextMetrics(const QgsMapToPixel *xform, const QgsRenderContext &context, const QFont &baseFont, const QFontMetricsF &fontMetrics, double letterSpacing, double wordSpacing, const QString &text=QString(), QgsTextDocument *document=nullptr, QgsTextDocumentMetrics *metrics=nullptr)
Calculate text metrics for later retrieval via textMetrics().
 
Container for settings relating to a selective masking around a text.
 
void setEnabled(bool)
Returns whether the mask is enabled.
 
void setSize(double size)
Sets the size of the buffer.
 
double size() const
Returns the size of the buffer.
 
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
 
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
 
double opacity() const
Returns the mask's opacity.
 
bool enabled() const
Returns whether the mask is enabled.
 
Qt::PenJoinStyle joinStyle() const
Returns the buffer join style.
 
void setOpacity(double opacity)
Sets the mask's opacity.
 
static QgsTextBackgroundSettings::ShapeType decodeShapeType(const QString &string)
Decodes a string representation of a background shape type to a type.
 
static Qgis::TextOrientation decodeTextOrientation(const QString &name, bool *ok=nullptr)
Attempts to decode a string representation of a text orientation.
 
static QgsTextShadowSettings::ShadowPlacement decodeShadowPlacementType(const QString &string)
Decodes a string representation of a shadow placement type to a type.
 
static QgsTextBackgroundSettings::RotationType decodeBackgroundRotationType(const QString &string)
Decodes a string representation of a background rotation type to a type.
 
static QString encodeTextOrientation(Qgis::TextOrientation orientation)
Encodes a text orientation.
 
static QgsTextBackgroundSettings::SizeType decodeBackgroundSizeType(const QString &string)
Decodes a string representation of a background size type to a type.
 
static double textWidth(const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, QFontMetricsF *fontMetrics=nullptr)
Returns the width of a text based on a given format.
 
static int sizeToPixel(double size, const QgsRenderContext &c, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &mapUnitScale=QgsMapUnitScale())
Calculates pixel size (considering output size should be in pixel or map units, scale factors and opt...
 
static double textHeight(const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, Qgis::TextLayoutMode mode=Qgis::TextLayoutMode::Point, QFontMetricsF *fontMetrics=nullptr, Qgis::TextRendererFlags flags=Qgis::TextRendererFlags(), double maxLineWidth=0)
Returns the height of a text based on a given format.
 
static void drawText(const QRectF &rect, double rotation, Qgis::TextHorizontalAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, bool drawAsOutlines=true, Qgis::TextVerticalAlignment vAlignment=Qgis::TextVerticalAlignment::Top, Qgis::TextRendererFlags flags=Qgis::TextRendererFlags())
Draws text within a rectangle using the specified settings.
 
Container for settings relating to a text shadow.
 
int offsetAngle() const
Returns the angle for offsetting the position of the shadow from the text.
 
bool enabled() const
Returns whether the shadow is enabled.
 
int scale() const
Returns the scaling used for the drop shadow (in percentage of original size).
 
void setShadowPlacement(QgsTextShadowSettings::ShadowPlacement placement)
Sets the placement for the drop shadow.
 
double opacity() const
Returns the shadow's opacity.
 
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the drop shadow.
 
void setColor(const QColor &color)
Sets the color for the drop shadow.
 
QColor color() const
Returns the color of the drop shadow.
 
ShadowPlacement
Placement positions for text shadow.
 
void setScale(int scale)
Sets the scaling used for the drop shadow (in percentage of original size).
 
double offsetDistance() const
Returns the distance for offsetting the position of the shadow from the text.
 
void setOffsetDistance(double distance)
Sets the distance for offsetting the position of the shadow from the text.
 
void setOpacity(double opacity)
Sets the shadow's opacity.
 
void setOffsetAngle(int angle)
Sets the angle for offsetting the position of the shadow from the text.
 
void setBlurRadiusUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's blur radius.
 
double blurRadius() const
Returns the blur radius for the shadow.
 
void setBlurRadius(double blurRadius)
Sets the blur radius for the shadow.
 
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's offset.
 
void setEnabled(bool enabled)
Sets whether the text shadow will be drawn.
 
AngleUnit
Units of angles.
 
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
 
static Q_INVOKABLE double fromUnitToUnitFactor(QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
 
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
 
RenderUnit
Rendering size units.
 
@ RenderPercentage
Percentage of another measurement (e.g., canvas size, feature size)
 
@ RenderPoints
Points (e.g., for font sizes)
 
@ RenderMillimeters
Millimeters.
 
@ RenderMapUnits
Map units.
 
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
 
Represents a vector layer which manages a vector based data sets.
 
bool labelsEnabled() const
Returns whether the layer contains labels which are enabled and should be drawn.
 
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
 
bool diagramsEnabled() const
Returns whether the layer contains diagrams which are enabled and should be drawn.
 
This class contains information how to simplify geometries fetched from a vector layer.
 
double tolerance() const
Gets the tolerance of simplification in map units. Represents the maximum distance in map units betwe...
 
bool forceLocalOptimization() const
Gets where the simplification executes, after fetch the geometries from provider, or when supported,...
 
SimplifyHints simplifyHints() const
Gets the simplification hints of the vector layer managed.
 
SimplifyAlgorithm simplifyAlgorithm() const
Gets the local simplification algorithm of the vector layer managed.
 
@ NoSimplification
No simplification can be applied.
 
Basic labeling configuration for vector tile layers.
 
Implements a map layer that is dedicated to rendering of vector tiles.
 
QgsVectorTileLabeling * labeling() const
Returns currently assigned labeling.
 
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
 
LabelPosition is a candidate feature label position.
 
double getAlpha() const
Returns the angle to rotate text (in rad).
 
double cost() const
Returns the candidate label position's geographical cost.
 
bool conflictsWithObstacle() const
Returns whether the position is marked as conflicting with an obstacle feature.
 
FeaturePart * getFeaturePart() const
Returns the feature corresponding to this labelposition.
 
double getX(int i=0) const
Returns the down-left x coordinate.
 
double getY(int i=0) const
Returns the down-left y coordinate.
 
LabelPosition * nextPart() const
Returns the next part of this label position (i.e.
 
@ PointCloudLayer
Point cloud layer. Added in QGIS 3.18.
 
@ MeshLayer
Mesh layer. Added in QGIS 3.2.
 
@ VectorLayer
Vector layer.
 
@ RasterLayer
Raster layer.
 
@ GroupLayer
Composite group layer. Added in QGIS 3.24.
 
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.
 
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
 
@ PluginLayer
Plugin based layer.
 
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
 
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
 
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
 
#define Q_NOWARN_DEPRECATED_POP
 
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
 
#define Q_NOWARN_DEPRECATED_PUSH
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
Q_GLOBAL_STATIC(QReadWriteLock, sDefinitionCacheLock)
 
#define QgsDebugMsgLevel(str, level)
 
QString updateDataDefinedString(const QString &value)
 
QVector< Qgis::LabelPredefinedPointPosition > PredefinedPointPositionVector
 
Q_GLOBAL_STATIC_WITH_ARGS(PredefinedPointPositionVector, DEFAULT_PLACEMENT_ORDER,({ Qgis::LabelPredefinedPointPosition::TopRight, Qgis::LabelPredefinedPointPosition::TopLeft, Qgis::LabelPredefinedPointPosition::BottomRight, Qgis::LabelPredefinedPointPosition::BottomLeft, Qgis::LabelPredefinedPointPosition::MiddleRight, Qgis::LabelPredefinedPointPosition::MiddleLeft, Qgis::LabelPredefinedPointPosition::TopSlightlyRight, Qgis::LabelPredefinedPointPosition::BottomSlightlyRight })) void QgsPalLayerSettings
 
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
 
const QgsCoordinateReferenceSystem & crs