[fdo-commits] r2668 - trunk/Providers/SDF/Src/Provider

svn_fdo at osgeo.org svn_fdo at osgeo.org
Fri Mar 9 14:06:24 EST 2007


Author: badreddinekaroui
Date: 2007-03-09 14:06:24 -0500 (Fri, 09 Mar 2007)
New Revision: 2668

Modified:
   trunk/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
   trunk/Providers/SDF/Src/Provider/SdfSelect.cpp
Log:
Merge ticket #21 fix from 2.1.1 branch to the trunk


Modified: trunk/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp	2007-03-09 19:06:03 UTC (rev 2667)
+++ trunk/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp	2007-03-09 19:06:24 UTC (rev 2668)
@@ -153,11 +153,21 @@
         //update optimized query also by pushing
         //the old filter -- it could not be optimized
         m_filters.push_back(FDO_SAFE_ADDREF(&filter));
-        fLeft->Release();
-        delete argLeft;
+		if( fLeft != NULL )
+			fLeft->Release();
+        
         return;
     }
     
+	if( filter.GetOperation() == FdoBinaryLogicalOperations_And && argLeft != NULL && argLeft->size() > 0 && fLeft == NULL )
+	{
+		// The left side reduced the condidate list to a smaller set and optimized away the left filter
+		// We only need to apply the right filter to the reduced set.
+		m_filters.push_back( right.Detach() );
+		m_retvals.push_back(argLeft);
+        return;
+	}
+
     //evaluate right hand side
     right->Process(this);
     
@@ -406,9 +416,11 @@
         //by returning only features whose bounding boxes intersect with the 
         //bounding box of the input. The actual query result is guaranteed
         //to be a subset of the R-Tree search.
-        else if (      filter.GetOperation() == FdoSpatialOperations_Intersects 
+        else if ( filter.GetOperation() == FdoSpatialOperations_Intersects 
             || filter.GetOperation() == FdoSpatialOperations_Contains
-            || filter.GetOperation() == FdoSpatialOperations_Within)
+            || filter.GetOperation() == FdoSpatialOperations_Within
+			|| filter.GetOperation() == FdoSpatialOperations_Inside
+			|| filter.GetOperation() == FdoSpatialOperations_Crosses )
         {
 
             FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
@@ -417,7 +429,7 @@
             Bounds bounds;
             FdoSpatialUtility::GetExtents(fgf, bounds.minx, bounds.miny, bounds.maxx, bounds.maxy);
 
-            if (bounds.maxx >= bounds.minx && bounds.maxy >= bounds.miny)
+            if (bounds.maxx >= bounds.minx && bounds.maxy >= bounds.miny )
             {
                 //expand a little to catch point features that lie exactly on the bounds
                 Bounds bounds2(bounds.minx - SDF_GLOBAL_TOLERANCE, 

Modified: trunk/Providers/SDF/Src/Provider/SdfSelect.cpp
===================================================================
--- trunk/Providers/SDF/Src/Provider/SdfSelect.cpp	2007-03-09 19:06:03 UTC (rev 2667)
+++ trunk/Providers/SDF/Src/Provider/SdfSelect.cpp	2007-03-09 19:06:24 UTC (rev 2668)
@@ -121,6 +121,10 @@
 		FdoPtr<FdoIFilterCapabilities> filterCaps = m_connection->GetFilterCapabilities();
 
         FdoCommonFilterExecutor::ValidateFilter( clas, m_filter, m_properties, filterCaps );
+		
+		FdoFilter* newFilter = FdoCommonFilterExecutor::OptimizeFilter( m_filter );
+		FDO_SAFE_RELEASE(m_filter);
+		m_filter = newFilter;
 	}
 
     //get the R-Tree for this feature class... 



More information about the fdo-commits mailing list