[GRASS-SVN] r64732 - in grass/trunk: general/g.mapset include lib/gis raster/r.proj vector/v.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 24 16:54:05 PST 2015


Author: annakrat
Date: 2015-02-24 16:54:05 -0800 (Tue, 24 Feb 2015)
New Revision: 64732

Modified:
   grass/trunk/general/g.mapset/main.c
   grass/trunk/include/gis.h
   grass/trunk/lib/gis/parser_standard_options.c
   grass/trunk/raster/r.proj/main.c
   grass/trunk/vector/v.proj/main.c
Log:
create standardized option for location and dbase, use it in r.proj, v.proj, g.mapset

Modified: grass/trunk/general/g.mapset/main.c
===================================================================
--- grass/trunk/general/g.mapset/main.c	2015-02-23 21:05:19 UTC (rev 64731)
+++ grass/trunk/general/g.mapset/main.c	2015-02-25 00:54:05 UTC (rev 64732)
@@ -57,20 +57,10 @@
     opt.mapset->guisection = _("Mapset");
     opt.mapset->gisprompt = "new,mapset,mapset";
 
-    opt.location = G_define_option();
-    opt.location->key = "location";
-    opt.location->type = TYPE_STRING;
-    opt.location->required = NO;
-    opt.location->multiple = NO;
-    opt.location->key_desc = "name";
-    opt.location->description = _("Location name (not location path)");
+    opt.location = G_define_standard_option(G_OPT_M_LOCATION);
     opt.location->guisection = _("Mapset");
 
-    opt.gisdbase = G_define_standard_option(G_OPT_M_DIR);
-    opt.gisdbase->key = "dbase";
-    opt.gisdbase->required = NO;
-    opt.gisdbase->label = _("GIS data directory");
-    opt.gisdbase->description = _("Full path to the directory where the new location is");
+    opt.gisdbase = G_define_standard_option(G_OPT_M_DBASE);
     opt.gisdbase->guisection = _("Mapset");
 
     flag.add = G_define_flag();

Modified: grass/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h	2015-02-23 21:05:19 UTC (rev 64731)
+++ grass/trunk/include/gis.h	2015-02-25 00:54:05 UTC (rev 64732)
@@ -264,6 +264,8 @@
     G_OPT_M_UNITS,              /*!< units */
     G_OPT_M_DATATYPE,           /*!< datatype */
     G_OPT_M_MAPSET,             /*!< mapset */
+    G_OPT_M_LOCATION,           /*!< location */
+    G_OPT_M_DBASE,              /*!< dbase */
     G_OPT_M_COORDS,             /*!< coordinates */
     G_OPT_M_COLR,               /*!< color rules */
     G_OPT_M_DIR,                /*!< directory input */    

Modified: grass/trunk/lib/gis/parser_standard_options.c
===================================================================
--- grass/trunk/lib/gis/parser_standard_options.c	2015-02-23 21:05:19 UTC (rev 64731)
+++ grass/trunk/lib/gis/parser_standard_options.c	2015-02-25 00:54:05 UTC (rev 64732)
@@ -100,6 +100,8 @@
    - G_OPT_M_UNITS
    - G_OPT_M_DATATYPE
    - G_OPT_M_MAPSET
+   - G_OPT_M_LOCATION
+   - G_OPT_M_DBASE
    - G_OPT_M_COORDS
    - G_OPT_M_COLR
    - G_OPT_M_REGION
@@ -655,7 +657,29 @@
 	Opt->label = _("Name of mapset (default: current search path)");
 	Opt->description = _("'.' for current mapset");
 	break;
+	
+    case G_OPT_M_LOCATION:
+    Opt->key = "location";
+    Opt->type = TYPE_STRING;
+    Opt->required = NO;
+    Opt->multiple = NO;
+    Opt->label = _("Location name");
+    Opt->description = _("Location name (not location path)");
+    Opt->gisprompt = "old,location,location";
+    Opt->key_desc = "name";
+    break;
 
