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

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


Author: romicadascalescu
Date: 2007-01-26 15:33:19 -0500 (Fri, 26 Jan 2007)
New Revision: 99

Modified:
   trunk/Providers/WFS/Src/Provider/FdoWfsSelectCommand.cpp
   trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.cpp
   trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.h
   trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp
Log:
Fixed WFS: Fail to get spatial extent

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsSelectCommand.cpp
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsSelectCommand.cpp	2007-01-26 20:32:45 UTC (rev 98)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsSelectCommand.cpp	2007-01-26 20:33:19 UTC (rev 99)
@@ -139,16 +139,12 @@
 	// validate the featureType by service metadata
 	// and at the same time find out the srs name that this feature type uses
 	FdoString* srsName = L"EPSG:4326";
-	if (featureTypeName != NULL) {
+	if (featureTypeName != NULL)
+    {
         FdoPtr<FdoWfsServiceMetadata> metadata = mConnection->GetServiceMetadata();
-        FdoPtr<FdoWfsFeatureTypeList> typeList = metadata->GetFeatureTypeList();
-        FdoPtr<FdoWfsFeatureTypeCollection> featTypes = typeList->GetFeatureTypes();
-        FdoPtr<FdoWfsFeatureType> featureType = featTypes->FindItem (mClassName->GetName());
-        if (featureType == NULL) {
-            featureType = featTypes->FindItem (mClassName->GetText());
-            if (featureType != NULL)
+        FdoPtr<FdoWfsFeatureType> featureType = metadata->GetFeatureType(mClassName);
+        if (featureType != NULL)
             srsName = featureType->GetSRS();
-        }
 	}
 
 	if (featureTypeName == NULL || srsName == NULL) { // no match found

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.cpp
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.cpp	2007-01-26 20:32:45 UTC (rev 98)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.cpp	2007-01-26 20:33:19 UTC (rev 99)
@@ -209,3 +209,39 @@
 		desBox->SetSouthBoundLatitude (srcBox->GetSouthBoundLatitude ());
 }
 
+FdoWfsFeatureType* FdoWfsServiceMetadata::GetFeatureType(FdoIdentifier* className)
+{
+    FdoPtr<FdoWfsFeatureTypeCollection> featTypes = m_featureTypeList->GetFeatureTypes();
+    FdoPtr<FdoWfsFeatureType> featureType = featTypes->FindItem (className->GetName());
+    if (featureType == NULL)
+    {
+        featureType = featTypes->FindItem (className->GetText());
+        if (featureType == NULL)
+        {
+            std::wstring lhs = className->GetName();
+	        for (int i = 0; i < featTypes->GetCount(); i++)
+            {
+		        FdoPtr<FdoWfsFeatureType> fType = featTypes->GetItem(i);
+                std::wstring rhs = fType->GetName();
+                std::wstring::size_type idxSep = rhs.find(L':');
+                bool foundit = false;
+                if (idxSep != std::wstring::npos)
+                {
+                    std::wstring::size_type szComp = rhs.size() - (idxSep+1);
+                    if(lhs.size() == szComp && !rhs.compare(idxSep+1, szComp < lhs.size() ? lhs.size() : szComp, lhs))
+                        foundit = true;
+                }
+                else {
+                    if (rhs == className->GetName())
+                        foundit = true;
+                }
+                if (foundit)
+                {
+                    featureType = fType;
+                    break;
+                }
+            }
+        }
+    }
+    return FDO_SAFE_ADDREF (featureType.p);
+}

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.h
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.h	2007-01-26 20:32:45 UTC (rev 98)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsServiceMetadata.h	2007-01-26 20:33:19 UTC (rev 99)
@@ -27,6 +27,7 @@
 
 class FdoWfsFeatureTypeList;
 class FdoWfsOgcFilterCapabilities;
+class FdoWfsFeatureType;
 
 class FdoWfsServiceMetadata : public FdoOwsServiceMetadata
 {
@@ -65,7 +66,7 @@
 
     virtual FdoXmlSaxContext* GetSaxContext();
 
-
+    FdoWfsFeatureType* GetFeatureType(FdoIdentifier* className);
 };
 
 

Modified: trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp
===================================================================
--- trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp	2007-01-26 20:32:45 UTC (rev 98)
+++ trunk/Providers/WFS/Src/Provider/FdoWfsSpatialExtentsAggregateReader.cpp	2007-01-26 20:33:19 UTC (rev 99)
@@ -30,19 +30,11 @@
 {
     // Get the cached metadata and feature types 
     FdoPtr<FdoWfsServiceMetadata> serviceMetadata = conn->GetServiceMetadata ();
-    FdoPtr<FdoWfsFeatureTypeList> featTypeList = serviceMetadata->GetFeatureTypeList ();
-    FdoPtr<FdoWfsFeatureTypeCollection> featTypes = featTypeList->GetFeatureTypes ();
+    FdoPtr<FdoWfsFeatureType> featureType = serviceMetadata->GetFeatureType(className);
+    if (featureType == NULL)
+        throw FdoCommandException::Create (
+            NlsMsgGet(FDO_NLSID(WFS_NAMED_FEATURETYPE_NOT_FOUND), (FdoString*)className->GetText()));
 
-    // Get the class name and feature type 
-    FdoPtr<FdoWfsFeatureType> featureType = featTypes->FindItem (className->GetName());
-    if (featureType == NULL) {
-        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
     FdoOwsGeographicBoundingBoxCollectionP extents = featureType->GetSRSExtents();
 



More information about the fdo-commits mailing list