[GRASS-SVN] r57709 - grass/trunk/lib/imagery

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 16 14:32:00 PDT 2013


Author: turek
Date: 2013-09-16 14:31:59 -0700 (Mon, 16 Sep 2013)
New Revision: 57709

Modified:
   grass/trunk/lib/imagery/iclass.c
Log:
iclass backend: make subgroup optional

Modified: grass/trunk/lib/imagery/iclass.c
===================================================================
--- grass/trunk/lib/imagery/iclass.c	2013-09-16 19:53:08 UTC (rev 57708)
+++ grass/trunk/lib/imagery/iclass.c	2013-09-16 21:31:59 UTC (rev 57709)
@@ -100,7 +100,8 @@
    \brief Read files for the specified group subgroup into the Ref structure.
 
    \param group_name name of imagery group
-   \param subgroup_name name of imagery subgroup
+   \param subgroup_name name of imagery subgroup 
+   \param subgroup_name if it is NULL, bands from group will be used
    \param[out] refer pointer to band files structure
 
    \return 1 on success
@@ -115,21 +116,36 @@
 	    group_name, subgroup_name);
     I_init_group_ref(refer);	/* called in I_get_group_ref */
 
-    I_get_subgroup_ref(group_name, subgroup_name, refer);
+    if (subgroup_name)
+	I_get_subgroup_ref(group_name, subgroup_name, refer);
+    else
+	I_get_group_ref(group_name, refer);
 
     for (n = 0; n < refer->nfiles; n++) {
 	if (G_find_raster(refer->file[n].name, refer->file[n].mapset) == NULL) {
-	    G_warning(_("Raster map <%s@%s> in subgroup "
-			"<%s> does not exist"), refer->file[n].name,
-		      refer->file[n].mapset, subgroup_name);
+	    if (subgroup_name)
+		G_warning(_("Raster map <%s@%s> in subgroup "
+			    "<%s> does not exist"), refer->file[n].name,
+			  refer->file[n].mapset, subgroup_name);
+	    else
+		G_warning(_("Raster map <%s@%s> in group "
+			    "<%s> does not exist"), refer->file[n].name,
+			  refer->file[n].mapset, group_name);
+
 	    I_free_group_ref(refer);
 	    return 0;
 	}
     }
 
     if (refer->nfiles <= 1) {
-	G_warning(_("Subgroup <%s> does not have enough files (it has %d files)"),
-		  subgroup_name, refer->nfiles);
+	if (subgroup_name)
+	    G_warning(_
+		      ("Subgroup <%s> does not have enough files (it has %d files)"),
+		      subgroup_name, refer->nfiles);
+	else
+	    G_warning(_
+		      ("Group <%s> does not have enough files (it has %d files)"),
+		      group_name, refer->nfiles);
 	I_free_group_ref(refer);
 	return 0;
     }



More information about the grass-commit mailing list