vectorlib_libraries.dox 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*! \page vlibDescription Vector libraries
  2. by GRASS Development Team (http://grass.osgeo.org)
  3. \tableofcontents
  4. \section vlibsAboutIntro Introduction
  5. Besides internal library functions there are two main libraries:
  6. - Vlib (Vector library), see \ref vlibIntro
  7. - DGLib (Directed Graph Library)
  8. For historical reasons, there are two internal libraries:
  9. - diglib (with dig_*() functions), GRASS 3.x/4.x
  10. - Vlib (with V1_*(), V2_*() and Vect_*() functions), since GRASS 4.x
  11. (except for the 5.7 interim version)
  12. The vector library was introduced in GRASS 4.0 to hide internal vector
  13. files' formats and structures. In GRASS 6/7, everything is accessed via
  14. Vect_*() functions, for example:
  15. Old 4.x code:
  16. \code
  17. xx = Map.Att[Map.Area[area_num].att].x;
  18. \endcode
  19. New 6.x/7.x functions:
  20. \code
  21. centroid = Vect_get_area_centroid(Map, area_num);
  22. Vect_read_line(Map, line_p, NULL, centroid);
  23. Vect_line_get_point(line_p, 0, &xx, NULL, NULL);
  24. \endcode
  25. In GRASS 6/7, all internal, mostly non-topological vector functions are
  26. hidden from the modules' API (mainly dig_*(), V1_*() and V2_*()
  27. functions). All available Vect_*() functions are topological vector
  28. functions.
  29. The following include file contains definitions and structures
  30. required by some of the routines in this library. The programmer
  31. should therefore include this file in any code that uses the vector
  32. library:
  33. \code
  34. #include <grass/vector.h>
  35. \endcode
  36. <i>Note: For details please read Blazek et al. 2002 (see below) as
  37. well as the references in this document.</i>
  38. \section vlibsHistory Historical notes
  39. The vector library in GRASS 4.0 changed significantly from the
  40. <em>Digit Library</em> (diglib) used in GRASS 3.1. Below is an
  41. overview of why the changes were made.
  42. The Digit Library was a collage of subroutines created for developing
  43. the map development programs. Few of these subroutines were actually
  44. designed as a user access library. They required individuals to assume
  45. too much responsibility and control over what happened to the data
  46. file. Thus when it came time to change vector data file formats for
  47. GRASS 4.0, many modules also required modification. The two different
  48. access levels for 3.0 vector files provided very different ways of
  49. calling the library; they offered little consistency for the user.
  50. The Digit Library was originally designed to only have one file open
  51. for read or write at a time. Although it was possible in some cases to
  52. get around this, one restriction was the global head structure. Since
  53. there was only one instance of this, there could only be one copy of
  54. that information, and thus, only one open vector file.
  55. The solution to these problems was to design a new user library as an
  56. interface to the vector data files. This new library was designed to
  57. provide a simple consistent interface, which hides as much of the
  58. details of the data format as possible. It also could be extended for
  59. future enhancements without the need to change existing programs.
  60. The new vector library in GRASS 4 provided routines for opening,
  61. closing, reading, and writing vector files, as well as several support
  62. functions. The Digit Library has been replaced, so that all existing
  63. modules was converted to use the new library. Those routines that
  64. existed in the Digit Library and were not affected by these changes
  65. continue to exist in unmodified form, and were included in the vector
  66. library. Most of the commonly used routines have been discarded, and
  67. replaced by the new vector routines.
  68. Instead the global head structure was used own local version of
  69. it. The structure that replaced structure head is structure \ref
  70. dig_head. There were still two levels of interface to the vector files
  71. (future releases may include more). Level one provided access only to
  72. arc (i.e. polyline) information and to the type of line (AREA, LINE,
  73. DOT). Level two provided access to polygons (areas), attributes, and
  74. network topology.
  75. */