File: qgspallabeling.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (746 lines) | stat: -rw-r--r-- 18,800 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/labeling/qgspallabeling.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsPalLayerSettings
{
%Docstring(signature="appended")
Contains settings for how a map layer will be labeled.
%End

%TypeHeaderCode
#include "qgspallabeling.h"
%End
  public:
    QgsPalLayerSettings();
    QgsPalLayerSettings( const QgsPalLayerSettings &s );
    ~QgsPalLayerSettings();


    enum class Property /BaseType=IntEnum/
      {
      // text style
      Size,
      Bold,
      Italic,
      Underline,
      Color,
      Strikeout,
      Family,
      FontStyle,
      FontSizeUnit,
      FontTransp,
      FontOpacity,
      FontCase,
      FontLetterSpacing,
      FontWordSpacing,
      FontBlendMode,
      FontStretchFactor,

      // text formatting
      MultiLineWrapChar,
      AutoWrapLength,
      MultiLineHeight,
      MultiLineAlignment,
      TextOrientation,
      TabStopDistance,
      DirSymbDraw,
      DirSymbLeft,
      DirSymbRight,
      DirSymbPlacement,
      DirSymbReverse,
      NumFormat,
      NumDecimals,
      NumPlusSign,

      // text buffer
      BufferDraw,
      BufferSize,
      BufferUnit,
      BufferColor,
      BufferTransp,
      BufferOpacity,
      BufferJoinStyle,
      BufferBlendMode,

      // mask buffer
      MaskEnabled,
      MaskBufferSize,
      MaskBufferUnit,
      MaskOpacity,
      MaskJoinStyle,

      // background
      ShapeDraw,
      ShapeKind,
      ShapeSVGFile,
      ShapeSizeType,
      ShapeSizeX,
      ShapeSizeY,
      ShapeSizeUnits,
      ShapeRotationType,
      ShapeRotation,
      ShapeOffset,
      ShapeOffsetUnits,
      ShapeRadii,
      ShapeRadiiUnits,
      ShapeTransparency,
      ShapeOpacity,
      ShapeBlendMode,
      ShapeFillColor,
      ShapeStrokeColor,
      ShapeStrokeWidth,
      ShapeStrokeWidthUnits,
      ShapeJoinStyle,

      // drop shadow
      ShadowDraw,
      ShadowUnder,
      ShadowOffsetAngle,
      ShadowOffsetDist,
      ShadowOffsetUnits,
      ShadowRadius,
      ShadowRadiusUnits,
      ShadowTransparency,
      ShadowOpacity,
      ShadowScale,
      ShadowColor,
      ShadowBlendMode,

      // placement
      CentroidWhole,
      OffsetQuad,
      OffsetXY,
      OffsetUnits,
      LabelDistance,
      MaximumDistance,
      DistanceUnits,
      OffsetRotation,
      CurvedCharAngleInOut,
      // (data defined only)
      PositionX,
      PositionY,
      PositionPoint,
      Hali,
      Vali,
      Rotation,
      LabelRotation,
      RepeatDistance,
      RepeatDistanceUnit,
      Priority,
      PredefinedPositionOrder,
      LinePlacementOptions,
      OverrunDistance,
      LabelAllParts,
      PolygonLabelOutside,
      LineAnchorPercent,
      LineAnchorClipping,
      LineAnchorType,
      LineAnchorTextPoint,

      // rendering
      ScaleVisibility,
      MinScale,
      MinimumScale,
      MaxScale,
      MaximumScale,
      FontLimitPixel,
      FontMinPixel,
      FontMaxPixel,
      IsObstacle,
      ObstacleFactor,
      ZIndex,
      CalloutDraw,

      AllowDegradedPlacement,
      OverlapHandling,

      // (data defined only)
      Show,
      AlwaysShow
    };

    bool prepare( QgsRenderContext &context, QSet<QString> &attributeNames /In,Out/, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs );
%Docstring
Prepare for registration of features. The ``context``, ``mapSettings``
and ``fields`` parameters give more information about the rendering
environment. If target ``crs`` is not specified, the targetCrs from
``mapSettings`` will be taken. The parameter ``attributeNames`` should
be updated to contain all the field names which the labeling requires
for the rendering.

.. versionadded:: 3.8
%End

    QSet<QString> referencedFields( const QgsRenderContext &context ) const;
%Docstring
Returns all field names referenced by the configuration (e.g. field name
or expression, data defined properties).

.. versionadded:: 3.14
%End

    void startRender( QgsRenderContext &context );
%Docstring
Prepares the label settings for rendering.

This should be called before rendering any labels, and must be followed
by a call to :py:func:`~QgsPalLayerSettings.stopRender` in order to
gracefully clean up symbols.

.. versionadded:: 3.10
%End

    void stopRender( QgsRenderContext &context );
%Docstring
Finalises the label settings after use.

This must be called after a call to
:py:func:`~QgsPalLayerSettings.startRender`, in order to gracefully
clean up symbols.

.. versionadded:: 3.10
%End

    bool containsAdvancedEffects() const;
%Docstring
Returns ``True`` if any component of the label settings requires
advanced effects such as blend modes, which require output in raster
formats to be fully respected.

.. versionadded:: 3.20
%End

    static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
Returns the labeling property definitions.
%End

    bool drawLabels;


    QString fieldName;

    bool isExpression;

    QgsExpression *getLabelExpression();
%Docstring
Returns the :py:class:`QgsExpression` for this label settings. May be
``None`` if isExpression is ``False``.
%End

 QColor previewBkgrdColor;

    QgsStringReplacementCollection substitutions;
    bool useSubstitutions;


    QString wrapChar;

    int autoWrapLength;

    bool useMaxLineLengthForAutoWrap;

    Qgis::LabelMultiLineAlignment multilineAlign;

    bool formatNumbers;

    int decimals;

    bool plusSign;


    Qgis::LabelPlacement placement;

    Qgis::LabelPolygonPlacementFlags polygonPlacementFlags() const;
%Docstring
Returns the polygon placement flags, which dictate how polygon labels
can be placed.

.. seealso:: :py:func:`setPolygonPlacementFlags`

.. versionadded:: 3.14
%End

    void setPolygonPlacementFlags( Qgis::LabelPolygonPlacementFlags flags );
%Docstring
Sets the polygon placement ``flags``, which dictate how polygon labels
can be placed.

.. seealso:: :py:func:`polygonPlacementFlags`

.. versionadded:: 3.14
%End

    bool centroidWhole;

    bool centroidInside;

    bool fitInPolygonOnly;

    double dist;

    Qgis::RenderUnit distUnits;

    QgsMapUnitScale distMapUnitScale;

    Qgis::LabelOffsetType offsetType;

    double repeatDistance;

    Qgis::RenderUnit repeatDistanceUnit;

    QgsMapUnitScale repeatDistanceMapUnitScale;

    double xOffset;

    double yOffset;

    Qgis::RenderUnit offsetUnits;

    QgsMapUnitScale labelOffsetMapUnitScale;

    double angleOffset;

    bool preserveRotation;

    Qgis::AngleUnit rotationUnit() const;
%Docstring
Unit for rotation of labels.

.. seealso:: :py:func:`setRotationUnit`

.. versionadded:: 3.22
%End

    void setRotationUnit( Qgis::AngleUnit angleUnit );
%Docstring
Set unit for rotation of labels.

.. seealso:: :py:func:`rotationUnit`

.. versionadded:: 3.22
%End

    double maxCurvedCharAngleIn;

    double maxCurvedCharAngleOut;

    int priority;


    bool scaleVisibility;

    double maximumScale;

    double minimumScale;

    bool fontLimitPixelSize;

    int fontMinPixelSize;

    int fontMaxPixelSize;

    Qgis::UpsideDownLabelHandling upsidedownLabels;

    bool labelPerPart;

    double zIndex;

    QString geometryGenerator;

    Qgis::GeometryType geometryGeneratorType;

    bool geometryGeneratorEnabled;

    Qgis::GeometryType layerType;

    void setLegendString( const QString &legendString );
%Docstring
setLegendString

:param legendString: the string to show in the legend and preview
%End

    QString legendString() const;
%Docstring
legendString

:return: the string to show in the legend and in the preview icon
%End

 void calculateLabelSize( const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f = 0, QgsRenderContext *context = 0, double *rotatedLabelX /Out/ = 0, double *rotatedLabelY /Out/ = 0 ) /Deprecated/;
%Docstring
Calculates the space required to render the provided ``text`` in map
units. Results will be written to ``labelX`` and ``labelY``.

If the text orientation is set to rotation-based, the spaced taken to
render vertically oriented text will be written to ``rotatedLabelX`` and
``rotatedLabelY``.

.. warning::

   This method only returns an approximate label size, and eg will not consider
   HTML formatted text correctly.

.. deprecated:: 3.40

   Will be removed from public API in QGIS 4.0.
%End

    void registerFeature( const QgsFeature &f, QgsRenderContext &context );
%Docstring
Registers a feature for labeling.

:param f: feature to label
:param context: render context. The :py:class:`QgsExpressionContext`
                contained within the render context must have already
                had the feature and fields sets prior to calling this
                method.

.. warning::

   This method is designed for use by PyQGIS clients only. C++ code should use the
   variant with additional arguments.
%End


    void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Read settings from a DOM element
%End

    QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Write settings into a DOM element
%End

    QgsPropertyCollection &dataDefinedProperties();
%Docstring
Returns a reference to the label's property collection, used for data
defined overrides.

.. seealso:: :py:func:`setDataDefinedProperties`
%End


    void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
Sets the label's property collection, used for data defined overrides.

:param collection: property collection. Existing properties will be
                   replaced.

.. seealso:: :py:func:`dataDefinedProperties`

.. seealso:: Property
%End

    const QgsTextFormat &format() const;
%Docstring
Returns the label text formatting settings, e.g., font settings, buffer
settings, etc.

.. seealso:: :py:func:`setFormat`
%End

    void setFormat( const QgsTextFormat &format );
%Docstring
Sets the label text formatting settings, e.g., font settings, buffer
settings, etc.

:param format: label text format

.. seealso:: :py:func:`format`
%End

    QgsCallout *callout() const;
%Docstring
Returns the label callout renderer, responsible for drawing label
callouts.

Ownership is not transferred.

.. seealso:: :py:func:`setCallout`

.. versionadded:: 3.10
%End

    void setCallout( QgsCallout *callout /Transfer/ );
%Docstring
Sets the label ``callout`` renderer, responsible for drawing label
callouts.

Ownership of ``callout`` is transferred to the settings.

.. seealso:: :py:func:`callout`

.. versionadded:: 3.10
%End


    QgsLabelLineSettings &lineSettings();
%Docstring
Returns the label line settings, which contain settings related to how
the label engine places and formats labels for line features (or polygon
features which are labeled in a "perimeter" style mode).

.. seealso:: :py:func:`setLineSettings`

.. versionadded:: 3.16
%End

    void setLineSettings( const QgsLabelLineSettings &settings );
%Docstring
Sets the label line ``settings``, which contain settings related to how
the label engine places and formats labels for line features (or polygon
features which are labeled in a "perimeter" style mode).

.. seealso:: :py:func:`lineSettings`

.. versionadded:: 3.16
%End


    QgsLabelPointSettings &pointSettings();
%Docstring
Returns the label point settings, which contain settings related to how
the label engine places and formats labels for point features, or
polygon features which are labeled in the "around" or "over" centroid
placement modes.

.. seealso:: :py:func:`setPointSettings`

.. versionadded:: 3.38
%End

    void setPointSettings( const QgsLabelPointSettings &settings );
%Docstring
Sets the label point ``settings``, which contain settings related to how
the label engine places and formats labels for point features, or
polygon features which are labeled in the "around" or "over" centroid
placement modes.

.. seealso:: :py:func:`pointSettings`

.. versionadded:: 3.38
%End


    QgsLabelObstacleSettings &obstacleSettings();
%Docstring
Returns the label obstacle settings.

.. seealso:: :py:func:`setObstacleSettings`

.. versionadded:: 3.10.2
%End

    void setObstacleSettings( const QgsLabelObstacleSettings &settings );
%Docstring
Sets the label obstacle ``settings``.

.. seealso:: :py:func:`obstacleSettings`

.. versionadded:: 3.10.2
%End


    QgsLabelThinningSettings &thinningSettings();
%Docstring
Returns the label thinning settings.

.. seealso:: :py:func:`setThinningSettings`

.. versionadded:: 3.12
%End

    void setThinningSettings( const QgsLabelThinningSettings &settings );
%Docstring
Sets the label thinning ``settings``.

.. seealso:: :py:func:`thinningSettings`

.. versionadded:: 3.12
%End


    QgsLabelPlacementSettings &placementSettings();
%Docstring
Returns the label placement settings.

.. seealso:: :py:func:`setPlacementSettings`

.. versionadded:: 3.26
%End

    void setPlacementSettings( const QgsLabelPlacementSettings &settings );
%Docstring
Sets the label placement ``settings``.

.. seealso:: :py:func:`placementSettings`

.. versionadded:: 3.26
%End

    static QPixmap labelSettingsPreviewPixmap( const QgsPalLayerSettings &settings, QSize size, const QString &previewText = QString(), int padding = 0, const QgsScreenProperties &screen = QgsScreenProperties() );
%Docstring
Returns a pixmap preview for label ``settings``.

:param settings: label settings
:param size: target pixmap size
:param previewText: text to render in preview, or empty for default text
:param padding: space between icon edge and color ramp
:param screen: can be used to specify the destination screen properties
               for the icon. This allows the icon to be generated using
               the correct DPI and device pixel ratio for the target
               screen (since QGIS 3.32)

.. versionadded:: 3.10
%End

    Qgis::UnplacedLabelVisibility unplacedVisibility() const;
%Docstring
Returns the layer's unplaced label visibility.

.. seealso:: :py:func:`setUnplacedVisibility`

.. versionadded:: 3.20
%End

    void setUnplacedVisibility( Qgis::UnplacedLabelVisibility visibility );
%Docstring
Sets the layer's unplaced label ``visibility``.

.. seealso:: :py:func:`unplacedVisibility`

.. versionadded:: 3.20
%End

    const QgsFeature *mCurFeat;
    QgsFields mCurFields;
    int fieldIndex;
    const QgsMapToPixel *xform;
    QgsCoordinateTransform ct;

    QgsPointXY ptZero;
    QgsPointXY ptOne;
    QgsGeometry extentGeom;
    int mFeaturesToLabel;
    int mFeatsSendingToPal;
    int mFeatsRegPal;

};

