Skip to content

Commit

Permalink
Fix #11589 - diagrams with OTF reprojection
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Feb 20, 2015
1 parent c3d9f10 commit c69f153
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/core/qgspallabeling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3421,9 +3421,24 @@ void QgsPalLabeling::registerDiagramFeature( const QString& layerID, QgsFeature&
//convert geom to geos
QgsGeometry* geom = feat.geometry();

if ( layerIt.value().ct && staticWillUseLayer( layerID ) ) // reproject the geometry if feature not already transformed for labeling
// reproject the geometry if necessary (but don't modify the features
// geometry so that geometry based expression keep working)
QScopedPointer<QgsGeometry> clonedGeometry;
if ( layerIt.value().ct )
{
geom->transform( *( layerIt.value().ct ) );
geom = new QgsGeometry( *geom );
clonedGeometry.reset( geom );

try
{
geom->transform( *( layerIt.value().ct ) );
}
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsgLevel( QString( "Ignoring feature %1 due transformation exception" ).arg( feat.id() ), 4 );
return;
}
}

const GEOSGeometry* geos_geom = geom->asGeos();
Expand Down

0 comments on commit c69f153

Please sign in to comment.