rewind_ogr.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. \file lib/vector/Vlib/rewind.c
  3. \brief Vector library - rewind data (native format)
  4. Higher level functions for reading/writing/manipulating vectors.
  5. (C) 2001-2009 by the GRASS Development Team
  6. This program is free software under the GNU General Public License
  7. (>=v2). Read the file COPYING that comes with GRASS for details.
  8. \author Radim Blazek, Piero Cavalieri
  9. */
  10. #include <grass/config.h>
  11. #include <grass/gis.h>
  12. #include <grass/vector.h>
  13. #ifdef HAVE_OGR
  14. #include <ogr_api.h>
  15. /*!
  16. \brief Rewind vector data file to cause reads to start at beginning (level 1)
  17. \param Map vector map
  18. \return 0 on success
  19. \return -1 on error
  20. */
  21. int V1_rewind_ogr(struct Map_info *Map)
  22. {
  23. G_debug(2, "V1_rewind_ogr(): name = %s", Map->name);
  24. Map->fInfo.ogr.lines_num = 0;
  25. Map->fInfo.ogr.lines_next = 0;
  26. OGR_L_ResetReading(Map->fInfo.ogr.layer);
  27. return 0;
  28. }
  29. /*!
  30. \brief Rewind vector data file to cause reads to start at beginning (level 2)
  31. \param Map vector map
  32. \return 0 on success
  33. \return -1 on error
  34. */
  35. int V2_rewind_ogr(struct Map_info *Map)
  36. {
  37. G_debug(2, "V2_rewind_ogr(): name = %s", Map->name);
  38. Map->next_line = 1;
  39. return 0;
  40. }
  41. #endif