@@ -352,19 +352,19 @@ QImage QgsSymbol::getPolygonSymbolAsImage()
352
352
return img; // this is ok because of qts sharing mechanism
353
353
}
354
354
355
- QImage QgsSymbol::getCachedPointSymbolAsImage ( double widthScale,
356
- bool selected, QColor selectionColor )
355
+ QImage QgsSymbol::getCachedPointSymbolAsImage ( double widthScale, bool selected, QColor selectionColor, double opacity )
357
356
{
358
357
if ( !mCacheUpToDate2
359
- || ( selected && mSelectionColor != selectionColor ) )
358
+ || ( selected && mSelectionColor != selectionColor ) || ( opacity != mOpacity ) )
360
359
{
361
360
if ( selected )
362
361
{
363
- cache2 ( widthScale, selectionColor );
362
+ cache2 ( widthScale, selectionColor, opacity );
364
363
}
365
364
else
366
365
{
367
- cache2 ( widthScale, mSelectionColor );
366
+
367
+ cache2 ( widthScale, mSelectionColor , opacity );
368
368
}
369
369
}
370
370
@@ -379,14 +379,15 @@ QImage QgsSymbol::getCachedPointSymbolAsImage( double widthScale,
379
379
}
380
380
381
381
QImage QgsSymbol::getPointSymbolAsImage ( double widthScale, bool selected, QColor selectionColor, double scale,
382
- double rotation, double rasterScaleFactor )
382
+ double rotation, double rasterScaleFactor, double opacity )
383
383
{
384
+
384
385
if ( 1.0 == ( scale * rasterScaleFactor ) && 0 == rotation )
385
386
{
386
387
if ( mWidthScale < 0 || widthScale == mWidthScale )
387
388
{
388
- // If scale is 1.0 and rotation 0.0, use cached image.
389
- return getCachedPointSymbolAsImage ( widthScale, selected, selectionColor );
389
+ // If scale is 1.0, rotation 0.0 use cached image.
390
+ return getCachedPointSymbolAsImage ( widthScale, selected, selectionColor, opacity );
390
391
}
391
392
}
392
393
@@ -402,18 +403,19 @@ QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColo
402
403
preRotateImage = QgsMarkerCatalogue::instance ()->imageMarker (
403
404
mPointSymbolName ,
404
405
( float )( mSize * scale * widthScale * rasterScaleFactor ),
405
- pen, mBrush );
406
+ pen, mBrush , opacity );
406
407
}
407
408
else
408
409
{
409
- QgsDebugMsg ( QString ( " marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6" )
410
- .arg ( mPointSymbolName )
411
- .arg ( mSize ).arg ( mSizeInMapUnits ? " true" : " false" )
412
- .arg ( scale ).arg ( widthScale ).arg ( rasterScaleFactor ) );
410
+ QgsDebugMsg ( QString ( " marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
411
+ .arg ( mPointSymbolName ).arg ( mSize ).arg ( mSizeInMapUnits ? " true" : " false" )
412
+ .arg ( scale ).arg ( widthScale ).arg ( rasterScaleFactor ).arg ( opacity ) );
413
+
414
+
413
415
preRotateImage = QgsMarkerCatalogue::instance ()->imageMarker (
414
416
mPointSymbolName ,
415
417
( float )( mSize * scale * widthScale * rasterScaleFactor ),
416
- pen, mBrush );
418
+ pen, mBrush , opacity );
417
419
}
418
420
419
421
QMatrix rotationMatrix;
@@ -443,26 +445,29 @@ void QgsSymbol::cache( QColor selectionColor )
443
445
mCacheUpToDate = true ;
444
446
}
445
447
446
- void QgsSymbol::cache2 ( double widthScale, QColor selectionColor )
448
+ void QgsSymbol::cache2 ( double widthScale, QColor selectionColor, double opacity )
447
449
{
448
450
// QgsDebugMsg(QString("widthScale = %1").arg(widthScale));
449
451
450
452
QPen pen = mPen ;
451
453
pen.setWidthF ( widthScale * pen.widthF () );
452
454
453
455
mPointSymbolImage2 = QgsMarkerCatalogue::instance ()->imageMarker ( mPointSymbolName , mSize * widthScale,
454
- pen, mBrush , false );
456
+ pen, mBrush , opacity );
455
457
456
458
QBrush brush = mBrush ;
457
459
brush.setColor ( selectionColor );
458
460
pen.setColor ( selectionColor );
459
461
460
462
mPointSymbolImageSelected2 = QgsMarkerCatalogue::instance ()->imageMarker (
461
- mPointSymbolName , mSize * widthScale, pen, brush, false );
463
+ mPointSymbolName , mSize * widthScale, pen, brush, opacity );
462
464
463
465
mSelectionColor2 = selectionColor;
464
466
465
467
mWidthScale = widthScale;
468
+
469
+ mOpacity = opacity;
470
+
466
471
mCacheUpToDate2 = true ;
467
472
}
468
473
0 commit comments