[fdo-commits] r97 - trunk/Providers/WFS/Src/Provider

svn_fdo at osgeo.org svn_fdo at osgeo.org
Fri Jan 26 15:17:26 EST 2007


Author: gregboone
Date: 2007-01-26 15:17:26 -0500 (Fri, 26 Jan 2007)
New Revision: 97

Modified:
   trunk/Providers/WFS/Src/Provider/FdoWfsSelectAggregatesCommand.cpp
   trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp
   trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.h
Log:
This submission fixes defect 875813: WFS SelectAggregates command reports no geometry property

The problem with the http://webservices.ionicsoft.com/unData/wfs/UN BND_ANNO class is that it contains 2 geometry properties. Due to this fact, the FdoClassDefinition does not have it's Primary Geometry Property value set. A solution to this defect will be to relax the check on the geometry property name passed in to the SpatialExtents function so that the provider only determines that the geometry property is defined on the class.

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsSelectAggregatesCommand.cpp
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsSelectAggregatesCommand.cpp	2007-01-26 00:30:38 UTC (rev 96)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsSelectAggregatesCommand.cpp	2007-01-26 20:17:26 UTC (rev 97)
@@ -151,19 +151,27 @@
                 NlsMsgGet(FDO_NLSID(WFS_CANNOT_QUERY_ABSTRACT_CLASS), (FdoString*)className));
         }
 
-        FdoPtr<FdoGeometricPropertyDefinition> geomProp = featureClass->GetGeometryProperty();
-        if (!geomProp) {
-            throw FdoCommandException::Create (
-                NlsMsgGet(FDO_NLSID(WFS_FEATURE_NO_GEOMETRY_PROPERTY), (FdoString*)className));
+        FdoBoolean bGeomPropertyFound = false;
+        FdoPtr<FdoPropertyDefinitionCollection> props = classDef->GetProperties();
+        for (int k = 0; k < props->GetCount(); k++)
+        {
+            FdoPtr<FdoPropertyDefinition> prop = props->GetItem(k);
+            if (prop->GetPropertyType() == FdoPropertyType_GeometricProperty)
+            {
+                FdoGeometricPropertyDefinition* geomProp = static_cast<FdoGeometricPropertyDefinition*>(prop.p);
+                if (wcscmp(argId->GetName(), geomProp->GetName()) == 0) {
+                    bGeomPropertyFound = true;
+                    break;
+                }
+            }
         }
-
-        if (wcscmp(argId->GetName(), geomProp->GetName()) != 0) {
+        if (!bGeomPropertyFound) {
             throw FdoCommandException::Create (
                 NlsMsgGet(FDO_NLSID(WFS_SELECTAGGREGATES_INVALID_ARGUMENT_TYPE), argId->GetName(), (FdoString*)className));
         }
     }
 
-    return new FdoWfsSpatialExtentsAggregateReader(mConnection, (FdoString*)className, computedIdentifier->GetName());
+    return new FdoWfsSpatialExtentsAggregateReader(mConnection, mClassName, computedIdentifier->GetName());
 }
 
 

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp	2007-01-26 00:30:38 UTC (rev 96)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp	2007-01-26 20:17:26 UTC (rev 97)
@@ -24,7 +24,7 @@
 #include "FdoWfsFeatureType.h"
 
 
