[QGIS Commit] r13433 - in trunk/qgis: python/core src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri May 7 04:39:41 EDT 2010


Author: wonder
Date: 2010-05-07 04:39:37 -0400 (Fri, 07 May 2010)
New Revision: 13433

Modified:
   trunk/qgis/python/core/qgssearchtreenode.sip
   trunk/qgis/src/core/qgssearchtreenode.cpp
   trunk/qgis/src/core/qgssearchtreenode.h
Log:
Added optional geometry parameter when evaluating predicates


Modified: trunk/qgis/python/core/qgssearchtreenode.sip
===================================================================
--- trunk/qgis/python/core/qgssearchtreenode.sip	2010-05-06 20:12:59 UTC (rev 13432)
+++ trunk/qgis/python/core/qgssearchtreenode.sip	2010-05-07 08:39:37 UTC (rev 13433)
@@ -90,7 +90,8 @@
     QString makeSearchString();
 
     //! 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
     bool hasError();
@@ -99,6 +100,7 @@
     const QString& errorMsg();
 
     //! wrapper around valueAgainst()
+    //! @note added in 1.4
     bool getValue( QgsSearchTreeValue& value /Out/, QgsSearchTreeNode* node,
                    const QMap<int,QgsField>& fields, const QMap<int,QVariant>& attributes, QgsGeometry* geom = 0 );
 

Modified: trunk/qgis/src/core/qgssearchtreenode.cpp
===================================================================
--- trunk/qgis/src/core/qgssearchtreenode.cpp	2010-05-06 20:12:59 UTC (rev 13432)
+++ trunk/qgis/src/core/qgssearchtreenode.cpp	2010-05-07 08:39:37 UTC (rev 13433)
@@ -250,7 +250,7 @@
 }
 
 
-bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes )
+bool QgsSearchTreeNode::checkAgainst( const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom )
 {
   QgsDebugMsgLevel( "checkAgainst: " + makeSearchString(), 2 );
 
@@ -269,21 +269,21 @@
   switch ( mOp )
   {
     case opNOT:
-      return !mLeft->checkAgainst( fields, attributes );
+      return !mLeft->checkAgainst( fields, attributes, geom );
 
     case opAND:
-      if ( !mLeft->checkAgainst( fields, attributes ) )
+      if ( !mLeft->checkAgainst( fields, attributes, geom ) )
         return false;
-      return mRight->checkAgainst( fields, attributes );
+      return mRight->checkAgainst( fields, attributes, geom );
 
     case opOR:
-      if ( mLeft->checkAgainst( fields, attributes ) )
+      if ( mLeft->checkAgainst( fields, attributes, geom ) )
         return true;
-      return mRight->checkAgainst( fields, attributes );
+      return mRight->checkAgainst( fields, attributes, geom );
 
     case opISNULL:
     case opISNOTNULL:
-      if ( !getValue( value1, mLeft, fields, attributes ) )
+      if ( !getValue( value1, mLeft, fields, attributes, geom ) )
         return false;
 
       if ( mOp == opISNULL )
@@ -302,7 +302,7 @@
     case opGE:
     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;
 
       if ( value1.isNull() || value2.isNull() )
@@ -329,8 +329,8 @@
     case opRegexp:
     case opLike:
     {
-      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;
 
       // value1 is string to be matched

Modified: trunk/qgis/src/core/qgssearchtreenode.h
===================================================================
--- trunk/qgis/src/core/qgssearchtreenode.h	2010-05-06 20:12:59 UTC (rev 13432)
+++ trunk/qgis/src/core/qgssearchtreenode.h	2010-05-07 08:39:37 UTC (rev 13433)
@@ -127,7 +127,8 @@
     QString makeSearchString();
 
     //! 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
     bool hasError() { return ( !mError.isEmpty() ); }
@@ -136,6 +137,7 @@
     const QString& errorMsg() { return mError; }
 
     //! wrapper around valueAgainst()
+    //! @note added in 1.4
     bool getValue( QgsSearchTreeValue& value, QgsSearchTreeNode* node,
                    const QgsFieldMap& fields, const QgsAttributeMap& attributes, QgsGeometry* geom = 0 );
 



More information about the QGIS-commit mailing list