GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
vector/diglib/type.c
Go to the documentation of this file.
1 
2 /**
3  * \file diglib/type.c
4  *
5  * \brief Vector library - feature type conversion (lower level functions)
6  *
7  * Lower level functions for reading/writing/manipulating vectors.
8  *
9  * This program is free software under the GNU General Public License
10  * (>=v2). Read the file COPYING that comes with GRASS for details.
11  *
12  * \author Radim Blazek
13  *
14  * \date 2001
15  */
16 
17 #include <grass/vector.h>
18 
19 /*!
20  \brief Convert type to store type
21 
22  \param type feature type
23 
24  \return store type
25  */
26 int dig_type_to_store(int type)
27 {
28  switch (type) {
29  case GV_POINT:
30  return GV_STORE_POINT;
31  case GV_LINE:
32  return GV_STORE_LINE;
33  case GV_BOUNDARY:
34  return GV_STORE_BOUNDARY;
35  case GV_CENTROID:
36  return GV_STORE_CENTROID;
37  case GV_AREA:
38  return GV_STORE_AREA;
39  case GV_FACE:
40  return GV_STORE_FACE;
41  case GV_KERNEL:
42  return GV_STORE_KERNEL;
43  case GV_VOLUME:
44  return GV_STORE_VOLUME;
45  default:
46  return 0;
47  }
48 }
49 
50 /*!
51  \brief Convert type from store type
52 
53  \param stype feature store type
54 
55  \return type
56  */
57 int dig_type_from_store(int stype)
58 {
59  switch (stype) {
60  case GV_STORE_POINT:
61  return GV_POINT;
62  case GV_STORE_LINE:
63  return GV_LINE;
64  case GV_STORE_BOUNDARY:
65  return GV_BOUNDARY;
66  case GV_STORE_CENTROID:
67  return GV_CENTROID;
68  case GV_STORE_AREA:
69  return GV_AREA;
70  case GV_STORE_FACE:
71  return GV_FACE;
72  case GV_STORE_KERNEL:
73  return GV_KERNEL;
74  case GV_STORE_VOLUME:
75  return GV_VOLUME;
76  default:
77  return 0;
78  }
79 }
#define GV_CENTROID
Definition: dig_defines.h:185
#define GV_STORE_LINE
Definition: dig_defines.h:196
#define GV_POINT
Feature types used in memory on run time (may change)
Definition: dig_defines.h:182
#define GV_STORE_AREA
Definition: dig_defines.h:201
#define GV_STORE_CENTROID
Definition: dig_defines.h:198
#define GV_LINE
Definition: dig_defines.h:183
#define GV_FACE
Definition: dig_defines.h:186
#define GV_STORE_BOUNDARY
Definition: dig_defines.h:197
#define GV_BOUNDARY
Definition: dig_defines.h:184
int dig_type_from_store(int stype)
Convert type from store type.
int dig_type_to_store(int type)
Convert type to store type.
#define GV_AREA
Definition: dig_defines.h:188
#define GV_STORE_KERNEL
Definition: dig_defines.h:200
#define GV_STORE_FACE
Definition: dig_defines.h:199
#define GV_STORE_VOLUME
Definition: dig_defines.h:202
#define GV_STORE_POINT
Feature types used in store like &#39;coor&#39; file or postgis type column (must not change) ...
Definition: dig_defines.h:195
#define GV_KERNEL
Definition: dig_defines.h:187
#define GV_VOLUME
Definition: dig_defines.h:189