4717_master.diff
src/core/symbology-ng/qgsmarkersymbollayerv2.cpp | ||
---|---|---|
23 | 23 |
#define DEG2RAD(x) ((x)*M_PI/180) |
24 | 24 | |
25 | 25 | |
26 |
static QPointF _rotatedOffset( const QPointF& offset, double angle ) |
|
27 |
{ |
|
28 |
angle = DEG2RAD( angle ); |
|
29 |
double c = cos( angle ), s = sin( angle ); |
|
30 |
return QPointF( offset.x() * c - offset.y() * s, offset.x() * s + offset.y() * c ); |
|
31 |
} |
|
32 | ||
33 | 26 |
////// |
34 | 27 | |
35 | 28 |
QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle ) |
... | ... | |
291 | 284 |
mPolygon |
292 | 285 |
<< QPointF( 0, -1 ) |
293 | 286 |
<< QPointF( 0.5, -0.5 ) |
294 |
<< QPointF( 0.25, -0.25 )
|
|
287 |
<< QPointF( 0.25, -0.5 ) |
|
295 | 288 |
<< QPointF( 0.25, 1 ) |
296 | 289 |
<< QPointF( -0.25, 1 ) |
297 | 290 |
<< QPointF( -0.25, -0.5 ) |
... | ... | |
360 | 353 |
} |
361 | 354 | |
362 | 355 |
QPointF off( context.outputLineWidth( mOffset.x() ), context.outputLineWidth( mOffset.y() ) ); |
363 |
if ( mAngle ) |
|
364 |
off = _rotatedOffset( off, mAngle ); |
|
365 | 356 | |
366 | 357 |
if ( mUsingCache ) |
367 | 358 |
{ |
... | ... | |
551 | 542 | |
552 | 543 |
p->save(); |
553 | 544 |
QPointF outputOffset = QPointF( context.outputLineWidth( mOffset.x() ), context.outputLineWidth( mOffset.y() ) ); |
554 |
if ( mAngle ) |
|
555 |
outputOffset = _rotatedOffset( outputOffset, mAngle ); |
|
545 | ||
556 | 546 |
p->translate( point + outputOffset ); |
557 | 547 | |
558 | 548 |
int size = ( int )( context.outputLineWidth( mSize ) ); |
... | ... | |
792 | 782 | |
793 | 783 |
p->save(); |
794 | 784 |
QPointF outputOffset = QPointF( context.outputLineWidth( mOffset.x() ), context.outputLineWidth( mOffset.y() ) ); |
795 |
if ( mAngle ) |
|
796 |
outputOffset = _rotatedOffset( outputOffset, mAngle ); |
|
785 | ||
797 | 786 |
p->translate( point + outputOffset ); |
798 | 787 | |
799 | 788 |
if ( context.renderHints() & QgsSymbolV2::DataDefinedSizeScale ) |