[mapserver-commits] r8494 - branches/branch-5-2/mapserver

svn at osgeo.org svn at osgeo.org
Wed Feb 4 07:18:09 EST 2009


Author: tomkralidis
Date: 2009-02-04 07:18:09 -0500 (Wed, 04 Feb 2009)
New Revision: 8494

Modified:
   branches/branch-5-2/mapserver/HISTORY.TXT
   branches/branch-5-2/mapserver/shp2img.c
   branches/branch-5-2/mapserver/shp2pdf.c
Log:
fix when layer status = DEFAULT and passing list of layers (#2066)



Modified: branches/branch-5-2/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-2/mapserver/HISTORY.TXT	2009-02-03 23:22:33 UTC (rev 8493)
+++ branches/branch-5-2/mapserver/HISTORY.TXT	2009-02-04 12:18:09 UTC (rev 8494)
@@ -13,6 +13,8 @@
 Current Version (SVN branch-5-2)
 --------------------------------
 
+- fix when layer status = DEFAULT and passing list of layers (#2066)
+
 - Fixed Blobs not filtered in OracleSpatial Attribute/WFS queries (#2829)
 
 - Add USE_MSSQL2008_PLUGIN to the MSSQL 2008 compile options (#2823)

Modified: branches/branch-5-2/mapserver/shp2img.c
===================================================================
--- branches/branch-5-2/mapserver/shp2img.c	2009-02-03 23:22:33 UTC (rev 8493)
+++ branches/branch-5-2/mapserver/shp2img.c	2009-02-04 12:18:09 UTC (rev 8494)
@@ -253,8 +253,25 @@
 
     if(strcmp(argv[i],"-l") == 0) { /* load layer list */
       layers = msStringSplit(argv[i+1], ' ', &(num_layers));
-      layer_found=0;
 
+      for(j=0; j<num_layers; j++) { /* loop over -l */
+        layer_found=0;
+        for(k=0; k<map->numlayers; k++) {
+          if(GET_LAYER(map, k)->name && strcmp(GET_LAYER(map, k)->name, layers[j]) == 0) {
+            layer_found=1;
+            break;
+          }
+          else {
+            invalid_layer = strdup(layers[j]);
+          }
+        }
+        if (layer_found==0) {
+          fprintf(stderr, "Layer (-l) %s not found\n", invalid_layer);
+          msCleanup();
+          exit(0);
+        }
+      }
+
       for(j=0; j<map->numlayers; j++) {
 	if(GET_LAYER(map, j)->status == MS_DEFAULT)
 	  continue;
@@ -263,20 +280,11 @@
 	  for(k=0; k<num_layers; k++) {
 	    if(GET_LAYER(map, j)->name && strcmp(GET_LAYER(map, j)->name, layers[k]) == 0) {
 	      GET_LAYER(map, j)->status = MS_ON;
-              layer_found=1;
 	      break;
 	    }
-            else {
-              invalid_layer = strdup(layers[k]);
-            }
 	  }
 	}
       }
-      if (layer_found == 0) {
-        fprintf(stderr, "Layer (-l) %s not found\n", invalid_layer);
-        msCleanup();
-        exit(0);
-      }
 
       msFreeCharArray(layers, num_layers);
 

Modified: branches/branch-5-2/mapserver/shp2pdf.c
===================================================================
--- branches/branch-5-2/mapserver/shp2pdf.c	2009-02-03 23:22:33 UTC (rev 8493)
+++ branches/branch-5-2/mapserver/shp2pdf.c	2009-02-04 12:18:09 UTC (rev 8494)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id:$
+ * $Id$
  *
  * Project:  MapServer
  * Purpose:  Commandline shape to pdf converter.
@@ -154,8 +154,25 @@
 
     if(strncmp(argv[i],"-l",2) == 0) { /* load layer list */
       layers = msStringSplit(argv[i+1], ' ', &(num_layers));
-      layer_found=0;
 
+      for(j=0; j<num_layers; j++) { /* loop over -l */
+        layer_found=0;
+        for(k=0; k<map->numlayers; k++) {
+          if(GET_LAYER(map, k)->name && strcmp(GET_LAYER(map, k)->name, layers[j]) == 0) {
+            layer_found=1;
+            break;
+          }
+          else {
+            invalid_layer = strdup(layers[j]);
+          }
+        }
+        if (layer_found==0) {
+          fprintf(stderr, "Layer (-l) %s not found\n", invalid_layer);
+          msCleanup();
+          exit(0);
+        }
+      }
+
       for(j=0; j<map->numlayers; j++) {
         if(GET_LAYER(map, j)->status == MS_DEFAULT)
           continue;
@@ -164,21 +181,11 @@
           for(k=0; k<num_layers; k++) {
             if(strcmp(GET_LAYER(map, j)->name, layers[k]) == 0) {
               GET_LAYER(map, j)->status = MS_ON;
-              layer_found=1;
               break;
             }
-            else {
-              invalid_layer = strdup(layers[k]);
-            }
           }
         }
       }
-      if (layer_found == 0) {
-        fprintf(stderr, "Layer (-l) %s not found\n", invalid_layer);
-        msCleanup();
-        exit(0);
-      }
-
       msFreeCharArray(layers, num_layers);
 
       i+=1;



More information about the mapserver-commits mailing list