Skip to content
Permalink
Browse files

[refFunctions] json helps and cleanup

  • Loading branch information
olivierdalang committed Sep 8, 2020
1 parent e3150d0 commit 900cef324afd3a9d90552c2146e69489d44b4c2f
@@ -20,6 +20,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -21,6 +21,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -21,6 +21,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -20,6 +20,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -21,6 +21,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -26,6 +26,12 @@
"arg": "max_distance",
"description": "an optional maximum distance to limit the number of matching features (if not set, only the nearest feature will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -21,6 +21,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -21,6 +21,12 @@
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"optional": true
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
"default": false
}
],
"examples": [
@@ -5795,7 +5795,7 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
}
else
{
cachedTarget = context->cachedValue( cacheLayer ).value<QgsVectorLayer*>();
cachedTarget = context->cachedValue( cacheLayer ).value<QgsVectorLayer *>();
}

if ( !context->hasCachedValue( cacheIndex ) )
@@ -5820,7 +5820,7 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
fidsList = spatialIndex.intersects( intDomain );
}

QListIterator<QgsFeatureId> i(fidsList);
QListIterator<QgsFeatureId> i( fidsList );
while ( i.hasNext() )
{
// TODO : ignore feature if same as this (and remove logic below)
@@ -5832,8 +5832,8 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
{
// If the cache (local spatial index) is not enabled, we directly
// get the features from the target layer
request.setFilterRect(intDomain);
QgsFeatureIterator fit = targetLayer->getFeatures(request);
request.setFilterRect( intDomain );
QgsFeatureIterator fit = targetLayer->getFeatures( request );
QgsFeature feat;
while ( fit.nextFeature( feat ) )
{
@@ -5855,7 +5855,7 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
bool found = false;
QVariantList results;

QListIterator<QgsFeature> i(features);
QListIterator<QgsFeature> i( features );
while ( i.hasNext() )
{
QgsFeature feat = i.next();
@@ -5920,8 +5920,6 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress

// Intersect functions:

typedef bool ( QgsGeometry::*t_relationFunction )( const QgsGeometry &geometry ) const;

static QVariant fcnGeomOverlayIntersects( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
return executeGeomOverlay( values, context, parent, &QgsGeometry::intersects );
@@ -6329,7 +6327,8 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
yFunc->setIsStatic( false );
functions << yFunc;

QMap< QString, QgsExpressionFunction::FcnEval > geometry_overlay_definitions {
QMap< QString, QgsExpressionFunction::FcnEval > geometry_overlay_definitions
{
{ QStringLiteral( "geometry_overlay_intersects" ), fcnGeomOverlayIntersects },
{ QStringLiteral( "geometry_overlay_contains" ), fcnGeomOverlayContains },
{ QStringLiteral( "geometry_overlay_crosses" ), fcnGeomOverlayCrosses },

0 comments on commit 900cef3

Please sign in to comment.
You can’t perform that action at this time.