64 static QString encodeColor(
const QColor &color );
65 static QColor decodeColor(
const QString &
str );
67 static QString encodeSldAlpha(
int alpha );
68 static int decodeSldAlpha(
const QString &
str );
70 static QString encodeSldFontStyle( QFont::Style style );
71 static QFont::Style decodeSldFontStyle(
const QString &
str );
73 static QString encodeSldFontWeight(
int weight );
74 static int decodeSldFontWeight(
const QString &
str );
76 static QString encodePenStyle( Qt::PenStyle style );
77 static Qt::PenStyle decodePenStyle(
const QString &
str );
79 static QString encodePenJoinStyle( Qt::PenJoinStyle style );
80 static Qt::PenJoinStyle decodePenJoinStyle(
const QString &
str );
82 static QString encodePenCapStyle( Qt::PenCapStyle style );
83 static Qt::PenCapStyle decodePenCapStyle(
const QString &
str );
85 static QString encodeSldLineJoinStyle( Qt::PenJoinStyle style );
86 static Qt::PenJoinStyle decodeSldLineJoinStyle(
const QString &
str );
88 static QString encodeSldLineCapStyle( Qt::PenCapStyle style );
89 static Qt::PenCapStyle decodeSldLineCapStyle(
const QString &
str );
91 static QString encodeBrushStyle( Qt::BrushStyle style );
92 static Qt::BrushStyle decodeBrushStyle(
const QString &
str );
94 static QString encodeSldBrushStyle( Qt::BrushStyle style );
95 static Qt::BrushStyle decodeSldBrushStyle(
const QString &
str );
102 static bool hasSldSymbolizer(
const QDomElement &element );
182 static QString encodePoint( QPointF point );
189 static QPointF decodePoint(
const QString &
string );
203 static QPointF toPoint(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
210 static QString encodeSize( QSizeF size );
217 static QSizeF decodeSize(
const QString &
string );
231 static QSizeF toSize(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
233 static QString encodeMapUnitScale(
const QgsMapUnitScale &mapUnitScale );
236 static QString encodeRealVector(
const QVector<qreal> &v );
237 static QVector<qreal> decodeRealVector(
const QString &s );
239 static QString encodeSldRealVector(
const QVector<qreal> &v );
240 static QVector<qreal> decodeSldRealVector(
const QString &s );
266 static double sizeInPixelsFromSldUom(
const QString &uom,
double size );
282 static QPainter::CompositionMode decodeBlendMode(
const QString &s );
307 static QPixmap symbolPreviewPixmap(
const QgsSymbol *symbol, QSize size,
int padding = 0,
QgsRenderContext *customContext =
nullptr,
bool selected =
false,
345 static QIcon colorRampPreviewIcon(
QgsColorRamp *ramp, QSize size,
int padding = 0 );
359 static QPixmap colorRampPreviewPixmap(
QgsColorRamp *ramp, QSize size,
int padding = 0, Qt::Orientation direction = Qt::Horizontal,
360 bool flipDirection =
false,
bool drawTransparentBackground =
true );
362 static void drawStippledBackground( QPainter *painter, QRect rect );
368 static void drawVertexMarker(
double x,
double y, QPainter &p,
Qgis::VertexMarkerType type,
int markerSize );
392 SymbolType *symbolCastToType =
dynamic_cast<SymbolType *
>( tmpSymbol );
394 if ( symbolCastToType )
396 return symbolCastToType;
409 static QDomElement saveSymbol(
const QString &symbolName,
const QgsSymbol *symbol, QDomDocument &doc,
const QgsReadWriteContext &context );
415 static QString symbolProperties(
QgsSymbol *symbol );
420 static bool createSymbolLayerListFromSld( QDomElement &element,
Qgis::GeometryType geomType, QList<QgsSymbolLayer *> &layers );
429 static bool convertPolygonSymbolizerToPointMarker( QDomElement &element, QList<QgsSymbolLayer *> &layerList );
436 static bool hasExternalGraphic( QDomElement &element );
444 static bool hasExternalGraphicV2( QDomElement &element,
const QString format = QString() );
446 static bool hasWellKnownMark( QDomElement &element );
448 static bool needFontMarker( QDomElement &element );
449 static bool needSvgMarker( QDomElement &element );
450 static bool needEllipseMarker( QDomElement &element );
451 static bool needMarkerLine( QDomElement &element );
452 static bool needLinePatternFill( QDomElement &element );
453 static bool needPointPatternFill( QDomElement &element );
454 static bool needSvgFill( QDomElement &element );
462 static bool needRasterImageFill( QDomElement &element );
464 static void fillToSld( QDomDocument &doc, QDomElement &element,
465 Qt::BrushStyle brushStyle,
const QColor &color = QColor() );
466 static bool fillFromSld( QDomElement &element,
467 Qt::BrushStyle &brushStyle, QColor &color );
470 static void lineToSld( QDomDocument &doc, QDomElement &element,
471 Qt::PenStyle penStyle,
const QColor &color,
double width = -1,
472 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
473 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 )
SIP_SKIP;
474 static
bool lineFromSld( QDomElement &element,
475 Qt::PenStyle &penStyle, QColor &color,
double &width,
476 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
477 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
479 static
void externalGraphicToSld( QDomDocument &doc, QDomElement &element,
480 const QString &path, const QString &mime,
481 const QColor &color,
double size = -1 );
482 static
bool externalGraphicFromSld( QDomElement &element,
483 QString &path, QString &mime,
484 QColor &color,
double &size );
486 static
void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
487 const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle,
488 double strokeWidth = -1,
double size = -1 );
491 static
bool wellKnownMarkerFromSld( QDomElement &element,
492 QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle,
493 double &strokeWidth,
double &size )
SIP_PYNAME( wellKnownMarkerFromSld2 );
495 static
void externalMarkerToSld( QDomDocument &doc, QDomElement &element,
496 const QString &path, const QString &format,
int *markIndex =
nullptr,
497 const QColor &color = QColor(),
double size = -1 );
498 static
bool externalMarkerFromSld( QDomElement &element,
499 QString &path, QString &format,
int &markIndex,
500 QColor &color,
double &size );
503 static
void labelTextToSld( QDomDocument &doc, QDomElement &element, const QString &label,
504 const QFont &font, const QColor &color = QColor(),
double size = -1 );
507 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor, const QColor &
c,
508 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
509 Qt::PenCapStyle capStyle = Qt::FlatCap,
511 const QVector<qreal> *dashPattern =
nullptr );
517 static QString ogrFeatureStyleBrush( const QColor &fillColr );
519 static
void createRotationElement( QDomDocument &doc, QDomElement &element, const QString &rotationFunc );
520 static
bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );
522 static
void createOpacityElement( QDomDocument &doc, QDomElement &element, const QString &alphaFunc );
523 static
bool opacityFromSldElement( QDomElement &element, QString &alphaFunc );
525 static
void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
526 static
bool displacementFromSldElement( QDomElement &element, QPointF &offset );
534 static
void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
536 static
void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
537 static
bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
539 static
void createGeometryElement( QDomDocument &doc, QDomElement &element, const QString &geomFunc );
540 static
bool geometryFromSldElement( QDomElement &element, QString &geomFunc );
548 static
bool createExpressionElement( QDomDocument &doc, QDomElement &element, const QString &function );
549 static
bool createFunctionElement( QDomDocument &doc, QDomElement &element, const QString &function );
550 static
bool functionFromSldElement( QDomElement &element, QString &function );
552 static QDomElement createSvgParameterElement( QDomDocument &doc, const QString &name, const QString &value );
553 static
QgsStringMap getSvgParameterList( QDomElement &element );
555 static QDomElement createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value );
556 static
QgsStringMap getVendorOptionList( QDomElement &element );
559 static QVariantMap parseProperties( const QDomElement &element );
561 static
void saveProperties( QVariantMap props, QDomDocument &doc, QDomElement &element );
601 static QDomElement saveColorRamp( const QString &name,
QgsColorRamp *ramp, QDomDocument &doc );
609 static QVariant colorRampToVariant( const QString &name,
QgsColorRamp *ramp );
624 static QString colorToName( const QColor &color );
632 static QList< QColor > parseColorList( const QString &colorStr );
640 static QMimeData *colorToMimeData( const QColor &color )
SIP_FACTORY;
649 static QColor colorFromMimeData( const QMimeData *data,
bool &hasAlpha
SIP_OUT );
674 static
bool saveColorsToGpl( QFile &file, const QString &paletteName, const
QgsNamedColorList &colors );
684 static
QgsNamedColorList importColorsFromGpl( QFile &file,
bool &ok, QString &name );
693 static QColor parseColor( const QString &colorStr,
bool strictEval = false );
703 static QColor parseColorWithAlpha( const QString &colorStr,
bool &containsAlpha,
bool strictEval = false );
708 static
void multiplyImageOpacity( QImage *image, qreal opacity );
711 static
void blurImageInPlace( QImage &image, QRect rect,
int radius,
bool alphaOnly );
716 static
void premultiplyColor( QColor &rgb,
int alpha );
733 static
void sortVariantList( QList<QVariant> &list, Qt::SortOrder order );
735 static QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint,
double distance );
738 static QStringList listSvgFiles();
741 static QStringList listSvgFilesAt( const QString &directory );
749 static QString svgSymbolNameToPath( const QString &name, const
QgsPathResolver &pathResolver );
755 static QString svgSymbolPathToName( const QString &path, const
QgsPathResolver &pathResolver );
764 static QList< QList< QPolygonF > > toQPolygonF( const
QgsGeometry &geometry,
Qgis::SymbolType type );
767 static QPointF polygonCentroid( const QPolygonF &points );
770 static QPointF polygonPointOnSurface( const QPolygonF &points, const QVector<QPolygonF> *rings =
nullptr );
773 static
bool pointInPolygon( const QPolygonF &points, QPointF point );
780 static
double polylineLength( const QPolygonF &polyline );
794 static QPolygonF polylineSubstring( const QPolygonF &polyline,
double startOffset,
double endOffset );
803 static
bool isSharpCorner( QPointF p1, QPointF p2, QPointF p3 );
812 static
void appendPolyline( QPolygonF &target, const QPolygonF &line );
828 static QString fieldOrExpressionFromExpression(
QgsExpression *expression );
835 static QList<
double> prettyBreaks(
double minimum,
double maximum,
int classes );
841 static
double rescaleUom(
double size,
Qgis::RenderUnit unit, const QVariantMap &props );
847 static QPointF rescaleUom( QPointF point,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescalePointUom );
853 static QVector<qreal> rescaleUom( const QVector<qreal> &array,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescaleArrayUom );
858 static
void applyScaleDependency( QDomDocument &doc, QDomElement &ruleElem, QVariantMap &props );
863 static
void mergeScaleDependencies(
double mScaleMinDenom,
double mScaleMaxDenom, QVariantMap &props );
870 static
void parametricSvgToSld( QDomDocument &doc, QDomElement &graphicElem,
872 const QColor &fillColor,
double size, const QColor &strokeColor,
double strokeWidth );
877 static QString getSvgParametricPath( const QString &basePath, const QColor &fillColor, const QColor &strokeColor,
double strokeWidth );
909 static
QgsSymbol *restrictedSizeSymbol( const
QgsSymbol *s,
double minSize,
double maxSize,
QgsRenderContext *context,
double &width,
double &height,
bool *ok =
nullptr );
926 static QSize tileSize(
int width,
int height,
double &angleRad
SIP_INOUT );
932 static
void clearSymbolLayerIds(
QgsSymbol *symbol );
944 static
void resetSymbolLayerIds(
QgsSymbol *symbol );
962 static QVector<
QgsGeometry > collectSymbolLayerClipGeometries( const
QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds );
978 static QgsProperty scaleWholeSymbol(
double scaleFactorX,
double scaleFactorY,
const QgsProperty &property )
982 ( !
qgsDoubleNear( scaleFactorX, 0.0 ) ?
"tostring(" + QString::number( scaleFactorX ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) +
984 ( !
qgsDoubleNear( scaleFactorY, 0.0 ) ?
"tostring(" + QString::number( scaleFactorY ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) );