[fdo-commits] r778 - in branches/3.2.x/Utilities/Common: Inc Src

svn_fdo at osgeo.org svn_fdo at osgeo.org
Wed Feb 14 18:53:43 EST 2007


Author: danstoica
Date: 2007-02-14 18:53:42 -0500 (Wed, 14 Feb 2007)
New Revision: 778

Modified:
   branches/3.2.x/Utilities/Common/Inc/FdoCommonFilterExecutor.h
   branches/3.2.x/Utilities/Common/Src/FdoCommonFilterExecutor.cpp
Log:
Validate spatial operators in the filter at Execute() time.

Modified: branches/3.2.x/Utilities/Common/Inc/FdoCommonFilterExecutor.h
===================================================================
--- branches/3.2.x/Utilities/Common/Inc/FdoCommonFilterExecutor.h	2007-02-14 23:26:23 UTC (rev 777)
+++ branches/3.2.x/Utilities/Common/Inc/FdoCommonFilterExecutor.h	2007-02-14 23:53:42 UTC (rev 778)
@@ -77,7 +77,7 @@
     /// \return
 	/// Throws "The identifier 'IdName' was not recognized" exception.
     /// 
-	static void ValidateFilter( FdoClassDefinition *cls, FdoFilter *filter, FdoIdentifierCollection *selIds = NULL );
+	static void ValidateFilter( FdoClassDefinition *cls, FdoFilter *filter, FdoIdentifierCollection *selIds = NULL, FdoIFilterCapabilities *filterCapabilities = NULL);
 
     /// \brief
     /// Increase the reference count.

Modified: branches/3.2.x/Utilities/Common/Src/FdoCommonFilterExecutor.cpp
===================================================================
--- branches/3.2.x/Utilities/Common/Src/FdoCommonFilterExecutor.cpp	2007-02-14 23:26:23 UTC (rev 777)
+++ branches/3.2.x/Utilities/Common/Src/FdoCommonFilterExecutor.cpp	2007-02-14 23:53:42 UTC (rev 778)
@@ -3797,13 +3797,16 @@
     }
 }
 
-void FdoCommonFilterExecutor::ValidateFilter( FdoClassDefinition *cls, FdoFilter *filter, FdoIdentifierCollection *selIds )
+void FdoCommonFilterExecutor::ValidateFilter( FdoClassDefinition *cls, FdoFilter *filter, 
+											  FdoIdentifierCollection *selIds,
+											  FdoIFilterCapabilities *filterCapabilities )
 {
     class FdoCommonFilterValidator : public virtual FdoIExpressionProcessor, public virtual FdoIFilterProcessor
     {
     private:
         FdoClassDefinition* m_class;
 		FdoIdentifierCollection *m_selectedIds;
+		FdoIFilterCapabilities	*m_filterCapabilities;
 
     protected:
 
@@ -3817,10 +3820,11 @@
         }
     public:
 
-        FdoCommonFilterValidator( FdoClassDefinition *cls, FdoIdentifierCollection *selIds )
+        FdoCommonFilterValidator( FdoClassDefinition *cls, FdoIdentifierCollection *selIds, FdoIFilterCapabilities *filterCapabilities )
         {
             m_class = cls;
 			m_selectedIds = selIds;
+			m_filterCapabilities = filterCapabilities;
         }
 
         virtual void Dispose() { delete this; }
@@ -3895,8 +3899,22 @@
         {
             ProcessIdentifier( *(FdoPtr<FdoIdentifier>(filter.GetPropertyName())) );
         }
-        virtual void ProcessSpatialCondition(FdoSpatialCondition& filter){  }
+        virtual void ProcessSpatialCondition(FdoSpatialCondition& filter)
+		{  
+			FdoSpatialOperations	op = filter.GetOperation();
+			bool					found = false;
+			int						numSpatialOps;
 
+			FdoSpatialOperations	*supportedSpatialOps = m_filterCapabilities->GetSpatialOperations( numSpatialOps );
+
+			for ( int i =0; i < numSpatialOps && !found; i++ )
+			{
+				found = ( op == supportedSpatialOps[i] );
+			}
+			if ( !found )
+				throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID(FDO_105_UNSUPPORTED_SPATIAL_OPERATION)));
+		}
+
         virtual void ProcessUnaryLogicalOperator(FdoUnaryLogicalOperator& filter)
         {
             HandleFilter( FdoPtr<FdoFilter>(filter.GetOperand()) );
@@ -3950,7 +3968,7 @@
         }
     };
 
-    FdoCommonFilterValidator  validator(cls, selIds);
+    FdoCommonFilterValidator  validator(cls, selIds, filterCapabilities);
     filter->Process( &validator ); 
 }
 



More information about the fdo-commits mailing list