QGIS API Documentation  3.2.0-Bonn (bc43194)
Static Public Member Functions | List of all members
QgsSymbolLayerUtils Class Reference

#include <qgssymbollayerutils.h>

Static Public Member Functions

static void applyScaleDependency (QDomDocument &doc, QDomElement &ruleElem, QgsStringMap &props)
 Checks if the properties contain scaleMinDenom and scaleMaxDenom, if available, they are added into the SE Rule element. More...
 
static void blurImageInPlace (QImage &image, QRect rect, int radius, bool alphaOnly)
 Blurs an image in place, e.g. creating Qt-independent drop shadows. More...
 
static void clearSymbolMap (QgsSymbolMap &symbols)
 
static QColor colorFromMimeData (const QMimeData *data, bool &hasAlpha)
 Attempts to parse mime data as a color. More...
 
static QgsNamedColorList colorListFromMimeData (const QMimeData *data)
 Attempts to parse mime data as a list of named colors. More...
 
static QMimeData * colorListToMimeData (const QgsNamedColorList &colorList, bool allFormats=true)
 Creates mime data from a list of named colors. More...
 
static QIcon colorRampPreviewIcon (QgsColorRamp *ramp, QSize size, int padding=0)
 Returns an icon preview for a color ramp. More...
 
static QPixmap colorRampPreviewPixmap (QgsColorRamp *ramp, QSize size, int padding=0)
 Returns a pixmap preview for a color ramp. More...
 
static QVariant colorRampToVariant (const QString &name, QgsColorRamp *ramp)
 Saves a color ramp to a QVariantMap, wrapped in a QVariant. More...
 
static QMimeData * colorToMimeData (const QColor &color)
 Creates mime data from a color. More...
 
static QString colorToName (const QColor &color)
 Returns a friendly display name for a color. More...
 
static bool convertPolygonSymbolizerToPointMarker (QDomElement &element, QgsSymbolLayerList &layerList)
 
static void createAnchorPointElement (QDomDocument &doc, QDomElement &element, QPointF anchor)
 Creates a SE 1.1 anchor point element as a child of the specified element. More...
 
static void createDisplacementElement (QDomDocument &doc, QDomElement &element, QPointF offset)
 
static bool createExpressionElement (QDomDocument &doc, QDomElement &element, const QString &function)
 Creates a OGC Expression element based on the provided function expression. More...
 
static QgsSymbolLayercreateFillLayerFromSld (QDomElement &element)
 
static bool createFunctionElement (QDomDocument &doc, QDomElement &element, const QString &function)
 
static void createGeometryElement (QDomDocument &doc, QDomElement &element, const QString &geomFunc)
 
static QgsSymbolLayercreateLineLayerFromSld (QDomElement &element)
 
static QgsSymbolLayercreateMarkerLayerFromSld (QDomElement &element)
 
static void createOnlineResourceElement (QDomDocument &doc, QDomElement &element, const QString &path, const QString &format)
 
static void createOpacityElement (QDomDocument &doc, QDomElement &element, const QString &alphaFunc)
 
static void createRotationElement (QDomDocument &doc, QDomElement &element, const QString &rotationFunc)
 
static QDomElement createSvgParameterElement (QDomDocument &doc, const QString &name, const QString &value)
 
static bool createSymbolLayerListFromSld (QDomElement &element, QgsWkbTypes::GeometryType geomType, QgsSymbolLayerList &layers)
 
static QDomElement createVendorOptionElement (QDomDocument &doc, const QString &name, const QString &value)
 
static QgsArrowSymbolLayer::HeadType decodeArrowHeadType (const QVariant &value, bool *ok=nullptr)
 Decodes a value representing an arrow head type. More...
 
static QgsArrowSymbolLayer::ArrowType decodeArrowType (const QVariant &value, bool *ok=nullptr)
 Decodes a value representing an arrow type. More...
 
static QPainter::CompositionMode decodeBlendMode (const QString &s)
 
static Qt::BrushStyle decodeBrushStyle (const QString &str)
 
static QColor decodeColor (const QString &str)
 
static QgsMapUnitScale decodeMapUnitScale (const QString &str)
 
static Qt::PenCapStyle decodePenCapStyle (const QString &str)
 
static Qt::PenJoinStyle decodePenJoinStyle (const QString &str)
 
static Qt::PenStyle decodePenStyle (const QString &str)
 
static QPointF decodePoint (const QString &string)
 Decodes a QSizeF from a string. More...
 
static QVector< qreal > decodeRealVector (const QString &s)
 
static QgsSymbol::ScaleMethod decodeScaleMethod (const QString &str)
 
static QSizeF decodeSize (const QString &string)
 Decodes a QSizeF from a string. More...
 
static int decodeSldAlpha (const QString &str)
 
static Qt::BrushStyle decodeSldBrushStyle (const QString &str)
 
static QFont::Style decodeSldFontStyle (const QString &str)
 
static int decodeSldFontWeight (const QString &str)
 
static Qt::PenCapStyle decodeSldLineCapStyle (const QString &str)
 
static Qt::PenJoinStyle decodeSldLineJoinStyle (const QString &str)
 
static QVector< qreal > decodeSldRealVector (const QString &s)
 
static QgsUnitTypes::RenderUnit decodeSldUom (const QString &str, double *scaleFactor)
 Decodes a SLD unit of measure string to a render unit. More...
 
static bool displacementFromSldElement (QDomElement &element, QPointF &offset)
 
static void drawStippledBackground (QPainter *painter, QRect rect)
 
static QString encodeBrushStyle (Qt::BrushStyle style)
 
static QString encodeColor (const QColor &color)
 
static QString encodeMapUnitScale (const QgsMapUnitScale &mapUnitScale)
 
static QString encodePenCapStyle (Qt::PenCapStyle style)
 
static QString encodePenJoinStyle (Qt::PenJoinStyle style)
 
static QString encodePenStyle (Qt::PenStyle style)
 
static QString encodePoint (QPointF point)
 Encodes a QPointF to a string. More...
 
static QString encodeRealVector (const QVector< qreal > &v)
 
static QString encodeScaleMethod (QgsSymbol::ScaleMethod scaleMethod)
 
static QString encodeSize (QSizeF size)
 Encodes a QSizeF to a string. More...
 
static QString encodeSldAlpha (int alpha)
 
static QString encodeSldBrushStyle (Qt::BrushStyle style)
 
static QString encodeSldFontStyle (QFont::Style style)
 
static QString encodeSldFontWeight (int weight)
 
static QString encodeSldLineCapStyle (Qt::PenCapStyle style)
 
static QString encodeSldLineJoinStyle (Qt::PenJoinStyle style)
 
static QString encodeSldRealVector (const QVector< qreal > &v)
 
static QString encodeSldUom (QgsUnitTypes::RenderUnit unit, double *scaleFactor)
 Encodes a render unit into an SLD unit of measure string. More...
 
static double estimateMaxSymbolBleed (QgsSymbol *symbol, const QgsRenderContext &context)
 Returns the maximum estimated bleed for the symbol. More...
 
static bool externalGraphicFromSld (QDomElement &element, QString &path, QString &mime, QColor &color, double &size)
 
static void externalGraphicToSld (QDomDocument &doc, QDomElement &element, const QString &path, const QString &mime, const QColor &color, double size=-1)
 
