浏览代码

Added exception check for presence of group to allow creation by i.group

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70541 15284696-431f-4ddb-bdfa-cd5b030d7da7
Yann Chemin 8 年之前
父节点
当前提交
971da0d740
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      imagery/i.ortho.photo/i.ortho.photo/menu.c

+ 9 - 6
imagery/i.ortho.photo/i.ortho.photo/menu.c

@@ -48,7 +48,7 @@ int main(int argc, char **argv)
     module->description = _("Menu driver for the photo imagery programs.");
 
     group_opt = G_define_standard_option(G_OPT_I_GROUP);
-    group_opt->required = NO;
+    group_opt->required = YES;
     group_opt->description =
 	_("Name of imagery group for ortho-rectification");
 
@@ -90,12 +90,15 @@ int main(int argc, char **argv)
 	*p = 0;
 
     /* get and check the group reference files */
-    if (!I_get_group_ref(group.name, &group.group_ref))
-	G_fatal_error(_("Pre-selected group <%s> not found"), group.name);
-    I_get_group_ref(group.name, &group.group_ref);
+    /* Skip if you are creating the group right now */
+    if (strcmp(moduletorun, "i.group") != 0){
+    	if (!I_get_group_ref(group.name, &group.group_ref))
+		G_fatal_error(_("Pre-selected group <%s> not found"), group.name);
+	    I_get_group_ref(group.name, &group.group_ref);
 
-    if (group.group_ref.nfiles <= 0)
-	G_fatal_error(_("Group [%s] contains no files"), group.name);
+	    if (group.group_ref.nfiles <= 0)
+		G_fatal_error(_("Group [%s] contains no files"), group.name);
+    }
 
     I_put_group(group.name);
     /*-----------------------------*/