Skip to content
Permalink
Browse files

Fix heatmap renderer not working for reprojected layers (fix #12362)

  • Loading branch information
nyalldawson committed Mar 17, 2015
1 parent 327517d commit e17ec09e5541dac8f69e2181e107228311b140ff
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/core/symbology-ng/qgsheatmaprenderer.cpp
@@ -107,8 +107,7 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& c
return false;
}

QgsGeometry* geom = feature.geometry();
if ( geom->type() != QGis::Point )
if ( !feature.geometry() || feature.geometry()->type() != QGis::Point )
{
//can only render point type
return false;
@@ -139,8 +138,28 @@ bool QgsHeatmapRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& c
int width = context.painter()->device()->width() / mRenderQuality;
int height = context.painter()->device()->height() / mRenderQuality;

//transform geometry if required
QgsGeometry* geom;
bool createdGeom = false;
const QgsCoordinateTransform* xform = context.coordinateTransform();
if ( xform )
{
geom = new QgsGeometry( *feature.geometry() );
createdGeom = true;
geom->transform( *xform );
}
else
{
geom = feature.geometry();
}

//convert point to multipoint
QgsMultiPoint multiPoint = convertToMultipoint( geom );
if ( createdGeom )
{
delete geom;
}
geom = 0;

//loop through all points in multipoint
for ( QgsMultiPoint::const_iterator pointIt = multiPoint.constBegin(); pointIt != multiPoint.constEnd(); ++pointIt )

0 comments on commit e17ec09

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