static bool externalMarkerFromSld (QDomElement &element, QString &path, QString &format, int &markIndex, QColor &color, double &size)
 
static void externalMarkerToSld (QDomDocument &doc, QDomElement &element, const QString &path, const QString &format, int *markIndex=nullptr, const QColor &color=QColor(), double size=-1)
 
static QString fieldOrExpressionFromExpression (QgsExpression *expression)
 Returns a field name if the whole expression is just a name of the field . More...
 
static QgsExpressionfieldOrExpressionToExpression (const QString &fieldOrExpression)
 Returns a new valid expression instance for given field or expression string. More...
 
static bool fillFromSld (QDomElement &element, Qt::BrushStyle &brushStyle, QColor &color)
 
static void fillToSld (QDomDocument &doc, QDomElement &element, Qt::BrushStyle brushStyle, const QColor &color=QColor())
 
static bool functionFromSldElement (QDomElement &element, QString &function)
 
static bool geometryFromSldElement (QDomElement &element, QString &geomFunc)
 
static QgsStringMap getSvgParameterList (QDomElement &element)
 
static QString getSvgParametricPath (const QString &basePath, const QColor &fillColor, const QColor &strokeColor, double strokeWidth)
 Encodes a reference to a parametric SVG into a path with parameters according to the SVG Parameters spec. More...
 
static QgsStringMap getVendorOptionList (QDomElement &element)
 
static bool hasExternalGraphic (QDomElement &element)
 
static bool hasWellKnownMark (QDomElement &element)
 
static QgsNamedColorList importColorsFromGpl (QFile &file, bool &ok, QString &name)
 Imports colors from a gpl GIMP palette file. More...
 
static void labelTextToSld (QDomDocument &doc, QDomElement &element, const QString &label, const QFont &font, const QColor &color=QColor(), double size=-1)
 
static bool lineFromSld (QDomElement &element, Qt::PenStyle &penStyle, QColor &color, double &width, Qt::PenJoinStyle *penJoinStyle=nullptr, Qt::PenCapStyle *penCapStyle=nullptr, QVector< qreal > *customDashPattern=nullptr, double *dashOffset=nullptr)
 
static void lineToSld (QDomDocument &doc, QDomElement &element, Qt::PenStyle penStyle, const QColor &color, double width=-1, const Qt::PenJoinStyle *penJoinStyle=nullptr, const Qt::PenCapStyle *penCapStyle=nullptr, const QVector< qreal > *customDashPattern=nullptr, double dashOffset=0.0)
 
static QStringList listSvgFiles ()
 Returns a list of all available svg files. More...
 
static QStringList listSvgFilesAt (const QString &directory)
 Returns a list of svg files at the specified directory. More...
 
static QgsColorRamploadColorRamp (QDomElement &element)
 Creates a color ramp from the settings encoded in an XML element. More...
 
static QgsColorRamploadColorRamp (const QVariant &value)
 Load a color ramp from a QVariantMap, wrapped in a QVariant. More...
 
static QgsSymbolloadSymbol (const QDomElement &element, const QgsReadWriteContext &context)
 Attempts to load a symbol from a DOM element. More...
 
template<class SymbolType >
static SymbolType * loadSymbol (const QDomElement &element, const QgsReadWriteContext &context)
 Attempts to load a symbol from a DOM element and cast it to a particular symbol type. More...
 
static QgsSymbolLayerloadSymbolLayer (QDomElement &element, const QgsReadWriteContext &context)
 Reads and returns symbol layer from XML. Caller is responsible for deleting the returned object. More...
 
static QgsSymbolMap loadSymbols (QDomElement &element, const QgsReadWriteContext &context)
 Reads a collection of symbols from XML and returns them in a map. Caller is responsible for deleting returned symbols. More...
 
static void mergeScaleDependencies (int mScaleMinDenom, int mScaleMaxDenom, QgsStringMap &props)
 Merges the local scale limits, if any, with the ones already in the map, if any. More...
 
static void multiplyImageOpacity (QImage *image, qreal opacity)
 Multiplies opacity of image pixel values with a (global) transparency value. More...
 
static bool needEllipseMarker (QDomElement &element)
 
static bool needFontMarker (QDomElement &element)
 
static bool needLinePatternFill (QDomElement &element)
 
static bool needMarkerLine (QDomElement &element)
 
static bool needPointPatternFill (QDomElement &element)
 
static bool needSvgFill (QDomElement &element)
 
static bool needSvgMarker (QDomElement &element)
 
static QString ogrFeatureStyleBrush (const QColor &fillColr)
 Create ogr feature style string for brush. More...
 
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=nullptr)
 Create ogr feature style string for pen. More...
 
static bool onlineResourceFromSldElement (QDomElement &element, QString &path, QString &format)
 
static bool opacityFromSldElement (QDomElement &element, QString &alphaFunc)
 
static void parametricSvgToSld (QDomDocument &doc, QDomElement &graphicElem, const QString &path, const QColor &fillColor, double size, const QColor &strokeColor, double strokeWidth)
 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. More...
 
static QColor parseColor (const QString &colorStr, bool strictEval=false)
 Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static QList< QColor > parseColorList (const QString &colorStr)
 Attempts to parse a string as a list of colors using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static QColor parseColorWithAlpha (const QString &colorStr, bool &containsAlpha, bool strictEval=false)
 Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings. More...
 
static QgsStringMap parseProperties (QDomElement &element)
 
static bool pointInPolygon (const QPolygonF &points, QPointF point)
 Calculate whether a point is within of a QPolygonF. More...
 
static QPointF pointOnLineWithDistance (QPointF startPoint, QPointF directionPoint, double distance)
 Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point. More...
 
static QPointF polygonCentroid (const QPolygonF &points)
 Calculate the centroid point of a QPolygonF. More...
 
static QPointF polygonPointOnSurface (const QPolygonF &points)
 Calculate a point within of a QPolygonF. More...
 
static void premultiplyColor (QColor &rgb, int alpha)
 Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value. More...
 
static QList< double > prettyBreaks (double minimum, double maximum, int classes)
 Computes a sequence of about 'classes' equally spaced round values which cover the range of values from 'minimum' to 'maximum'. More...
 
static double rescaleUom (double size, QgsUnitTypes::RenderUnit unit, const QgsStringMap &props)
 Rescales the given size based on the uomScale found in the props, if any is found, otherwise returns the value un-modified. More...
 
static QPointF rescaleUom (QPointF point, QgsUnitTypes::RenderUnit unit, const QgsStringMap &props)
 Rescales the given point based on the uomScale found in the props, if any is found, otherwise returns a copy of the original point. More...
 
static QVector< qreal > rescaleUom (const QVector< qreal > &array, QgsUnitTypes::RenderUnit unit, const QgsStringMap &props)
 Rescales the given array based on the uomScale found in the props, if any is found, otherwise returns a copy of the original point. More...
 
static bool rotationFromSldElement (QDomElement &element, QString &rotationFunc)
 
static QDomElement saveColorRamp (const QString &name, QgsColorRamp *ramp, QDomDocument &doc)
 Encodes a color ramp's settings to an XML element. More...
 
static bool saveColorsToGpl (QFile &file, const QString &paletteName, const QgsNamedColorList &colors)
 Exports colors to a gpl GIMP palette file. More...
 
static void saveProperties (QgsStringMap props, QDomDocument &doc, QDomElement &element)
 
