Skip to content

Commit 7b7f915

Browse files
committed
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)
1 parent 5234212 commit 7b7f915

File tree

4 files changed

+336
-21
lines changed

4 files changed

+336
-21
lines changed

src/core/symbology/qgssymbol.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ QPolygonF QgsSymbol::_getLineString( QgsRenderContext &context, const QgsCurve &
125125
ct.transformPolygon( pts );
126126
}
127127

128+
// remove non-finite points, e.g. infinite or NaN points caused by reprojecting errors
129+
pts.erase( std::remove_if( pts.begin(), pts.end(),
130+
[]( const QPointF point )
131+
{
132+
return !std::isfinite( point.x() ) || !std::isfinite( point.y() );
133+
} ), pts.end() );
134+
128135
QPointF *ptr = pts.data();
129136
for ( int i = 0; i < pts.size(); ++i, ++ptr )
130137
{
@@ -161,6 +168,13 @@ QPolygonF QgsSymbol::_getPolygonRing( QgsRenderContext &context, const QgsCurve
161168
ct.transformPolygon( poly );
162169
}
163170

171+
// remove non-finite points, e.g. infinite or NaN points caused by reprojecting errors
172+
poly.erase( std::remove_if( poly.begin(), poly.end(),
173+
[]( const QPointF point )
174+
{
175+
return !std::isfinite( point.x() ) || !std::isfinite( point.y() );
176+
} ), poly.end() );
177+
164178
QPointF *ptr = poly.data();
165179
for ( int i = 0; i < poly.size(); ++i, ++ptr )
166180
{

0 commit comments

Comments
 (0)