labels.c 856 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include <stdlib.h>
  18. #include <grass/raster.h>
  19. #include "defs.h"
  20. void read_labels(struct Map *map)
  21. {
  22. if (Rast_read_cats(map->name, map->mapset, &map->labels) < 0)
  23. exit(1);
  24. }
  25. char *get_label(struct Map *map, CELL cat)
  26. {
  27. return Rast_get_c_cat(&cat, &map->labels);
  28. }