static QDomElement saveSymbol (const QString &symbolName, QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
 Writes a symbol definition to XML. More...
 
static QDomElement saveSymbols (QgsSymbolMap &symbols, const QString &tagName, QDomDocument &doc, const QgsReadWriteContext &context)
 Writes a collection of symbols to XML with specified tagName for the top-level element. More...
 
static double sizeInPixelsFromSldUom (const QString &uom, double size)
 Returns the size scaled in pixels according to the uom attribute. More...
 
static void sortVariantList (QList< QVariant > &list, Qt::SortOrder order)
 Sorts the passed list in requested order. More...
 
static QString svgSymbolNameToPath (const QString &name, const QgsPathResolver &pathResolver)
 Determines an SVG symbol's path from its name. More...
 
static QString svgSymbolPathToName (const QString &path, const QgsPathResolver &pathResolver)
 Determines an SVG symbol's name from its path. More...
 
static QgsSymbolsymbolFromMimeData (const QMimeData *data)
 Attempts to parse mime data as a symbol. More...
 
static QIcon symbolLayerPreviewIcon (QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
 Draws a symbol layer preview to an icon. More...
 
static QPicture symbolLayerPreviewPicture (QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
 Draws a symbol layer preview to a QPicture. More...
 
static QIcon symbolPreviewIcon (QgsSymbol *symbol, QSize size, int padding=0)
 Returns an icon preview for a color ramp. More...
 
static QPixmap symbolPreviewPixmap (QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr)
 Returns a pixmap preview for a color ramp. More...
 
static QString symbolProperties (QgsSymbol *symbol)
 Returns a string representing the symbol. More...
 
static QMimeData * symbolToMimeData (QgsSymbol *symbol)
 Creates new mime data from a symbol. More...
 
static bool wellKnownMarkerFromSld (QDomElement &element, QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle, double &strokeWidth, 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)
 

Detailed Description

Definition at line 54 of file qgssymbollayerutils.h.

Member Function Documentation

◆ applyScaleDependency()

void QgsSymbolLayerUtils::applyScaleDependency ( QDomDocument &  doc,
QDomElement &  ruleElem,
QgsStringMap props 
)
static

Checks if the properties contain scaleMinDenom and scaleMaxDenom, if available, they are added into the SE Rule element.

Since
QGIS 3.0

Definition at line 4169 of file qgssymbollayerutils.cpp.

◆ blurImageInPlace()

void QgsSymbolLayerUtils::blurImageInPlace ( QImage &  image,
QRect  rect,
int  radius,
bool  alphaOnly 
)
static

Blurs an image in place, e.g. creating Qt-independent drop shadows.

Definition at line 3553 of file qgssymbollayerutils.cpp.

◆ clearSymbolMap()

void QgsSymbolLayerUtils::clearSymbolMap ( QgsSymbolMap symbols)
static

Definition at line 2884 of file qgssymbollayerutils.cpp.

◆ colorFromMimeData()

QColor QgsSymbolLayerUtils::colorFromMimeData ( const QMimeData *  data,
bool &  hasAlpha 
)
static

Attempts to parse mime data as a color.

Parameters
datamime data to parse
hasAlphawill be set to true if mime data was interpreted as a color containing an explicit alpha value
Returns
valid color if mimedata could be interpreted as a color, otherwise an invalid color
Since
QGIS 2.5

Definition at line 3108 of file qgssymbollayerutils.cpp.

◆ colorListFromMimeData()

QgsNamedColorList QgsSymbolLayerUtils::colorListFromMimeData ( const QMimeData *  data)
static

Attempts to parse mime data as a list of named colors.

Parameters
datamime data to parse
Returns
list of parsed colors
Since
QGIS 2.5

Definition at line 3130 of file qgssymbollayerutils.cpp.

◆ colorListToMimeData()

QMimeData * QgsSymbolLayerUtils::colorListToMimeData ( const QgsNamedColorList colorList,
bool  allFormats = true 
)
static

Creates mime data from a list of named colors.

Parameters
colorListlist of named colors
allFormatsset to true to include additional mime formats, include text/plain and application/x-color
Returns
mime data containing encoded colors
Since
QGIS 2.5

Definition at line 3243 of file qgssymbollayerutils.cpp.

◆ colorRampPreviewIcon()

QIcon QgsSymbolLayerUtils::colorRampPreviewIcon ( QgsColorRamp ramp,
QSize  size,
int  padding = 0 
)
static

Returns an icon preview for a color ramp.

Parameters
rampcolor ramp
sizetarget icon size
paddingspace between icon edge and color ramp
See also
colorRampPreviewPixmap()

Definition at line 739 of file qgssymbollayerutils.cpp.

◆ colorRampPreviewPixmap()

QPixmap QgsSymbolLayerUtils::colorRampPreviewPixmap ( QgsColorRamp ramp,
QSize  size,
int  padding = 0 
)
static

Returns a pixmap preview for a color ramp.

Parameters
rampcolor ramp
sizetarget pixmap size
paddingspace between icon edge and color ramp
See also
colorRampPreviewIcon()

Definition at line 744 of file qgssymbollayerutils.cpp.

◆ colorRampToVariant()

QVariant QgsSymbolLayerUtils::colorRampToVariant ( const QString &  name,
QgsColorRamp ramp 
)
static

Saves a color ramp to a QVariantMap, wrapped in a QVariant.

You can use QgsXmlUtils::writeVariant to save it to an XML document.

See also
loadColorRamp( const QVariant &value )

Definition at line 2968 of file qgssymbollayerutils.cpp.

◆ colorToMimeData()

QMimeData * QgsSymbolLayerUtils::colorToMimeData ( const QColor &  color)
static

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.

Parameters
colorcolor to encode as mime data
See also
colorFromMimeData
Since
QGIS 2.5

Definition at line 3098 of file qgssymbollayerutils.cpp.

◆ colorToName()

QString QgsSymbolLayerUtils::colorToName ( const QColor &  color)
static

Returns a friendly display name for a color.

Parameters
colorsource color
Returns
display name for color
Since
QGIS 2.5

Definition at line 3019 of file qgssymbollayerutils.cpp.

◆ convertPolygonSymbolizerToPointMarker()

bool QgsSymbolLayerUtils::convertPolygonSymbolizerToPointMarker ( QDomElement &  element,
QgsSymbolLayerList layerList 
)
static

Definition at line 1486 of file qgssymbollayerutils.cpp.

◆ createAnchorPointElement()

void QgsSymbolLayerUtils::createAnchorPointElement ( QDomDocument &  doc,
QDomElement &  element,
QPointF  anchor 
)
static

Creates a SE 1.1 anchor point element as a child of the specified element.

Parameters
docThe document
elementThe parent element
anchorAn anchor specification, with values between 0 and 1

Definition at line 2386 of file qgssymbollayerutils.cpp.

◆ createDisplacementElement()

void QgsSymbolLayerUtils::createDisplacementElement ( QDomDocument &  doc,
QDomElement &  element,
QPointF  offset 
)
static

Definition at line 2368 of file qgssymbollayerutils.cpp.

◆ createExpressionElement()

bool QgsSymbolLayerUtils::createExpressionElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  function 
)
static

Creates a OGC Expression element based on the provided function expression.

Parameters
docThe document owning the element
elementThe element parent
functionThe expression to be encoded

Definition at line 2586 of file qgssymbollayerutils.cpp.

◆ createFillLayerFromSld()

QgsSymbolLayer * QgsSymbolLayerUtils::createFillLayerFromSld ( QDomElement &  element)
static

Definition at line 1234 of file qgssymbollayerutils.cpp.

◆ createFunctionElement()

bool QgsSymbolLayerUtils::createFunctionElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  function 
)
static

Definition at line 2602 of file qgssymbollayerutils.cpp.

◆ createGeometryElement()

void QgsSymbolLayerUtils::createGeometryElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  geomFunc 
)
static

