[mapserver-commits] r9291 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Sep 4 02:21:42 EDT 2009


Author: warmerdam
Date: 2009-09-04 02:21:40 -0400 (Fri, 04 Sep 2009)
New Revision: 9291

Modified:
   trunk/mapserver/mapwcs.c
   trunk/mapserver/mapwcs11.c
Log:
implement SECTIONS support for WCS1.1 Getcapabilities (#3105)

Modified: trunk/mapserver/mapwcs.c
===================================================================
--- trunk/mapserver/mapwcs.c	2009-09-04 06:20:10 UTC (rev 9290)
+++ trunk/mapserver/mapwcs.c	2009-09-04 06:21:40 UTC (rev 9291)
@@ -374,8 +374,10 @@
 	     params->interpolation = strdup(request->ParamValues[i]);
        else if(strcasecmp(request->ParamNames[i], "SERVICE") == 0)
 	     params->service = strdup(request->ParamValues[i]);
-	   else if(strcasecmp(request->ParamNames[i], "SECTION") == 0)
-	     params->section = strdup(request->ParamValues[i]); /* TODO: validate value here */
+       else if(strcasecmp(request->ParamNames[i], "SECTION") == 0) /* 1.0 */
+           params->section = strdup(request->ParamValues[i]); /* TODO: validate value here */
+       else if(strcasecmp(request->ParamNames[i], "SECTIONS") == 0) /* 1.1 */
+           params->section = strdup(request->ParamValues[i]); /* TODO: validate value here */
 
        /* GetCoverage parameters. */
        else if(strcasecmp(request->ParamNames[i], "BBOX") == 0) {

Modified: trunk/mapserver/mapwcs11.c
===================================================================
--- trunk/mapserver/mapwcs11.c	2009-09-04 06:20:10 UTC (rev 9290)
+++ trunk/mapserver/mapwcs11.c	2009-09-04 06:21:40 UTC (rev 9291)
@@ -371,8 +371,6 @@
       }
     }
 
-
-
 /* -------------------------------------------------------------------- */
 /*      Build list of layer identifiers available.                      */
 /* -------------------------------------------------------------------- */
@@ -433,14 +431,26 @@
 /* -------------------------------------------------------------------- */
 /*      Service metadata.                                               */
 /* -------------------------------------------------------------------- */
+    if( params->section == NULL 
+        || strstr(params->section,"All") != NULL
+        || strstr(params->section,"ServiceIdentification") != NULL )
+    {
+        psTmpNode = xmlAddChild(psRootNode, msOWSCommonServiceIdentification(
+                                    psOwsNs, map, "OGC WCS", params->version, "CO"));
+    }
 
-    psTmpNode = xmlAddChild(psRootNode, msOWSCommonServiceIdentification(
-                                psOwsNs, map, "OGC WCS", params->version, "CO"));
-
     /*service provider*/
-    psTmpNode = xmlAddChild(psRootNode, msOWSCommonServiceProvider(
-                                psOwsNs, psXLinkNs, map, "CO"));
+    if( params->section == NULL 
+        || strstr(params->section,"All") != NULL
+        || strstr(params->section,"ServiceProvider") != NULL )
+    {
+        psTmpNode = xmlAddChild(psRootNode, msOWSCommonServiceProvider(
+                                    psOwsNs, psXLinkNs, map, "CO"));
+    }
 
+/* -------------------------------------------------------------------- */
+/*      Operations metadata.                                            */
+/* -------------------------------------------------------------------- */
     /*operation metadata */
     if ((script_url=msOWSGetOnlineResource(map, "COM", "onlineresource", req)) == NULL 
         || (script_url_encoded = msEncodeHTMLEntities(script_url)) == NULL)
@@ -450,84 +460,91 @@
     }
     free( script_url );
 
-/* -------------------------------------------------------------------- */
-/*      Operations metadata.                                            */
-/* -------------------------------------------------------------------- */
-    psMainNode= xmlAddChild(psRootNode,msOWSCommonOperationsMetadata(psOwsNs));
+    if( params->section == NULL 
+        || strstr(params->section,"All") != NULL
+        || strstr(params->section,"OperationsMetadata") != NULL )
+    {
+        psMainNode= xmlAddChild(psRootNode,msOWSCommonOperationsMetadata(psOwsNs));
 
 /* -------------------------------------------------------------------- */
 /*      GetCapabilities - add Sections and AcceptVersions?              */
 /* -------------------------------------------------------------------- */
-    psNode = msOWSCommonOperationsMetadataOperation( 
-        psOwsNs, psXLinkNs,
-        "GetCapabilities", OWS_METHOD_GET, script_url_encoded);
+        psNode = msOWSCommonOperationsMetadataOperation( 
+            psOwsNs, psXLinkNs,
+            "GetCapabilities", OWS_METHOD_GET, script_url_encoded);
+        
+        xmlAddChild(psMainNode, psNode);
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "service", "WCS"));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
 
