Skip to content

Commit

Permalink
[symbology] Make use of the marker symbol line angle for all polyline…
Browse files Browse the repository at this point in the history
… templated line rendering

(cherry picked from commit 34ae29f)
  • Loading branch information
nirvn authored and nyalldawson committed May 15, 2021
1 parent dc7c883 commit 8d5c17d
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -1620,7 +1620,6 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi

QgsRenderContext &rc = context.renderContext();

double origAngle = symbolAngle();
int i = -1, maxCount = 0;
bool isRing = false;

Expand Down Expand Up @@ -1675,7 +1674,7 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
if ( rotateSymbols() )
{
double angle = context.renderContext().geometry()->vertexAngle( vId );
setSymbolAngle( angle * 180 / M_PI );
setSymbolLineAngle( angle * 180 / M_PI );
}
renderSymbol( mapPoint, context.feature(), rc, -1, context.selected() );
}
Expand Down Expand Up @@ -1723,8 +1722,6 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
double distance;
distance = placement == QgsTemplatedLineSymbolLayerBase::FirstVertex ? offsetAlongLine : -offsetAlongLine;
renderOffsetVertexAlongLine( points, i, distance, context );
// restore original rotation
setSymbolAngle( origAngle );

return;
}
Expand Down Expand Up @@ -1753,7 +1750,7 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
{
double angle = std::atan2( currentPoint.y() - prevPoint.y(),
currentPoint.x() - prevPoint.x() );
setSymbolAngle( origAngle + angle * 180 / M_PI );
setSymbolLineAngle( angle * 180 / M_PI );
}
prevPoint = currentPoint;
}
Expand All @@ -1764,15 +1761,12 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
if ( rotateSymbols() )
{
double angle = markerAngle( points, isRing, i );
setSymbolAngle( origAngle + angle * 180 / M_PI );
setSymbolLineAngle( angle * 180 / M_PI );
}
}

renderSymbol( symbolPoint, context.feature(), rc, -1, context.selected() );
}

// restore original rotation
setSymbolAngle( origAngle );
}

double QgsTemplatedLineSymbolLayerBase::markerAngle( const QPolygonF &points, bool isRing, int vertex )
Expand Down Expand Up @@ -1856,7 +1850,6 @@ void QgsTemplatedLineSymbolLayerBase::renderOffsetVertexAlongLine( const QPolygo
return;

QgsRenderContext &rc = context.renderContext();
double origAngle = symbolAngle();
if ( qgsDoubleNear( distance, 0.0 ) )
{
// rotate marker (if desired)
Expand All @@ -1866,7 +1859,7 @@ void QgsTemplatedLineSymbolLayerBase::renderOffsetVertexAlongLine( const QPolygo
if ( points.first() == points.last() )
isRing = true;
double angle = markerAngle( points, isRing, vertex );
setSymbolAngle( origAngle + angle * 180 / M_PI );
setSymbolLineAngle( angle * 180 / M_PI );
}
renderSymbol( points[vertex], context.feature(), rc, -1, context.selected() );
return;
Expand Down Expand Up @@ -1895,7 +1888,7 @@ void QgsTemplatedLineSymbolLayerBase::renderOffsetVertexAlongLine( const QPolygo
// rotate marker (if desired)
if ( rotateSymbols() )
{
setSymbolAngle( origAngle + ( l.angle() * 180 / M_PI ) );
setSymbolLineAngle( l.angle() * 180 / M_PI );
}
renderSymbol( markerPoint, context.feature(), rc, -1, context.selected() );
return;
Expand Down

0 comments on commit 8d5c17d

Please sign in to comment.