Skip to content
Permalink
Browse files

[symbology] Make use of the marker symbol line angle for all polyline…

… templated line rendering

(cherry picked from commit 34ae29f)
  • Loading branch information
nirvn authored and nyalldawson committed Apr 27, 2021
1 parent 8837590 commit 8529d578985894e98a89ac65593ddc6729b080b8
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/core/symbology/qgslinesymbollayer.cpp
@@ -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;

@@ -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() );
}
@@ -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;
}
@@ -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;
}
@@ -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 )
@@ -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)
@@ -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;
@@ -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;

0 comments on commit 8529d57

Please sign in to comment.