GRASS 8 Programmer's Manual 8.6.0dev(2026)-745b61fbf6
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 SPDX-FileCopyrightText: 2001-2009 GRASS Development Team
9 SPDX-License-Identifier: GPL-2.0-or-later
10
11 \author Radim Blazek
12 */
13
14#include <grass/vector.h>
15
16/*!
17 \brief Get types from options
18
19 \param type_opt Option structure
20
21 \return types
22 \return -1 on error
23 */
25{
26 int i, type;
27
28 type = 0;
29 for (i = 0; type_opt->answers[i]; i++) {
30 if (strcmp(type_opt->answers[i], "auto") == 0)
31 continue;
32
33 switch (type_opt->answers[i][0]) {
34 case 'p':
35 type |= GV_POINT;
36 break;
37 case 'l':
38 type |= GV_LINE;
39 break;
40 case 'b':
41 type |= GV_BOUNDARY;
42 break;
43 case 'c':
44 type |= GV_CENTROID;
45 break;
46 case 'f':
47 type |= GV_FACE;
48 break;
49 case 'k':
50 type |= GV_KERNEL;
51 break;
52 case 'a':
53 type |= GV_AREA;
54 break;
55 case 'v':
56 type |= GV_VOLUME;
57 break;
58 }
59 }
60
61 return type;
62}
#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:560
int Vect_option_to_types(const struct Option *type_opt)
Get types from options.