Sfoglia il codice sorgente

libgis: define new standard opt: G_OPT_M_EN
update v.what


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47147 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 anni fa
parent
commit
ba1221b0fa
3 ha cambiato i file con 97 aggiunte e 93 eliminazioni
  1. 1 0
      include/gis.h
  2. 95 87
      lib/gis/parser_standard_options.c
  3. 1 6
      vector/v.what/main.c

+ 1 - 0
include/gis.h

@@ -218,6 +218,7 @@ static const char *GRASS_copyright __attribute__ ((unused))
     G_OPT_M_UNITS,              /* units */
     G_OPT_M_DATATYPE,           /* datatype */
     G_OPT_M_MAPSET,             /* mapset */
+    G_OPT_M_EN,                 /* coordinates */
 } STD_OPT;
 
 /* Message format */

+ 95 - 87
lib/gis/parser_standard_options.c

@@ -1,16 +1,16 @@
 /*!
- * \file gis/parser_standard_options.c
- *
- * \brief GIS Library - Argument parsing functions (standard options)
- *
- * (C) 2001-2010 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author Original author CERL
- * \author Soeren Gebbert added Dec. 2009 WPS process_description document
- */
+  \file lib/gis/parser_standard_options.c
+  
+  \brief GIS Library - Argument parsing functions (standard options)
+  
+  (C) 2001-2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Original author CERL
+  \author Soeren Gebbert added Dec. 2009 WPS process_description document
+*/
 
 #include <grass/gis.h>
 #include <grass/glocale.h>
@@ -18,81 +18,80 @@
 #include "parser_local_proto.h"
 
 /*!
- * \brief Create standardised Option structure.
- *
- * This function will create a standardised Option structure defined
- * by parameter opt. A list of valid parameters can be found in gis.h.
- * It allocates memory for the Option structure and returns a pointer
- * to this memory.
- *
- * If an invalid parameter was specified a empty Option structure will
- * be returned (not NULL).
- *
- *  - database:
- *   - G_OPT_DB_WHERE
- *   - G_OPT_DB_COLUMN
- *   - G_OPT_DB_COLUMNS
- *   - G_OPT_DB_TABLE
- *   - G_OPT_DB_DRIVER
- *   - G_OPT_DB_DATABASE
- *   - G_OPT_DB_SCHEMA
- *
- *  - imagery:
- *   - G_OPT_I_GROUP
- *   - G_OPT_I_SUBGROUP
- *
- *  - raster:
- *   - G_OPT_R_INPUT
- *   - G_OPT_R_INPUTS
- *   - G_OPT_R_OUTPUT
- *   - G_OPT_R_MAP
- *   - G_OPT_R_MAPS
- *   - G_OPT_R_BASE
- *   - G_OPT_R_COVER
- *   - G_OPT_R_ELEV
- *   - G_OPT_R_ELEVS
- *
- *  - raster3d:
- *   - G_OPT_R3_INPUT
- *   - G_OPT_R3_INPUTS
- *   - G_OPT_R3_OUTPUT
- *   - G_OPT_R3_MAP
- *   - G_OPT_R3_MAPS
- *
- *  - vector:
- *   - G_OPT_V_INPUT
- *   - G_OPT_V_INPUTS
- *   - G_OPT_V_OUTPUT
- *   - G_OPT_V_MAP
- *   - G_OPT_V_MAPS
- *   - G_OPT_V_TYPE
- *   - G_OPT_V_FIELD
- *   - G_OPT_V_FIELD_ALL
- *   - G_OPT_V_CAT
- *   - G_OPT_V_CATS
- *   - G_OPT_V_ID
- *   - G_OPT_V_IDS
- * 
- *  - files
- *   - G_OPT_F_INPUT
- *   - G_OPT_F_OUTPUT
- *   - G_OPT_F_SEP
- *
- *  - colors
- *   - G_OPT_C_FG
- *   - G_OPT_C_BG
- *
- *  - misc
- *
- *   - G_OPT_M_UNITS
- *   - G_OPT_M_DATATYPE
- *   - G_OPT_M_MAPSET
- *
- * \param opt type of Option struct to create
- *
- * \return pointer to an Option struct
- */
+  \brief Create standardised Option structure.
+  
+  This function will create a standardised Option structure defined
+  by parameter opt. A list of valid parameters can be found in gis.h.
+  It allocates memory for the Option structure and returns a pointer
+  to this memory.
+  
+  If an invalid parameter was specified a empty Option structure will
+  be returned (not NULL).
+  
+  - database:
+   - G_OPT_DB_WHERE
+   - G_OPT_DB_COLUMN
+   - G_OPT_DB_COLUMNS
+   - G_OPT_DB_TABLE
+   - G_OPT_DB_DRIVER
+   - G_OPT_DB_DATABASE
+   - G_OPT_DB_SCHEMA
+ 
+  - imagery:
+   - G_OPT_I_GROUP
+   - G_OPT_I_SUBGROUP
 
