Skip to content

Commit

Permalink
Fix two issues with varying width interpolated renderer
Browse files Browse the repository at this point in the history
Fixes  #46362

Also fixes an unreported issue where the "Ignore out of range" checkbox
is not correctly set when it should be checked.
  • Loading branch information
elpaso authored and nyalldawson committed Feb 4, 2022
1 parent 50cd02a commit 615af05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/symbology/qgsinterpolatedlinerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void QgsInterpolatedLineRenderer::renderInDeviceCoordinates( double valueColor1,
double width1 = mStrokeWidth.strokeWidth( valueWidth1 );
double width2 = mStrokeWidth.strokeWidth( valueWidth2 );

if ( !std::isnan( width1 ) || !std::isnan( width2 ) ) // the two widths on extremity are not out of range and ignored
if ( !std::isnan( width1 ) && !std::isnan( width2 ) ) // the two widths on extremity are not out of range and ignored
{
//Draw line cap
QBrush brush( Qt::SolidPattern );
Expand Down Expand Up @@ -158,6 +158,7 @@ void QgsInterpolatedLineRenderer::renderInDeviceCoordinates( double valueColor1,
painter->setPen( pen );

painter->drawPolygon( varLine );

}
else if ( !gradients.isEmpty() && !breakValues.isEmpty() && !breakColors.isEmpty() )
{
Expand Down Expand Up @@ -920,6 +921,7 @@ void QgsInterpolatedLineSymbolLayer::drawPreviewIcon( QgsSymbolRenderContext &co
}

renderPolyline( points, context );

}


Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgsinterpolatedlinesymbollayerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void QgsInterpolatedLineSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer
whileBlocking( mWidthUnitSelectionFixed )->setUnit( mLayer->widthUnit() );
whileBlocking( mWidthUnitSelectionVarying )->setUnit( mLayer->widthUnit() );
whileBlocking( mCheckBoxAbsoluteValue )->setChecked( interpolatedWidth.useAbsoluteValue() );
whileBlocking( mCheckBoxOutOfrange )->setChecked( interpolatedLineWidth().ignoreOutOfRange() );
whileBlocking( mCheckBoxOutOfrange )->setChecked( interpolatedWidth.ignoreOutOfRange() );

const QgsInterpolatedLineColor interpolatedColor = mLayer->interpolatedColor();
whileBlocking( mColorMethodComboBox )->setCurrentIndex( mColorMethodComboBox->findData( interpolatedColor.coloringMethod() ) );
Expand Down

0 comments on commit 615af05

Please sign in to comment.