Skip to content

Commit 33e0710

Browse files
enricoferm-kuhn
authored andcommitted
right limit parameter extraction method
1 parent e741750 commit 33e0710

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/core/expression/qgsexpressionfunction.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5694,11 +5694,10 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
56945694

56955695
node = QgsExpressionUtils::getNode( values.at( 3 ), parent ); //in expressions overlay functions throw the exception: Eval Error: Cannot convert '' to int
56965696
ENSURE_NO_EVAL_ERROR
5697-
QString limitString = node->dump();
5698-
if ( limitString != "NULL" ) {
5699-
int limit = QgsExpressionUtils::getIntValue( limitString, parent );
5700-
request.setLimit( limit );
5701-
}
5697+
QVariant limitValue = node->eval( parent, context );
5698+
ENSURE_NO_EVAL_ERROR
5699+
qlonglong limit = QgsExpressionUtils::getIntValue( limitValue, parent );
5700+
request.setLimit( limit );
57025701

57035702
int neighbors = 1;
57045703
/*
@@ -6289,7 +6288,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
62896288
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
62906289
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
62916290
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6292-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(), true),
6291+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true),
62936292
fcnGeomOverlayIntersects, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
62946293

62956294
// The current feature is accessed for the geometry, so this should not be cached
@@ -6309,7 +6308,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
63096308
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
63106309
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
63116310
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6312-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6311+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true),
63136312
// TODO: limit param
63146313
fcnGeomOverlayContains, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
63156314
// The current feature is accessed for the geometry, so this should not be cached
@@ -6329,7 +6328,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
63296328
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
63306329
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
63316330
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6332-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6331+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true),
63336332
fcnGeomOverlayCrosses, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
63346333
// The current feature is accessed for the geometry, so this should not be cached
63356334
fcnGeomOverlayCrossesFunc->setIsStatic( false );
@@ -6348,7 +6347,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
63486347
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
63496348
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
63506349
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6351-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6350+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true),
63526351
fcnGeomOverlayEquals, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
63536352
// The current feature is accessed for the geometry, so this should not be cached
63546353
fcnGeomOverlayEqualsFunc->setIsStatic( false );
@@ -6367,7 +6366,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
63676366
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
63686367
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
63696368
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6370-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6369+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true),
63716370
fcnGeomOverlayTouches, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
63726371
// The current feature is accessed for the geometry, so this should not be cached
63736372
fcnGeomOverlayTouchesFunc->setIsStatic( false );
@@ -6386,7 +6385,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
63866385
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
63876386
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
63886387
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6389-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6388+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true ),
63906389
fcnGeomOverlayDisjoint, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
63916390
// The current feature is accessed for the geometry, so this should not be cached
63926391
fcnGeomOverlayDisjointFunc->setIsStatic( false );
@@ -6405,7 +6404,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
64056404
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
64066405
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
64076406
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6408-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ),
6407+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true ),
64096408
fcnGeomOverlayWithin, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true );
64106409
// The current feature is accessed for the geometry, so this should not be cached
64116410
fcnGeomOverlayWithinFunc->setIsStatic( false );
@@ -6424,7 +6423,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
64246423
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) )
64256424
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true )
64266425
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true )
6427-
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() )
6426+
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(-1), true )
64286427
<< QgsExpressionFunction::Parameter( QStringLiteral( "neighbors" ), true, 1 )
64296428
<< QgsExpressionFunction::Parameter( QStringLiteral( "max_distance" ), true, 0 ),
64306429
//<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true ),

0 commit comments

Comments
 (0)