Skip to content

Commit b0b28f5

Browse files
committedAug 18, 2011
Merge pull request #37 from NathanW2/identify-patch
Move setting of projection to after we have features for identify feature tool.
2 parents 0ba0f93 + 0373a26 commit b0b28f5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

‎src/app/qgsmaptoolidentify.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,6 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
211211

212212
int featureCount = 0;
213213

214-
// init distance/area calculator
215-
QgsDistanceArea calc;
216-
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
217-
calc.setEllipsoid( ellipsoid );
218-
calc.setSourceCrs( layer->crs().srsid() );
219-
220214
QgsFeatureList featureList;
221215

222216
// toLayerCoordinates will throw an exception for an 'invalid' point.
@@ -247,6 +241,14 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int
247241
QgsDebugMsg( QString( "Caught CRS exception %1" ).arg( cse.what() ) );
248242
}
249243

244+
// init distance/area calculator
245+
QgsDistanceArea calc;
246+
if ( !featureList.count() == 0 )
247+
{
248+
calc.setProjectionsEnabled( mCanvas->hasCrsTransformEnabled() ); // project?
249+
calc.setEllipsoid( ellipsoid );
250+
calc.setSourceCrs( layer->crs().srsid() );
251+
}
250252
QgsFeatureList::iterator f_it = featureList.begin();
251253

252254
for ( ; f_it != featureList.end(); ++f_it )

0 commit comments

Comments
 (0)
Please sign in to comment.