defs.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /****************************************************************************
  2. *
  3. * MODULE: r.distance
  4. *
  5. * AUTHOR(S): Michael Shapiro - CERL
  6. *
  7. * PURPOSE: Locates the closest points between objects in two
  8. * raster maps.
  9. *
  10. * COPYRIGHT: (C) 2003 by the GRASS Development Team
  11. *
  12. * This program is free software under the GNU General Public
  13. * License (>=v2). Read the file COPYING that comes with GRASS
  14. * for details.
  15. *
  16. ***************************************************************************/
  17. #ifndef __R_DIST_DEFS_H__
  18. #define __R_DIST_DEFS_H__
  19. #include <grass/gis.h>
  20. #include <grass/raster.h>
  21. struct EdgeList /* keep track of edge cells */
  22. {
  23. struct CatEdgeList
  24. {
  25. CELL cat; /* category number */
  26. int *row, *col; /* arrays of pixels indexes */
  27. int ncells; /* count of edges cells with this cat */
  28. int nalloc; /* lenght of allocation for row,col */
  29. } *catlist; /* array of cat:edgelists */
  30. int ncats; /* number of cats */
  31. int nalloc; /* length of allocation for catlist */
  32. int count; /* total number of edge cells */
  33. };
  34. struct Map
  35. {
  36. const char *name; /* raster map name */
  37. const char *mapset; /* raster map mapset */
  38. const char *fullname; /* raster map fully qualified name */
  39. struct Categories labels; /* category labels */
  40. struct EdgeList edges; /* edge cells */
  41. };
  42. struct Parms
  43. {
  44. struct Map map1, map2; /* two raster maps to analyze */
  45. int labels; /* boolean: report includes cat labels */
  46. char *fs; /* report field separator */
  47. int overlap; /* checking for overlapping, than distance is 0 */
  48. };
  49. /* distance.c */
  50. void find_minimum_distance(const struct CatEdgeList *, const struct CatEdgeList *,
  51. double *, double *, double *, double *, double *,
  52. const struct Cell_head *, int, const char *, const char *);
  53. int null_distance(const char *, const char *, int *, int *);
  54. /* edges.c */
  55. void print_edge_info(struct Map *);
  56. void find_edge_cells(struct Map *);
  57. void add_edge_cell(struct Map *, CELL, int, int);
  58. void init_edge_list(struct Map *);
  59. void sort_edge_list(struct Map *);
  60. /* labels.c */
  61. void read_labels(struct Map *);
  62. char *get_label(struct Map *, CELL);
  63. /* parse.c */
  64. void parse(int, char *[], struct Parms *);
  65. /* report.c */
  66. void report(struct Parms *);
  67. #endif /* __R_DIST_DEFS_H__ */