Skip to content

Commit

Permalink
Set the line angle instead of the symbol angle
Browse files Browse the repository at this point in the history
Fixes #38716
  • Loading branch information
elpaso committed Sep 16, 2020
1 parent 49037e0 commit 2018edb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -2056,12 +2056,14 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineCentral( const QPolygonF &po
}

// draw the marker
double origAngle = symbolAngle();
// rotate marker (if desired)
if ( rotateSymbols() )
setSymbolAngle( origAngle + thisSymbolAngle * 180 / M_PI );
{
setSymbolLineAngle( thisSymbolAngle * 180 / M_PI );
}

renderSymbol( pt, context.feature(), context.renderContext(), -1, context.selected() );
if ( rotateSymbols() )
setSymbolAngle( origAngle );

}
}

Expand Down
4 changes: 3 additions & 1 deletion src/core/symbology/qgsmarkersymbollayer.cpp
Expand Up @@ -246,7 +246,9 @@ void QgsSimpleMarkerSymbolLayerBase::renderPoint( QPointF point, QgsSymbolRender
}

if ( !qgsDoubleNear( angle, 0.0 ) && ( hasDataDefinedRotation || createdNewPath ) )
{
transform.rotate( angle );
}

//need to pass: symbol, polygon, path

Expand Down Expand Up @@ -666,7 +668,7 @@ void QgsSimpleMarkerSymbolLayerBase::calculateOffsetAndRotation( QgsSymbolRender
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyAngle ) )
{
context.setOriginalValueVariable( angle );
angle = mDataDefinedProperties.valueAsDouble( QgsSymbolLayer::PropertyAngle, context.renderContext().expressionContext(), mAngle, &ok ) + mLineAngle;
angle = mDataDefinedProperties.valueAsDouble( QgsSymbolLayer::PropertyAngle, context.renderContext().expressionContext(), 0, &ok ) + mLineAngle;

// If the expression evaluation was not successful, fallback to static value
if ( !ok )
Expand Down

0 comments on commit 2018edb

Please sign in to comment.