Definition at line 2543 of file qgssymbollayerutils.cpp.

◆ createLineLayerFromSld()

QgsSymbolLayer * QgsSymbolLayerUtils::createLineLayerFromSld ( QDomElement &  element)
static

Definition at line 1257 of file qgssymbollayerutils.cpp.

◆ createMarkerLayerFromSld()

QgsSymbolLayer * QgsSymbolLayerUtils::createMarkerLayerFromSld ( QDomElement &  element)
static

Definition at line 1276 of file qgssymbollayerutils.cpp.

◆ createOnlineResourceElement()

void QgsSymbolLayerUtils::createOnlineResourceElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  path,
const QString &  format 
)
static

Definition at line 2654 of file qgssymbollayerutils.cpp.

◆ createOpacityElement()

void QgsSymbolLayerUtils::createOpacityElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  alphaFunc 
)
static

Definition at line 2348 of file qgssymbollayerutils.cpp.

◆ createRotationElement()

void QgsSymbolLayerUtils::createRotationElement ( QDomDocument &  doc,
QDomElement &  element,
const QString &  rotationFunc 
)
static

Definition at line 2327 of file qgssymbollayerutils.cpp.

◆ createSvgParameterElement()

QDomElement QgsSymbolLayerUtils::createSvgParameterElement ( QDomDocument &  doc,
const QString &  name,
const QString &  value 
)
static

Definition at line 2688 of file qgssymbollayerutils.cpp.

◆ createSymbolLayerListFromSld()

bool QgsSymbolLayerUtils::createSymbolLayerListFromSld ( QDomElement &  element,
QgsWkbTypes::GeometryType  geomType,
QgsSymbolLayerList layers 
)
static

Definition at line 1084 of file qgssymbollayerutils.cpp.

◆ createVendorOptionElement()

QDomElement QgsSymbolLayerUtils::createVendorOptionElement ( QDomDocument &  doc,
const QString &  name,
const QString &  value 
)
static

Definition at line 2735 of file qgssymbollayerutils.cpp.

◆ decodeArrowHeadType()

QgsArrowSymbolLayer::HeadType QgsSymbolLayerUtils::decodeArrowHeadType ( const QVariant &  value,
bool *  ok = nullptr 
)
static

Decodes a value representing an arrow head type.

Since
QGIS 3.2

Definition at line 374 of file qgssymbollayerutils.cpp.

◆ decodeArrowType()

QgsArrowSymbolLayer::ArrowType QgsSymbolLayerUtils::decodeArrowType ( const QVariant &  value,
bool *  ok = nullptr 
)
static

Decodes a value representing an arrow type.

Since
QGIS 3.2

Definition at line 399 of file qgssymbollayerutils.cpp.

◆ decodeBlendMode()

QPainter::CompositionMode QgsSymbolLayerUtils::decodeBlendMode ( const QString &  s)
static

Definition at line 631 of file qgssymbollayerutils.cpp.

◆ decodeBrushStyle()

Qt::BrushStyle QgsSymbolLayerUtils::decodeBrushStyle ( const QString &  str)
static

Definition at line 302 of file qgssymbollayerutils.cpp.

◆ decodeColor()

QColor QgsSymbolLayerUtils::decodeColor ( const QString &  str)
static

Definition at line 53 of file qgssymbollayerutils.cpp.

◆ decodeMapUnitScale()

QgsMapUnitScale QgsSymbolLayerUtils::decodeMapUnitScale ( const QString &  str)
static

Definition at line 460 of file qgssymbollayerutils.cpp.

◆ decodePenCapStyle()

Qt::PenCapStyle QgsSymbolLayerUtils::decodePenCapStyle ( const QString &  str)
static

Definition at line 232 of file qgssymbollayerutils.cpp.

◆ decodePenJoinStyle()

Qt::PenJoinStyle QgsSymbolLayerUtils::decodePenJoinStyle ( const QString &  str)
static

Definition at line 186 of file qgssymbollayerutils.cpp.

◆ decodePenStyle()

Qt::PenStyle QgsSymbolLayerUtils::decodePenStyle ( const QString &  str)
static

Definition at line 160 of file qgssymbollayerutils.cpp.

◆ decodePoint()

QPointF QgsSymbolLayerUtils::decodePoint ( const QString &  string)
static

Decodes a QSizeF from a string.

See also
encodePoint()
decodeSize()

Definition at line 429 of file qgssymbollayerutils.cpp.

◆ decodeRealVector()

QVector< qreal > QgsSymbolLayerUtils::decodeRealVector ( const QString &  s)
static

Definition at line 556 of file qgssymbollayerutils.cpp.

◆ decodeScaleMethod()

QgsSymbol::ScaleMethod QgsSymbolLayerUtils::decodeScaleMethod ( const QString &  str)
static

Definition at line 615 of file qgssymbollayerutils.cpp.

◆ decodeSize()

QSizeF QgsSymbolLayerUtils::decodeSize ( const QString &  string)
static

Decodes a QSizeF from a string.

See also
encodeSize()
decodePoint()
Since
QGIS 3.0

Definition at line 442 of file qgssymbollayerutils.cpp.

◆ decodeSldAlpha()

int QgsSymbolLayerUtils::decodeSldAlpha ( const QString &  str)
static

Definition at line 79 of file qgssymbollayerutils.cpp.

◆ decodeSldBrushStyle()

Qt::BrushStyle QgsSymbolLayerUtils::decodeSldBrushStyle ( const QString &  str)
static

Definition at line 359 of file qgssymbollayerutils.cpp.

◆ decodeSldFontStyle()

QFont::Style QgsSymbolLayerUtils::decodeSldFontStyle ( const QString &  str)
static

Definition at line 105 of file qgssymbollayerutils.cpp.

◆ decodeSldFontWeight()

int QgsSymbolLayerUtils::decodeSldFontWeight ( const QString &  str)
static

Definition at line 125 of file qgssymbollayerutils.cpp.

◆ decodeSldLineCapStyle()

Qt::PenCapStyle QgsSymbolLayerUtils::decodeSldLineCapStyle ( const QString &  str)
static

Definition at line 255 of file qgssymbollayerutils.cpp.

◆ decodeSldLineJoinStyle()

Qt::PenJoinStyle QgsSymbolLayerUtils::decodeSldLineJoinStyle ( const QString &  str)
static

Definition at line 209 of file qgssymbollayerutils.cpp.

◆ decodeSldRealVector()

QVector< qreal > QgsSymbolLayerUtils::decodeSldRealVector ( const QString &  s)
static

Definition at line 585 of file qgssymbollayerutils.cpp.

◆ decodeSldUom()

