[mapserver-commits] r11346 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Mar 28 06:22:49 EDT 2011


Author: schpidi
Date: 2011-03-28 03:22:49 -0700 (Mon, 28 Mar 2011)
New Revision: 11346

Modified:
   trunk/mapserver/mapwcs20.c
Log:
Correcting error in default values of rangeType in WCS 2.0.


Modified: trunk/mapserver/mapwcs20.c
===================================================================
--- trunk/mapserver/mapwcs20.c	2011-03-25 15:27:23 UTC (rev 11345)
+++ trunk/mapserver/mapwcs20.c	2011-03-28 10:22:49 UTC (rev 11346)
@@ -2386,7 +2386,7 @@
                 return MS_FAILURE;
             }
 
-            /* default values */
+            /* look up default metadata values */
             for(j = 1; j < 5; ++j)
             {
                 if(keys != NULL)
@@ -2394,8 +2394,29 @@
                     default_values.values[j] = (char *)msOWSLookupMetadata(&(layer->metadata), "COM", keys[j]);
                 }
             }
+            
+            /* set default values for interval and significant figures */
+            switch(cm->imagemode)
+            {
+            case MS_IMAGEMODE_BYTE:
+            case MS_IMAGEMODE_PC256:
+                default_values.interval_min = 0.;
+                default_values.interval_max = 255.;
+                default_values.significant_figures = 3;
+                break;
+            case MS_IMAGEMODE_INT16:
+                default_values.interval_min = 0.;
+                default_values.interval_max = (double)USHRT_MAX;
+                default_values.significant_figures = 5;
+                break;
+            case MS_IMAGEMODE_FLOAT32:
+                default_values.interval_min = -FLT_MAX;
+                default_values.interval_max = FLT_MAX;
+                default_values.significant_figures = 12;
+                break;
+            }
 
-            /* default interval values */
+            /* lookup default interval values */
             if (interval_key != NULL
                 && (value = msOWSLookupMetadata(&(layer->metadata), "COM", interval_key)) != NULL)
             {
@@ -2413,30 +2434,8 @@
                 }
                 msFreeCharArray(interval_array, num_interval);
             }
-            else
-            {
-                switch(cm->imagemode)
-                {
-                case MS_IMAGEMODE_BYTE:
-                case MS_IMAGEMODE_PC256:
-                    default_values.interval_min = 0.;
-                    default_values.interval_max = 255.;
-                    default_values.significant_figures = 3;
-                    break;
-                case MS_IMAGEMODE_INT16:
-                    default_values.interval_min = 0.;
-                    default_values.interval_max = (double)USHRT_MAX;
-                    default_values.significant_figures = 5;
-                    break;
-                case MS_IMAGEMODE_FLOAT32:
-                    default_values.interval_min = -FLT_MAX;
-                    default_values.interval_max = FLT_MAX;
-                    default_values.significant_figures = 12;
-                    break;
-                }
-            }
 
-            /* default value for significant figures */
+            /* lookup default value for significant figures */
             if((value = msOWSLookupMetadata(&(layer->metadata), "COM", significant_figures_key)) != NULL)
             {
                 if(msStringParseInteger(value, &(default_values.significant_figures)) != MS_SUCCESS)
@@ -2449,10 +2448,12 @@
                 }
             }
 
+            /* iterate over every band */
             for(i = 0; i < cm->numbands; ++i)
             {
                 cm->bands[i].name = NULL;
-
+                
+                /* look up band metadata or copy defaults */
                 if(num_band_names != 0)
                 {
                     cm->bands[i].name = msStrdup(band_names[i]);



More information about the mapserver-commits mailing list