+  - raster:
+   - G_OPT_R_INPUT
+   - G_OPT_R_INPUTS
+   - G_OPT_R_OUTPUT
+   - G_OPT_R_MAP
+   - G_OPT_R_MAPS
+   - G_OPT_R_BASE
+   - G_OPT_R_COVER
+   - G_OPT_R_ELEV
+   - G_OPT_R_ELEVS
+   
+  - raster3d:
+   - G_OPT_R3_INPUT
+   - G_OPT_R3_INPUTS
+   - G_OPT_R3_OUTPUT
+   - G_OPT_R3_MAP
+   - G_OPT_R3_MAPS
+   
+  - vector:
+   - G_OPT_V_INPUT
+   - G_OPT_V_INPUTS
+   - G_OPT_V_OUTPUT
+   - G_OPT_V_MAP
+   - G_OPT_V_MAPS
+   - G_OPT_V_TYPE
+   - G_OPT_V_FIELD
+   - G_OPT_V_FIELD_ALL
+   - G_OPT_V_CAT
+   - G_OPT_V_CATS
+   - G_OPT_V_ID
+   - G_OPT_V_IDS
+   
+  - files
+   - G_OPT_F_INPUT
+   - G_OPT_F_OUTPUT
+   - G_OPT_F_SEP
+   
+  - colors
+   - G_OPT_C_FG
+   - G_OPT_C_BG
+ 
+  - misc
+   - G_OPT_M_UNITS
+   - G_OPT_M_DATATYPE
+   - G_OPT_M_MAPSET
+   - G_OPT_M_EN
+
+   \param opt type of Option struct to create
+   
+   \return pointer to an Option struct
+*/
 struct Option *G_define_standard_option(int opt)
 {
     struct Option *Opt;
@@ -537,7 +536,16 @@ struct Option *G_define_standard_option(int opt)
 	Opt->gisprompt = "old,mapset,mapset";
 	Opt->label = _("Name of mapset (default: current search path)");
 	Opt->description = _("'.' for current mapset");
+	break;
+
+    case G_OPT_M_EN:
+	Opt->key = "east_north";
+	Opt->type = TYPE_DOUBLE;
+	Opt->required = NO;
+	Opt->multiple = YES;
+	Opt->key_desc = "east,north";
+	Opt->description = _("Coordinates");
     }
 
-    return (Opt);
+    return Opt;
 }

+ 1 - 6
vector/v.what/main.c

@@ -60,12 +60,7 @@ int main(int argc, char **argv)
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD_ALL);
     
-    coords_opt = G_define_option();
-    coords_opt->key = "east_north";
-    coords_opt->type = TYPE_DOUBLE;
-    coords_opt->key_desc = "east,north";
-    coords_opt->required = NO;
-    coords_opt->multiple = YES;
+    coords_opt = G_define_standard_option(G_OPT_M_EN);
     coords_opt->label = _("Coordinates for query");
     coords_opt->description = _("If not given read from standard input");