QgsUnitTypes::RenderUnit QgsSymbolLayerUtils::decodeSldUom ( const QString &  str,
double *  scaleFactor 
)
static

Decodes a SLD unit of measure string to a render unit.

Parameters
strstring to decode
scaleFactorif specified, will be set to scale factor for unit of measure
Returns
matching render unit
See also
encodeSldUom()

Definition at line 519 of file qgssymbollayerutils.cpp.

◆ displacementFromSldElement()

bool QgsSymbolLayerUtils::displacementFromSldElement ( QDomElement &  element,
QPointF &  offset 
)
static

Definition at line 2403 of file qgssymbollayerutils.cpp.

◆ drawStippledBackground()

void QgsSymbolLayerUtils::drawStippledBackground ( QPainter *  painter,
QRect  rect 
)
static

Definition at line 767 of file qgssymbollayerutils.cpp.

◆ encodeBrushStyle()

QString QgsSymbolLayerUtils::encodeBrushStyle ( Qt::BrushStyle  style)
static

Definition at line 263 of file qgssymbollayerutils.cpp.

◆ encodeColor()

QString QgsSymbolLayerUtils::encodeColor ( const QColor &  color)
static

Definition at line 48 of file qgssymbollayerutils.cpp.

◆ encodeMapUnitScale()

QString QgsSymbolLayerUtils::encodeMapUnitScale ( const QgsMapUnitScale mapUnitScale)
static

Definition at line 450 of file qgssymbollayerutils.cpp.

◆ encodePenCapStyle()

QString QgsSymbolLayerUtils::encodePenCapStyle ( Qt::PenCapStyle  style)
static

Definition at line 217 of file qgssymbollayerutils.cpp.

◆ encodePenJoinStyle()

QString QgsSymbolLayerUtils::encodePenJoinStyle ( Qt::PenJoinStyle  style)
static

Definition at line 171 of file qgssymbollayerutils.cpp.

◆ encodePenStyle()

QString QgsSymbolLayerUtils::encodePenStyle ( Qt::PenStyle  style)
static

Definition at line 139 of file qgssymbollayerutils.cpp.

◆ encodePoint()

QString QgsSymbolLayerUtils::encodePoint ( QPointF  point)
static

Encodes a QPointF to a string.

See also
decodePoint()
encodeSize()

Definition at line 424 of file qgssymbollayerutils.cpp.

◆ encodeRealVector()

QString QgsSymbolLayerUtils::encodeRealVector ( const QVector< qreal > &  v)
static

Definition at line 541 of file qgssymbollayerutils.cpp.

◆ encodeScaleMethod()

QString QgsSymbolLayerUtils::encodeScaleMethod ( QgsSymbol::ScaleMethod  scaleMethod)
static

Definition at line 599 of file qgssymbollayerutils.cpp.

◆ encodeSize()

QString QgsSymbolLayerUtils::encodeSize ( QSizeF  size)
static

Encodes a QSizeF to a string.

See also
decodeSize()
encodePoint()
Since
QGIS 3.0

Definition at line 437 of file qgssymbollayerutils.cpp.

◆ encodeSldAlpha()

QString QgsSymbolLayerUtils::encodeSldAlpha ( int  alpha)
static

Definition at line 72 of file qgssymbollayerutils.cpp.

◆ encodeSldBrushStyle()

QString QgsSymbolLayerUtils::encodeSldBrushStyle ( Qt::BrushStyle  style)
static

Definition at line 322 of file qgssymbollayerutils.cpp.

◆ encodeSldFontStyle()

QString QgsSymbolLayerUtils::encodeSldFontStyle ( QFont::Style  style)
static

Definition at line 90 of file qgssymbollayerutils.cpp.

◆ encodeSldFontWeight()

QString QgsSymbolLayerUtils::encodeSldFontWeight ( int  weight)
static

Definition at line 113 of file qgssymbollayerutils.cpp.

◆ encodeSldLineCapStyle()

QString QgsSymbolLayerUtils::encodeSldLineCapStyle ( Qt::PenCapStyle  style)
static

Definition at line 240 of file qgssymbollayerutils.cpp.

◆ encodeSldLineJoinStyle()

QString QgsSymbolLayerUtils::encodeSldLineJoinStyle ( Qt::PenJoinStyle  style)
static

Definition at line 194 of file qgssymbollayerutils.cpp.

◆ encodeSldRealVector()

QString QgsSymbolLayerUtils::encodeSldRealVector ( const QVector< qreal > &  v)
static

Definition at line 570 of file qgssymbollayerutils.cpp.

◆ encodeSldUom()

QString QgsSymbolLayerUtils::encodeSldUom ( QgsUnitTypes::RenderUnit  unit,
double *  scaleFactor 
)
static

Encodes a render unit into an SLD unit of measure string.

Parameters
unitunit to encode
scaleFactorif specified, will be set to scale factor for unit of measure
Returns
encoded string
See also
decodeSldUom()

Definition at line 498 of file qgssymbollayerutils.cpp.

◆ estimateMaxSymbolBleed()

double QgsSymbolLayerUtils::estimateMaxSymbolBleed ( QgsSymbol symbol,
const QgsRenderContext context 
)
static

Returns the maximum estimated bleed for the symbol.

Definition at line 698 of file qgssymbollayerutils.cpp.

◆ externalGraphicFromSld()

bool QgsSymbolLayerUtils::externalGraphicFromSld ( QDomElement &  element,
QString &  path,
QString &  mime,
QColor &  color,
double &  size 
)
static

Definition at line 2145 of file qgssymbollayerutils.cpp.

◆ externalGraphicToSld()

void QgsSymbolLayerUtils::externalGraphicToSld ( QDomDocument &  doc,
QDomElement &  element,
const QString &  path,
const QString &  mime,
const QColor &  color,
double  size = -1 
)
static

Definition at line 2062 of file qgssymbollayerutils.cpp.

◆ externalMarkerFromSld()

bool QgsSymbolLayerUtils::externalMarkerFromSld ( QDomElement &  element,
QString &  path,
QString &  format,
int &  markIndex,
QColor &  color,
double &  size 
)
static

Definition at line 2200 of file qgssymbollayerutils.cpp.

◆ externalMarkerToSld()

void QgsSymbolLayerUtils::externalMarkerToSld ( QDomDocument &  doc,
QDomElement &  element,
const QString &  path,
const QString &  format,
int *  markIndex = nullptr,
const QColor &  color = QColor(),
double  size = -1 
)
static

Definition at line 2170 of file qgssymbollayerutils.cpp.

◆ fieldOrExpressionFromExpression()

QString QgsSymbolLayerUtils::fieldOrExpressionFromExpression ( QgsExpression expression)
static

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->expression() method may return quoted field name, but that is not wanted for saving (due to backward compatibility) or display in GUI.

Since
QGIS 2.2

Definition at line 3920 of file qgssymbollayerutils.cpp.

◆ fieldOrExpressionToExpression()

QgsExpression * QgsSymbolLayerUtils::fieldOrExpressionToExpression ( const QString &  fieldOrExpression)
static

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 null pointer. This is useful when accepting input which could be either a non-quoted field name or expression.

Since
QGIS 2.2

Definition at line 3904 of file qgssymbollayerutils.cpp.

◆ fillFromSld()

bool QgsSymbolLayerUtils::fillFromSld ( QDomElement &  element,
Qt::BrushStyle &  brushStyle,
QColor &  color 
)
static

