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

(cherry-picked from 454cce8)
  • Loading branch information
nyalldawson committed Mar 3, 2018
1 parent 5234212 commit 7b7f915a7dff654af6275e9b58dc329983ddffc0
@@ -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 7b7f915

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