+    case G_OPT_M_DBASE:
+    Opt->key = "dbase";
+    Opt->type = TYPE_STRING;
+    Opt->required = NO;
+    Opt->multiple = NO;
+    Opt->label = _("GRASS GIS database directory");
+    Opt->description = _("Default: path to the current GRASS GIS database");
+    Opt->gisprompt = "old,dbase,dbase";
+    Opt->key_desc = "path";
+    break;
+
     case G_OPT_M_COORDS:
 	Opt->key = "coordinates";
 	Opt->type = TYPE_DOUBLE;

Modified: grass/trunk/raster/r.proj/main.c
===================================================================
--- grass/trunk/raster/r.proj/main.c	2015-02-23 21:05:19 UTC (rev 64731)
+++ grass/trunk/raster/r.proj/main.c	2015-02-25 00:54:05 UTC (rev 64732)
@@ -152,26 +152,18 @@
     inmap->required = NO;
     inmap->guisection = _("Source");
 
-    inlocation = G_define_option();
-    inlocation->key = "location";
-    inlocation->type = TYPE_STRING;
+    inlocation = G_define_standard_option(G_OPT_M_LOCATION);
     inlocation->required = YES;
-    inlocation->description = _("Location containing input raster map");
-    inlocation->gisprompt = "old,location,location";
-    inlocation->key_desc = "name";
+    inlocation->label = _("Location containing input raster map");
+    inlocation->guisection = _("Source");
 
     imapset = G_define_standard_option(G_OPT_M_MAPSET);
     imapset->label = _("Mapset containing input raster map");
     imapset->description = _("Default: name of current mapset");
     imapset->guisection = _("Source");
 
-    indbase = G_define_option();
-    indbase->key = "dbase";
-    indbase->type = TYPE_STRING;
-    indbase->required = NO;
-    indbase->description = _("Path to GRASS database of input location");
-    indbase->gisprompt = "old,dbase,dbase";
-    indbase->key_desc = "path";
+    indbase = G_define_standard_option(G_OPT_M_DBASE);
+    indbase->label = _("Path to GRASS database of input location");
     indbase->guisection = _("Source");
 
     outmap = G_define_standard_option(G_OPT_R_OUTPUT);

Modified: grass/trunk/vector/v.proj/main.c
===================================================================
--- grass/trunk/vector/v.proj/main.c	2015-02-23 21:05:19 UTC (rev 64731)
+++ grass/trunk/vector/v.proj/main.c	2015-02-25 00:54:05 UTC (rev 64732)
@@ -77,27 +77,18 @@
     mapopt->description = NULL;
     mapopt->guisection = _("Source");
     
-    ilocopt = G_define_option();
-    ilocopt->key = "location";
-    ilocopt->type = TYPE_STRING;
+    ilocopt = G_define_standard_option(G_OPT_M_LOCATION);
     ilocopt->required = YES;
-    ilocopt->description = _("Location containing input vector map");
-    ilocopt->gisprompt = "old,location,location";
-    ilocopt->key_desc = "name";
+    ilocopt->label = _("Location containing input vector map");
+    ilocopt->guisection = _("Source");
     
     isetopt = G_define_standard_option(G_OPT_M_MAPSET);
     isetopt->label = _("Mapset containing input vector map");
     isetopt->description = _("Default: name of current mapset");
     isetopt->guisection = _("Source");
 
-    ibaseopt = G_define_option();
-    ibaseopt->key = "dbase";
-    ibaseopt->type = TYPE_STRING;
-    ibaseopt->required = NO;
+    ibaseopt = G_define_standard_option(G_OPT_M_DBASE);
     ibaseopt->label = _("Path to GRASS database of input location");
-    ibaseopt->description = _("Default: path to the current GRASS database");
-    ibaseopt->gisprompt = "old,dbase,dbase";
-    ibaseopt->key_desc = "path";
     ibaseopt->guisection = _("Source");
 
     smax = G_define_option();



More information about the grass-commit mailing list