grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rewind.c
Go to the documentation of this file.
1/*!
2 \file lib/vector/Vlib/rewind.c
3
4 \brief Vector library - rewind data
5
6 Higher level functions for reading/writing/manipulating vectors.
7
8 (C) 2001-2009, 2011-2012 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 Original author CERL, probably Dave Gerdes or Mike Higgins.
14 \author Update to GRASS 5.7 Radim Blazek and David D. Gray.
15 \author Level 3 by Martin Landa <landa.martin gmail.com>
16*/
17
18#include <grass/vector.h>
19#include <grass/glocale.h>
20
21static int rew_dummy()
22{
23 return -1;
24}
25
26#if !defined HAVE_OGR || !defined HAVE_POSTGRES
27static int format()
28{
29 G_fatal_error(_("Requested format is not compiled in this version"));
30 return 0;
31}
32#endif
33
34
35static int (*Rewind_array[][4]) () = {
36 {
38#ifdef HAVE_OGR
39 , {
41 , {
43#else
44 , {
46 , {
48#endif
49#ifdef HAVE_POSTGRES
50 , {
52#else
53 , {
55#endif
56};
57
58/*!
59 \brief Rewind vector map to cause reads to start at beginning
60
61 \param Map pointer to Map_info structure
62
63 \return 0 on success
64 \return -1 on error
65 */
66int Vect_rewind(struct Map_info *Map)
67{
68 if (!VECT_OPEN(Map))
69 return -1;
70
71 G_debug(1, "Vect_Rewind(): name = %s level = %d", Map->name, Map->level);
72
73 return (*Rewind_array[Map->format][Map->level]) (Map);
74}
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: debug.c:65
#define VECT_OPEN(Map)
Check if vector map is open.
Definition: dig_defines.h:136
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
Definition: error.c:160
#define _(str)
Definition: glocale.h:13
int V2_rewind_nat(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format...
Definition: rewind_nat.c:40
int V1_rewind_nat(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native fo...
Definition: rewind_nat.c:27
int V1_rewind_ogr(struct Map_info *Map)
Rewind vector map (OGR layer) to cause reads to start at beginning (level 1)
Definition: rewind_ogr.c:32
int V2_rewind_ogr(struct Map_info *Map)
Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2)
Definition: rewind_ogr.c:61
int V1_rewind_pg(struct Map_info *Map)
Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1)
Definition: rewind_pg.c:34
int V2_rewind_pg(struct Map_info *Map)
Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2)
Definition: rewind_pg.c:70
Vector map info.
Definition: dig_structs.h:1260
int level
Topology level.
Definition: dig_structs.h:1313
char * name
Map name (for 4.0)
Definition: dig_structs.h:1332
int format
Map format (native, ogr, postgis)
Definition: dig_structs.h:1271
static int rew_dummy()
Definition: rewind.c:21
static int format()
Definition: rewind.c:27
static int(* Rewind_array[][4])()
Definition: rewind.c:35
int Vect_rewind(struct Map_info *Map)
Rewind vector map to cause reads to start at beginning.
Definition: rewind.c:66