Skip to content

Commit

Permalink
multipoint geometry support in Field Calculator (fix #5513)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 29, 2012
1 parent d3a50e8 commit 4e70885
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/core/qgsexpression.cpp
Expand Up @@ -333,12 +333,26 @@ static QVariant fcnFeatureId( const QVariantList& , QgsFeature* f, QgsExpression
static QVariant fcnX( const QVariantList& , QgsFeature* f, QgsExpression* )
{
ENSURE_GEOM_TYPE( f, g, QGis::Point );
return g->asPoint().x();
if ( g->isMultipart() )
{
return g->asMultiPoint()[ 0 ].x();
}
else
{
return g->asPoint().x();
}
}
static QVariant fcnY( const QVariantList& , QgsFeature* f, QgsExpression* )
{
ENSURE_GEOM_TYPE( f, g, QGis::Point );
return g->asPoint().y();
if ( g->isMultipart() )
{
return g->asMultiPoint()[ 0 ].y();
}
else
{
return g->asPoint().y();
}
}

static QVariant pointAt( const QVariantList& values, QgsFeature* f, QgsExpression* parent ) // helper function
Expand Down

0 comments on commit 4e70885

Please sign in to comment.