redraw.c 700 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <stdlib.h>
  2. #include <grass/display.h>
  3. #include <grass/glocale.h>
  4. #include "local_proto.h"
  5. int redraw(void)
  6. {
  7. int i;
  8. char command[128];
  9. R_close_driver();
  10. sprintf(command, "d.erase");
  11. system(command);
  12. if (cmd) {
  13. system(cmd);
  14. }
  15. else {
  16. /* Redraw raster map */
  17. if (rast) {
  18. for (i = 0; i < nrasts; i++) {
  19. sprintf(command, "d.rast -o map=%s", rast[i]);
  20. system(command);
  21. }
  22. }
  23. /* Redraw vector map */
  24. if (vect) {
  25. for (i = 0; i < nvects; i++) {
  26. sprintf(command, "d.vect map=%s", vect[i]);
  27. system(command);
  28. }
  29. }
  30. }
  31. if (R_open_driver() != 0)
  32. G_fatal_error(_("No graphics device selected"));
  33. D_setup(0);
  34. return 0;
  35. }