Skip to content
Permalink
Browse files

Don't try to render non-finite points

They occur as a result of reprojection errors, and cause a line
to be extend to the top-left of the canvas.

Fixes #9392
  • Loading branch information
nyalldawson committed Mar 5, 2018
1 parent 5b8599e commit 454cce89f1fb45978fb75166616063d90a7563b3
@@ -125,6 +125,13 @@ QPolygonF QgsSymbol::_getLineString( QgsRenderContext &context, const QgsCurve &
ct.transformPolygon( pts );
}

// remove non-finite points, e.g. infinite or NaN points caused by reprojecting errors
pts.erase( std::remove_if( pts.begin(), pts.end(),
[]( const QPointF point )
{
return !std::isfinite( point.x() ) || !std::isfinite( point.y() );
} ), pts.end() );

QPointF *ptr = pts.data();
for ( int i = 0; i < pts.size(); ++i, ++ptr )
{
@@ -161,6 +168,13 @@ QPolygonF QgsSymbol::_getPolygonRing( QgsRenderContext &context, const QgsCurve
ct.transformPolygon( poly );
}

// remove non-finite points, e.g. infinite or NaN points caused by reprojecting errors
poly.erase( std::remove_if( poly.begin(), poly.end(),
[]( const QPointF point )
{
return !std::isfinite( point.x() ) || !std::isfinite( point.y() );
} ), poly.end() );

QPointF *ptr = poly.data();
for ( int i = 0; i < poly.size(); ++i, ++ptr )
{

0 comments on commit 454cce8

Please sign in to comment.
You can’t perform that action at this time.