[QGIS Commit] r9211 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Aug 29 17:00:45 EDT 2008
Author: jef
Date: 2008-08-29 17:00:45 -0400 (Fri, 29 Aug 2008)
New Revision: 9211
Modified:
trunk/qgis/src/app/qgsmaptoolidentify.cpp
Log:
fix #1252
Modified: trunk/qgis/src/app/qgsmaptoolidentify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-08-29 15:28:48 UTC (rev 9210)
+++ trunk/qgis/src/app/qgsmaptoolidentify.cpp 2008-08-29 21:00:45 UTC (rev 9211)
@@ -266,7 +266,7 @@
layer->select( layer->pendingAllAttributesList(), r, true, true );
QgsFeature f;
while ( layer->getNextFeature( f ) )
- mFeatureList << QgsFeature(f);
+ mFeatureList << QgsFeature( f );
QApplication::restoreOverrideCursor();
@@ -334,15 +334,18 @@
double dist = calc.measure( f_it->geometry() );
QString str = calc.textUnit( dist, 3, mCanvas->mapUnits(), false );
mResults->addDerivedAttribute( featureNode, QObject::tr( "Length" ), str );
- // Add the start and end points in as derived attributes
- str.setNum( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
- mResults->addDerivedAttribute( featureNode, "startX", str );
- str.setNum( f_it->geometry()->asPolyline().first().y(), 'g', 10 );
- mResults->addDerivedAttribute( featureNode, "startY", str );
- str.setNum( f_it->geometry()->asPolyline().last().x(), 'g', 10 );
- mResults->addDerivedAttribute( featureNode, "endX", str );
- str.setNum( f_it->geometry()->asPolyline().last().y(), 'g', 10 );
- mResults->addDerivedAttribute( featureNode, "endY", str );
+ if ( f_it->geometry()->wkbType() == QGis::WKBLineString )
+ {
+ // Add the start and end points in as derived attributes
+ str.setNum( f_it->geometry()->asPolyline().first().x(), 'g', 10 );
+ mResults->addDerivedAttribute( featureNode, "startX", str );
+ str.setNum( f_it->geometry()->asPolyline().first().y(), 'g', 10 );
+ mResults->addDerivedAttribute( featureNode, "startY", str );
+ str.setNum( f_it->geometry()->asPolyline().last().x(), 'g', 10 );
+ mResults->addDerivedAttribute( featureNode, "endX", str );
+ str.setNum( f_it->geometry()->asPolyline().last().y(), 'g', 10 );
+ mResults->addDerivedAttribute( featureNode, "endY", str );
+ }
}
else if ( layer->vectorType() == QGis::Polygon )
{
More information about the QGIS-commit
mailing list