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