QGIS/python/core/auto_generated/labeling/qgspallabeling.sip.in

773 lines
20 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/labeling/qgspallabeling.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl 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 Placement
{
AroundPoint,
OverPoint,
Line,
Curved,
Horizontal,
Free,
OrderedPositionsAroundPoint,
PerimeterCurved,
OutsidePolygons,
};
enum PredefinedPointPosition
{
TopLeft,
TopSlightlyLeft,
TopMiddle,
TopSlightlyRight,
TopRight,
MiddleLeft,
MiddleRight,
BottomLeft,
BottomSlightlyLeft,
BottomMiddle,
BottomSlightlyRight,
BottomRight,
};
enum OffsetType
{
FromPoint,
FromSymbolBounds,
};
enum LinePlacementFlags
{
OnLine,
AboveLine,
BelowLine,
MapOrientation,
};
enum QuadrantPosition
{
QuadrantAboveLeft,
QuadrantAbove,
QuadrantAboveRight,
QuadrantLeft,
QuadrantOver,
QuadrantRight,
QuadrantBelowLeft,
QuadrantBelow,
QuadrantBelowRight,
};
enum UpsideDownLabels
{
Upright,
ShowDefined,
ShowAll
};
enum DirectionSymbols
{
SymbolLeftRight,
SymbolAbove,
SymbolBelow
};
enum MultiLineAlign
{
MultiLeft,
MultiCenter,
MultiRight,
MultiFollowPlacement,
MultiJustify,
};
enum ObstacleType
{
PolygonInterior,
PolygonBoundary,
PolygonWhole
};
enum Property
{
// text style
Size,
Bold,
Italic,
Underline,
Color,
Strikeout,
Family,
FontStyle,
FontSizeUnit,
FontTransp,
FontOpacity,
FontCase,
FontLetterSpacing,
FontWordSpacing,
FontBlendMode,
// text formatting
MultiLineWrapChar,
AutoWrapLength,
MultiLineHeight,
MultiLineAlignment,
TextOrientation,
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,
DistanceUnits,
OffsetRotation,
CurvedCharAngleInOut,
// (data defined only)
PositionX,
PositionY,
Hali,
Vali,
Rotation,
LabelRotation,
RepeatDistance,
RepeatDistanceUnit,
Priority,
PredefinedPositionOrder,
LinePlacementOptions,
OverrunDistance,
LabelAllParts,
PolygonLabelOutside,
LineAnchorPercent,
LineAnchorClipping,
// rendering
ScaleVisibility,
MinScale,
MinimumScale,
MaxScale,
MaximumScale,
FontLimitPixel,
FontMinPixel,
FontMaxPixel,
IsObstacle,
ObstacleFactor,
ZIndex,
CalloutDraw,
// (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.
.. versionadded:: 3.0
%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;
MultiLineAlign multilineAlign;
bool formatNumbers;
int decimals;
bool plusSign;
Placement placement;
QgsLabeling::PolygonPlacementFlags 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( QgsLabeling::PolygonPlacementFlags 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;
QgsUnitTypes::RenderUnit distUnits;
QgsMapUnitScale distMapUnitScale;
OffsetType offsetType;
double repeatDistance;
QgsUnitTypes::RenderUnit repeatDistanceUnit;
QgsMapUnitScale repeatDistanceMapUnitScale;
QuadrantPosition quadOffset;
double xOffset;
double yOffset;
QgsUnitTypes::RenderUnit offsetUnits;
QgsMapUnitScale labelOffsetMapUnitScale;
double angleOffset;
bool preserveRotation;
double maxCurvedCharAngleIn;
double maxCurvedCharAngleOut;
int priority;
bool scaleVisibility;
double maximumScale;
double minimumScale;
bool fontLimitPixelSize;
int fontMinPixelSize;
int fontMaxPixelSize;
bool displayAll;
UpsideDownLabels upsidedownLabels;
bool labelPerPart;
%Property( name = limitNumLabels, get = _limitNumLabels, set = _setLimitNumLabels )
%Property( name = maxNumLabels, get = _maxNumLabels, set = _setMaxNumLabels )
%Property( name = minFeatureSize, get = _minFeatureSize, set = _setMinFeatureSize )
%Property( name = obstacle, get = _getIsObstacle, set = _setIsObstacle )
%Property( name = obstacleFactor, get = _getObstacleFactor, set = _setObstacleFactor )
%Property( name = obstacleType, get = _getObstacleType, set = _setObstacleType )
%Property( name = placementFlags, get = _getLinePlacementFlags, set = _setLinePlacementFlags )
%Property( name = mergeLines, get = _getMergeLines, set = _setMergeLines )
%Property( name = addDirectionSymbol, get = _getAddDirectionSymbol, set = _setAddDirectionSymbol )
%Property( name = leftDirectionSymbol, get = _getLeftDirectionSymbol, set = _setLeftDirectionSymbol )
%Property( name = rightDirectionSymbol, get = _getRightDirectionSymbol, set = _setRightDirectionSymbol )
%Property( name = reverseDirectionSymbol, get = _getReverseDirectionSymbol, set = _setReverseDirectionSymbol )
%Property( name = placeDirectionSymbol, get = _getPlaceDirectionSymbol, set = _setPlaceDirectionSymbol )
%Property( name = overrunDistance, get = _getOverrunDistance, set = _setOverrunDistance )
%Property( name = overrunDistanceUnit, get = _getOverrunDistanceUnit, set = _setOverrunDistanceUnit )
%Property( name = overrunDistanceMapUnitScale, get = _getOverrunDistanceMapUnitScale, set = _setOverrunDistanceMapUnitScale )
bool _limitNumLabels() const;
void _setLimitNumLabels( bool limit );
int _maxNumLabels() const;
void _setMaxNumLabels( int max );
double _minFeatureSize() const;
void _setMinFeatureSize( double size );
bool _getIsObstacle() const;
void _setIsObstacle( bool obstacle );
double _getObstacleFactor() const;
void _setObstacleFactor( double factor );
ObstacleType _getObstacleType() const;
void _setObstacleType( ObstacleType type );
unsigned int _getLinePlacementFlags() const;
void _setLinePlacementFlags( unsigned int flags );
bool _getMergeLines() const;
void _setMergeLines( bool merge );
bool _getAddDirectionSymbol() const;
void _setAddDirectionSymbol( bool add );
QString _getLeftDirectionSymbol() const;
void _setLeftDirectionSymbol( const QString &symbol );
QString _getRightDirectionSymbol() const;
void _setRightDirectionSymbol( const QString &symbol );
bool _getReverseDirectionSymbol() const;
void _setReverseDirectionSymbol( bool reverse );
DirectionSymbols _getPlaceDirectionSymbol() const;
void _setPlaceDirectionSymbol( DirectionSymbols placement );
double _getOverrunDistance() const;
void _setOverrunDistance( double distance );
QgsUnitTypes::RenderUnit _getOverrunDistanceUnit() const;
void _setOverrunDistanceUnit( QgsUnitTypes::RenderUnit unit );
QgsMapUnitScale _getOverrunDistanceMapUnitScale() const;
void _setOverrunDistanceMapUnitScale( const QgsMapUnitScale &scale );
double zIndex;
QString geometryGenerator;
QgsWkbTypes::GeometryType geometryGeneratorType;
bool geometryGeneratorEnabled;
QgsWkbTypes::GeometryType layerType;
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 );
%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`` .
%End
void registerFeature( const QgsFeature &f, QgsRenderContext &context );
%Docstring
Register 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.
:param labelFeature: if using :py:class:`QgsLabelingEngine`, this will receive the label feature. Not available
in Python bindings.
%End
void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Read settings from a DOM element
.. versionadded:: 2.12
%End
QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Write settings into a DOM element
.. versionadded:: 2.12
%End
QgsPropertyCollection &dataDefinedProperties();
%Docstring
Returns a reference to the label's property collection, used for data defined overrides.
.. seealso:: :py:func:`setDataDefinedProperties`
.. versionadded:: 3.0
%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
.. versionadded:: 3.0
%End
const QgsTextFormat &format() const;
%Docstring
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
.. seealso:: :py:func:`setFormat`
.. versionadded:: 3.0
%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`
.. versionadded:: 3.0
%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
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
static QPixmap labelSettingsPreviewPixmap( const QgsPalLayerSettings &settings, QSize size, const QString &previewText = QString(), int padding = 0 );
%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
.. versionadded:: 3.10
%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.
.. versionadded:: 2.4
%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
.. versionadded:: 2.9
%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
.. versionadded:: 2.9
%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.
.. versionadded:: 2.9
%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
.. versionadded:: 2.10
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/labeling/qgspallabeling.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/