[GRASS-dev] Adding 3D types for "type=" option uniformly
Benjamin Ducke
benjamin.ducke at oxfordarch.co.uk
Sat Sep 5 05:31:54 EDT 2009
I am currently adding capabilities to handle 3D date to some core
modules in GRASS 6.5. One of the first candidates was v.category.
I noticed that it uses the standard option declaration:
type_opt = G_define_standard_option(G_OPT_V_TYPE);
to allow users to specify geometry types. According to lib/gis/parser.c,
this includes only 2D types:
case G_OPT_V_TYPE:
Opt->key = "type";
Opt->type = TYPE_STRING;
Opt->required = NO;
Opt->multiple = YES;
Opt->answer = "point,line,boundary,centroid,area";
Opt->options = "point,line,boundary,centroid,area";
Opt->description = _("Feature type");
My question is: how to best handle "type=" options in modules that also
need to deal with 3D types? The way it is currently done by most
modules is to extent the list of types manually, e.g. v.out.ogr does:
type_opt = G_define_standard_option(G_OPT_V_TYPE);
type_opt->options = "point,kernel,centroid,line,boundary,area,face";
and I could keep doing it that way. But wouldn't it be more elegant
to add a 3D type list definition to the vector lib itself? Like:
case G_OPT_V3_TYPE:
Opt->key = "type";
Opt->type = TYPE_STRING;
Opt->required = NO;
Opt->multiple = YES;
Opt->answer = "point,line,boundary,centroid,area,face,kernel";
Opt->options = "point,line,boundary,centroid,area,face,kernel";
Opt->description = _("Feature type");
so that all modules capable of handling 3D data could just
declare their "type=" options to be G_OPT_V3_TYPE? That way, we could
also easily add G_VOLUME support in the future by just extending G_OPT_V3_TYPE.
Ben
------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
More information about the grass-dev
mailing list