17
17
#include < cmath>
18
18
19
19
QgsSymbolV2::QgsSymbolV2 ( SymbolType type, QgsSymbolLayerV2List layers )
20
- : mType( type ), mLayers( layers ), mOutputUnit( MM )
20
+ : mType( type ), mLayers( layers ), mOutputUnit( MM ), mAlpha( 1.0 )
21
21
{
22
22
23
23
// check they're all correct symbol layers
@@ -126,14 +126,14 @@ bool QgsSymbolV2::changeSymbolLayer( int index, QgsSymbolLayerV2* layer )
126
126
127
127
void QgsSymbolV2::startRender ( QgsRenderContext& context )
128
128
{
129
- QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit );
129
+ QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit , mAlpha );
130
130
for ( QgsSymbolLayerV2List::iterator it = mLayers .begin (); it != mLayers .end (); ++it )
131
131
( *it )->startRender ( symbolContext );
132
132
}
133
133
134
134
void QgsSymbolV2::stopRender ( QgsRenderContext& context )
135
135
{
136
- QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit );
136
+ QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit , mAlpha );
137
137
for ( QgsSymbolLayerV2List::iterator it = mLayers .begin (); it != mLayers .end (); ++it )
138
138
( *it )->stopRender ( symbolContext );
139
139
}
@@ -244,8 +244,8 @@ QgsSymbolLayerV2List QgsSymbolV2::cloneLayers() const
244
244
245
245
// //////////////////
246
246
247
- QgsSymbolV2RenderContext::QgsSymbolV2RenderContext ( QgsRenderContext& c, QgsSymbolV2::OutputUnit u )
248
- : mRenderContext( c ), mOutputUnit( u )
247
+ QgsSymbolV2RenderContext::QgsSymbolV2RenderContext ( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha )
248
+ : mRenderContext( c ), mOutputUnit( u ), mAlpha( alpha )
249
249
{
250
250
251
251
}
@@ -331,7 +331,7 @@ double QgsMarkerSymbolV2::size()
331
331
332
332
void QgsMarkerSymbolV2::renderPoint ( const QPointF& point, QgsRenderContext& context, int layer )
333
333
{
334
- QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit );
334
+ QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit , mAlpha );
335
335
if ( layer != -1 )
336
336
{
337
337
if ( layer >= 0 && layer < mLayers .count () )
@@ -350,6 +350,7 @@ QgsSymbolV2* QgsMarkerSymbolV2::clone() const
350
350
{
351
351
QgsSymbolV2* cloneSymbol = new QgsMarkerSymbolV2 ( cloneLayers () );
352
352
cloneSymbol->setOutputUnit ( mOutputUnit );
353
+ cloneSymbol->setAlpha ( mAlpha );
353
354
return cloneSymbol;
354
355
}
355
356
@@ -399,7 +400,7 @@ double QgsLineSymbolV2::width()
399
400
400
401
void QgsLineSymbolV2::renderPolyline ( const QPolygonF& points, QgsRenderContext& context, int layer )
401
402
{
402
- QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit );
403
+ QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit , mAlpha );
403
404
if ( layer != -1 )
404
405
{
405
406
if ( layer >= 0 && layer < mLayers .count () )
@@ -419,6 +420,7 @@ QgsSymbolV2* QgsLineSymbolV2::clone() const
419
420
{
420
421
QgsSymbolV2* cloneSymbol = new QgsLineSymbolV2 ( cloneLayers () );
421
422
cloneSymbol->setOutputUnit ( mOutputUnit );
423
+ cloneSymbol->setAlpha ( mAlpha );
422
424
return cloneSymbol;
423
425
}
424
426
@@ -434,7 +436,7 @@ QgsFillSymbolV2::QgsFillSymbolV2( QgsSymbolLayerV2List layers )
434
436
435
437
void QgsFillSymbolV2::renderPolygon ( const QPolygonF& points, QList<QPolygonF>* rings, QgsRenderContext& context, int layer )
436
438
{
437
- QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit );
439
+ QgsSymbolV2RenderContext symbolContext ( context, mOutputUnit , mAlpha );
438
440
if ( layer != -1 )
439
441
{
440
442
if ( layer >= 0 && layer < mLayers .count () )
@@ -454,5 +456,6 @@ QgsSymbolV2* QgsFillSymbolV2::clone() const
454
456
{
455
457
QgsSymbolV2* cloneSymbol = new QgsFillSymbolV2 ( cloneLayers () );
456
458
cloneSymbol->setOutputUnit ( mOutputUnit );
459
+ cloneSymbol->setAlpha ( mAlpha );
457
460
return cloneSymbol;
458
461
}
0 commit comments