Skip to content
Permalink
Browse files
multipoint geometry support in Field Calculator (fix #5513)
  • Loading branch information
alexbruy committed Apr 29, 2012
1 parent d3a50e8 commit 4e70885db9156a5e357c119745a585106ac8ea25
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/core/qgsexpression.cpp
@@ -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

0 comments on commit 4e70885

Please sign in to comment.