63 static QString encodeColor(
const QColor &color );
64 static QColor decodeColor(
const QString &
str );
66 static QString encodeSldAlpha(
int alpha );
67 static int decodeSldAlpha(
const QString &
str );
69 static QString encodeSldFontStyle( QFont::Style style );
70 static QFont::Style decodeSldFontStyle(
const QString &
str );
72 static QString encodeSldFontWeight(
int weight );
73 static int decodeSldFontWeight(
const QString &
str );
75 static QString encodePenStyle( Qt::PenStyle style );
76 static Qt::PenStyle decodePenStyle(
const QString &
str );
78 static QString encodePenJoinStyle( Qt::PenJoinStyle style );
79 static Qt::PenJoinStyle decodePenJoinStyle(
const QString &
str );
81 static QString encodePenCapStyle( Qt::PenCapStyle style );
82 static Qt::PenCapStyle decodePenCapStyle(
const QString &
str );
84 static QString encodeSldLineJoinStyle( Qt::PenJoinStyle style );
85 static Qt::PenJoinStyle decodeSldLineJoinStyle(
const QString &
str );
87 static QString encodeSldLineCapStyle( Qt::PenCapStyle style );
88 static Qt::PenCapStyle decodeSldLineCapStyle(
const QString &
str );
90 static QString encodeBrushStyle( Qt::BrushStyle style );
91 static Qt::BrushStyle decodeBrushStyle(
const QString &
str );
93 static QString encodeSldBrushStyle( Qt::BrushStyle style );
94 static Qt::BrushStyle decodeSldBrushStyle(
const QString &
str );
174 static QString encodePoint( QPointF point );
181 static QPointF decodePoint(
const QString &
string );
195 static QPointF toPoint(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
202 static QString encodeSize( QSizeF size );
209 static QSizeF decodeSize(
const QString &
string );
223 static QSizeF toSize(
const QVariant &value,
bool *ok
SIP_OUT =
nullptr );
225 static QString encodeMapUnitScale(
const QgsMapUnitScale &mapUnitScale );
228 static QString encodeRealVector(
const QVector<qreal> &v );
229 static QVector<qreal> decodeRealVector(
const QString &s );
231 static QString encodeSldRealVector(
const QVector<qreal> &v );
232 static QVector<qreal> decodeSldRealVector(
const QString &s );
258 static double sizeInPixelsFromSldUom(
const QString &uom,
double size );
274 static QPainter::CompositionMode decodeBlendMode(
const QString &s );
299 static QPixmap symbolPreviewPixmap(
const QgsSymbol *symbol, QSize size,
int padding = 0,
QgsRenderContext *customContext =
nullptr,
bool selected =
false,
337 static QIcon colorRampPreviewIcon(
QgsColorRamp *ramp, QSize size,
int padding = 0 );
351 static QPixmap colorRampPreviewPixmap(
QgsColorRamp *ramp, QSize size,
int padding = 0, Qt::Orientation direction = Qt::Horizontal,
352 bool flipDirection =
false,
bool drawTransparentBackground =
true );
354 static void drawStippledBackground( QPainter *painter, QRect rect );
360 static void drawVertexMarker(
double x,
double y, QPainter &p,
Qgis::VertexMarkerType type,
int markerSize );
384 SymbolType *symbolCastToType =
dynamic_cast<SymbolType *
>( tmpSymbol );
386 if ( symbolCastToType )
388 return symbolCastToType;
401 static QDomElement saveSymbol(
const QString &symbolName,
const QgsSymbol *symbol, QDomDocument &doc,
const QgsReadWriteContext &context );
407 static QString symbolProperties(
QgsSymbol *symbol );
412 static bool createSymbolLayerListFromSld( QDomElement &element,
Qgis::GeometryType geomType, QList<QgsSymbolLayer *> &layers );
421 static bool convertPolygonSymbolizerToPointMarker( QDomElement &element, QList<QgsSymbolLayer *> &layerList );
427 static bool hasExternalGraphic( QDomElement &element );
434 static bool hasExternalGraphicV2( QDomElement &element,
const QString format = QString() );
436 static bool hasWellKnownMark( QDomElement &element );
438 static bool needFontMarker( QDomElement &element );
439 static bool needSvgMarker( QDomElement &element );
440 static bool needEllipseMarker( QDomElement &element );
441 static bool needMarkerLine( QDomElement &element );
442 static bool needLinePatternFill( QDomElement &element );
443 static bool needPointPatternFill( QDomElement &element );
444 static bool needSvgFill( QDomElement &element );
451 static bool needRasterImageFill( QDomElement &element );
453 static void fillToSld( QDomDocument &doc, QDomElement &element,
454 Qt::BrushStyle brushStyle,
const QColor &color = QColor() );
455 static bool fillFromSld( QDomElement &element,
456 Qt::BrushStyle &brushStyle, QColor &color );
459 static void lineToSld( QDomDocument &doc, QDomElement &element,
460 Qt::PenStyle penStyle,
const QColor &color,
double width = -1,
461 const Qt::PenJoinStyle *penJoinStyle =
nullptr,
const Qt::PenCapStyle *penCapStyle =
nullptr,
462 const QVector<qreal> *customDashPattern =
nullptr,
double dashOffset = 0.0 )
SIP_SKIP;
463 static
bool lineFromSld( QDomElement &element,
464 Qt::PenStyle &penStyle, QColor &color,
double &width,
465 Qt::PenJoinStyle *penJoinStyle =
nullptr, Qt::PenCapStyle *penCapStyle =
nullptr,
466 QVector<qreal> *customDashPattern =
nullptr,
double *dashOffset =
nullptr );
468 static
void externalGraphicToSld( QDomDocument &doc, QDomElement &element,
469 const QString &path, const QString &mime,
470 const QColor &color,
double size = -1 );
471 static
bool externalGraphicFromSld( QDomElement &element,
472 QString &path, QString &mime,
473 QColor &color,
double &size );
475 static
void wellKnownMarkerToSld( QDomDocument &doc, QDomElement &element,
476 const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle,
477 double strokeWidth = -1,
double size = -1 );
480 static
bool wellKnownMarkerFromSld( QDomElement &element,
481 QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle,
482 double &strokeWidth,
double &size )
SIP_PYNAME( wellKnownMarkerFromSld2 );
484 static
void externalMarkerToSld( QDomDocument &doc, QDomElement &element,
485 const QString &path, const QString &format,
int *markIndex =
nullptr,
486 const QColor &color = QColor(),
double size = -1 );
487 static
bool externalMarkerFromSld( QDomElement &element,
488 QString &path, QString &format,
int &markIndex,
489 QColor &color,
double &size );
492 static
void labelTextToSld( QDomDocument &doc, QDomElement &element, const QString &label,
493 const QFont &font, const QColor &color = QColor(),
double size = -1 );
496 static QString ogrFeatureStylePen(
double width,
double mmScaleFactor,
double mapUnitsScaleFactor, const QColor &
c,
497 Qt::PenJoinStyle joinStyle = Qt::MiterJoin,
498 Qt::PenCapStyle capStyle = Qt::FlatCap,
500 const QVector<qreal> *dashPattern =
nullptr );
506 static QString ogrFeatureStyleBrush( const QColor &fillColr );
508 static
void createRotationElement( QDomDocument &doc, QDomElement &element, const QString &rotationFunc );
509 static
bool rotationFromSldElement( QDomElement &element, QString &rotationFunc );
511 static
void createOpacityElement( QDomDocument &doc, QDomElement &element, const QString &alphaFunc );
512 static
bool opacityFromSldElement( QDomElement &element, QString &alphaFunc );
514 static
void createDisplacementElement( QDomDocument &doc, QDomElement &element, QPointF offset );
515 static
bool displacementFromSldElement( QDomElement &element, QPointF &offset );
523 static
void createAnchorPointElement( QDomDocument &doc, QDomElement &element, QPointF anchor );
525 static
void createOnlineResourceElement( QDomDocument &doc, QDomElement &element, const QString &path, const QString &format );
526 static
bool onlineResourceFromSldElement( QDomElement &element, QString &path, QString &format );
528 static
void createGeometryElement( QDomDocument &doc, QDomElement &element, const QString &geomFunc );
529 static
bool geometryFromSldElement( QDomElement &element, QString &geomFunc );
537 static
bool createExpressionElement( QDomDocument &doc, QDomElement &element, const QString &function );
538 static
bool createFunctionElement( QDomDocument &doc, QDomElement &element, const QString &function );
539 static
bool functionFromSldElement( QDomElement &element, QString &function );
541 static QDomElement createSvgParameterElement( QDomDocument &doc, const QString &name, const QString &value );
542 static
QgsStringMap getSvgParameterList( QDomElement &element );
544 static QDomElement createVendorOptionElement( QDomDocument &doc, const QString &name, const QString &value );
545 static
QgsStringMap getVendorOptionList( QDomElement &element );
548 static QVariantMap parseProperties( const QDomElement &element );
550 static
void saveProperties( QVariantMap props, QDomDocument &doc, QDomElement &element );
590 static QDomElement saveColorRamp( const QString &name,
QgsColorRamp *ramp, QDomDocument &doc );
598 static QVariant colorRampToVariant( const QString &name,
QgsColorRamp *ramp );
613 static QString colorToName( const QColor &color );
621 static QList< QColor > parseColorList( const QString &colorStr );
629 static QMimeData *colorToMimeData( const QColor &color )
SIP_FACTORY;
638 static QColor colorFromMimeData( const QMimeData *data,
bool &hasAlpha
SIP_OUT );
663 static
bool saveColorsToGpl( QFile &file, const QString &paletteName, const
QgsNamedColorList &colors );
673 static
QgsNamedColorList importColorsFromGpl( QFile &file,
bool &ok, QString &name );
682 static QColor parseColor( const QString &colorStr,
bool strictEval = false );
692 static QColor parseColorWithAlpha( const QString &colorStr,
bool &containsAlpha,
bool strictEval = false );
697 static
void multiplyImageOpacity( QImage *image, qreal opacity );
700 static
void blurImageInPlace( QImage &image, QRect rect,
int radius,
bool alphaOnly );
705 static
void premultiplyColor( QColor &rgb,
int alpha );
722 static
void sortVariantList( QList<QVariant> &list, Qt::SortOrder order );
724 static QPointF pointOnLineWithDistance( QPointF startPoint, QPointF directionPoint,
double distance );
727 static QStringList listSvgFiles();
730 static QStringList listSvgFilesAt( const QString &directory );
738 static QString svgSymbolNameToPath( const QString &name, const
QgsPathResolver &pathResolver );
744 static QString svgSymbolPathToName( const QString &path, const
QgsPathResolver &pathResolver );
747 static QPointF polygonCentroid( const QPolygonF &points );
750 static QPointF polygonPointOnSurface( const QPolygonF &points, const QVector<QPolygonF> *rings =
nullptr );
753 static
bool pointInPolygon( const QPolygonF &points, QPointF point );
760 static
double polylineLength( const QPolygonF &polyline );
774 static QPolygonF polylineSubstring( const QPolygonF &polyline,
double startOffset,
double endOffset );
783 static
bool isSharpCorner( QPointF p1, QPointF p2, QPointF p3 );
792 static
void appendPolyline( QPolygonF &target, const QPolygonF &line );
808 static QString fieldOrExpressionFromExpression(
QgsExpression *expression );
815 static QList<
double> prettyBreaks(
double minimum,
double maximum,
int classes );
821 static
double rescaleUom(
double size,
Qgis::RenderUnit unit, const QVariantMap &props );
827 static QPointF rescaleUom( QPointF point,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescalePointUom );
833 static QVector<qreal> rescaleUom( const QVector<qreal> &array,
Qgis::RenderUnit unit, const QVariantMap &props )
SIP_PYNAME( rescaleArrayUom );
838 static
void applyScaleDependency( QDomDocument &doc, QDomElement &ruleElem, QVariantMap &props );
843 static
void mergeScaleDependencies(
double mScaleMinDenom,
double mScaleMaxDenom, QVariantMap &props );
850 static
void parametricSvgToSld( QDomDocument &doc, QDomElement &graphicElem,
852 const QColor &fillColor,
double size, const QColor &strokeColor,
double strokeWidth );
857 static QString getSvgParametricPath( const QString &basePath, const QColor &fillColor, const QColor &strokeColor,
double strokeWidth );
889 static
QgsSymbol *restrictedSizeSymbol( const
QgsSymbol *s,
double minSize,
double maxSize,
QgsRenderContext *context,
double &width,
double &height,
bool *ok =
nullptr );
906 static QSize tileSize(
int width,
int height,
double &angleRad
SIP_INOUT );
912 static
void clearSymbolLayerIds(
QgsSymbol *symbol );
924 static
void resetSymbolLayerIds(
QgsSymbol *symbol );
946 static QgsProperty scaleWholeSymbol(
double scaleFactorX,
double scaleFactorY,
const QgsProperty &property )
950 ( !
qgsDoubleNear( scaleFactorX, 0.0 ) ?
"tostring(" + QString::number( scaleFactorX ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) +
952 ( !
qgsDoubleNear( scaleFactorY, 0.0 ) ?
"tostring(" + QString::number( scaleFactorY ) +
"*(" + exprString +
"))" : QStringLiteral(
"'0'" ) ) );