Skip to content

Commit

Permalink
Added python bindings for vector field symbollayer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Nov 15, 2011
1 parent 2b6efe5 commit ed13141
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions python/core/qgsvectorfieldsymbollayer.sip
Original file line number Diff line number Diff line change
@@ -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;
};
11 changes: 10 additions & 1 deletion python/core/symbology-ng-core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed13141

Please sign in to comment.