vectorlib_libraries.dox 3.9 KB

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