mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Added optional geometry parameter when evaluating predicates
git-svn-id: http://svn.osgeo.org/qgis/trunk@13433 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
3df2e9d33e
commit
b3e9ed7afd
@ -90,7 +90,8 @@ class QgsSearchTreeNode
|
|||||||
QString makeSearchString();
|
QString makeSearchString();
|
||||||
|
|
||||||
//! checks whether the node tree is valid against supplied attributes
|
//! checks whether the node tree is valid against supplied attributes
|
||||||
bool checkAgainst( const QMap<int,QgsField>& fields, const QMap<int, QVariant>& attributes );
|
//! @note optional geom parameter added in 1.5
|
||||||
|
bool checkAgainst( const QMap<int,QgsField>& fields, const QMap<int, QVariant>& attributes, QgsGeometry* geom = 0 );
|
||||||
|
|
||||||
//! checks if there were errors during evaluation
|
//! checks if there were errors during evaluation
|
||||||
bool hasError();
|
bool hasError();
|
||||||
@ -99,6 +100,7 @@ class QgsSearchTreeNode
|
|||||||
const QString& errorMsg();
|
const QString& errorMsg();
|
||||||
|
|
||||||
//! wrapper around valueAgainst()
|
//! wrapper around valueAgainst()
|
||||||
|
//! @note added in 1.4
|
||||||
bool getValue( QgsSearchTreeValue& value /Out/, QgsSearchTreeNode* node,
|
bool getValue( QgsSearchTreeValue& value /Out/, QgsSearchTreeNode* node,
|
||||||
const QMap<int,QgsField>& fields, const QMap<int,QVariant>& attributes, QgsGeometry* geom = 0 );
|
const QMap<int,QgsField>& fields, const QMap<int,QVariant>& attributes, QgsGeometry* geom = 0 );
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ QStringList QgsSearchTreeNode::referencedColumns()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes )
|
bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom )
|
||||||
{
|
{
|
||||||
QgsDebugMsgLevel( "checkAgainst: " + makeSearchString(), 2 );
|
QgsDebugMsgLevel( "checkAgainst: " + makeSearchString(), 2 );
|
||||||
|
|
||||||
@ -269,21 +269,21 @@ bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttrib
|
|||||||
switch ( mOp )
|
switch ( mOp )
|
||||||
{
|
{
|
||||||
case opNOT:
|
case opNOT:
|
||||||
return !mLeft->checkAgainst( fields, attributes );
|
return !mLeft->checkAgainst( fields, attributes, geom );
|
||||||
|
|
||||||
case opAND:
|
case opAND:
|
||||||
if ( !mLeft->checkAgainst( fields, attributes ) )
|
if ( !mLeft->checkAgainst( fields, attributes, geom ) )
|
||||||
return false;
|
return false;
|
||||||
return mRight->checkAgainst( fields, attributes );
|
return mRight->checkAgainst( fields, attributes, geom );
|
||||||
|
|
||||||
case opOR:
|
case opOR:
|
||||||
if ( mLeft->checkAgainst( fields, attributes ) )
|
if ( mLeft->checkAgainst( fields, attributes, geom ) )
|
||||||
return true;
|
return true;
|
||||||
return mRight->checkAgainst( fields, attributes );
|
return mRight->checkAgainst( fields, attributes, geom );
|
||||||
|
|
||||||
case opISNULL:
|
case opISNULL:
|
||||||
case opISNOTNULL:
|
case opISNOTNULL:
|
||||||
if ( !getValue( value1, mLeft, fields, attributes ) )
|
if ( !getValue( value1, mLeft, fields, attributes, geom ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( mOp == opISNULL )
|
if ( mOp == opISNULL )
|
||||||
@ -302,7 +302,7 @@ bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttrib
|
|||||||
case opGE:
|
case opGE:
|
||||||
case opLE:
|
case opLE:
|
||||||
|
|
||||||
if ( !getValue( value1, mLeft, fields, attributes ) || !getValue( value2, mRight, fields, attributes ) )
|
if ( !getValue( value1, mLeft, fields, attributes, geom ) || !getValue( value2, mRight, fields, attributes, geom ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( value1.isNull() || value2.isNull() )
|
if ( value1.isNull() || value2.isNull() )
|
||||||
@ -329,8 +329,8 @@ bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttrib
|
|||||||
case opRegexp:
|
case opRegexp:
|
||||||
case opLike:
|
case opLike:
|
||||||
{
|
{
|
||||||
if ( !getValue( value1, mLeft, fields, attributes ) ||
|
if ( !getValue( value1, mLeft, fields, attributes, geom ) ||
|
||||||
!getValue( value2, mRight, fields, attributes ) )
|
!getValue( value2, mRight, fields, attributes, geom ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// value1 is string to be matched
|
// value1 is string to be matched
|
||||||
|
@ -127,7 +127,8 @@ class CORE_EXPORT QgsSearchTreeNode
|
|||||||
QString makeSearchString();
|
QString makeSearchString();
|
||||||
|
|
||||||
//! checks whether the node tree is valid against supplied attributes
|
//! checks whether the node tree is valid against supplied attributes
|
||||||
bool checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes );
|
//! @note optional geom parameter added in 1.5
|
||||||
|
bool checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
|
||||||
|
|
||||||
//! checks if there were errors during evaluation
|
//! checks if there were errors during evaluation
|
||||||
bool hasError() { return ( !mError.isEmpty() ); }
|
bool hasError() { return ( !mError.isEmpty() ); }
|
||||||
@ -136,6 +137,7 @@ class CORE_EXPORT QgsSearchTreeNode
|
|||||||
const QString& errorMsg() { return mError; }
|
const QString& errorMsg() { return mError; }
|
||||||
|
|
||||||
//! wrapper around valueAgainst()
|
//! wrapper around valueAgainst()
|
||||||
|
//! @note added in 1.4
|
||||||
bool getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node,
|
bool getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node,
|
||||||
const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
|
const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user