class QgsLabelCandidate
{
%Docstring(signature="appended")
Represents a label candidate.
%End

%TypeHeaderCode
#include "qgspallabeling.h"
%End
  public:
    QgsLabelCandidate( const QRectF &r, double c );

    QRectF rect;
    double cost;
};

class QgsPalLabeling
{
%Docstring(signature="appended")
PAL labeling utilities.
%End

%TypeHeaderCode
#include "qgspallabeling.h"
%End
  public:

    static bool staticWillUseLayer( const QgsMapLayer *layer );
%Docstring
Called to find out whether a specified ``layer`` is used for labeling.
%End


    static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) /Factory/;
%Docstring
Prepares a geometry for registration with PAL. Handles reprojection,
rotation, clipping, etc.

:param geometry: geometry to prepare
:param context: render context
:param ct: coordinate transform, or invalid transform if no
           transformation required
:param clipGeometry: geometry to clip features to, if applicable
:param mergeLines: ``True`` if touching lines from this layer will be
                   merged and treated as single features during labeling

:return: prepared geometry
%End

    static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
%Docstring
Checks whether a geometry requires preparation before registration with
PAL

:param geometry: geometry to prepare
:param context: render context
:param ct: coordinate transform, or invalid transform if no
           transformation required
:param clipGeometry: geometry to clip features to, if applicable
:param mergeLines: ``True`` if touching lines from this layer will be
                   merged and treated as single features during labeling

:return: ``True`` if geometry requires preparation
%End

    static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
%Docstring
Splits a ``text`` string to a list of separate lines, using a specified
wrap character (``wrapCharacter``). The text string will be split on
either newline characters or the wrap character.

Since QGIS 3.4 the ``autoWrapLength`` argument can be used to specify an
ideal length of line to automatically wrap text to (automatic wrapping
is disabled if ``autoWrapLength`` is 0). This automatic wrapping is
performed after processing wrapping using ``wrapCharacter``. When auto
wrapping is enabled, the ``useMaxLineLengthWhenAutoWrapping`` argument
controls whether the lines should be wrapped to an ideal maximum of
``autoWrapLength`` characters, or if ``False`` then the lines are
wrapped to an ideal minimum length of ``autoWrapLength`` characters.
%End

    static QStringList splitToGraphemes( const QString &text );
%Docstring
Splits a text string to a list of graphemes, which are the smallest
allowable character divisions in the string. This accounts for scripts
were individual characters are not allowed to be split apart (e.g.,
Arabic and Indic based scripts)

:param text: string to split

:return: list of graphemes
%End

};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/labeling/qgspallabeling.h                                   *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/