Skip to content
Permalink
Browse files

Add python bindings for symbology units and data defined functions

  • Loading branch information
mhugent committed Apr 19, 2013
1 parent 99c922d commit 9675af0406fc9b86825b4cd10c412bf501b2bfec
@@ -39,6 +39,18 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
void setOutlineColor( const QColor& c );
QColor outlineColor() const;

void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit symbolWidthUnit() const;

void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit symbolHeightUnit() const;

void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outlineWidthUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;

QSet<QString> usedAttributes() const;

};
@@ -46,6 +46,15 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2

void setOffset( QPointF offset );
QPointF offset();

void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit borderWidthUnit() const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
};

/**Base class for polygon renderers generating texture images*/
@@ -62,6 +71,9 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2

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

void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
};

/**A class for svg fill patterns. The class automatically scales the pattern to
@@ -105,6 +117,16 @@ class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
QColor svgOutlineColor() const;
void setSvgOutlineWidth( double w );
double svgOutlineWidth() const;

void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit patternWidthUnit() const;

void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;

};

class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
@@ -142,6 +164,18 @@ class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
QColor color() const;
void setOffset( double offset );
double offset() const;

void setDistanceUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceUnit() const;

void setLineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit lineWidthUnit() const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
};

class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer
@@ -183,6 +217,21 @@ class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer

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

void setDistanceXUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceXUnit() const;

void setDistanceYUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit distanceYUnit() const;

void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit displacementXUnit() const;

void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit displacementYUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
};

class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
@@ -44,9 +44,15 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
double offset() const;
void setOffset( double offset );

QgsSymbolV2::OutputUnit offsetUnit() const;
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );

bool useCustomDashPattern() const;
void setUseCustomDashPattern( bool b );

QgsSymbolV2::OutputUnit customDashPatternUnit() const;
void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit );

QVector<qreal> customDashVector() const;
void setCustomDashVector( const QVector<qreal>& vector );
};
@@ -114,6 +120,15 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
double offset() const;
void setOffset( double offset );

QgsSymbolV2::OutputUnit intervalUnit() const;
void setIntervalUnit( QgsSymbolV2::OutputUnit unit );

QgsSymbolV2::OutputUnit offsetUnit() const;
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;

Placement placement() const;
void setPlacement( Placement p );

@@ -157,4 +172,7 @@ class QgsLineDecorationSymbolLayerV2 : QgsLineSymbolLayerV2
QgsSymbolLayerV2* clone() const /Factory/;

void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
};
@@ -39,6 +39,12 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
QColor borderColor() const;
void setBorderColor( QColor color );

double outlineWidth() const;
void setOutlineWidth( double w );

QgsSymbolV2::OutputUnit outlineWidthUnit() const;
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit u );

protected:

void drawMarker( QPainter* p, QgsSymbolV2RenderContext& context );
@@ -92,6 +98,12 @@ class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2

double outlineWidth() const;
void setOutlineWidth( double w );

void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outlineWidthUnit() const;

void setOutputUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit outputUnit() const;
};

class QgsFontMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
@@ -90,15 +90,31 @@ class QgsSymbolLayerV2
void setLocked( bool locked );
bool isLocked() const;

virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
virtual QgsSymbolV2::OutputUnit outputUnit() const;

// used only with rending with symbol levels is turned on (0 = first pass, 1 = second, ...)
void setRenderingPass( int renderingPass );
int renderingPass() const;

// symbol layers normally only use additional attributes to provide data defined settings
virtual QSet<QString> usedAttributes() const;

virtual const QgsExpression* dataDefinedProperty( const QString& property ) const;
virtual QString dataDefinedPropertyString( const QString& property ) const;
virtual void setDataDefinedProperty( const QString& property, const QString& expressionString );
virtual void removeDataDefinedProperty( const QString& property );
virtual void removeDataDefinedProperties();

protected:
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );

virtual void prepareExpressions( const QgsVectorLayer* vl );
virtual QgsExpression* expression( const QString& property );
/**Saves data defined properties to string map*/
void saveDataDefinedProperties( QgsStringMap& stringMap ) const;
/**Copies data defined properties of this layer to another symbol layer*/
void copyDataDefinedProperties( QgsSymbolLayerV2* destLayer ) const;
};

//////////////////////
@@ -130,6 +146,15 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2

virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

void setSizeUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit sizeUnit() const;

virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
virtual QgsSymbolV2::OutputUnit outputUnit() const;

protected:
QgsMarkerSymbolLayerV2( bool locked = false );
};
@@ -149,6 +174,9 @@ class QgsLineSymbolLayerV2 : QgsSymbolLayerV2
virtual void setWidth( double width );
virtual double width() const;

void setWidthUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit widthUnit() const;

void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size );

protected:

0 comments on commit 9675af0

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