Skip to content
Permalink
Browse files

Added python wrappers from QgsSymbolLayerV2Utils

git-svn-id: http://svn.osgeo.org/qgis/trunk@13353 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Apr 23, 2010
1 parent b210172 commit 962c8ddb4ddf2b10c96ca5aa2eb684ad399e57ea
Showing with 84 additions and 6 deletions.
  1. +17 −6 python/core/qgsapplication.sip
  2. +67 −0 python/core/symbology-ng-core.sip
@@ -104,6 +104,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! 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 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! @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 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! 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);

@@ -900,3 +900,70 @@ class QgsRendererV2Registry
};

///////////////

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 );
};

0 comments on commit 962c8dd

Please sign in to comment.
You can’t perform that action at this time.