@@ -541,6 +541,27 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
541
541
{
542
542
angle = mAngleExpression ->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toDouble ();
543
543
}
544
+
545
+ bool hasDataDefinedRotation = context.renderHints () & QgsSymbolV2::DataDefinedRotation || mAngleExpression ;
546
+ if ( hasDataDefinedRotation )
547
+ {
548
+ // For non-point markers, "dataDefinedRotation" means following the
549
+ // shape (shape-data defined). For them, "field-data defined" does
550
+ // not work at all. TODO: if "field-data defined" ever gets implemented
551
+ // we'll need a way to distinguish here between the two, possibly
552
+ // using another flag in renderHints()
553
+ const QgsFeature* f = context.feature ();
554
+ if ( f )
555
+ {
556
+ QgsGeometry *g = f->geometry ();
557
+ if ( g && g->type () == QGis::Point )
558
+ {
559
+ const QgsMapToPixel& m2p = context.renderContext ().mapToPixel ();
560
+ angle += m2p.mapRotation ();
561
+ }
562
+ }
563
+ }
564
+
544
565
if ( angle )
545
566
off = _rotatedOffset ( off, angle );
546
567
@@ -558,6 +579,7 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
558
579
559
580
if ( mUsingCache )
560
581
{
582
+ // QgsDebugMsg( QString("XXX using cache") );
561
583
// we will use cached image
562
584
QImage &img = context.selected () ? mSelCache : mCache ;
563
585
double s = img.width () / context.renderContext ().rasterScaleFactor ();
@@ -580,7 +602,6 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
580
602
transform.scale ( half, half );
581
603
}
582
604
583
- bool hasDataDefinedRotation = context.renderHints () & QgsSymbolV2::DataDefinedRotation || mAngleExpression ;
584
605
if ( angle != 0 && ( hasDataDefinedRotation || createdNewPath ) )
585
606
transform.rotate ( angle );
586
607
@@ -1318,6 +1339,27 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
1318
1339
{
1319
1340
angle = angleExpression->evaluate ( const_cast <QgsFeature*>( context.feature () ) ).toDouble ();
1320
1341
}
1342
+
1343
+ bool hasDataDefinedRotation = context.renderHints () & QgsSymbolV2::DataDefinedRotation || angleExpression;
1344
+ if ( hasDataDefinedRotation )
1345
+ {
1346
+ // For non-point markers, "dataDefinedRotation" means following the
1347
+ // shape (shape-data defined). For them, "field-data defined" does
1348
+ // not work at all. TODO: if "field-data defined" ever gets implemented
1349
+ // we'll need a way to distinguish here between the two, possibly
1350
+ // using another flag in renderHints()
1351
+ const QgsFeature* f = context.feature ();
1352
+ if ( f )
1353
+ {
1354
+ QgsGeometry *g = f->geometry ();
1355
+ if ( g && g->type () == QGis::Point )
1356
+ {
1357
+ const QgsMapToPixel& m2p = context.renderContext ().mapToPixel ();
1358
+ angle += m2p.mapRotation ();
1359
+ }
1360
+ }
1361
+ }
1362
+
1321
1363
if ( angle )
1322
1364
outputOffset = _rotatedOffset ( outputOffset, angle );
1323
1365
p->translate ( point + outputOffset );
0 commit comments