-    xmlAddChild(psMainNode, psNode);
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "service", "WCS"));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
-
 /* -------------------------------------------------------------------- */
 /*      DescribeCoverage                                                */
 /* -------------------------------------------------------------------- */
-    psNode = msOWSCommonOperationsMetadataOperation(
-        psOwsNs, psXLinkNs,
-        "DescribeCoverage", OWS_METHOD_GET, script_url_encoded);
-
-    xmlAddChild(psMainNode, psNode);
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "service", "WCS"));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "identifiers", identifier_list ));
-
+        psNode = msOWSCommonOperationsMetadataOperation(
+            psOwsNs, psXLinkNs,
+            "DescribeCoverage", OWS_METHOD_GET, script_url_encoded);
+        
+        xmlAddChild(psMainNode, psNode);
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "service", "WCS"));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "identifiers", identifier_list ));
+        
 /* -------------------------------------------------------------------- */
 /*      GetCoverage                                                     */
 /* -------------------------------------------------------------------- */
-    psNode = msOWSCommonOperationsMetadataOperation(
-        psOwsNs, psXLinkNs,
-        "GetCoverage", OWS_METHOD_GET, script_url_encoded);
+        psNode = msOWSCommonOperationsMetadataOperation(
+            psOwsNs, psXLinkNs,
+            "GetCoverage", OWS_METHOD_GET, script_url_encoded);
+        
+        format_list = msWCSGetFormatsList11( map, NULL );
+        
+        xmlAddChild(psMainNode, psNode);
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "service", "WCS"));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "Identifier", identifier_list ));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "InterpolationType", 
+                        "NEAREST_NEIGHBOUR,BILINEAR" ));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "format", format_list ));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "store", "false" ));
+        xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
+                        ows_version, psOwsNs, "Parameter", "GridBaseCRS", 
+                        "urn:ogc:def:crs:epsg::4326" ));
+        
+        msFree( format_list );
+    }    
 
-    format_list = msWCSGetFormatsList11( map, NULL );
-    
-    xmlAddChild(psMainNode, psNode);
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "service", "WCS"));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "version", (char *)params->version));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "Identifier", identifier_list ));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "InterpolationType", 
-                    "NEAREST_NEIGHBOUR,BILINEAR" ));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "format", format_list ));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "store", "false" ));
-    xmlAddChild(psNode, msOWSCommonOperationsMetadataDomainType(
-                    ows_version, psOwsNs, "Parameter", "GridBaseCRS", 
-                    "urn:ogc:def:crs:epsg::4326" ));
-
-    msFree( format_list );
-    
 /* -------------------------------------------------------------------- */
 /*      Contents section.                                               */
 /* -------------------------------------------------------------------- */
-    psMainNode = xmlNewChild( psRootNode, NULL, BAD_CAST "Contents", NULL );
-
-    for(i=0; i<map->numlayers; i++)
+    if( params->section == NULL 
+        || strstr(params->section,"All") != NULL
+        || strstr(params->section,"Contents") != NULL )
     {
-        layerObj *layer = map->layers[i];
-        int       status;
+        psMainNode = xmlNewChild( psRootNode, NULL, BAD_CAST "Contents", NULL );
 
-        if(!msWCSIsLayerSupported(layer)) 
-            continue;
-
-        status = msWCSGetCapabilities11_CoverageSummary( 
-            map, params, req, psDoc, psMainNode, layer );
-        if(status != MS_SUCCESS) return MS_FAILURE;
+        for(i=0; i<map->numlayers; i++)
+        {
+            layerObj *layer = map->layers[i];
+            int       status;
+            
+            if(!msWCSIsLayerSupported(layer)) 
+                continue;
+            
+            status = msWCSGetCapabilities11_CoverageSummary( 
+                map, params, req, psDoc, psMainNode, layer );
+            if(status != MS_SUCCESS) return MS_FAILURE;
+        }
     }
 
 /* -------------------------------------------------------------------- */



More information about the mapserver-commits mailing list