-FdoWfsSpatialExtentsAggregateReader::FdoWfsSpatialExtentsAggregateReader(FdoWfsConnection* conn, FdoString* layerName, FdoString* aliasName) :
+FdoWfsSpatialExtentsAggregateReader::FdoWfsSpatialExtentsAggregateReader(FdoWfsConnection* conn, FdoIdentifier* className, FdoString* aliasName) :
     m_ReaderIndex(-1),
     m_AliasName(aliasName)
 {
@@ -34,10 +34,13 @@
     FdoPtr<FdoWfsFeatureTypeCollection> featTypes = featTypeList->GetFeatureTypes ();
 
     // Get the class name and feature type 
-    FdoPtr<FdoWfsFeatureType> featureType = featTypes->FindItem (layerName);
+    FdoPtr<FdoWfsFeatureType> featureType = featTypes->FindItem (className->GetName());
     if (featureType == NULL) {
-        throw FdoCommandException::Create (
-            NlsMsgGet(FDO_NLSID(WFS_NAMED_FEATURETYPE_NOT_FOUND), (FdoString*)layerName));
+        featureType = featTypes->FindItem (className->GetText());
+        if (featureType == NULL) {
+            throw FdoCommandException::Create (
+                NlsMsgGet(FDO_NLSID(WFS_NAMED_FEATURETYPE_NOT_FOUND), (FdoString*)className->GetText()));
+        }
     }
 
     // Get the total extent of the feature type
@@ -48,26 +51,26 @@
     {
         // Get the extents from the bounding box collection
         FdoOwsGeographicBoundingBoxP bbox = extents->GetExtents();
-	    
+        
         // Copy the extent values to an array of doubles
         double ordinates[10];
-	    ordinates[0] = bbox->GetWestBoundLongitude ();
-	    ordinates[1] = bbox->GetSouthBoundLatitude ();
-	    ordinates[2] = bbox->GetEastBoundLongitude ();
-	    ordinates[3] = bbox->GetSouthBoundLatitude ();
-	    ordinates[4] = bbox->GetEastBoundLongitude ();
-	    ordinates[5] = bbox->GetNorthBoundLatitude ();
-	    ordinates[6] = bbox->GetWestBoundLongitude ();
-	    ordinates[7] = bbox->GetNorthBoundLatitude ();
-	    ordinates[8] = bbox->GetWestBoundLongitude ();
-	    ordinates[9] = bbox->GetSouthBoundLatitude ();
+        ordinates[0] = bbox->GetWestBoundLongitude ();
+        ordinates[1] = bbox->GetSouthBoundLatitude ();
+        ordinates[2] = bbox->GetEastBoundLongitude ();
+        ordinates[3] = bbox->GetSouthBoundLatitude ();
+        ordinates[4] = bbox->GetEastBoundLongitude ();
+        ordinates[5] = bbox->GetNorthBoundLatitude ();
+        ordinates[6] = bbox->GetWestBoundLongitude ();
+        ordinates[7] = bbox->GetNorthBoundLatitude ();
+        ordinates[8] = bbox->GetWestBoundLongitude ();
+        ordinates[9] = bbox->GetSouthBoundLatitude ();
 
         // Create a linear ring using the bounding box ordinates 
-	    FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
-	    FdoPtr<FdoILinearRing> linearRing = gf->CreateLinearRing(FdoDimensionality_XY, 10, ordinates);
+        FdoPtr<FdoFgfGeometryFactory> gf = FdoFgfGeometryFactory::GetInstance();
+        FdoPtr<FdoILinearRing> linearRing = gf->CreateLinearRing(FdoDimensionality_XY, 10, ordinates);
 
         // Create a polygon geometry representing the extents from the linear ring
-	    m_Extents = gf->CreatePolygon(linearRing, NULL);
+        m_Extents = gf->CreatePolygon(linearRing, NULL);
     }
 }
 

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.h
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.h	2007-01-26 00:30:38 UTC (rev 96)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.h	2007-01-26 20:17:26 UTC (rev 97)
@@ -20,7 +20,7 @@
 {
 public:
 
-    FdoWfsSpatialExtentsAggregateReader(FdoWfsConnection* con, FdoString* layerName, FdoString* aliasName);
+    FdoWfsSpatialExtentsAggregateReader(FdoWfsConnection* con, FdoIdentifier* className, FdoString* aliasName);
     virtual ~FdoWfsSpatialExtentsAggregateReader();
 
 protected:



More information about the fdo-commits mailing list