@@ -900,3 +900,70 @@ class QgsRendererV2Registry
900
900
};
901
901
902
902
///////////////
903
+
904
+ typedef QMap<QString, QgsSymbolV2* > QgsSymbolV2Map;
905
+
906
+ class QgsSymbolLayerV2Utils
907
+ {
908
+ %TypeHeaderCode
909
+ #include <qgssymbollayerv2utils.h>
910
+ %End
911
+
912
+ public:
913
+
914
+ static QString encodeColor( QColor color );
915
+ static QColor decodeColor( QString str );
916
+
917
+ static QString encodePenStyle( Qt::PenStyle style );
918
+ static Qt::PenStyle decodePenStyle( QString str );
919
+
920
+ static QString encodePenJoinStyle( Qt::PenJoinStyle style );
921
+ static Qt::PenJoinStyle decodePenJoinStyle( QString str );
922
+
923
+ static QString encodePenCapStyle( Qt::PenCapStyle style );
924
+ static Qt::PenCapStyle decodePenCapStyle( QString str );
925
+
926
+ static QString encodeBrushStyle( Qt::BrushStyle style );
927
+ static Qt::BrushStyle decodeBrushStyle( QString str );
928
+
929
+ static QString encodePoint( QPointF point );
930
+ static QPointF decodePoint( QString str );
931
+
932
+ static QString encodeRealVector( const QVector<qreal>& v );
933
+ static QVector<qreal> decodeRealVector( const QString& s );
934
+
935
+ static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit );
936
+ static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str );
937
+
938
+ static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size );
939
+ static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbolV2::OutputUnit u, QSize size );
940
+ static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize size );
941
+
942
+ static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size );
943
+ static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSize size );
944
+
945
+ static QgsSymbolV2* loadSymbol( QDomElement& element ) /Factory/;
946
+ static QgsSymbolLayerV2* loadSymbolLayer( QDomElement& element ) /Factory/;
947
+ static QDomElement saveSymbol( QString name, QgsSymbolV2* symbol, QDomDocument& doc, QgsSymbolV2Map* subSymbols = NULL );
948
+
949
+ static QgsStringMap parseProperties( QDomElement& element );
950
+ static void saveProperties( QgsStringMap props, QDomDocument& doc, QDomElement& element );
951
+
952
+ static QgsSymbolV2Map loadSymbols( QDomElement& element ) /Factory/;
953
+ static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagName, QDomDocument& doc );
954
+
955
+ static void clearSymbolMap( QgsSymbolV2Map& symbols );
956
+
957
+ static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ) /Factory/;
958
+ static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* ramp, QDomDocument& doc );
959
+
960
+ /**Returns the line width scale factor depending on the unit and the paint device*/
961
+ static double lineWidthScaleFactor( QgsRenderContext& c, QgsSymbolV2::OutputUnit u );
962
+ /**Returns scale factor painter units -> pixel dimensions*/
963
+ static double pixelSizeScaleFactor( QgsRenderContext& c, QgsSymbolV2::OutputUnit u );
964
+ /**Creates a render context for a pixel based device*/
965
+ static QgsRenderContext createRenderContext( QPainter* p );
966
+
967
+ /**Multiplies opacity of image pixel values with a (global) transparency value*/
968
+ static void multiplyImageOpacity( QImage* image, qreal alpha );
969
+ };
0 commit comments