Skip to content
Permalink
Browse files
Added python bindings for vector field symbollayer
  • Loading branch information
mhugent committed Nov 15, 2011
1 parent 2b6efe5 commit ed13141b672f6c3bbf56d0b39890cbc4456093ba
Showing with 71 additions and 1 deletion.
  1. +1 −0 python/core/core.sip
  2. +60 −0 python/core/qgsvectorfieldsymbollayer.sip
  3. +10 −1 python/core/symbology-ng-core.sip
@@ -82,6 +82,7 @@
%Include qgsuniquevaluerenderer.sip
%Include qgsattributeaction.sip
%Include qgsvectordataprovider.sip
%Include qgsvectorfieldsymbollayer.sip
%Include qgsvectorfilewriter.sip
%Include qgsvectorlayer.sip
%Include qgsvectorlayerimport.sip
@@ -0,0 +1,60 @@
class QgsVectorFieldSymbolLayer: QgsMarkerSymbolLayerV2
{
%TypeHeaderCode
#include <qgsvectorfieldsymbollayer.h>
%End
public:
enum VectorFieldType
{
Cartesian = 0,
Polar,
Height
};

enum AngleOrientation
{
ClockwiseFromNorth = 0,
CounterclockwiseFromEast
};

enum AngleUnits
{
Degrees = 0,
Radians
};

QgsVectorFieldSymbolLayer();
~QgsVectorFieldSymbolLayer();

static QgsSymbolLayerV2* create( const QgsStringMap& properties );

QString layerType() const;

bool setSubSymbol( QgsSymbolV2* symbol );
QgsSymbolV2* subSymbol();

void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );
void startRender( QgsSymbolV2RenderContext& context );
void stopRender( QgsSymbolV2RenderContext& context );

QgsSymbolLayerV2* clone() const;
QgsStringMap properties() const;

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );

QSet<QString> usedAttributes() const;

//setters and getters
void setXAttribute( const QString& attribute );
QString xAttribute() const;
void setYAttribute( const QString& attribute );
QString yAttribute() const;
void setScale( double s );
double scale() const;
void setVectorFieldType( VectorFieldType type );
VectorFieldType vectorFieldType() const;
void setAngleOrientation( AngleOrientation orientation );
AngleOrientation angleOrientation() const;
void setAngleUnits( AngleUnits units );
AngleUnits angleUnits() const;
};
@@ -490,7 +490,16 @@ class QgsSymbolLayerV2
%ConvertToSubClassCode
switch (sipCpp->type())
{
case QgsSymbolV2::Marker: sipClass = sipClass_QgsMarkerSymbolLayerV2; break;
case QgsSymbolV2::Marker:
if( sipCpp->layerType() == "VectorField" )
{
sipClass = sipClass_QgsVectorFieldSymbolLayer;
}
else
{
sipClass = sipClass_QgsMarkerSymbolLayerV2;
}
break;
case QgsSymbolV2::Line: sipClass = sipClass_QgsLineSymbolLayerV2; break;
case QgsSymbolV2::Fill: sipClass = sipClass_QgsFillSymbolLayerV2; break;
default: sipClass = 0; break;

0 comments on commit ed13141

Please sign in to comment.