-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref functions #62
Open
m-kuhn
wants to merge
12
commits into
m-kuhn:refFunctions
Choose a base branch
from
enricofer:refFunctions
base: refFunctions
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ref functions #62
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4368205
new overlay functions
enricofer 78d5400
overlay functions first implementation
enricofer 5b203a6
optional parameter handling, disjoint, nearest multiresult
enricofer 8b26b46
limit overlay nearest neighbors to 1
enricofer 8c4a04c
geometry overlay functions test suite
enricofer 8a25613
limit features parameter; grow spatial index query geometry bbox for …
enricofer d493303
limit parameter default changed to -1
enricofer 35bba7f
further optional parameters decode hack
enricofer 32b7a00
right limit parameter extraction method
enricofer cd58105
exclude current feature for self overlay layer
enricofer d370b50
target layer with different crs reproject support
enricofer 569f1a3
different crs reprojection code revision
enricofer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4926,8 +4926,13 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress | |||||||||||
request.setFilterExpression( filterString ); //filter cached features | ||||||||||||
} | ||||||||||||
|
||||||||||||
int limit = QgsExpressionUtils::getIntValue( values.at( 3 ), parent ); //in expressions overlay functions throw the exception: Eval Error: Cannot convert '' to int | ||||||||||||
request.setLimit( limit ); | ||||||||||||
node = QgsExpressionUtils::getNode( values.at( 3 ), parent ); //in expressions overlay functions throw the exception: Eval Error: Cannot convert '' to int | ||||||||||||
ENSURE_NO_EVAL_ERROR | ||||||||||||
QString limitString = node->dump(); | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to go for the following:
Suggested change
The issue is, that we need to do "lazy evaluation" in this method. We can't let the expression evaluate everything because we need to take care of the "filter" string manually and evaluate it with a different context. |
||||||||||||
if ( limitString != "NULL" ) { | ||||||||||||
int limit = QgsExpressionUtils::getIntValue( limitString, parent ); | ||||||||||||
request.setLimit( limit ); | ||||||||||||
} | ||||||||||||
|
||||||||||||
int neighbors = 1; | ||||||||||||
/* | ||||||||||||
|
@@ -5474,7 +5479,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant(), true), | ||||||||||||
fcnGeomOverlayIntersects, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayIntersectsFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5493,7 +5498,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
// TODO: limit param | ||||||||||||
fcnGeomOverlayContains, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
|
@@ -5513,7 +5518,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
fcnGeomOverlayCrosses, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayCrossesFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5532,7 +5537,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
fcnGeomOverlayEquals, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayEqualsFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5551,7 +5556,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
fcnGeomOverlayTouches, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayTouchesFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5570,7 +5575,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
fcnGeomOverlayDisjoint, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayDisjointFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5589,7 +5594,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ), | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ), | ||||||||||||
fcnGeomOverlayWithin, QStringLiteral( "GeometryGroup" ), QString(), false, QSet<QString>() << QgsFeatureRequest::ALL_ATTRIBUTES, true ); | ||||||||||||
// The current feature is accessed for the geometry, so this should not be cached | ||||||||||||
fcnGeomOverlayWithinFunc->setIsStatic( false ); | ||||||||||||
|
@@ -5608,7 +5613,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions() | |||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "layer" ) ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "filter" ), true, QVariant(), true ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, -1 ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true, QVariant() ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "neighbors" ), true, 1 ) | ||||||||||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "max_distance" ), true, 0 ), | ||||||||||||
//<< QgsExpressionFunction::Parameter( QStringLiteral( "limit" ), true ), | ||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that further optional parameters have to be interpreted as an expression and then converted to int. The result is a bit tricky, but goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it is the proper way to do this....