Skip to content

Commit 864df0f

Browse files
committed
[FEATURE] Add support for gradient fills for polygons
1 parent 3d2814f commit 864df0f

29 files changed

+2006
-4
lines changed

python/core/symbology-ng/qgsfillsymbollayerv2.sip

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,102 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2
5959
QgsSymbolV2::OutputUnit outputUnit() const;
6060
};
6161

62+
class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2
63+
{
64+
%TypeHeaderCode
65+
#include <qgsfillsymbollayerv2.h>
66+
%End
67+
68+
public:
69+
70+
enum GradientColorType
71+
{
72+
SimpleTwoColor,
73+
ColorRamp
74+
};
75+
76+
enum GradientType
77+
{
78+
Linear,
79+
Radial,
80+
Conical
81+
};
82+
83+
enum GradientCoordinateMode
84+
{
85+
Feature,
86+
Viewport
87+
};
88+
89+
enum GradientSpread
90+
{
91+
Pad,
92+
Reflect,
93+
Repeat
94+
};
95+
96+
QgsGradientFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR,
97+
QColor color2 = Qt::white,
98+
GradientColorType gradientColorType = SimpleTwoColor,
99+
GradientType gradientType = Linear,
100+
GradientCoordinateMode coordinateMode = Feature,
101+
GradientSpread gradientSpread = Pad );
102+
103+
// static stuff
104+
105+
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
106+
107+
// implemented from base classes
108+
109+
QString layerType() const;
110+
111+
void startRender( QgsSymbolV2RenderContext& context );
112+
113+
void stopRender( QgsSymbolV2RenderContext& context );
114+
115+
void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
116+
117+
QgsStringMap properties() const;
118+
119+
QgsSymbolLayerV2* clone() const /Factory/;
120+
121+
//up to here
122+
123+
GradientType gradientType() const;
124+
void setGradientType( GradientType gradientType );
125+
126+
GradientColorType gradientColorType() const;
127+
void setGradientColorType( GradientColorType gradientColorType );
128+
129+
QgsVectorColorRampV2* colorRamp();
130+
void setColorRamp( QgsVectorColorRampV2* ramp );
131+
132+
QColor color2() const;
133+
void setColor2( QColor color2 );
134+
135+
GradientCoordinateMode coordinateMode() const;
136+
void setCoordinateMode( GradientCoordinateMode coordinateMode );
137+
138+
GradientSpread gradientSpread() const;
139+
void setGradientSpread( GradientSpread gradientSpread );
140+
141+
void setReferencePoint1( QPointF referencePoint );
142+
QPointF referencePoint1() const;
143+
144+
void setReferencePoint2( QPointF referencePoint );
145+
QPointF referencePoint2() const;
146+
147+
void setAngle( double angle );
148+
double angle() const;
149+
150+
void setOffset( QPointF offset );
151+
QPointF offset() const;
152+
153+
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
154+
QgsSymbolV2::OutputUnit offsetUnit() const;
155+
156+
};
157+
62158
/**Base class for polygon renderers generating texture images*/
63159
class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
64160
{

0 commit comments

Comments
 (0)