mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
1057 lines
37 KiB
Plaintext
1057 lines
37 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgssymbollayerutils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef QMap<QString, QString> QgsStringMap;
|
|
typedef QMap<QString, QgsSymbol * > QgsSymbolMap;
|
|
|
|
|
|
class QgsSymbolLayerUtils
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssymbollayerutils.h"
|
|
%End
|
|
public:
|
|
|
|
static QString encodeColor( const QColor &color );
|
|
static QColor decodeColor( const QString &str );
|
|
|
|
static QString encodeSldAlpha( int alpha );
|
|
static int decodeSldAlpha( const QString &str );
|
|
|
|
static QString encodeSldFontStyle( QFont::Style style );
|
|
static QFont::Style decodeSldFontStyle( const QString &str );
|
|
|
|
static QString encodeSldFontWeight( int weight );
|
|
static int decodeSldFontWeight( const QString &str );
|
|
|
|
static QString encodePenStyle( Qt::PenStyle style );
|
|
static Qt::PenStyle decodePenStyle( const QString &str );
|
|
|
|
static QString encodePenJoinStyle( Qt::PenJoinStyle style );
|
|
static Qt::PenJoinStyle decodePenJoinStyle( const QString &str );
|
|
|
|
static QString encodePenCapStyle( Qt::PenCapStyle style );
|
|
static Qt::PenCapStyle decodePenCapStyle( const QString &str );
|
|
|
|
static QString encodeSldLineJoinStyle( Qt::PenJoinStyle style );
|
|
static Qt::PenJoinStyle decodeSldLineJoinStyle( const QString &str );
|
|
|
|
static QString encodeSldLineCapStyle( Qt::PenCapStyle style );
|
|
static Qt::PenCapStyle decodeSldLineCapStyle( const QString &str );
|
|
|
|
static QString encodeBrushStyle( Qt::BrushStyle style );
|
|
static Qt::BrushStyle decodeBrushStyle( const QString &str );
|
|
|
|
static QString encodeSldBrushStyle( Qt::BrushStyle style );
|
|
static Qt::BrushStyle decodeSldBrushStyle( const QString &str );
|
|
|
|
static Qgis::SymbolCoordinateReference decodeCoordinateReference( const QString &string, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Decodes a ``string`` representing a symbol coordinate reference mode.
|
|
|
|
:param string: string to decode
|
|
|
|
:return: - decoded marker clip mode
|
|
- ok: will be set to ``True`` if ``string`` was successfully decoded
|
|
|
|
.. seealso:: :py:func:`encodeCoordinateReference`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static QString encodeCoordinateReference( Qgis::SymbolCoordinateReference coordinateReference );
|
|
%Docstring
|
|
Encodes a symbol coordinate reference mode to a string.
|
|
|
|
:param coordinateReference: coordinate reference mode
|
|
|
|
.. seealso:: :py:func:`decodeCoordinateReference`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static QgsArrowSymbolLayer::HeadType decodeArrowHeadType( const QVariant &value, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Decodes a ``value`` representing an arrow head type.
|
|
|
|
.. versionadded:: 3.2
|
|
%End
|
|
|
|
static QgsArrowSymbolLayer::ArrowType decodeArrowType( const QVariant &value, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Decodes a ``value`` representing an arrow type.
|
|
|
|
.. versionadded:: 3.2
|
|
%End
|
|
|
|
static Qgis::MarkerClipMode decodeMarkerClipMode( const QString &string, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Decodes a ``string`` representing a marker clip mode.
|
|
|
|
:param string: string to decode
|
|
|
|
:return: - decoded marker clip mode
|
|
- ok: will be set to ``True`` if ``string`` was successfully decoded
|
|
|
|
.. seealso:: :py:func:`encodeMarkerClipMode`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static QString encodeMarkerClipMode( Qgis::MarkerClipMode mode );
|
|
%Docstring
|
|
Encodes a marker clip ``mode`` to a string.
|
|
|
|
.. seealso:: :py:func:`decodeMarkerClipMode`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static Qgis::LineClipMode decodeLineClipMode( const QString &string, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Decodes a ``string`` representing a line clip mode.
|
|
|
|
:param string: string to decode
|
|
|
|
:return: - decoded line clip mode
|
|
- ok: will be set to ``True`` if ``string`` was successfully decoded
|
|
|
|
.. seealso:: :py:func:`encodeLineClipMode`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static QString encodeLineClipMode( Qgis::LineClipMode mode );
|
|
%Docstring
|
|
Encodes a line clip ``mode`` to a string.
|
|
|
|
.. seealso:: :py:func:`decodeLineClipMode`
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
static QString encodePoint( QPointF point );
|
|
%Docstring
|
|
Encodes a QPointF to a string.
|
|
|
|
.. seealso:: :py:func:`decodePoint`
|
|
|
|
.. seealso:: :py:func:`encodeSize`
|
|
%End
|
|
|
|
static QPointF decodePoint( const QString &string );
|
|
%Docstring
|
|
Decodes a QSizeF from a string.
|
|
|
|
.. seealso:: :py:func:`encodePoint`
|
|
|
|
.. seealso:: :py:func:`decodeSize`
|
|
%End
|
|
|
|
static QPointF toPoint( const QVariant &value, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Converts a ``value`` to a point.
|
|
|
|
:param value: value to convert
|
|
|
|
:return: - converted point
|
|
- ok: will be set to ``True`` if value was successfully converted
|
|
|
|
|
|
.. seealso:: :py:func:`decodePoint`
|
|
|
|
.. seealso:: :py:func:`toSize`
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
static QString encodeSize( QSizeF size );
|
|
%Docstring
|
|
Encodes a QSizeF to a string.
|
|
|
|
.. seealso:: :py:func:`decodeSize`
|
|
|
|
.. seealso:: :py:func:`encodePoint`
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QSizeF decodeSize( const QString &string );
|
|
%Docstring
|
|
Decodes a QSizeF from a string.
|
|
|
|
.. seealso:: :py:func:`encodeSize`
|
|
|
|
.. seealso:: :py:func:`decodePoint`
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QSizeF toSize( const QVariant &value, bool *ok /Out/ = 0 );
|
|
%Docstring
|
|
Converts a ``value`` to a size.
|
|
|
|
:param value: value to convert
|
|
|
|
:return: - converted size
|
|
- ok: will be set to ``True`` if value was successfully converted
|
|
|
|
|
|
.. seealso:: :py:func:`decodeSize`
|
|
|
|
.. seealso:: :py:func:`toPoint`
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
static QString encodeMapUnitScale( const QgsMapUnitScale &mapUnitScale );
|
|
static QgsMapUnitScale decodeMapUnitScale( const QString &str );
|
|
|
|
static QString encodeRealVector( const QVector<qreal> &v );
|
|
static QVector<qreal> decodeRealVector( const QString &s );
|
|
|
|
static QString encodeSldRealVector( const QVector<qreal> &v );
|
|
static QVector<qreal> decodeSldRealVector( const QString &s );
|
|
|
|
static QString encodeSldUom( Qgis::RenderUnit unit, double *scaleFactor );
|
|
%Docstring
|
|
Encodes a render unit into an SLD unit of measure string.
|
|
|
|
:param unit: unit to encode
|
|
:param scaleFactor: if specified, will be set to scale factor for unit of measure
|
|
|
|
:return: encoded string
|
|
|
|
.. seealso:: :py:func:`decodeSldUom`
|
|
%End
|
|
|
|
static Qgis::RenderUnit decodeSldUom( const QString &str, double *scaleFactor = 0 );
|
|
%Docstring
|
|
Decodes a SLD unit of measure string to a render unit.
|
|
|
|
:param str: string to decode
|
|
:param scaleFactor: if specified, will be set to scale factor for unit of measure
|
|
|
|
:return: matching render unit
|
|
|
|
.. seealso:: :py:func:`encodeSldUom`
|
|
%End
|
|
|
|
static double sizeInPixelsFromSldUom( const QString &uom, double size );
|
|
%Docstring
|
|
Returns the size scaled in pixels according to the uom attribute.
|
|
|
|
:param uom: The uom attribute from SLD 1.1 version
|
|
:param size: The original size
|
|
|
|
:return: the size in pixels
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QString encodeScaleMethod( Qgis::ScaleMethod scaleMethod );
|
|
%Docstring
|
|
Encodes a symbol scale method to a string.
|
|
|
|
.. seealso:: :py:func:`decodeScaleMethod`
|
|
%End
|
|
|
|
static Qgis::ScaleMethod decodeScaleMethod( const QString &str );
|
|
%Docstring
|
|
Decodes a symbol scale method from a string.
|
|
|
|
.. seealso:: :py:func:`encodeScaleMethod`
|
|
%End
|
|
|
|
static QPainter::CompositionMode decodeBlendMode( const QString &s );
|
|
|
|
static QIcon symbolPreviewIcon( const QgsSymbol *symbol, QSize size, int padding = 0, QgsLegendPatchShape *shape = 0 );
|
|
%Docstring
|
|
Returns an icon preview for a color ramp.
|
|
|
|
:param symbol: symbol
|
|
:param size: target pixmap size
|
|
:param padding: space between icon edge and symbol
|
|
:param shape: optional legend patch shape to use for rendering the preview icon
|
|
|
|
.. seealso:: :py:func:`symbolPreviewPixmap`
|
|
%End
|
|
|
|
static QPixmap symbolPreviewPixmap( const QgsSymbol *symbol, QSize size, int padding = 0, QgsRenderContext *customContext = 0, bool selected = false,
|
|
const QgsExpressionContext *expressionContext = 0,
|
|
const QgsLegendPatchShape *shape = 0 );
|
|
%Docstring
|
|
Returns a pixmap preview for a color ramp.
|
|
|
|
:param symbol: symbol
|
|
:param size: target pixmap size
|
|
:param padding: space between icon edge and symbol
|
|
:param customContext: render context to use when rendering symbol
|
|
:param selected: set to ``True`` to render the symbol in a selected state
|
|
:param expressionContext: optional custom expression context
|
|
:param shape: optional legend patch shape to use for rendering the preview icon
|
|
|
|
.. note::
|
|
|
|
Parameter customContext added in QGIS 2.6
|
|
|
|
.. note::
|
|
|
|
Parameter selected added in QGIS 3.10
|
|
|
|
.. note::
|
|
|
|
Parameter expressionContext added in QGIS 3.10
|
|
|
|
.. note::
|
|
|
|
Parameter shape added in QGIS 3.14
|
|
|
|
.. seealso:: :py:func:`symbolPreviewIcon`
|
|
%End
|
|
|
|
static QPicture symbolLayerPreviewPicture( const QgsSymbolLayer *layer, Qgis::RenderUnit units, QSize size, const QgsMapUnitScale &scale = QgsMapUnitScale(), Qgis::SymbolType parentSymbolType = Qgis::SymbolType::Hybrid );
|
|
%Docstring
|
|
Draws a symbol layer preview to a QPicture
|
|
|
|
:param layer: symbol layer to draw
|
|
:param units: size units
|
|
:param size: target size of preview picture
|
|
:param scale: map unit scale for preview
|
|
:param parentSymbolType: since QGIS 3.22, can be used to specify the parent symbol type so that geometry generator preview icons are correctly calculated
|
|
|
|
:return: QPicture containing symbol layer preview
|
|
|
|
.. seealso:: :py:func:`symbolLayerPreviewIcon`
|
|
|
|
.. versionadded:: 2.9
|
|
%End
|
|
|
|
static QIcon symbolLayerPreviewIcon( const QgsSymbolLayer *layer, Qgis::RenderUnit u, QSize size, const QgsMapUnitScale &scale = QgsMapUnitScale(), Qgis::SymbolType parentSymbolType = Qgis::SymbolType::Hybrid, QgsMapLayer *mapLayer = 0 );
|
|
%Docstring
|
|
Draws a symbol layer preview to an icon.
|
|
|
|
:param layer: symbol layer to draw
|
|
:param u: size units
|
|
:param size: target size of preview icon
|
|
:param scale: map unit scale for preview
|
|
:param parentSymbolType: since QGIS 3.22, can be used to specify the parent symbol type so that geometry generator preview icons are correctly calculated
|
|
:param mapLayer: since QGIS 3.28, can be used to specify the associated map layer so that layer related expressions are correctly calculated
|
|
|
|
:return: icon containing symbol layer preview
|
|
|
|
.. seealso:: :py:func:`symbolLayerPreviewPicture`
|
|
%End
|
|
|
|
static QIcon colorRampPreviewIcon( QgsColorRamp *ramp, QSize size, int padding = 0 );
|
|
%Docstring
|
|
Returns an icon preview for a color ramp.
|
|
|
|
:param ramp: color ramp
|
|
:param size: target icon size
|
|
:param padding: space between icon edge and color ramp
|
|
|
|
.. seealso:: :py:func:`colorRampPreviewPixmap`
|
|
%End
|
|
|
|
static QPixmap colorRampPreviewPixmap( QgsColorRamp *ramp, QSize size, int padding = 0, Qt::Orientation direction = Qt::Horizontal,
|
|
bool flipDirection = false, bool drawTransparentBackground = true );
|
|
%Docstring
|
|
Returns a pixmap preview for a color ramp.
|
|
|
|
:param ramp: color ramp
|
|
:param size: target pixmap size
|
|
:param padding: space between icon edge and color ramp
|
|
:param direction: direction to render pixmap (since QGIS 3.18)
|
|
:param flipDirection: set to ``True`` to flip the direction of the ramp. For horizontal ``directions``, ramps will be
|
|
rendered left to right by default. For vertical ``directions``, ramps will be rendered top to bottom by default. Setting
|
|
this flag to ``True`` will reverse these default directions.
|
|
:param drawTransparentBackground: set to ``False`` to disable the checkerboard effect drawn below transparent colors in the ramp
|
|
|
|
.. seealso:: :py:func:`colorRampPreviewIcon`
|
|
%End
|
|
|
|
static void drawStippledBackground( QPainter *painter, QRect rect );
|
|
|
|
static void drawVertexMarker( double x, double y, QPainter &p, Qgis::VertexMarkerType type, int markerSize );
|
|
%Docstring
|
|
Draws a vertex symbol at (painter) coordinates x, y. (Useful to assist vertex editing.)
|
|
|
|
.. versionadded:: 3.4.5
|
|
%End
|
|
|
|
static double estimateMaxSymbolBleed( QgsSymbol *symbol, const QgsRenderContext &context );
|
|
%Docstring
|
|
Returns the maximum estimated bleed for the symbol
|
|
%End
|
|
|
|
static QgsSymbol *loadSymbol( const QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
|
|
%Docstring
|
|
Attempts to load a symbol from a DOM element
|
|
|
|
:param element: DOM element representing symbol
|
|
:param context: object to transform relative to absolute paths
|
|
|
|
:return: decoded symbol, if possible
|
|
%End
|
|
|
|
|
|
static QgsSymbolLayer *loadSymbolLayer( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
|
|
%Docstring
|
|
Reads and returns symbol layer from XML. Caller is responsible for deleting the returned object
|
|
%End
|
|
static QDomElement saveSymbol( const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context );
|
|
%Docstring
|
|
Writes a symbol definition to XML
|
|
%End
|
|
|
|
static QString symbolProperties( QgsSymbol *symbol );
|
|
%Docstring
|
|
Returns a string representing the symbol. Can be used to test for equality
|
|
between symbols.
|
|
|
|
.. versionadded:: 2.12
|
|
%End
|
|
|
|
static bool createSymbolLayerListFromSld( QDomElement &element, Qgis::GeometryType geomType, QList<QgsSymbolLayer *> &layers );
|
|
%Docstring
|
|
Creates a symbol layer list from a DOM ``element``.
|
|
%End
|
|
|
|
static QgsSymbolLayer *createFillLayerFromSld( QDomElement &element ) /Factory/;
|
|
static QgsSymbolLayer *createLineLayerFromSld( QDomElement &element ) /Factory/;
|
|
static QgsSymbolLayer *createMarkerLayerFromSld( QDomElement &element ) /Factory/;
|
|
|
|
static bool convertPolygonSymbolizerToPointMarker( QDomElement &element, QList<QgsSymbolLayer *> &layerList );
|
|
%Docstring
|
|
Converts a polygon symbolizer ``element`` to a list of marker symbol layers.
|
|
%End
|
|
|
|
static bool hasExternalGraphic( QDomElement &element );
|
|
%Docstring
|
|
Checks if ``element`` contains an ExternalGraphic element with format "image/svg+xml"
|
|
@return ``True`` if the ExternalGraphic with format "image/svg+xml" is found .
|
|
%End
|
|
|
|
static bool hasExternalGraphicV2( QDomElement &element, const QString format = QString() );
|
|
%Docstring
|
|
Checks if ``element`` contains an ExternalGraphic element, if the optional ``format`` is specified it will also be checked.
|
|
@return ``True`` if the ExternalGraphic element is found and the optionally specified format matches.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
static bool hasWellKnownMark( QDomElement &element );
|
|
|
|
static bool needFontMarker( QDomElement &element );
|
|
static bool needSvgMarker( QDomElement &element );
|
|
static bool needEllipseMarker( QDomElement &element );
|
|
static bool needMarkerLine( QDomElement &element );
|
|
static bool needLinePatternFill( QDomElement &element );
|
|
static bool needPointPatternFill( QDomElement &element );
|
|
static bool needSvgFill( QDomElement &element );
|
|
|
|
static bool needRasterImageFill( QDomElement &element );
|
|
%Docstring
|
|
Checks if ``element`` contains a graphic fill with a raster image of type PNG, JPEG or GIF.
|
|
@return ``True`` if element contains a graphic fill with a raster image.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
static void fillToSld( QDomDocument &doc, QDomElement &element,
|
|
Qt::BrushStyle brushStyle, const QColor &color = QColor() );
|
|
static bool fillFromSld( QDomElement &element,
|
|
Qt::BrushStyle &brushStyle, QColor &color );
|
|
|
|
static bool lineFromSld( QDomElement &element,
|
|
Qt::PenStyle &penStyle, QColor &color, double &width,
|
|
Qt::PenJoinStyle *penJoinStyle = 0, Qt::PenCapStyle *penCapStyle = 0,
|
|
QVector<qreal> *customDashPattern = 0, double *dashOffset = 0 );
|
|
|
|
static void externalGraphicToSld( QDomDocument &doc, QDomElement &element,
|
|
const QString &path, const QString &mime,
|
|
const QColor &color, double size = -1 );
|
|
static bool externalGraphicFromSld( QDomElement &element,
|
|
QString &path, QString &mime,
|
|
QColor &color, double &size );
|
|
|
|
static void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
|
|
const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle,
|
|
double strokeWidth = -1, double size = -1 );
|
|
|
|
static bool wellKnownMarkerFromSld( QDomElement &element,
|
|
QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle,
|
|
double &strokeWidth, double &size ) /PyName=wellKnownMarkerFromSld2/;
|
|
%Docstring
|
|
|
|
.. note::
|
|
|
|
available in Python as wellKnownMarkerFromSld2
|
|
%End
|
|
|
|
static void externalMarkerToSld( QDomDocument &doc, QDomElement &element,
|
|
const QString &path, const QString &format, int *markIndex = 0,
|
|
const QColor &color = QColor(), double size = -1 );
|
|
static bool externalMarkerFromSld( QDomElement &element,
|
|
QString &path, QString &format, int &markIndex,
|
|
QColor &color, double &size );
|
|
|
|
|
|
static void labelTextToSld( QDomDocument &doc, QDomElement &element, const QString &label,
|
|
const QFont &font, const QColor &color = QColor(), double size = -1 );
|
|
|
|
static QString ogrFeatureStylePen( double width, double mmScaleFactor, double mapUnitsScaleFactor, const QColor &c,
|
|
Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
|
|
Qt::PenCapStyle capStyle = Qt::FlatCap,
|
|
double offset = 0.0,
|
|
const QVector<qreal> *dashPattern = 0 );
|
|
%Docstring
|
|
Create ogr feature style string for pen
|
|
%End
|
|
|
|
static QString ogrFeatureStyleBrush( const QColor &fillColr );
|
|
%Docstring
|
|
Create ogr feature style string for brush
|
|
|
|
:param fillColr: fill color
|
|
%End
|
|
|
|
static void createRotationElement( QDomDocument &doc, QDomElement &element, const QString &rotationFunc );
|
|
static bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );
|
|
|
|
static void createOpacityElement( QDomDocument &doc, QDomElement &element, const QString &alphaFunc );
|
|
static bool opacityFromSldElement( QDomElement &element, QString &alphaFunc );
|
|
|
|
static void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
|
|
static bool displacementFromSldElement( QDomElement &element, QPointF &offset );
|
|
|
|
static void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
|
|
%Docstring
|
|
Creates a SE 1.1 anchor point element as a child of the specified element
|
|
|
|
:param doc: The document
|
|
:param element: The parent element
|
|
:param anchor: An anchor specification, with values between 0 and 1
|
|
%End
|
|
|
|
static void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
|
|
static bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
|
|
|
|
static void createGeometryElement( QDomDocument &doc, QDomElement &element, const QString &geomFunc );
|
|
static bool geometryFromSldElement( QDomElement &element, QString &geomFunc );
|
|
|
|
static bool createExpressionElement( QDomDocument &doc, QDomElement &element, const QString &function );
|
|
%Docstring
|
|
Creates a OGC Expression element based on the provided function expression
|
|
|
|
:param doc: The document owning the element
|
|
:param element: The element parent
|
|
:param function: The expression to be encoded
|
|
%End
|
|
static bool createFunctionElement( QDomDocument &doc, QDomElement &element, const QString &function );
|
|
static bool functionFromSldElement( QDomElement &element, QString &function );
|
|
|
|
static QDomElement createSvgParameterElement( QDomDocument &doc, const QString &name, const QString &value );
|
|
static QgsStringMap getSvgParameterList( QDomElement &element );
|
|
|
|
static QDomElement createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value );
|
|
static QgsStringMap getVendorOptionList( QDomElement &element );
|
|
|
|
static QVariantMap parseProperties( const QDomElement &element );
|
|
%Docstring
|
|
Parses the properties from XML and returns a map
|
|
%End
|
|
static void saveProperties( QVariantMap props, QDomDocument &doc, QDomElement &element );
|
|
%Docstring
|
|
Saves the map of properties to XML
|
|
%End
|
|
|
|
static QgsSymbolMap loadSymbols( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
|
|
%Docstring
|
|
Reads a collection of symbols from XML and returns them in a map. Caller is responsible for deleting returned symbols.
|
|
%End
|
|
static QDomElement saveSymbols( QgsSymbolMap &symbols, const QString &tagName, QDomDocument &doc, const QgsReadWriteContext &context );
|
|
%Docstring
|
|
Writes a collection of symbols to XML with specified tagName for the top-level element
|
|
%End
|
|
|
|
static void clearSymbolMap( QgsSymbolMap &symbols );
|
|
|
|
static QMimeData *symbolToMimeData( const QgsSymbol *symbol ) /Factory/;
|
|
%Docstring
|
|
Creates new mime data from a ``symbol``.
|
|
This also sets the mime color data to match the symbol's color, so that copied symbols
|
|
can be paste in places where a color is expected.
|
|
|
|
.. seealso:: :py:func:`symbolFromMimeData`
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QgsSymbol *symbolFromMimeData( const QMimeData *data ) /Factory/;
|
|
%Docstring
|
|
Attempts to parse ``mime`` data as a symbol. A new symbol instance will be returned
|
|
if the data was successfully converted to a symbol.
|
|
|
|
.. seealso:: :py:func:`symbolToMimeData`
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QgsColorRamp *loadColorRamp( QDomElement &element ) /Factory/;
|
|
%Docstring
|
|
Creates a color ramp from the settings encoded in an XML element
|
|
|
|
:param element: DOM element
|
|
|
|
:return: new color ramp. Caller takes responsibility for deleting the returned value.
|
|
|
|
.. seealso:: :py:func:`saveColorRamp`
|
|
%End
|
|
|
|
static QDomElement saveColorRamp( const QString &name, QgsColorRamp *ramp, QDomDocument &doc );
|
|
%Docstring
|
|
Encodes a color ramp's settings to an XML element
|
|
|
|
:param name: name of ramp
|
|
:param ramp: color ramp to save
|
|
:param doc: XML document
|
|
|
|
:return: DOM element representing state of color ramp
|
|
|
|
.. seealso:: :py:func:`loadColorRamp`
|
|
%End
|
|
|
|
static QVariant colorRampToVariant( const QString &name, QgsColorRamp *ramp );
|
|
%Docstring
|
|
Saves a color ramp to a QVariantMap, wrapped in a QVariant.
|
|
You can use :py:class:`QgsXmlUtils`.writeVariant to save it to an XML document.
|
|
|
|
.. seealso:: :py:func:`loadColorRamp`
|
|
%End
|
|
|
|
static QgsColorRamp *loadColorRamp( const QVariant &value ) /Factory/;
|
|
%Docstring
|
|
Load a color ramp from a QVariantMap, wrapped in a QVariant.
|
|
You can use :py:class:`QgsXmlUtils`.readVariant to load it from an XML document.
|
|
|
|
.. seealso:: :py:func:`colorRampToVariant`
|
|
%End
|
|
|
|
static QString colorToName( const QColor &color );
|
|
%Docstring
|
|
Returns a friendly display name for a color
|
|
|
|
:param color: source color
|
|
|
|
:return: display name for color
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static QList< QColor > parseColorList( const QString &colorStr );
|
|
%Docstring
|
|
Attempts to parse a string as a list of colors using a variety of common formats, including hex
|
|
codes, rgb and rgba strings.
|
|
|
|
:param colorStr: string representing the color list
|
|
|
|
:return: list of parsed colors
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static QMimeData *colorToMimeData( const QColor &color ) /Factory/;
|
|
%Docstring
|
|
Creates mime data from a color. Sets both the mime data's color data, and the
|
|
mime data's text with the color's hex code.
|
|
|
|
:param color: color to encode as mime data
|
|
|
|
.. seealso:: :py:func:`colorFromMimeData`
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static QColor colorFromMimeData( const QMimeData *data, bool &hasAlpha /Out/ );
|
|
%Docstring
|
|
Attempts to parse mime data as a color
|
|
|
|
:param data: mime data to parse
|
|
|
|
:return: - valid color if mimedata could be interpreted as a color, otherwise an invalid color
|
|
- hasAlpha: will be set to ``True`` if mime data was interpreted as a color containing an explicit alpha value
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static QgsNamedColorList colorListFromMimeData( const QMimeData *data );
|
|
%Docstring
|
|
Attempts to parse mime data as a list of named colors
|
|
|
|
:param data: mime data to parse
|
|
|
|
:return: list of parsed colors
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static QMimeData *colorListToMimeData( const QgsNamedColorList &colorList, bool allFormats = true ) /Factory/;
|
|
%Docstring
|
|
Creates mime data from a list of named colors
|
|
|
|
:param colorList: list of named colors
|
|
:param allFormats: set to ``True`` to include additional mime formats, include text/plain and application/x-color
|
|
|
|
:return: mime data containing encoded colors
|
|
|
|
.. versionadded:: 2.5
|
|
%End
|
|
|
|
static bool saveColorsToGpl( QFile &file, const QString &paletteName, const QgsNamedColorList &colors );
|
|
%Docstring
|
|
Exports colors to a gpl GIMP palette file
|
|
|
|
:param file: destination file
|
|
:param paletteName: name of palette, which is stored in gpl file
|
|
:param colors: colors to export
|
|
|
|
:return: ``True`` if export was successful
|
|
|
|
.. seealso:: :py:func:`importColorsFromGpl`
|
|
%End
|
|
|
|
static QgsNamedColorList importColorsFromGpl( QFile &file, bool &ok, QString &name );
|
|
%Docstring
|
|
Imports colors from a gpl GIMP palette file
|
|
|
|
:param file: source gpl file
|
|
:param ok: will be ``True`` if file was successfully read
|
|
:param name: will be set to palette name from gpl file, if present
|
|
|
|
:return: list of imported colors
|
|
|
|
.. seealso:: :py:func:`saveColorsToGpl`
|
|
%End
|
|
|
|
static QColor parseColor( const QString &colorStr, bool strictEval = false );
|
|
%Docstring
|
|
Attempts to parse a string as a color using a variety of common formats, including hex
|
|
codes, rgb and rgba strings.
|
|
|
|
:param colorStr: string representing the color
|
|
:param strictEval: set to ``True`` for stricter color parsing rules
|
|
|
|
:return: parsed color
|
|
|
|
.. versionadded:: 2.3
|
|
%End
|
|
|
|
static QColor parseColorWithAlpha( const QString &colorStr, bool &containsAlpha, bool strictEval = false );
|
|
%Docstring
|
|
Attempts to parse a string as a color using a variety of common formats, including hex
|
|
codes, rgb and rgba, hsl and hsla strings.
|
|
|
|
:param colorStr: string representing the color
|
|
:param containsAlpha: if colorStr contains an explicit alpha value then containsAlpha will be set to ``True``
|
|
:param strictEval: set to ``True`` for stricter color parsing rules
|
|
|
|
:return: parsed color
|
|
|
|
.. versionadded:: 2.3
|
|
%End
|
|
|
|
static void multiplyImageOpacity( QImage *image, qreal opacity );
|
|
%Docstring
|
|
Multiplies opacity of image pixel values with a (global) transparency value.
|
|
%End
|
|
|
|
static void blurImageInPlace( QImage &image, QRect rect, int radius, bool alphaOnly );
|
|
%Docstring
|
|
Blurs an image in place, e.g. creating Qt-independent drop shadows
|
|
%End
|
|
|
|
static void premultiplyColor( QColor &rgb, int alpha );
|
|
%Docstring
|
|
Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value
|
|
|
|
.. versionadded:: 2.3
|
|
%End
|
|
|
|
static bool condenseFillAndOutline( QgsFillSymbolLayer *fill, QgsLineSymbolLayer *outline );
|
|
%Docstring
|
|
Attempts to condense a ``fill`` and ``outline`` layer, by moving the outline layer to the
|
|
fill symbol's stroke.
|
|
|
|
This will only be done if the ``outline`` can be transformed into a stroke on the fill layer
|
|
losslessly. If so, ``fill`` will be updated in place with the new stroke. Any existing stroke
|
|
settings in ``fill`` will be replaced.
|
|
|
|
Returns ``True`` if the fill and outline were successfully condensed.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
static void sortVariantList( QList<QVariant> &list, Qt::SortOrder order );
|
|
%Docstring
|
|
Sorts the passed list in requested order
|
|
%End
|
|
static QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint, double distance );
|
|
%Docstring
|
|
Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point
|
|
%End
|
|
|
|
static QStringList listSvgFiles();
|
|
%Docstring
|
|
Returns a list of all available svg files
|
|
%End
|
|
|
|
static QStringList listSvgFilesAt( const QString &directory );
|
|
%Docstring
|
|
Returns a list of svg files at the specified directory
|
|
%End
|
|
|
|
static QString svgSymbolNameToPath( const QString &name, const QgsPathResolver &pathResolver );
|
|
%Docstring
|
|
Determines an SVG symbol's path from its ``name``.
|
|
If ``name`` is not an absolute path the file is scanned for in the SVG paths specified
|
|
in settings svg/searchPathsForSVG.
|
|
|
|
.. seealso:: :py:func:`svgSymbolPathToName`
|
|
%End
|
|
|
|
static QString svgSymbolPathToName( const QString &path, const QgsPathResolver &pathResolver );
|
|
%Docstring
|
|
Determines an SVG symbol's name from its ``path``.
|
|
|
|
.. seealso:: :py:func:`svgSymbolNameToPath`
|
|
%End
|
|
|
|
static QPointF polygonCentroid( const QPolygonF &points );
|
|
%Docstring
|
|
Calculate the centroid point of a QPolygonF
|
|
%End
|
|
|
|
static QPointF polygonPointOnSurface( const QPolygonF &points, const QVector<QPolygonF> *rings = 0 );
|
|
%Docstring
|
|
Calculate a point on the surface of a QPolygonF
|
|
%End
|
|
|
|
static bool pointInPolygon( const QPolygonF &points, QPointF point );
|
|
%Docstring
|
|
Calculate whether a point is within of a QPolygonF
|
|
%End
|
|
|
|
static double polylineLength( const QPolygonF &polyline );
|
|
%Docstring
|
|
Returns the total length of a ``polyline``.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
static QPolygonF polylineSubstring( const QPolygonF &polyline, double startOffset, double endOffset );
|
|
%Docstring
|
|
Returns the substring of a ``polyline`` which starts at ``startOffset`` from the beginning of the line
|
|
and ends at ``endOffset`` from the start of the line.
|
|
|
|
If ``startOffset`` is less than 0, then the start point will be calculated by subtracting that distance
|
|
from the end of the line. Similarly, if ``endOffset`` is less than zero then the end point will be subtracted
|
|
from the end of the line.
|
|
|
|
May return an empty linestring if the substring is zero length.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
static bool isSharpCorner( QPointF p1, QPointF p2, QPointF p3 );
|
|
%Docstring
|
|
Returns ``True`` if the angle formed by the line ``p1`` - ``p2`` - ``p3`` forms a "sharp" corner.
|
|
|
|
Sharp corners form an angle which exceeds a 45 degree threshold.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
static void appendPolyline( QPolygonF &target, const QPolygonF &line );
|
|
%Docstring
|
|
Appends a polyline ``line`` to an existing ``target`` polyline.
|
|
|
|
Any duplicate points at the start ``line`` which match the end point from ``target`` will be skipped.
|
|
|
|
.. versionadded:: 3.16
|
|
%End
|
|
|
|
static QgsExpression *fieldOrExpressionToExpression( const QString &fieldOrExpression ) /Factory/;
|
|
%Docstring
|
|
Returns a new valid expression instance for given field or expression string.
|
|
If the input is not a valid expression, it is assumed that it is a field name and gets properly quoted.
|
|
If the string is empty, returns ``None``.
|
|
This is useful when accepting input which could be either a non-quoted field name or expression.
|
|
|
|
.. versionadded:: 2.2
|
|
%End
|
|
|
|
static QString fieldOrExpressionFromExpression( QgsExpression *expression );
|
|
%Docstring
|
|
Returns a field name if the whole expression is just a name of the field .
|
|
Returns full expression string if the expression is more complex than just one field.
|
|
Using just expression->:py:func:`~QgsSymbolLayerUtils.expression` method may return quoted field name, but that is not
|
|
wanted for saving (due to backward compatibility) or display in GUI.
|
|
|
|
.. versionadded:: 2.2
|
|
%End
|
|
|
|
static QList<double> prettyBreaks( double minimum, double maximum, int classes );
|
|
%Docstring
|
|
Computes a sequence of about 'classes' equally spaced round values
|
|
which cover the range of values from 'minimum' to 'maximum'.
|
|
The values are chosen so that they are 1, 2 or 5 times a power of 10.
|
|
|
|
.. versionadded:: 2.10
|
|
%End
|
|
|
|
static double rescaleUom( double size, Qgis::RenderUnit unit, const QVariantMap &props );
|
|
%Docstring
|
|
Rescales the given size based on the uomScale found in the props, if any is found, otherwise
|
|
returns the value un-modified
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QPointF rescaleUom( QPointF point, Qgis::RenderUnit unit, const QVariantMap &props ) /PyName=rescalePointUom/;
|
|
%Docstring
|
|
Rescales the given point based on the uomScale found in the props, if any is found, otherwise
|
|
returns a copy of the original point
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QVector<qreal> rescaleUom( const QVector<qreal> &array, Qgis::RenderUnit unit, const QVariantMap &props ) /PyName=rescaleArrayUom/;
|
|
%Docstring
|
|
Rescales the given array based on the uomScale found in the props, if any is found, otherwise
|
|
returns a copy of the original point
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static void applyScaleDependency( QDomDocument &doc, QDomElement &ruleElem, QVariantMap &props );
|
|
%Docstring
|
|
Checks if the properties contain scaleMinDenom and scaleMaxDenom, if available, they are added into the SE Rule element
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static void mergeScaleDependencies( double mScaleMinDenom, double mScaleMaxDenom, QVariantMap &props );
|
|
%Docstring
|
|
Merges the local scale limits, if any, with the ones already in the map, if any
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static void parametricSvgToSld( QDomDocument &doc, QDomElement &graphicElem,
|
|
const QString &path,
|
|
const QColor &fillColor, double size, const QColor &strokeColor, double strokeWidth );
|
|
%Docstring
|
|
Encodes a reference to a parametric SVG into SLD, as a succession of parametric SVG using URL parameters,
|
|
a fallback SVG without parameters, and a final fallback as a mark with the right colors and stroke for systems
|
|
that cannot do SVG at all
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QString getSvgParametricPath( const QString &basePath, const QColor &fillColor, const QColor &strokeColor, double strokeWidth );
|
|
%Docstring
|
|
Encodes a reference to a parametric SVG into a path with parameters according to the SVG Parameters spec
|
|
|
|
.. versionadded:: 3.0
|
|
%End
|
|
|
|
static QSet<const QgsSymbolLayer *> toSymbolLayerPointers( const QgsFeatureRenderer *renderer, const QSet<QgsSymbolLayerId> &symbolLayerIds );
|
|
%Docstring
|
|
Converts a set of symbol layer id to a set of pointers to actual symbol layers carried by the feature renderer.
|
|
|
|
.. versionadded:: 3.12
|
|
%End
|
|
|
|
static double rendererFrameRate( const QgsFeatureRenderer *renderer );
|
|
%Docstring
|
|
Calculates the frame rate (in frames per second) at which the given ``renderer`` must be redrawn.
|
|
|
|
Returns -1 if the ``renderer`` is not animated.
|
|
|
|
.. versionadded:: 3.26
|
|
%End
|
|
|
|
static QgsSymbol *restrictedSizeSymbol( const QgsSymbol *s, double minSize, double maxSize, QgsRenderContext *context, double &width, double &height, bool *ok = 0 );
|
|
%Docstring
|
|
Creates a new symbol with size restricted to min/max size if original size is out of min/max range
|
|
|
|
:param s: the original symbol
|
|
:param minSize: the minimum size in mm
|
|
:param maxSize: the maximum size in mm
|
|
:param context: the render context
|
|
:param width: expected width, can be changed by the function
|
|
:param height: expected height, can be changed by the function
|
|
:param ok: if not None, ok is set to false if it's not possible to compute a restricted symbol (if geometry generators
|
|
are involved for instance)
|
|
|
|
:return: None if size is within minSize/maxSize range or if it's not possible to compute a
|
|
restricted size symbol. New symbol if size was out of min/max range.
|
|
Caller takes ownership
|
|
%End
|
|
|
|
static QgsStringMap evaluatePropertiesMap( const QMap<QString, QgsProperty> &propertiesMap, const QgsExpressionContext &context );
|
|
%Docstring
|
|
Evaluates a map of properties using the given ``context`` and returns a variant map with evaluated expressions from the properties.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
static QSize tileSize( int width, int height, double &angleRad /In,Out/ );
|
|
%Docstring
|
|
Calculate the minimum size in pixels of a symbol tile given the symbol ``width`` and ``height`` and the symbol layer rotation ``angleRad`` in radians (counter clockwise).
|
|
The method makes approximations and can modify ``angle`` in order to generate the smallest possible tile.
|
|
|
|
:param width: marker width, including margins
|
|
:param height: marker height, including margins
|
|
:param angleRad: symbol layer rotation angle in radians (counter clockwise), it may be approximated by the method to minimize the tile size.
|
|
|
|
:return: the size of the tile
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
static void fixOldSymbolLayerReferences( const QMap<QString, QgsMapLayer *> &mapLayers );
|
|
%Docstring
|
|
:py:class:`QgsSymbolLayerReference` uses :py:class:`QgsSymbolLayer` unique uuid identifier since QGIS 3.30, instead of the symbol
|
|
key (rule for :py:class:`QgsRuleBasedRenderer` for instance) and index path, so this method migrates ``mapLayers`` old references
|
|
to new ones.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgssymbollayerutils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|