@@ -174,6 +174,7 @@ QgsPalLayerSettings::QgsPalLayerSettings()
174
174
vectorScaleFactor = 1.0 ;
175
175
rasterCompressFactor = 1.0 ;
176
176
addDirectionSymbol = false ;
177
+ upsidedownLabels = Upright;
177
178
fontSizeInMapUnits = false ;
178
179
bufferSizeInMapUnits = false ;
179
180
labelOffsetInMapUnits = true ;
@@ -221,6 +222,7 @@ QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
221
222
vectorScaleFactor = s.vectorScaleFactor ;
222
223
rasterCompressFactor = s.rasterCompressFactor ;
223
224
addDirectionSymbol = s.addDirectionSymbol ;
225
+ upsidedownLabels = s.upsidedownLabels ;
224
226
fontSizeInMapUnits = s.fontSizeInMapUnits ;
225
227
bufferSizeInMapUnits = s.bufferSizeInMapUnits ;
226
228
distInMapUnits = s.distInMapUnits ;
@@ -400,6 +402,7 @@ void QgsPalLayerSettings::readFromLayer( QgsVectorLayer* layer )
400
402
displayAll = layer->customProperty ( " labeling/displayAll" , QVariant ( false ) ).toBool ();
401
403
mergeLines = layer->customProperty ( " labeling/mergeLines" ).toBool ();
402
404
addDirectionSymbol = layer->customProperty ( " labeling/addDirectionSymbol" ).toBool ();
405
+ upsidedownLabels = ( UpsideDownLabels ) layer->customProperty ( " labeling/upsidedownLabels" , QVariant ( Upright ) ).toUInt ();
403
406
minFeatureSize = layer->customProperty ( " labeling/minFeatureSize" ).toDouble ();
404
407
fontSizeInMapUnits = layer->customProperty ( " labeling/fontSizeInMapUnits" ).toBool ();
405
408
bufferSizeInMapUnits = layer->customProperty ( " labeling/bufferSizeInMapUnits" ).toBool ();
@@ -458,6 +461,7 @@ void QgsPalLayerSettings::writeToLayer( QgsVectorLayer* layer )
458
461
layer->setCustomProperty ( " labeling/displayAll" , displayAll );
459
462
layer->setCustomProperty ( " labeling/mergeLines" , mergeLines );
460
463
layer->setCustomProperty ( " labeling/addDirectionSymbol" , addDirectionSymbol );
464
+ layer->setCustomProperty ( " labeling/upsidedownLabels" , ( unsigned int )upsidedownLabels );
461
465
layer->setCustomProperty ( " labeling/minFeatureSize" , minFeatureSize );
462
466
layer->setCustomProperty ( " labeling/fontSizeInMapUnits" , fontSizeInMapUnits );
463
467
layer->setCustomProperty ( " labeling/bufferSizeInMapUnits" , bufferSizeInMapUnits );
@@ -1064,6 +1068,17 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
1064
1068
// set whether adjacent lines should be merged
1065
1069
l->setMergeConnectedLines ( lyr.mergeLines );
1066
1070
1071
+ // set how to show upside-down labels
1072
+ Layer::UpsideDownLabels upsdnlabels;
1073
+ switch ( lyr.upsidedownLabels )
1074
+ {
1075
+ case QgsPalLayerSettings::Upright: upsdnlabels = Layer::Upright; break ;
1076
+ case QgsPalLayerSettings::ShowDefined: upsdnlabels = Layer::ShowDefined; break ;
1077
+ case QgsPalLayerSettings::ShowAll: upsdnlabels = Layer::ShowAll; break ;
1078
+ default : Q_ASSERT ( " unsupported upside-down label setting" && 0 ); return 0 ;
1079
+ }
1080
+ l->setUpsidedownLabels ( upsdnlabels );
1081
+
1067
1082
// fix for font size in map units causing font to show pointsize at small map scales
1068
1083
int pixelFontSize = lyr.sizeToPixel ( lyr.textFont .pointSizeF (), ctx );
1069
1084
0 commit comments