Definition at line 1793 of file qgssymbollayerutils.cpp.

◆ fillToSld()

void QgsSymbolLayerUtils::fillToSld ( QDomDocument &  doc,
QDomElement &  element,
Qt::BrushStyle  brushStyle,
const QColor &  color = QColor() 
)
static

Definition at line 1742 of file qgssymbollayerutils.cpp.

◆ functionFromSldElement()

bool QgsSymbolLayerUtils::functionFromSldElement ( QDomElement &  element,
QString &  function 
)
static

Definition at line 2617 of file qgssymbollayerutils.cpp.

◆ geometryFromSldElement()

bool QgsSymbolLayerUtils::geometryFromSldElement ( QDomElement &  element,
QString &  geomFunc 
)
static

Definition at line 2577 of file qgssymbollayerutils.cpp.

◆ getSvgParameterList()

QgsStringMap QgsSymbolLayerUtils::getSvgParameterList ( QDomElement &  element)
static

Definition at line 2696 of file qgssymbollayerutils.cpp.

◆ getSvgParametricPath()

QString QgsSymbolLayerUtils::getSvgParametricPath ( const QString &  basePath,
const QColor &  fillColor,
const QColor &  strokeColor,
double  strokeWidth 
)
static

Encodes a reference to a parametric SVG into a path with parameters according to the SVG Parameters spec.

Since
QGIS 3.0

Definition at line 2110 of file qgssymbollayerutils.cpp.

◆ getVendorOptionList()

QgsStringMap QgsSymbolLayerUtils::getVendorOptionList ( QDomElement &  element)
static

Definition at line 2743 of file qgssymbollayerutils.cpp.

◆ hasExternalGraphic()

bool QgsSymbolLayerUtils::hasExternalGraphic ( QDomElement &  element)
static

Definition at line 1299 of file qgssymbollayerutils.cpp.

◆ hasWellKnownMark()

bool QgsSymbolLayerUtils::hasWellKnownMark ( QDomElement &  element)
static

Definition at line 1340 of file qgssymbollayerutils.cpp.

◆ importColorsFromGpl()

QgsNamedColorList QgsSymbolLayerUtils::importColorsFromGpl ( QFile &  file,
bool &  ok,
QString &  name 
)
static

Imports colors from a gpl GIMP palette file.

Parameters
filesource gpl file
okwill be true if file was successfully read
namewill be set to palette name from gpl file, if present
Returns
list of imported colors
See also
saveColorsToGpl

Definition at line 3319 of file qgssymbollayerutils.cpp.

◆ labelTextToSld()

void QgsSymbolLayerUtils::labelTextToSld ( QDomDocument &  doc,
QDomElement &  element,
const QString &  label,
const QFont &  font,
const QColor &  color = QColor(),
double  size = -1 
)
static

Definition at line 2432 of file qgssymbollayerutils.cpp.

◆ lineFromSld()

bool QgsSymbolLayerUtils::lineFromSld ( QDomElement &  element,
Qt::PenStyle &  penStyle,
QColor &  color,
double &  width,
Qt::PenJoinStyle *  penJoinStyle = nullptr,
Qt::PenCapStyle *  penCapStyle = nullptr,
QVector< qreal > *  customDashPattern = nullptr,
double *  dashOffset = nullptr 
)
static

Definition at line 1931 of file qgssymbollayerutils.cpp.

◆ lineToSld()

void QgsSymbolLayerUtils::lineToSld ( QDomDocument &  doc,
QDomElement &  element,
Qt::PenStyle  penStyle,
const QColor &  color,
double  width = -1,
const Qt::PenJoinStyle *  penJoinStyle = nullptr,
const Qt::PenCapStyle *  penCapStyle = nullptr,
const QVector< qreal > *  customDashPattern = nullptr,
double  dashOffset = 0.0 
)
static
Note
not available in Python bindings

Definition at line 1847 of file qgssymbollayerutils.cpp.

◆ listSvgFiles()

QStringList QgsSymbolLayerUtils::listSvgFiles ( )
static

Returns a list of all available svg files.

Definition at line 3674 of file qgssymbollayerutils.cpp.

◆ listSvgFilesAt()

QStringList QgsSymbolLayerUtils::listSvgFilesAt ( const QString &  directory)
static

Returns a list of svg files at the specified directory.

Definition at line 3698 of file qgssymbollayerutils.cpp.

◆ loadColorRamp() [1/2]

QgsColorRamp * QgsSymbolLayerUtils::loadColorRamp ( QDomElement &  element)
static

Creates a color ramp from the settings encoded in an XML element.

Parameters
elementDOM element
Returns
new color ramp. Caller takes responsibility for deleting the returned value.
See also
saveColorRamp()

Definition at line 2933 of file qgssymbollayerutils.cpp.

◆ loadColorRamp() [2/2]

QgsColorRamp * QgsSymbolLayerUtils::loadColorRamp ( const QVariant &  value)
static

Load a color ramp from a QVariantMap, wrapped in a QVariant.

You can use QgsXmlUtils::readVariant to load it from an XML document.

See also
colorRampToVariant()

Definition at line 2987 of file qgssymbollayerutils.cpp.

◆ loadSymbol() [1/2]

QgsSymbol * QgsSymbolLayerUtils::loadSymbol ( const QDomElement &  element,
const QgsReadWriteContext context 
)
static

Attempts to load a symbol from a DOM element.

Parameters
elementDOM element representing symbol
contextobject to transform relative to absolute paths
Returns
decoded symbol, if possible

Definition at line 892 of file qgssymbollayerutils.cpp.

◆ loadSymbol() [2/2]

template<class SymbolType >
static SymbolType* QgsSymbolLayerUtils::loadSymbol ( const QDomElement &  element,
const QgsReadWriteContext context 
)
inlinestatic

Attempts to load a symbol from a DOM element and cast it to a particular symbol type.

Parameters
elementDOM element representing symbol
contextobject to transform relative to absolute paths
Returns
decoded symbol cast to specified type, if possible
Note
not available in Python bindings

Definition at line 256 of file qgssymbollayerutils.h.

◆ loadSymbolLayer()

QgsSymbolLayer * QgsSymbolLayerUtils::loadSymbolLayer ( QDomElement &  element,
const QgsReadWriteContext context 
)
static

Reads and returns symbol layer from XML. Caller is responsible for deleting the returned object.

Definition at line 970 of file qgssymbollayerutils.cpp.

◆ loadSymbols()

QgsSymbolMap QgsSymbolLayerUtils::loadSymbols ( QDomElement &  element,
const QgsReadWriteContext context 
)
static

Reads a collection of symbols from XML and returns them in a map. Caller is responsible for deleting returned symbols.

Definition at line 2792 of file qgssymbollayerutils.cpp.

◆ mergeScaleDependencies()

void QgsSymbolLayerUtils::mergeScaleDependencies ( int  mScaleMinDenom,
int  mScaleMaxDenom,
QgsStringMap props 
)
static

Merges the local scale limits, if any, with the ones already in the map, if any.

Since
QGIS 3.0

Definition at line 4186 of file qgssymbollayerutils.cpp.

◆ multiplyImageOpacity()

void QgsSymbolLayerUtils::multiplyImageOpacity ( QImage *  image,
qreal  opacity 
)
static

