get_info.c 765 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <grass/gis.h>
  4. #include <grass/display.h>
  5. #include <grass/colors.h>
  6. #include <grass/glocale.h>
  7. #include "colors.h"
  8. int get_map_info(char *name, char *mapset)
  9. {
  10. struct Colors colors;
  11. struct Categories categories;
  12. if (!name)
  13. exit(0);
  14. if (*name == '\0')
  15. exit(0);
  16. /* Reading color lookup table */
  17. if (Rast_read_cats(name, mapset, &categories) == -1)
  18. G_fatal_error(_("Error reading category file for <%s>"), name);
  19. /* Reading color lookup table */
  20. if (Rast_read_colors(name, mapset, &colors) == -1)
  21. G_fatal_error(_("Unable to read color table for raster map <%s>"), name);
  22. interact(&categories, &colors, name, mapset);
  23. /* Wrapup graphics */
  24. R_flush();
  25. return 0;
  26. }