[mapguide-commits] r5127 - in trunk/MgDev: Server/src/Wfs Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Sep 10 02:22:17 EDT 2010


Author: liuar
Date: 2010-09-10 06:22:17 +0000 (Fri, 10 Sep 2010)
New Revision: 5127

Modified:
   trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
   trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp
   trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
   trunk/MgDev/Web/src/HttpHandler/WfsFeatures.cpp
   trunk/MgDev/Web/src/HttpHandler/WfsFeatures.h
Log:
Ticket #1421
MapGuide encodes the feature schema name to hash code as the feature type's namespace. However, OGC WFS certification supports customized namespace url for feature type. So MapGuide has to provide a way to specify a namespace url and a prefix indicate the url. All the namespaces and prefixes should appear in wfs:FeatureCollection element in GetFeature response document.

Modified: trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
===================================================================
--- trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-09-08 14:31:23 UTC (rev 5126)
+++ trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-09-10 06:22:17 UTC (rev 5127)
@@ -100,6 +100,12 @@
   &Feature.OuterXml;
  </Define>
 
+ <Define item="GetFeatureCollection.xml">
+    <wfs:FeatureCollection &FeatureCollection.Namespaces;>
+        <?EnumFeatures using="&GetFeature.xml;" ?> 
+    </wfs:FeatureCollection>
+ </Define>
+ 
 </Definitions>
 
 <!--
@@ -316,9 +322,7 @@
 
 -->
 <Response request="GetFeature" content-type="text/xml; subtype=gml/2.1.2">
- <wfs:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs">
-  <?EnumFeatures using="&GetFeature.xml;" ?>
- </wfs:FeatureCollection>
+ <?GetFeatureCollection using="&GetFeatureCollection.xml;" ?>
 </Response>
 
 <!--
@@ -327,9 +331,7 @@
 
 -->
 <Response request="GetFeature" content-type="text/xml; subtype=gml/3.1.1">
- <wfs:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs">
-  <?EnumFeatures using="&GetFeature.xml;" ?>
- </wfs:FeatureCollection>
+  <?GetFeatureCollection using="&GetFeatureCollection.xml;" ?>
 </Response>
 
 <!--

Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp	2010-09-08 14:31:23 UTC (rev 5126)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp	2010-09-10 06:22:17 UTC (rev 5127)
@@ -321,7 +321,7 @@
     {
         ProcedureEnumFeatures(PI);
     }
-    else if(sProc == kpszPiGetFeatureCollection) // DEPRECATED
+    else if(sProc == kpszPiGetFeatureCollection)
     {
         ProcedureGetFeatureCollection(PI);
     }
@@ -401,10 +401,26 @@
                                                      kpszExceptionMessageUnknownTypeName));
 }
 
-// This will enumerate all features
-void MgOgcWfsServer::ProcedureGetFeatureCollection(MgXmlProcessingInstruction& instruction)
+void MgOgcWfsServer::ProcedureGetFeatureCollection(MgXmlProcessingInstruction& PI)
 {
-    ProcessExpandableText(_("<!-- GetFeatureCollection PI is deprecated; use EnumFeatures -->"));
+    STRING sFormat;
+    if(!PI.GetAttribute(kpszPiAttributeUsing,sFormat))
+        sFormat = kpszPiGetFeatureCollectionDefaultFormat;
+
+    STRING sSubset;
+    if(!PI.GetAttribute(kpszPiAttributeSubset,sSubset))
+        sSubset = kpszEmpty;
+    ProcessExpandableTextIntoString(sSubset,sSubset);
+
+    bool bHasNamespace = false;
+
+    if(m_pFeatureSet != NULL) {
+        while(!bHasNamespace && m_pFeatureSet->Next()) {
+            bHasNamespace = m_pFeatureSet->GenerateNamespacesDefinition(*m_pTopOfDefinitions);
+        }
+    }
+
+    ProcessExpandableText(sFormat);
 }
 
 void MgOgcWfsServer::SetFeatures(MgWfsFeatures* pFeatures)

Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h	2010-09-08 14:31:23 UTC (rev 5126)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h	2010-09-10 06:22:17 UTC (rev 5127)
@@ -85,14 +85,12 @@
     // ?>
     void ProcedureEnumFeatureTypes(MgXmlProcessingInstruction& PIEnum);
 
-    // Soon to be deprecated.
     void ProcedureGetFeatureCollection(MgXmlProcessingInstruction& PIEnum);
 
     // <?EnumFeatures
     //
     void ProcedureEnumFeatures(MgXmlProcessingInstruction& PIEnum);
 
-
     CPSZ ServiceExceptionReportElement();
 
     MgWfsFeatureDefinitions* m_pFeatures;

Modified: trunk/MgDev/Web/src/HttpHandler/WfsFeatures.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/WfsFeatures.cpp	2010-09-08 14:31:23 UTC (rev 5126)
+++ trunk/MgDev/Web/src/HttpHandler/WfsFeatures.cpp	2010-09-10 06:22:17 UTC (rev 5127)
@@ -20,6 +20,7 @@
 
 
 CPSZ gszElementNameFeatureMember = _("http://www.opengis.net/gml:featureMember");
+CPSZ gszElementNameFeatureCollection = _("http://www.opengis.net/wfs:FeatureCollection");
 
 MgWfsFeatures::MgWfsFeatures(CPSZ szInputXml,int iMaxFeatures)
 :   m_sFeatureCollection(szInputXml)
@@ -81,6 +82,12 @@
                         // And tell the caller we've got a hit.
                         return m_bOk;
                     }
+                    else if(m_Namespaces.QualifiedName(Begin) == gszElementNameFeatureCollection){
+                        MgXmlAttribute& attributes = Begin.Attributes();
+                        m_sFeatureCollectionNamespaces = attributes.Contents();
+                        m_XmlInput.Next();
+                        return m_bOk;
+                    }
                     else {
                         m_XmlInput.Next();
                     }
@@ -120,3 +127,13 @@
     }
 }
 
+bool MgWfsFeatures::GenerateNamespacesDefinition(MgUtilDictionary& Dictionary)
+{
+    if(m_bOk && !m_sFeatureCollectionNamespaces.empty()) {
+        Dictionary.AddDefinition(L"FeatureCollection.Namespaces", m_sFeatureCollectionNamespaces);
+        return true;
+    }
+
+    return false;
+}
+

Modified: trunk/MgDev/Web/src/HttpHandler/WfsFeatures.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/WfsFeatures.h	2010-09-08 14:31:23 UTC (rev 5126)
+++ trunk/MgDev/Web/src/HttpHandler/WfsFeatures.h	2010-09-10 06:22:17 UTC (rev 5127)
@@ -31,7 +31,7 @@
 
     bool Next();
     void GenerateDefinitions(MgUtilDictionary& Dictionary);
-
+    bool GenerateNamespacesDefinition(MgUtilDictionary& Dictionary);
     virtual void Dispose(){delete this;}
 
 private:
@@ -39,6 +39,7 @@
     MgXmlNamespaceManager m_Namespaces;
     MgXmlParser m_XmlInput;
     STRING m_sCurrentFeature;                 // just the current feature.
+    STRING m_sFeatureCollectionNamespaces;    // the namespaces in <wfs:FeatureCollection>
     STRING::size_type m_iCurrentInnerContent; // index to start of content after <gml:featureMember>
     STRING::size_type m_iCurrentInnerLength;  // length of content between <gml:featureMember> and </gml:featureMember>
     bool m_bOk;



More information about the mapguide-commits mailing list