Skip to content

Commit 962c8dd

Browse files
author
wonder
committed
Added python wrappers from QgsSymbolLayerV2Utils
git-svn-id: http://svn.osgeo.org/qgis/trunk@13353 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b210172 commit 962c8dd

File tree

2 files changed

+84
-6
lines changed

2 files changed

+84
-6
lines changed

python/core/qgsapplication.sip

+17-6
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
104104
//! Returns the path to the authors file.
105105
static const QString authorsFilePath();
106106

107+
/** Returns the path to the contributors file.
108+
* Contributors are people who have submitted patches
109+
* but don't have svn write access.
110+
* @note this function was added in version 1.3 */
111+
static const QString contributorsFilePath();
112+
107113
/**Returns the path to the sponsors file.
108114
@note this function was added in version 1.2*/
109115
static const QString sponsorsFilePath();
@@ -160,12 +166,6 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
160166
//! @note deprecated
161167
static const QString svgPath();
162168

163-
//! Returns the path to user's style. Added in QGIS 1.4
164-
static const QString userStyleV2Path();
165-
166-
//! Returns the path to default style (works as a starting point). Added in QGIS 1.4
167-
static const QString defaultStyleV2Path();
168-
169169
//! Returns the path to the application prefix directory.
170170
static const QString prefixPath();
171171

@@ -181,6 +181,17 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
181181
//! Returns the path to the default theme directory.
182182
static const QString defaultThemePath();
183183

184+
//! Returns path to the desired icon file.
185+
//! First it tries to use the active theme path, then default theme path
186+
//! @note Added in 1.5
187+
static QString iconPath( QString iconFile );
188+
189+
//! Returns the path to user's style. Added in QGIS 1.4
190+
static const QString userStyleV2Path();
191+
192+
//! Returns the path to default style (works as a starting point). Added in QGIS 1.4
193+
static const QString defaultStyleV2Path();
194+
184195
//! Alters prefix path - used by 3rd party apps
185196
static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);
186197

python/core/symbology-ng-core.sip

+67
Original file line numberDiff line numberDiff line change
@@ -900,3 +900,70 @@ class QgsRendererV2Registry
900900
};
901901

902902
///////////////
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

Comments
 (0)