GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
vector/Vlib/type.c
Go to the documentation of this file.
1/*!
2 \file lib/vector/Vlib/type.c
3
4 \brief Vector library - feature type
5
6 Higher level functions for reading/writing/manipulating vectors.
7
8 (C) 2001-2009 by the GRASS Development Team
9
10 This program is free software under the GNU General Public License
11 (>=v2). Read the file COPYING that comes with GRASS for details.
12
13 \author Radim Blazek
14 */
15
16#include <grass/vector.h>
17
18/*!
19 \brief Get types from options
20
21 \param type_opt Option structure
22
23 \return types
24 \return -1 on error
25 */
27{
28 int i, type;
29
30 type = 0;
31 for (i = 0; type_opt->answers[i]; i++) {
32 if (strcmp(type_opt->answers[i], "auto") == 0)
33 continue;
34
35 switch (type_opt->answers[i][0]) {
36 case 'p':
37 type |= GV_POINT;
38 break;
39 case 'l':
40 type |= GV_LINE;
41 break;
42 case 'b':
43 type |= GV_BOUNDARY;
44 break;
45 case 'c':
46 type |= GV_CENTROID;
47 break;
48 case 'f':
49 type |= GV_FACE;
50 break;
51 case 'k':
52 type |= GV_KERNEL;
53 break;
54 case 'a':
55 type |= GV_AREA;
56 break;
57 case 'v':
58 type |= GV_VOLUME;
59 break;
60 }
61 }
62
63 return type;
64}
#define GV_CENTROID
#define GV_LINE
#define GV_POINT
Feature types used in memory on run time (may change)
#define GV_BOUNDARY
#define GV_FACE
#define GV_AREA
#define GV_VOLUME
#define GV_KERNEL
Structure that stores option information.
Definition gis.h:563
int Vect_option_to_types(const struct Option *type_opt)
Get types from options.