[fdo-commits] r233 - branches/3.2.x/Providers/SDF/Src/Provider

svn_fdo at osgeo.org svn_fdo at osgeo.org
Fri Mar 9 13:48:04 EST 2007


Author: badreddinekaroui
Date: 2007-03-09 13:48:04 -0500 (Fri, 09 Mar 2007)
New Revision: 233

Modified:
   branches/3.2.x/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
   branches/3.2.x/Providers/SDF/Src/Provider/SdfSelect.cpp
Log:
Merge ticket #21 fix from 2.1.1 branch to 2.1.x


Modified: branches/3.2.x/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
===================================================================
--- branches/3.2.x/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp	2007-03-09 01:43:39 UTC (rev 232)
+++ branches/3.2.x/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp	2007-03-09 18:48:04 UTC (rev 233)
@@ -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: branches/3.2.x/Providers/SDF/Src/Provider/SdfSelect.cpp
===================================================================
--- branches/3.2.x/Providers/SDF/Src/Provider/SdfSelect.cpp	2007-03-09 01:43:39 UTC (rev 232)
+++ branches/3.2.x/Providers/SDF/Src/Provider/SdfSelect.cpp	2007-03-09 18:48:04 UTC (rev 233)
@@ -122,6 +122,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