Skip to content

Commit

Permalink
Fix interpolated line renderer exact inverted
Browse files Browse the repository at this point in the history
Fix #46371
  • Loading branch information
elpaso committed Feb 4, 2022
1 parent 91cf895 commit 3026770
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/symbology/qgsinterpolatedlinerenderer.cpp
Expand Up @@ -74,13 +74,14 @@ void QgsInterpolatedLineRenderer::renderInDeviceCoordinates( double valueColor1,
Q_ASSERT( breakColors.count() == breakValues.count() );
for ( int i = 0; i < breakValues.count(); ++i )
{
double value = breakValues.at( i );
double width = context.convertToPainterUnits( mStrokeWidth.strokeWidth( value ), mStrokeWidthUnit );
const bool widthIsInverted { valueWidth1 > valueWidth2 };
const double value = breakValues.at( i );
const double width = context.convertToPainterUnits( mStrokeWidth.strokeWidth( widthIsInverted ? mStrokeWidth.maximumValue() - value : value ), mStrokeWidthUnit );
QPen pen( mSelected ? selectedColor : breakColors.at( i ) );
pen.setWidthF( width );
pen.setCapStyle( Qt::PenCapStyle::RoundCap );
painter->setPen( pen );
QPointF point = p1 + dir * ( value - valueColor1 ) / ( valueColor2 - valueColor1 );
const QPointF point = p1 + dir * ( value - valueColor1 ) / ( valueColor2 - valueColor1 );
painter->drawPoint( point );
}
}
Expand Down

0 comments on commit 3026770

Please sign in to comment.