[fdo-commits] r237 - branches/3.2.x/Providers/SDF/Src/Utils
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Fri Mar 16 15:13:28 EDT 2007
Author: danstoica
Date: 2007-03-16 15:13:28 -0400 (Fri, 16 Mar 2007)
New Revision: 237
Modified:
branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.cpp
branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.h
Log:
Fixed secondary filtering in the presence of Multipolygons
Modified: branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.cpp
===================================================================
--- branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.cpp 2007-03-15 13:18:34 UTC (rev 236)
+++ branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.cpp 2007-03-16 19:13:28 UTC (rev 237)
@@ -26,7 +26,7 @@
#include "DateTimeValue.h"
#include "NullValue.h"
#include <FdoSpatial.h>
-#include "FdoCommonMiscUtil.h"
+#include <FdoCommonMiscUtil.h>
#include <wctype.h>
#include <malloc.h>
#include <math.h>
@@ -333,8 +333,11 @@
FdoPtr<FdoIGeometry> geomRight = gf->CreateGeometryFromFgf(baRight);
FdoPtr<FdoIGeometry> geomLeft = gf->CreateGeometryFromFgf(fgf, fgfLen);
+ // A polygon might be actually a multi polygon.
+ FdoPtr<FdoIGeometry> geometry = ReconstructPolygon( geomLeft );
+
//call on the geometry utility to evaluate the spatial operation
- bool ret = FdoSpatialUtility::Evaluate(geomLeft, filter.GetOperation(), geomRight);
+ bool ret = FdoSpatialUtility::Evaluate( geometry? geometry : geomLeft, filter.GetOperation(), geomRight);
m_retvals.push(m_pPool->ObtainBooleanValue(ret));
}
@@ -998,5 +1001,26 @@
m_retvals.push(m_pPool->ObtainInt64Value(color));
}
+// Returns NULL in case geometry was not reconstructed
+FdoIGeometry *FilterExecutor::ReconstructPolygon( FdoIGeometry *geometry )
+{
+ FdoPtr<FdoIGeometry> newGeometry;
+ if ( geometry->GetDerivedType() == FdoGeometryType_Polygon )
+ {
+ FdoIPolygon * poly = (FdoIPolygon *)geometry;
+ if ( poly->GetInteriorRingCount() != 0 )
+ {
+ FdoPtr<FdoLinearRingCollection> rings = FdoLinearRingCollection::Create ();
+ for (int i = 0; i < poly->GetInteriorRingCount(); i++)
+ {
+ FdoPtr<FdoILinearRing> ring = poly->GetInteriorRing(i);
+ rings->Add(ring);
+ }
+ newGeometry = FdoSpatialUtility::CreateGeometryFromRings (rings, true);
+ }
+ }
+ return FDO_SAFE_ADDREF(newGeometry.p);
+}
+
Modified: branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.h
===================================================================
--- branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.h 2007-03-15 13:18:34 UTC (rev 236)
+++ branches/3.2.x/Providers/SDF/Src/Utils/FilterExecutor.h 2007-03-16 19:13:28 UTC (rev 237)
@@ -154,6 +154,9 @@
void ProcessFunctionCeilFloor( FdoString *name, DataValue* argLeft );
void ExecuteARGB(FdoFunction& function);
+
+ FdoIGeometry* ReconstructPolygon( FdoIGeometry *geometry );
+
//pattern matching
bool MatchesHere(wchar_t* pattern, wchar_t* src);
More information about the fdo-commits
mailing list