Multiplies opacity of image pixel values with a (global) transparency value.

Definition at line 3523 of file qgssymbollayerutils.cpp.

◆ needEllipseMarker()

bool QgsSymbolLayerUtils::needEllipseMarker ( QDomElement &  element)
static

Definition at line 1400 of file qgssymbollayerutils.cpp.

◆ needFontMarker()

bool QgsSymbolLayerUtils::needFontMarker ( QDomElement &  element)
static

Definition at line 1355 of file qgssymbollayerutils.cpp.

◆ needLinePatternFill()

bool QgsSymbolLayerUtils::needLinePatternFill ( QDomElement &  element)
static

Definition at line 1431 of file qgssymbollayerutils.cpp.

◆ needMarkerLine()

bool QgsSymbolLayerUtils::needMarkerLine ( QDomElement &  element)
static

Definition at line 1418 of file qgssymbollayerutils.cpp.

◆ needPointPatternFill()

bool QgsSymbolLayerUtils::needPointPatternFill ( QDomElement &  element)
static

Definition at line 1466 of file qgssymbollayerutils.cpp.

◆ needSvgFill()

bool QgsSymbolLayerUtils::needSvgFill ( QDomElement &  element)
static

Definition at line 1472 of file qgssymbollayerutils.cpp.

◆ needSvgMarker()

bool QgsSymbolLayerUtils::needSvgMarker ( QDomElement &  element)
static

Definition at line 1395 of file qgssymbollayerutils.cpp.

◆ ogrFeatureStyleBrush()

QString QgsSymbolLayerUtils::ogrFeatureStyleBrush ( const QColor &  fillColr)
static

Create ogr feature style string for brush.

Parameters
fillColrfill color

Definition at line 2533 of file qgssymbollayerutils.cpp.

◆ ogrFeatureStylePen()

QString QgsSymbolLayerUtils::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 = nullptr 
)
static

Create ogr feature style string for pen.

Definition at line 2459 of file qgssymbollayerutils.cpp.

◆ onlineResourceFromSldElement()

bool QgsSymbolLayerUtils::onlineResourceFromSldElement ( QDomElement &  element,
QString &  path,
QString &  format 
)
static

Definition at line 2669 of file qgssymbollayerutils.cpp.

◆ opacityFromSldElement()

bool QgsSymbolLayerUtils::opacityFromSldElement ( QDomElement &  element,
QString &  alphaFunc 
)
static

Definition at line 2358 of file qgssymbollayerutils.cpp.

◆ parametricSvgToSld()

void QgsSymbolLayerUtils::parametricSvgToSld ( QDomDocument &  doc,
QDomElement &  graphicElem,
const QString &  path,
const QColor &  fillColor,
double  size,
const QColor &  strokeColor,
double  strokeWidth 
)
static

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.

Since
QGIS 3.0

Definition at line 2082 of file qgssymbollayerutils.cpp.

◆ parseColor()

QColor QgsSymbolLayerUtils::parseColor ( const QString &  colorStr,
bool  strictEval = false 
)
static

Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color
strictEvalset to true for stricter color parsing rules
Returns
parsed color
Since
QGIS 2.3

Definition at line 3400 of file qgssymbollayerutils.cpp.

◆ parseColorList()

QList< QColor > QgsSymbolLayerUtils::parseColorList ( const QString &  colorStr)
static

Attempts to parse a string as a list of colors using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color list
Returns
list of parsed colors
Since
QGIS 2.5

Definition at line 3031 of file qgssymbollayerutils.cpp.

◆ parseColorWithAlpha()

QColor QgsSymbolLayerUtils::parseColorWithAlpha ( const QString &  colorStr,
bool &  containsAlpha,
bool  strictEval = false 
)
static

Attempts to parse a string as a color using a variety of common formats, including hex codes, rgb and rgba strings.

Parameters
colorStrstring representing the color
containsAlphaif colorStr contains an explicit alpha value then containsAlpha will be set to true
strictEvalset to true for stricter color parsing rules
Returns
parsed color
Since
QGIS 2.3

Definition at line 3406 of file qgssymbollayerutils.cpp.

◆ parseProperties()

QgsStringMap QgsSymbolLayerUtils::parseProperties ( QDomElement &  element)
static

Definition at line 2763 of file qgssymbollayerutils.cpp.

◆ pointInPolygon()

bool QgsSymbolLayerUtils::pointInPolygon ( const QPolygonF &  points,
QPointF  point 
)
static

Calculate whether a point is within of a QPolygonF.

Definition at line 3878 of file qgssymbollayerutils.cpp.

◆ pointOnLineWithDistance()

QPointF QgsSymbolLayerUtils::pointOnLineWithDistance ( QPointF  startPoint,
QPointF  directionPoint,
double  distance 
)
static

Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point.

Definition at line 3664 of file qgssymbollayerutils.cpp.

◆ polygonCentroid()

QPointF QgsSymbolLayerUtils::polygonCentroid ( const QPolygonF &  points)
static

Calculate the centroid point of a QPolygonF.

Definition at line 3818 of file qgssymbollayerutils.cpp.

◆ polygonPointOnSurface()

QPointF QgsSymbolLayerUtils::polygonPointOnSurface ( const QPolygonF &  points)
static

Calculate a point within of a QPolygonF.

Definition at line 3850 of file qgssymbollayerutils.cpp.

◆ premultiplyColor()

void QgsSymbolLayerUtils::premultiplyColor ( QColor &  rgb,
int  alpha 
)
static

Converts a QColor into a premultiplied ARGB QColor value using a specified alpha value.

Since
QGIS 2.3

Definition at line 3629 of file qgssymbollayerutils.cpp.

◆ prettyBreaks()

QList< double > QgsSymbolLayerUtils::prettyBreaks ( double  minimum,
double  maximum,
int  classes 
)
static

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.

Since
QGIS 2.10

Definition at line 3930 of file qgssymbollayerutils.cpp.

◆ rescaleUom() [1/3]

double QgsSymbolLayerUtils::rescaleUom ( double  size,
QgsUnitTypes::RenderUnit  unit,
const QgsStringMap props 
)
static

Rescales the given size based on the uomScale found in the props, if any is found, otherwise returns the value un-modified.

Since
QGIS 3.0

Definition at line 4074 of file qgssymbollayerutils.cpp.

◆ rescaleUom() [2/3]

QPointF QgsSymbolLayerUtils::rescaleUom ( QPointF  point,
QgsUnitTypes::RenderUnit  unit,
const QgsStringMap props 
)
static

Rescales the given point based on the uomScale found in the props, if any is found, otherwise returns a copy of the original point.

Since
QGIS 3.0

Definition at line 4151 of file qgssymbollayerutils.cpp.

◆ rescaleUom() [3/3]

QVector< qreal > QgsSymbolLayerUtils::rescaleUom ( const QVector< qreal > &  array,
QgsUnitTypes::RenderUnit  unit,
const QgsStringMap props 
)
static

Rescales the given array based on the uomScale found in the props, if any is found, otherwise returns a copy of the original point.

Since
QGIS 3.0

Definition at line 4158 of file qgssymbollayerutils.cpp.

◆ rotationFromSldElement()

bool QgsSymbolLayerUtils::rotationFromSldElement ( QDomElement &  element,
QString &  rotationFunc 
)
static

Definition at line 2337 of file qgssymbollayerutils.cpp.

