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 );
428 static bool hasExternalGraphic( QDomElement &element );
435 static bool hasExternalGraphicV2( QDomElement &element,
const QString format = QString() );
437 static bool hasWellKnownMark( QDomElement &element );
439 static bool needFontMarker( QDomElement &element );
440 static bool needSvgMarker( QDomElement &element );
441 static bool needEllipseMarker( QDomElement &element );
442 static bool needMarkerLine( QDomElement &element );
443 static bool needLinePatternFill( QDomElement &element );
444 static bool needPointPatternFill( QDomElement &element );
445 static bool needSvgFill( QDomElement &element );
452 static bool needRasterImageFill( QDomElement &element );
454 static void fillToSld( QDomDocument &doc, QDomElement &element,
455 Qt::BrushStyle brushStyle,
const QColor &color = QColor() );
456 static bool fillFromSld( QDomElement &element,
457 Qt::BrushStyle &brushStyle, QColor &color );
460 static void lineToSld( QDomDocument &doc, QDomElement &element,
461 Qt::PenStyle penStyle,
const QColor &color,
double width = -1,
462 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
463 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 )
SIP_SKIP;
464 static
bool lineFromSld( QDomElement &element,
465 Qt::PenStyle &penStyle, QColor &color,
double &width,
466 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
467 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
469 static
void externalGraphicToSld( QDomDocument &doc, QDomElement &element,
470 const QString &path, const QString &mime,
471 const QColor &color,
double size = -1 );
472 static
bool externalGraphicFromSld( QDomElement &element,
473 QString &path, QString &mime,
474 QColor &color,
double &size );
476 static
void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
477 const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle,
478 double strokeWidth = -1,
double size = -1 );
481 static
bool wellKnownMarkerFromSld( QDomElement &element,
482 QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle,
483 double &strokeWidth,
double &size )
SIP_PYNAME( wellKnownMarkerFromSld2 );
485 static
void externalMarkerToSld( QDomDocument &doc, QDomElement &element,
486 const QString &path, const QString &format,
int *markIndex =
nullptr,
487 const QColor &color = QColor(),
double size = -1 );
488 static
bool externalMarkerFromSld( QDomElement &element,
489 QString &path, QString &format,
int &markIndex,
490 QColor &color,
double &size );
493 static
void labelTextToSld( QDomDocument &doc, QDomElement &element, const QString &label,
494 const QFont &font, const QColor &color = QColor(),
double size = -1 );
497 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor, const QColor &
c,
498 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
499 Qt::PenCapStyle capStyle = Qt::FlatCap,
501 const QVector<qreal> *dashPattern =
nullptr );
507 static QString ogrFeatureStyleBrush( const QColor &fillColr );
509 static
void createRotationElement( QDomDocument &doc, QDomElement &element, const QString &rotationFunc );
510 static
bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );
512 static
void createOpacityElement( QDomDocument &doc, QDomElement &element, const QString &alphaFunc );
513 static
bool opacityFromSldElement( QDomElement &element, QString &alphaFunc );
515 static
void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
516 static
bool displacementFromSldElement( QDomElement &element, QPointF &offset );
524 static
void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
526 static
void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
527 static
bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
529 static
void createGeometryElement( QDomDocument &doc, QDomElement &element, const QString &geomFunc );
530 static
bool geometryFromSldElement( QDomElement &element, QString &geomFunc );
538 static
bool createExpressionElement( QDomDocument &doc, QDomElement &element, const QString &function );
539 static
bool createFunctionElement( QDomDocument &doc, QDomElement &element, const QString &function );
540 static
bool functionFromSldElement( QDomElement &element, QString &function );
542 static QDomElement createSvgParameterElement( QDomDocument &doc, const QString &name, const QString &value );
543 static
QgsStringMap getSvgParameterList( QDomElement &element );
545 static QDomElement createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value );
546 static
QgsStringMap getVendorOptionList( QDomElement &element );
549 static QVariantMap parseProperties( const QDomElement &element );
551 static
void saveProperties( QVariantMap props, QDomDocument &doc, QDomElement &element );
591 static QDomElement saveColorRamp( const QString &name,
QgsColorRamp *ramp, QDomDocument &doc );
599 static QVariant colorRampToVariant( const QString &name,
QgsColorRamp *ramp );
614 static QString colorToName( const QColor &color );
622 static QList< QColor > parseColorList( const QString &colorStr );
630 static QMimeData *colorToMimeData( const QColor &color )
SIP_FACTORY;
639 static QColor colorFromMimeData( const QMimeData *data,
bool &hasAlpha
SIP_OUT );
664 static
bool saveColorsToGpl( QFile &file, const QString &paletteName, const
QgsNamedColorList &colors );
674 static
QgsNamedColorList importColorsFromGpl( QFile &file,
bool &ok, QString &name );
683 static QColor parseColor( const QString &colorStr,
bool strictEval = false );
693 static QColor parseColorWithAlpha( const QString &colorStr,
bool &containsAlpha,
bool strictEval = false );
698 static
void multiplyImageOpacity( QImage *image, qreal opacity );
701 static
void blurImageInPlace( QImage &image, QRect rect,
int radius,
bool alphaOnly );
706 static
void premultiplyColor( QColor &rgb,
int alpha );
723 static
void sortVariantList( QList<QVariant> &list, Qt::SortOrder order );
725 static QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint,
double distance );
728 static QStringList listSvgFiles();
731 static QStringList listSvgFilesAt( const QString &directory );
739 static QString svgSymbolNameToPath( const QString &name, const
QgsPathResolver &pathResolver );
745 static QString svgSymbolPathToName( const QString &path, const
QgsPathResolver &pathResolver );
754 static QList< QList< QPolygonF > > toQPolygonF( const
QgsGeometry &geometry,
Qgis::SymbolType type );
757 static QPointF polygonCentroid( const QPolygonF &points );
760 static QPointF polygonPointOnSurface( const QPolygonF &points, const QVector<QPolygonF> *rings =
nullptr );
763 static
bool pointInPolygon( const QPolygonF &points, QPointF point );
770 static
double polylineLength( const QPolygonF &polyline );
784 static QPolygonF polylineSubstring( const QPolygonF &polyline,
double startOffset,
double endOffset );
793 static
bool isSharpCorner( QPointF p1, QPointF p2, QPointF p3 );
802 static
void appendPolyline( QPolygonF &target, const QPolygonF &line );
818 static QString fieldOrExpressionFromExpression(
QgsExpression *expression );
825 static QList<
double> prettyBreaks(
double minimum,
double maximum,
int classes );
831 static
double rescaleUom(
double size,
Qgis::RenderUnit unit, const QVariantMap &props );
837 static QPointF rescaleUom( QPointF point,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescalePointUom );
843 static QVector<qreal> rescaleUom( const QVector<qreal> &array,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescaleArrayUom );
848 static
void applyScaleDependency( QDomDocument &doc, QDomElement &ruleElem, QVariantMap &props );
853 static
void mergeScaleDependencies(
double mScaleMinDenom,
double mScaleMaxDenom, QVariantMap &props );
860 static
void parametricSvgToSld( QDomDocument &doc, QDomElement &graphicElem,
862 const QColor &fillColor,
double size, const QColor &strokeColor,
double strokeWidth );
867 static QString getSvgParametricPath( const QString &basePath, const QColor &fillColor, const QColor &strokeColor,
double strokeWidth );
899 static
QgsSymbol *restrictedSizeSymbol( const
QgsSymbol *s,
double minSize,
double maxSize,
QgsRenderContext *context,
double &width,
double &height,
bool *ok =
nullptr );
916 static QSize tileSize(
int width,
int height,
double &angleRad
SIP_INOUT );
922 static
void clearSymbolLayerIds(
QgsSymbol *symbol );
934 static
void resetSymbolLayerIds(
QgsSymbol *symbol );
952 static QVector<
QgsGeometry > collectSymbolLayerClipGeometries( const
QgsRenderContext &context, const QString &symbolLayerId, const QRectF &bounds );
968 static QgsProperty scaleWholeSymbol(
double scaleFactorX,
double scaleFactorY,
const QgsProperty &property )
972 ( !
qgsDoubleNear( scaleFactorX, 0.0 ) ?
"tostring(" + QString::number( scaleFactorX ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) +
974 ( !
qgsDoubleNear( scaleFactorY, 0.0 ) ?
"tostring(" + QString::number( scaleFactorY ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) );