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 );
175 static QString encodePoint( QPointF point );
182 static QPointF decodePoint(
const QString &
string );
196 static QPointF toPoint(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
203 static QString encodeSize( QSizeF size );
210 static QSizeF decodeSize(
const QString &
string );
224 static QSizeF toSize(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
226 static QString encodeMapUnitScale(
const QgsMapUnitScale &mapUnitScale );
229 static QString encodeRealVector(
const QVector<qreal> &v );
230 static QVector<qreal> decodeRealVector(
const QString &s );
232 static QString encodeSldRealVector(
const QVector<qreal> &v );
233 static QVector<qreal> decodeSldRealVector(
const QString &s );
259 static double sizeInPixelsFromSldUom(
const QString &uom,
double size );
275 static QPainter::CompositionMode decodeBlendMode(
const QString &s );
300 static QPixmap symbolPreviewPixmap(
const QgsSymbol *symbol, QSize size,
int padding = 0,
QgsRenderContext *customContext =
nullptr,
bool selected =
false,
338 static QIcon colorRampPreviewIcon(
QgsColorRamp *ramp, QSize size,
int padding = 0 );
352 static QPixmap colorRampPreviewPixmap(
QgsColorRamp *ramp, QSize size,
int padding = 0, Qt::Orientation direction = Qt::Horizontal,
353 bool flipDirection =
false,
bool drawTransparentBackground =
true );
355 static void drawStippledBackground( QPainter *painter, QRect rect );
361 static void drawVertexMarker(
double x,
double y, QPainter &p,
Qgis::VertexMarkerType type,
int markerSize );
385 SymbolType *symbolCastToType =
dynamic_cast<SymbolType *
>( tmpSymbol );
387 if ( symbolCastToType )
389 return symbolCastToType;
402 static QDomElement saveSymbol(
const QString &symbolName,
const QgsSymbol *symbol, QDomDocument &doc,
const QgsReadWriteContext &context );
408 static QString symbolProperties(
QgsSymbol *symbol );
413 static bool createSymbolLayerListFromSld( QDomElement &element,
Qgis::GeometryType geomType, QList<QgsSymbolLayer *> &layers );
422 static bool convertPolygonSymbolizerToPointMarker( QDomElement &element, QList<QgsSymbolLayer *> &layerList );
429 static bool hasExternalGraphic( QDomElement &element );
437 static bool hasExternalGraphicV2( QDomElement &element,
const QString format = QString() );
439 static bool hasWellKnownMark( QDomElement &element );
441 static bool needFontMarker( QDomElement &element );
442 static bool needSvgMarker( QDomElement &element );
443 static bool needEllipseMarker( QDomElement &element );
444 static bool needMarkerLine( QDomElement &element );
445 static bool needLinePatternFill( QDomElement &element );
446 static bool needPointPatternFill( QDomElement &element );
447 static bool needSvgFill( QDomElement &element );
455 static bool needRasterImageFill( QDomElement &element );
457 static void fillToSld( QDomDocument &doc, QDomElement &element,
458 Qt::BrushStyle brushStyle,
const QColor &color = QColor() );
459 static bool fillFromSld( QDomElement &element,
460 Qt::BrushStyle &brushStyle, QColor &color );
463 static void lineToSld( QDomDocument &doc, QDomElement &element,
464 Qt::PenStyle penStyle,
const QColor &color,
double width = -1,
465 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
466 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 )
SIP_SKIP;
467 static
bool lineFromSld( QDomElement &element,
468 Qt::PenStyle &penStyle, QColor &color,
double &width,
469 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
470 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
472 static
void externalGraphicToSld( QDomDocument &doc, QDomElement &element,
473 const QString &path, const QString &mime,
474 const QColor &color,
double size = -1 );
475 static
bool externalGraphicFromSld( QDomElement &element,
476 QString &path, QString &mime,
477 QColor &color,
double &size );
479 static
void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
480 const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle,
481 double strokeWidth = -1,
double size = -1 );
484 static
bool wellKnownMarkerFromSld( QDomElement &element,
485 QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle,
486 double &strokeWidth,
double &size )
SIP_PYNAME( wellKnownMarkerFromSld2 );
488 static
void externalMarkerToSld( QDomDocument &doc, QDomElement &element,
489 const QString &path, const QString &format,
int *markIndex =
nullptr,
490 const QColor &color = QColor(),
double size = -1 );
491 static
bool externalMarkerFromSld( QDomElement &element,
492 QString &path, QString &format,
int &markIndex,
493 QColor &color,
double &size );
496 static
void labelTextToSld( QDomDocument &doc, QDomElement &element, const QString &label,
497 const QFont &font, const QColor &color = QColor(),
double size = -1 );
500 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor, const QColor &
c,
501 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
502 Qt::PenCapStyle capStyle = Qt::FlatCap,
504 const QVector<qreal> *dashPattern =
nullptr );
510 static QString ogrFeatureStyleBrush( const QColor &fillColr );
512 static
void createRotationElement( QDomDocument &doc, QDomElement &element, const QString &rotationFunc );
513 static
bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );
515 static
void createOpacityElement( QDomDocument &doc, QDomElement &element, const QString &alphaFunc );
516 static
bool opacityFromSldElement( QDomElement &element, QString &alphaFunc );
518 static
void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
519 static
bool displacementFromSldElement( QDomElement &element, QPointF &offset );
527 static
void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
529 static
void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
530 static
bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
532 static
void createGeometryElement( QDomDocument &doc, QDomElement &element, const QString &geomFunc );
533 static
bool geometryFromSldElement( QDomElement &element, QString &geomFunc );
541 static
bool createExpressionElement( QDomDocument &doc, QDomElement &element, const QString &function );
542 static
bool createFunctionElement( QDomDocument &doc, QDomElement &element, const QString &function );
543 static
bool functionFromSldElement( QDomElement &element, QString &function );
545 static QDomElement createSvgParameterElement( QDomDocument &doc, const QString &name, const QString &value );
546 static
QgsStringMap getSvgParameterList( QDomElement &element );
548 static QDomElement createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value );
549 static
QgsStringMap getVendorOptionList( QDomElement &element );
552 static QVariantMap parseProperties( const QDomElement &element );
554 static
void saveProperties( QVariantMap props, QDomDocument &doc, QDomElement &element );
594 static QDomElement saveColorRamp( const QString &name,
QgsColorRamp *ramp, QDomDocument &doc );
602 static QVariant colorRampToVariant( const QString &name,
QgsColorRamp *ramp );
617 static QString colorToName( const QColor &color );
625 static QList< QColor > parseColorList( const QString &colorStr );
633 static QMimeData *colorToMimeData( const QColor &color )
SIP_FACTORY;
642 static QColor colorFromMimeData( const QMimeData *data,
bool &hasAlpha
SIP_OUT );
667 static
bool saveColorsToGpl( QFile &file, const QString &paletteName, const
QgsNamedColorList &colors );
677 static
QgsNamedColorList importColorsFromGpl( QFile &file,
bool &ok, QString &name );
686 static QColor parseColor( const QString &colorStr,
bool strictEval = false );
696 static QColor parseColorWithAlpha( const QString &colorStr,
bool &containsAlpha,
bool strictEval = false );
701 static
void multiplyImageOpacity( QImage *image, qreal opacity );
704 static
void blurImageInPlace( QImage &image, QRect rect,
int radius,
bool alphaOnly );
709 static
void premultiplyColor( QColor &rgb,
int alpha );
726 static
void sortVariantList( QList<QVariant> &list, Qt::SortOrder order );
728 static QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint,
double distance );
731 static QStringList listSvgFiles();
734 static QStringList listSvgFilesAt( const QString &directory );
742 static QString svgSymbolNameToPath( const QString &name, const
QgsPathResolver &pathResolver );
748 static QString svgSymbolPathToName( const QString &path, const
QgsPathResolver &pathResolver );
757 static QList< QList< QPolygonF > > toQPolygonF( const
QgsGeometry &geometry,
Qgis::SymbolType type );
760 static QPointF polygonCentroid( const QPolygonF &points );
763 static QPointF polygonPointOnSurface( const QPolygonF &points, const QVector<QPolygonF> *rings =
nullptr );
766 static
bool pointInPolygon( const QPolygonF &points, QPointF point );
773 static
double polylineLength( const QPolygonF &polyline );
787 static QPolygonF polylineSubstring( const QPolygonF &polyline,
double startOffset,
double endOffset );
796 static
bool isSharpCorner( QPointF p1, QPointF p2, QPointF p3 );
805 static
void appendPolyline( QPolygonF &target, const QPolygonF &line );
821 static QString fieldOrExpressionFromExpression(
QgsExpression *expression );
828 static QList<
double> prettyBreaks(
double minimum,
double maximum,
int classes );
834 static
double rescaleUom(
double size,
Qgis::RenderUnit unit, const QVariantMap &props );
840 static QPointF rescaleUom( QPointF point,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescalePointUom );
846 static QVector<qreal> rescaleUom( const QVector<qreal> &array,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescaleArrayUom );
851 static
void applyScaleDependency( QDomDocument &doc, QDomElement &ruleElem, QVariantMap &props );
856 static
void mergeScaleDependencies(
double mScaleMinDenom,
double mScaleMaxDenom, QVariantMap &props );
863 static
void parametricSvgToSld( QDomDocument &doc, QDomElement &graphicElem,
865 const QColor &fillColor,
double size, const QColor &strokeColor,
double strokeWidth );
870 static QString getSvgParametricPath( const QString &basePath, const QColor &fillColor, const QColor &strokeColor,
double strokeWidth );
902 static
QgsSymbol *restrictedSizeSymbol( const
QgsSymbol *s,
double minSize,
double maxSize,
QgsRenderContext *context,
double &width,
double &height,
bool *ok =
nullptr );
919 static QSize tileSize(
int width,
int height,
double &angleRad
SIP_INOUT );
925 static
void clearSymbolLayerIds(
QgsSymbol *symbol );
937 static
void resetSymbolLayerIds(
QgsSymbol *symbol );
955 static QVector<
QgsGeometry > collectSymbolLayerClipGeometries( const
QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds );
971 static QgsProperty scaleWholeSymbol(
double scaleFactorX,
double scaleFactorY,
const QgsProperty &property )
975 ( !
qgsDoubleNear( scaleFactorX, 0.0 ) ?
"tostring(" + QString::number( scaleFactorX ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) +
977 ( !
qgsDoubleNear( scaleFactorY, 0.0 ) ?
"tostring(" + QString::number( scaleFactorY ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) );