◆ saveColorRamp()

QDomElement QgsSymbolLayerUtils::saveColorRamp ( const QString &  name,
QgsColorRamp ramp,
QDomDocument &  doc 
)
static

Encodes a color ramp's settings to an XML element.

Parameters
namename of ramp
rampcolor ramp to save
docXML document
Returns
DOM element representing state of color ramp
See also
loadColorRamp()

Definition at line 2958 of file qgssymbollayerutils.cpp.

◆ saveColorsToGpl()

bool QgsSymbolLayerUtils::saveColorsToGpl ( QFile &  file,
const QString &  paletteName,
const QgsNamedColorList colors 
)
static

Exports colors to a gpl GIMP palette file.

Parameters
filedestination file
paletteNamename of palette, which is stored in gpl file
colorscolors to export
Returns
true if export was successful
See also
importColorsFromGpl

Definition at line 3284 of file qgssymbollayerutils.cpp.

◆ saveProperties()

void QgsSymbolLayerUtils::saveProperties ( QgsStringMap  props,
QDomDocument &  doc,
QDomElement &  element 
)
static

Definition at line 2781 of file qgssymbollayerutils.cpp.

◆ saveSymbol()

QDomElement QgsSymbolLayerUtils::saveSymbol ( const QString &  symbolName,
QgsSymbol symbol,
QDomDocument &  doc,
const QgsReadWriteContext context 
)
static

Writes a symbol definition to XML.

Definition at line 1029 of file qgssymbollayerutils.cpp.

◆ saveSymbols()

QDomElement QgsSymbolLayerUtils::saveSymbols ( QgsSymbolMap symbols,
const QString &  tagName,
QDomDocument &  doc,
const QgsReadWriteContext context 
)
static

Writes a collection of symbols to XML with specified tagName for the top-level element.

Definition at line 2870 of file qgssymbollayerutils.cpp.

◆ sizeInPixelsFromSldUom()

double QgsSymbolLayerUtils::sizeInPixelsFromSldUom ( const QString &  uom,
double  size 
)
static

Returns the size scaled in pixels according to the uom attribute.

Parameters
uomThe uom attribute from SLD 1.1 version
sizeThe original size
Returns
the size in pixels
Since
QGIS 3.0

Definition at line 4209 of file qgssymbollayerutils.cpp.

◆ sortVariantList()

void QgsSymbolLayerUtils::sortVariantList ( QList< QVariant > &  list,
Qt::SortOrder  order 
)
static

Sorts the passed list in requested order.

Definition at line 3650 of file qgssymbollayerutils.cpp.

◆ svgSymbolNameToPath()

QString QgsSymbolLayerUtils::svgSymbolNameToPath ( const QString &  name,
const QgsPathResolver pathResolver 
)
static

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.

See also
svgSymbolPathToName()

Definition at line 3723 of file qgssymbollayerutils.cpp.

◆ svgSymbolPathToName()

QString QgsSymbolLayerUtils::svgSymbolPathToName ( const QString &  path,
const QgsPathResolver pathResolver 
)
static

Determines an SVG symbol's name from its path.

See also
svgSymbolNameToPath()

Definition at line 3786 of file qgssymbollayerutils.cpp.

◆ symbolFromMimeData()

QgsSymbol * QgsSymbolLayerUtils::symbolFromMimeData ( const QMimeData *  data)
static

Attempts to parse mime data as a symbol.

A new symbol instance will be returned if the data was successfully converted to a symbol.

See also
symbolToMimeData()
Since
QGIS 3.0

Definition at line 2908 of file qgssymbollayerutils.cpp.

◆ symbolLayerPreviewIcon()

QIcon QgsSymbolLayerUtils::symbolLayerPreviewIcon ( QgsSymbolLayer layer,
QgsUnitTypes::RenderUnit  u,
QSize  size,
const QgsMapUnitScale scale = QgsMapUnitScale() 
)
static

Draws a symbol layer preview to an icon.

Parameters
layersymbol layer to draw
usize units
sizetarget size of preview icon
scalemap unit scale for preview
Returns
icon containing symbol layer preview
See also
symbolLayerPreviewPicture()

Definition at line 725 of file qgssymbollayerutils.cpp.

◆ symbolLayerPreviewPicture()

QPicture QgsSymbolLayerUtils::symbolLayerPreviewPicture ( QgsSymbolLayer layer,
QgsUnitTypes::RenderUnit  units,
QSize  size,
const QgsMapUnitScale scale = QgsMapUnitScale() 
)
static

Draws a symbol layer preview to a QPicture.

Parameters
layersymbol layer to draw
unitssize units
sizetarget size of preview picture
scalemap unit scale for preview
Returns
QPicture containing symbol layer preview
See also
symbolLayerPreviewIcon()
Since
QGIS 2.9

Definition at line 711 of file qgssymbollayerutils.cpp.

◆ symbolPreviewIcon()

QIcon QgsSymbolLayerUtils::symbolPreviewIcon ( QgsSymbol symbol,
QSize  size,
int  padding = 0 
)
static

Returns an icon preview for a color ramp.

Parameters
symbolsymbol
sizetarget pixmap size
paddingspace between icon edge and symbol
See also
symbolPreviewPixmap()

Definition at line 648 of file qgssymbollayerutils.cpp.

◆ symbolPreviewPixmap()

QPixmap QgsSymbolLayerUtils::symbolPreviewPixmap ( QgsSymbol symbol,
QSize  size,
int  padding = 0,
QgsRenderContext customContext = nullptr 
)
static

Returns a pixmap preview for a color ramp.

Parameters
symbolsymbol
sizetarget pixmap size
paddingspace between icon edge and symbol
customContextrender context to use when rendering symbol
Note
Parameter customContext added in QGIS 2.6
See also
symbolPreviewIcon()

Definition at line 653 of file qgssymbollayerutils.cpp.

◆ symbolProperties()

QString QgsSymbolLayerUtils::symbolProperties ( QgsSymbol symbol)
static

Returns a string representing the symbol.

Can be used to test for equality between symbols.

Since
QGIS 2.12

Definition at line 1074 of file qgssymbollayerutils.cpp.

◆ symbolToMimeData()

QMimeData * QgsSymbolLayerUtils::symbolToMimeData ( QgsSymbol symbol)
static

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.

See also
symbolFromMimeData()
Since
QGIS 3.0

Definition at line 2890 of file qgssymbollayerutils.cpp.

◆ wellKnownMarkerFromSld()

bool QgsSymbolLayerUtils::wellKnownMarkerFromSld ( QDomElement &  element,
QString &  name,
QColor &  color,
QColor &  strokeColor,
Qt::PenStyle &  strokeStyle,
double &  strokeWidth,
double &  size 
)
static
Note
available in Python as wellKnownMarkerFromSld2

Definition at line 2280 of file qgssymbollayerutils.cpp.

◆ wellKnownMarkerToSld()

void QgsSymbolLayerUtils::wellKnownMarkerToSld ( QDomDocument &  doc,
QDomElement &  element,
const QString &  name,
const QColor &  color,
const QColor &  strokeColor,
Qt::PenStyle  strokeStyle,
double  strokeWidth = -1,
double  size = -1 
)
static

Definition at line 2244 of file qgssymbollayerutils.cpp.


The documentation for this class was generated from the following files: