[QGIS Commit] r13353 - trunk/qgis/python/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Apr 23 11:20:25 EDT 2010


Author: wonder
Date: 2010-04-23 11:20:24 -0400 (Fri, 23 Apr 2010)
New Revision: 13353

Modified:
   trunk/qgis/python/core/qgsapplication.sip
   trunk/qgis/python/core/symbology-ng-core.sip
Log:
Added python wrappers from QgsSymbolLayerV2Utils


Modified: trunk/qgis/python/core/qgsapplication.sip
===================================================================
--- trunk/qgis/python/core/qgsapplication.sip	2010-04-23 15:06:52 UTC (rev 13352)
+++ trunk/qgis/python/core/qgsapplication.sip	2010-04-23 15:20:24 UTC (rev 13353)
@@ -104,6 +104,12 @@
     //! Returns the path to the authors file.
     static const QString authorsFilePath();
 
+    /** Returns the path to the contributors file.
+     * Contributors are people who have submitted patches
+     * but don't have svn write access.
+     * @note this function was added in version 1.3 */
+    static const QString contributorsFilePath();
+
     /**Returns the path to the sponsors file.
       @note this function was added in version 1.2*/
     static const QString sponsorsFilePath();
@@ -160,12 +166,6 @@
     //! @note deprecated
     static const QString svgPath();
 
-    //! Returns the path to user's style. Added in QGIS 1.4
-    static const QString userStyleV2Path();
-
-    //! Returns the path to default style (works as a starting point). Added in QGIS 1.4
-    static const QString defaultStyleV2Path();
-
     //! Returns the path to the application prefix directory.
     static const QString prefixPath();
 
@@ -181,6 +181,17 @@
     //! Returns the path to the default theme directory.
     static const QString defaultThemePath(); 
     
+    //! Returns path to the desired icon file.
+    //! First it tries to use the active theme path, then default theme path
+    //! @note Added in 1.5
+    static QString iconPath( QString iconFile );
+
+    //! Returns the path to user's style. Added in QGIS 1.4
+    static const QString userStyleV2Path();
+
+    //! Returns the path to default style (works as a starting point). Added in QGIS 1.4
+    static const QString defaultStyleV2Path();
+
     //! Alters prefix path - used by 3rd party apps
     static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);
     

Modified: trunk/qgis/python/core/symbology-ng-core.sip
===================================================================
--- trunk/qgis/python/core/symbology-ng-core.sip	2010-04-23 15:06:52 UTC (rev 13352)
+++ trunk/qgis/python/core/symbology-ng-core.sip	2010-04-23 15:20:24 UTC (rev 13353)
@@ -900,3 +900,70 @@
 };
 
 ///////////////
+
+typedef QMap<QString, QgsSymbolV2* > QgsSymbolV2Map;
+
+class QgsSymbolLayerV2Utils
+{
+%TypeHeaderCode
+#include <qgssymbollayerv2utils.h>
+%End
+
+  public:
+
+    static QString encodeColor( QColor color );
+    static QColor decodeColor( QString str );
+
+    static QString encodePenStyle( Qt::PenStyle style );
+    static Qt::PenStyle decodePenStyle( QString str );
+
+    static QString encodePenJoinStyle( Qt::PenJoinStyle style );
+    static Qt::PenJoinStyle decodePenJoinStyle( QString str );
+
+    static QString encodePenCapStyle( Qt::PenCapStyle style );
+    static Qt::PenCapStyle decodePenCapStyle( QString str );
+
+    static QString encodeBrushStyle( Qt::BrushStyle style );
+    static Qt::BrushStyle decodeBrushStyle( QString str );
+
+    static QString encodePoint( QPointF point );
+    static QPointF decodePoint( QString str );
+
+    static QString encodeRealVector( const QVector<qreal>& v );
+    static QVector<qreal> decodeRealVector( const QString& s );
+
+    static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit );
+    static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str );
+
+    static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size );
+    static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbolV2::OutputUnit u, QSize size );
+    static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize size );
+
+    static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size );
+    static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSize size );
+
+    static QgsSymbolV2* loadSymbol( QDomElement& element ) /Factory/;
+    static QgsSymbolLayerV2* loadSymbolLayer( QDomElement& element ) /Factory/;
+    static QDomElement saveSymbol( QString name, QgsSymbolV2* symbol, QDomDocument& doc, QgsSymbolV2Map* subSymbols = NULL );
+
+    static QgsStringMap parseProperties( QDomElement& element );
+    static void saveProperties( QgsStringMap props, QDomDocument& doc, QDomElement& element );
+
+    static QgsSymbolV2Map loadSymbols( QDomElement& element ) /Factory/;
+    static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagName, QDomDocument& doc );
+
+    static void clearSymbolMap( QgsSymbolV2Map& symbols );
+
+    static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ) /Factory/;
+    static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* ramp, QDomDocument& doc );
+
+    /**Returns the line width scale factor depending on the unit and the paint device*/
+    static double lineWidthScaleFactor( QgsRenderContext& c, QgsSymbolV2::OutputUnit u );
+    /**Returns scale factor painter units -> pixel dimensions*/
+    static double pixelSizeScaleFactor( QgsRenderContext& c, QgsSymbolV2::OutputUnit u );
+    /**Creates a render context for a pixel based device*/
+    static QgsRenderContext createRenderContext( QPainter* p );
+
+    /**Multiplies opacity of image pixel values with a (global) transparency value*/
+    static void multiplyImageOpacity( QImage* image, qreal alpha );
+};



More information about the QGIS-commit mailing list