Skip to content

Commit

Permalink
Move setting projection to after we have features
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 authored and timlinux committed Sep 7, 2011
1 parent ad817fc commit 5b63060
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/app/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int

int featureCount = 0;

// init distance/area calculator
QgsDistanceArea calc;
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
calc.setEllipsoid( ellipsoid );
calc.setSourceCrs( layer->crs().srsid() );

QgsFeatureList featureList;

// toLayerCoordinates will throw an exception for an 'invalid' point.
Expand Down Expand Up @@ -246,6 +240,14 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
QgsDebugMsg( QString( "Caught CRS exception %1" ).arg( cse.what() ) );
}

// init distance/area calculator
QgsDistanceArea calc;
if ( !featureList.count() == 0 )
{
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
calc.setEllipsoid( ellipsoid );
calc.setSourceCrs( layer->crs().srsid() );
}
QgsFeatureList::iterator f_it = featureList.begin();

for ( ; f_it != featureList.end(); ++f_it )
Expand Down

0 comments on commit 5b63060

Please sign in to comment.