Skip to content
Permalink
Browse files
[symbology] Make use of the marker symbol line angle for all polyline…
… templated line rendering
  • Loading branch information
nirvn committed Apr 18, 2021
1 parent b6e354f commit 34ae29f7a6fb05d9789a6b0c0df141222e2e5f63
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/core/symbology/qgslinesymbollayer.cpp
@@ -1741,7 +1741,6 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi

QgsRenderContext &rc = context.renderContext();

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

@@ -1796,7 +1795,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() );
}
@@ -1844,8 +1843,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;
}
@@ -1874,7 +1871,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;
}
@@ -1885,15 +1882,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 )
@@ -1977,7 +1971,6 @@ void QgsTemplatedLineSymbolLayerBase::renderOffsetVertexAlongLine( const QPolygo
return;

QgsRenderContext &rc = context.renderContext();
double origAngle = symbolAngle();
if ( qgsDoubleNear( distance, 0.0 ) )
{
// rotate marker (if desired)
@@ -1987,7 +1980,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;
@@ -2016,7 +2009,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 34ae29f

Please sign in to comment.