Skip to content

Commit 9a71b19

Browse files
author
jef
committed
fix #1252
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9211 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 38db41e commit 9a71b19

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/app/qgsmaptoolidentify.cpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
266266
layer->select( layer->pendingAllAttributesList(), r, true, true );
267267
QgsFeature f;
268268
while ( layer->getNextFeature( f ) )
269-
mFeatureList << QgsFeature(f);
269+
mFeatureList << QgsFeature( f );
270270

271271
QApplication::restoreOverrideCursor();
272272

@@ -334,15 +334,18 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
334334
double dist = calc.measure( f_it->geometry() );
335335
QString str = calc.textUnit( dist, 3, mCanvas->mapUnits(), false );
336336
mResults->addDerivedAttribute( featureNode, QObject::tr( "Length" ), str );
337-
// Add the start and end points in as derived attributes
338-
str.setNum( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
339-
mResults->addDerivedAttribute( featureNode, "startX", str );
340-
str.setNum( f_it->geometry()->asPolyline().first().y(), 'g', 10 );
341-
mResults->addDerivedAttribute( featureNode, "startY", str );
342-
str.setNum( f_it->geometry()->asPolyline().last().x(), 'g', 10 );
343-
mResults->addDerivedAttribute( featureNode, "endX", str );
344-
str.setNum( f_it->geometry()->asPolyline().last().y(), 'g', 10 );
345-
mResults->addDerivedAttribute( featureNode, "endY", str );
337+
if ( f_it->geometry()->wkbType() == QGis::WKBLineString )
338+
{
339+
// Add the start and end points in as derived attributes
340+
str.setNum( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
341+
mResults->addDerivedAttribute( featureNode, "startX", str );
342+
str.setNum( f_it->geometry()->asPolyline().first().y(), 'g', 10 );
343+
mResults->addDerivedAttribute( featureNode, "startY", str );
344+
str.setNum( f_it->geometry()->asPolyline().last().x(), 'g', 10 );
345+
mResults->addDerivedAttribute( featureNode, "endX", str );
346+
str.setNum( f_it->geometry()->asPolyline().last().y(), 'g', 10 );
347+
mResults->addDerivedAttribute( featureNode, "endY", str );
348+
}
346349
}
347350
else if ( layer->vectorType() == QGis::Polygon )
348351
{

0 commit comments

Comments
 (0)