[fdo-commits] r222 - branches/3.2.1/Providers/SDF/Src/Provider
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Sun Feb 25 12:23:06 EST 2007
Author: badreddinekaroui
Date: 2007-02-25 12:23:06 -0500 (Sun, 25 Feb 2007)
New Revision: 222
Modified:
branches/3.2.1/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
branches/3.2.1/Providers/SDF/Src/Provider/SdfSelect.cpp
Log:
See ticket #21
Modified: branches/3.2.1/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp
===================================================================
--- branches/3.2.1/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp 2007-02-24 12:54:22 UTC (rev 221)
+++ branches/3.2.1/Providers/SDF/Src/Provider/SdfQueryOptimizer.cpp 2007-02-25 17:23:06 UTC (rev 222)
@@ -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->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.1/Providers/SDF/Src/Provider/SdfSelect.cpp
===================================================================
--- branches/3.2.1/Providers/SDF/Src/Provider/SdfSelect.cpp 2007-02-24 12:54:22 UTC (rev 221)
+++ branches/3.2.1/Providers/SDF/Src/Provider/SdfSelect.cpp 2007-02-25 17:23:06 UTC (rev 222)
@@ -21,8 +21,7 @@
#include "SdfQueryOptimizer.h"
#include "SdfSimpleFeatureReader.h"
#include "FilterExecutor.h"
-#include <FdoCommonFilterExecutor.h>
-
+#include "FdoCommonFilterExecutor.h"
//-------------------------------------------------------
// Constructor / destructor
//-------------------------------------------------------
@@ -118,7 +117,13 @@
throw FdoException::Create(NlsMsgGetMain(FDO_NLSID(SDFPROVIDER_75_CLASS_NOTFOUND), m_className->GetName()));
if( m_filter != NULL )
+ {
FdoCommonFilterExecutor::ValidateFilter( clas, m_filter, m_properties );
+
+ FdoFilter* newFilter = FdoCommonFilterExecutor::OptimizeFilter( m_filter );
+ FDO_SAFE_RELEASE(m_filter);
+ m_filter = newFilter;
+ }
//get the R-Tree for this feature class...
SdfRTree* rt = m_connection->GetRTree(clas);
More information about the fdo-commits
mailing list