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

703 lines
16 KiB
Plaintext
Raw Normal View History

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgspallabeling.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsLabelPosition
{
%TypeHeaderCode
#include "qgspallabeling.h"
%End
public:
2019-06-03 16:50:38 +10:00
QgsLabelPosition( QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString(),
const QgsGeometry &labelGeometry = QgsGeometry() );
2019-06-03 16:50:38 +10:00
%Docstring
Constructor for QgsLabelPosition.
:param id: associated feature ID
:param r: label rotation in degrees clockwise
:param corners: corner points of label bounding box, in map units
:param rect: label bounding box, in map units
:param w: width of label, in map units
:param h: height of label, in map units
:param layer: ID of associated map layer
:param labeltext: text rendered for label
:param labelfont: font used to render label
:param upside_down: ``True`` if label is upside down
:param diagram: ``True`` if label is a diagram
:param pinned: ``True`` if label has pinned placement
:param providerId: ID of associated label provider
:param labelGeometry: polygon geometry of label boundary
%End
2017-11-11 15:22:19 +10:00
QgsLabelPosition();
2017-11-11 15:22:19 +10:00
%Docstring
Constructor for QgsLabelPosition
%End
2019-03-10 16:16:40 +01:00
QgsFeatureId featureId;
double rotation;
QVector< QgsPointXY > cornerPoints;
QgsRectangle labelRect;
QgsGeometry labelGeometry;
double width;
double height;
QString layerID;
QString labelText;
QFont labelFont;
bool upsideDown;
bool isDiagram;
bool isPinned;
QString providerID;
};
2012-09-16 20:40:18 +02:00
class QgsPalLayerSettings
{
2012-09-16 20:40:18 +02:00
%TypeHeaderCode
#include "qgspallabeling.h"
2012-09-16 20:40:18 +02:00
%End
public:
QgsPalLayerSettings();
QgsPalLayerSettings( const QgsPalLayerSettings &s );
2012-09-16 20:40:18 +02:00
~QgsPalLayerSettings();
2019-02-07 14:36:43 +01:00
2012-09-16 20:40:18 +02:00
enum Placement
{
AroundPoint,
OverPoint,
Line,
Curved,
Horizontal,
Free,
OrderedPositionsAroundPoint,
PerimeterCurved,
};
enum PredefinedPointPosition
{
TopLeft,
TopSlightlyLeft,
TopMiddle,
TopSlightlyRight,
TopRight,
MiddleLeft,
MiddleRight,
BottomLeft,
BottomSlightlyLeft,
BottomMiddle,
BottomSlightlyRight,
BottomRight,
2012-09-16 20:40:18 +02:00
};
2019-02-07 14:36:43 +01:00
enum OffsetType
{
FromPoint,
FromSymbolBounds,
};
2019-02-07 14:36:43 +01:00
2012-09-16 20:40:18 +02:00
enum LinePlacementFlags
{
OnLine,
AboveLine,
BelowLine,
MapOrientation,
2012-09-16 20:40:18 +02:00
};
enum QuadrantPosition
{
QuadrantAboveLeft,
QuadrantAbove,
QuadrantAboveRight,
QuadrantLeft,
QuadrantOver,
QuadrantRight,
QuadrantBelowLeft,
QuadrantBelow,
QuadrantBelowRight,
};
enum UpsideDownLabels
{
Upright,
ShowDefined,
ShowAll
};
enum DirectionSymbols
{
SymbolLeftRight,
SymbolAbove,
SymbolBelow
};
enum MultiLineAlign
{
2014-06-02 21:00:51 +02:00
MultiLeft,
MultiCenter,
MultiRight,
MultiFollowPlacement
};
2019-02-07 14:36:43 +01:00
enum ObstacleType
{
PolygonInterior,
PolygonBoundary,
PolygonWhole
};
2015-07-29 11:52:14 +02:00
2017-01-10 19:35:19 +10:00
enum Property
2012-09-16 20:40:18 +02:00
{
2018-09-10 11:11:56 -04:00
// text style
2014-05-27 23:22:50 +02:00
Size,
Bold,
Italic,
Underline,
Color,
Strikeout,
Family,
FontStyle,
FontSizeUnit,
FontTransp,
FontOpacity,
2014-05-27 23:22:50 +02:00
FontCase,
FontLetterSpacing,
FontWordSpacing,
FontBlendMode,
2018-09-10 11:11:56 -04:00
// text formatting
2014-05-27 23:22:50 +02:00
MultiLineWrapChar,
AutoWrapLength,
2014-05-27 23:22:50 +02:00
MultiLineHeight,
MultiLineAlignment,
DirSymbDraw,
DirSymbLeft,
DirSymbRight,
DirSymbPlacement,
DirSymbReverse,
NumFormat,
NumDecimals,
NumPlusSign,
2018-09-10 11:11:56 -04:00
// text buffer
2014-05-27 23:22:50 +02:00
BufferDraw,
BufferSize,
BufferUnit,
BufferColor,
BufferTransp,
BufferOpacity,
2014-05-27 23:22:50 +02:00
BufferJoinStyle,
BufferBlendMode,
// background
2014-05-27 23:22:50 +02:00
ShapeDraw,
ShapeKind,
ShapeSVGFile,
ShapeSizeType,
ShapeSizeX,
ShapeSizeY,
ShapeSizeUnits,
ShapeRotationType,
ShapeRotation,
ShapeOffset,
ShapeOffsetUnits,
ShapeRadii,
ShapeRadiiUnits,
ShapeTransparency,
ShapeOpacity,
2014-05-27 23:22:50 +02:00
ShapeBlendMode,
ShapeFillColor,
ShapeStrokeColor,
ShapeStrokeWidth,
ShapeStrokeWidthUnits,
2014-05-27 23:22:50 +02:00
ShapeJoinStyle,
2018-09-10 11:11:56 -04:00
// drop shadow
2014-05-27 23:22:50 +02:00
ShadowDraw,
ShadowUnder,
ShadowOffsetAngle,
ShadowOffsetDist,
ShadowOffsetUnits,
ShadowRadius,
ShadowRadiusUnits,
ShadowTransparency,
ShadowOpacity,
2014-05-27 23:22:50 +02:00
ShadowScale,
ShadowColor,
ShadowBlendMode,
// placement
2014-05-27 23:22:50 +02:00
CentroidWhole,
OffsetQuad,
OffsetXY,
OffsetUnits,
LabelDistance,
DistanceUnits,
OffsetRotation,
CurvedCharAngleInOut,
2018-09-10 11:11:56 -04:00
// (data defined only)
PositionX,
PositionY,
Hali,
Vali,
Rotation,
LabelRotation,
2014-05-27 23:22:50 +02:00
RepeatDistance,
RepeatDistanceUnit,
Priority,
PredefinedPositionOrder,
LinePlacementOptions,
// rendering
2014-05-27 23:22:50 +02:00
ScaleVisibility,
MinScale,
MinimumScale,
2014-05-27 23:22:50 +02:00
MaxScale,
MaximumScale,
2014-05-27 23:22:50 +02:00
FontLimitPixel,
FontMinPixel,
FontMaxPixel,
IsObstacle,
ObstacleFactor,
ZIndex,
2015-07-29 11:52:14 +02:00
2018-09-10 11:11:56 -04:00
// (data defined only)
2014-05-27 23:22:50 +02:00
Show,
AlwaysShow
2012-09-16 20:40:18 +02:00
};
2019-03-11 12:27:42 +01:00
bool prepare( QgsRenderContext &context, QSet<QString> &attributeNames /In,Out/, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs );
2019-03-11 12:27:42 +01:00
%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
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 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 startRender(), in order to gracefully clean up symbols.
.. versionadded:: 3.10
2019-03-11 12:27:42 +01:00
%End
static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
2017-12-15 10:36:55 -04:00
Returns the labeling property definitions.
.. versionadded:: 3.0
%End
bool drawLabels;
2012-09-16 20:40:18 +02:00
QString fieldName;
bool isExpression;
QgsExpression *getLabelExpression();
%Docstring
Returns the QgsExpression for this label settings. May be ``None`` if isExpression is ``False``.
%End
2012-09-16 20:40:18 +02:00
QColor previewBkgrdColor;
2012-09-16 20:40:18 +02:00
QgsStringReplacementCollection substitutions;
bool useSubstitutions;
QString wrapChar;
int autoWrapLength;
bool useMaxLineLengthForAutoWrap;
MultiLineAlign multilineAlign;
bool addDirectionSymbol;
QString leftDirectionSymbol;
QString rightDirectionSymbol;
DirectionSymbols placeDirectionSymbol;
bool reverseDirectionSymbol;
bool formatNumbers;
int decimals;
bool plusSign;
Placement placement;
unsigned int placementFlags;
bool centroidWhole;
bool centroidInside;
2015-07-29 11:52:14 +02:00
bool fitInPolygonOnly;
double dist;
QgsUnitTypes::RenderUnit distUnits;
2014-05-27 23:22:50 +02:00
QgsMapUnitScale distMapUnitScale;
OffsetType offsetType;
2014-05-27 23:22:50 +02:00
double repeatDistance;
QgsUnitTypes::RenderUnit repeatDistanceUnit;
2014-05-27 23:22:50 +02:00
QgsMapUnitScale repeatDistanceMapUnitScale;
QuadrantPosition quadOffset;
double xOffset;
double yOffset;
QgsUnitTypes::RenderUnit offsetUnits;
2014-05-27 23:22:50 +02:00
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;
bool mergeLines;
bool limitNumLabels;
int maxNumLabels;
double minFeatureSize;
bool obstacle;
2015-07-29 11:52:14 +02:00
double obstacleFactor;
ObstacleType obstacleType;
double zIndex;
QString geometryGenerator;
QgsWkbTypes::GeometryType geometryGeneratorType;
bool geometryGeneratorEnabled;
QgsWkbTypes::GeometryType layerType;
2019-02-05 17:57:27 +01:00
void calculateLabelSize( const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f = 0, QgsRenderContext *context = 0 );
%Docstring
Calculates the space required to render the provided ``text`` in map units.
Results will be written to ``labelX`` and ``labelY``.
%End
2012-09-16 20:40:18 +02:00
void registerFeature( const QgsFeature &f, QgsRenderContext &context );
2012-09-16 20:40:18 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Register a feature for labeling.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param f: feature to label
:param context: render context. The QgsExpressionContext contained within the render context
must have already had the feature and fields sets prior to calling this method.
2017-12-19 11:43:52 -04:00
: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
2017-12-15 10:36:55 -04:00
Read settings from a DOM element
.. versionadded:: 2.12
%End
QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Write settings into a DOM element
.. versionadded:: 2.12
%End
QgsPropertyCollection &dataDefinedProperties();
%Docstring
2017-12-15 10:36:55 -04:00
Returns a reference to the label's property collection, used for data defined overrides.
.. seealso:: :py:func:`setDataDefinedProperties`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
%End
2012-09-16 20:40:18 +02:00
void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the label's property collection, used for data defined overrides.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param collection: property collection. Existing properties will be replaced.
.. seealso:: :py:func:`dataDefinedProperties`
2018-05-28 11:31:08 -04:00
2019-01-21 11:22:06 +10:00
.. seealso:: Property
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
%End
const QgsTextFormat &format() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
.. seealso:: :py:func:`setFormat`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%End
void setFormat( const QgsTextFormat &format );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param format: label text format
.. seealso:: :py:func:`format`
2017-12-15 10:36:55 -04:00
.. versionadded:: 3.0
%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;
2012-09-16 20:40:18 +02:00
};
class QgsLabelCandidate
{
2012-09-16 20:40:18 +02:00
%TypeHeaderCode
#include "qgspallabeling.h"
2012-09-16 20:40:18 +02:00
%End
public:
QgsLabelCandidate( const QRectF &r, double c );
2012-09-16 20:40:18 +02:00
QRectF rect;
double cost;
};
class QgsLabelingResults
{
%Docstring
2017-12-15 10:36:55 -04:00
Class that stores computed placement from labeling engine.
.. versionadded:: 2.4
%End
%TypeHeaderCode
#include "qgspallabeling.h"
%End
2014-05-27 23:22:50 +02:00
public:
QgsLabelingResults();
~QgsLabelingResults();
QList<QgsLabelPosition> labelsAtPosition( const QgsPointXY &p ) const;
%Docstring
Returns infos about labels at a given (map) position
%End
QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle &r ) const;
%Docstring
Returns infos about labels within a given (map) rectangle
%End
void setMapSettings( const QgsMapSettings &settings );
%Docstring
Sets the map ``settings`` associated with the labeling run.
.. versionadded:: 3.4.8
%End
2014-05-27 23:22:50 +02:00
private:
QgsLabelingResults( const QgsLabelingResults & );
};
class QgsPalLabeling
2012-09-16 20:40:18 +02:00
{
2012-09-16 20:40:18 +02:00
%TypeHeaderCode
#include "qgspallabeling.h"
2012-09-16 20:40:18 +02:00
%End
public:
static bool staticWillUseLayer( QgsVectorLayer *layer );
%Docstring
2017-12-15 10:36:55 -04:00
called to find out whether the layer is used for labeling
.. versionadded:: 2.4
%End
2015-04-17 09:51:24 +02:00
static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) /Factory/;
%Docstring
2017-12-15 10:36:55 -04:00
Prepares a geometry for registration with PAL. Handles reprojection, rotation, clipping, etc.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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
2017-12-15 10:36:55 -04:00
:return: prepared geometry
.. versionadded:: 2.9
%End
2014-05-27 23:22:50 +02:00
static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
%Docstring
2017-12-15 10:36:55 -04:00
Checks whether a geometry requires preparation before registration with PAL
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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
2017-12-15 10:36:55 -04:00
2019-02-26 19:54:09 +10:00
:return: ``True`` if geometry requires preparation
2017-12-15 10:36:55 -04:00
.. 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``).
2017-12-15 10:36:55 -04:00
The text string will be split on either newline characters or the wrap character.
2017-12-15 21:36:08 -04:00
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
2019-02-26 19:54:09 +10:00
if ``False`` then the lines are wrapped to an ideal minimum length of ``autoWrapLength`` characters.
2017-12-15 10:36:55 -04:00
.. versionadded:: 2.9
%End
2015-05-31 00:42:13 +02:00
static QStringList splitToGraphemes( const QString &text );
%Docstring
2017-12-15 10:36:55 -04:00
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)
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param text: string to split
:return: list of graphemes
.. versionadded:: 2.10
%End
2012-09-16 20:40:18 +02:00
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgspallabeling.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/