set_window.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*!
  2. * \file gis/set_window.c
  3. *
  4. * \brief GIS Library - Set window (map region)
  5. *
  6. * (C) 2001-2009 by the GRASS Development Team
  7. *
  8. * This program is free software under the GNU General Public License
  9. * (>=v2). Read the file COPYING that comes with GRASS for details.
  10. *
  11. * \author Original author CERL
  12. */
  13. #include <grass/gis.h>
  14. #include <grass/glocale.h>
  15. #include "G.h"
  16. /*!
  17. * \brief Get the current working window (region)
  18. *
  19. * The current working window values are returned in the structure
  20. * <i>window</i>.
  21. *
  22. * \param[in,out] window window structure to be set
  23. */
  24. void G_get_set_window(struct Cell_head *window)
  25. {
  26. G__init_window();
  27. G_copy(window, &G__.window, sizeof(*window));
  28. }
  29. /*!
  30. * \brief Establishes 'window' as the current working window.
  31. *
  32. * \param window window to become operative window
  33. *
  34. * \return -1 on error
  35. * \return 1 on success
  36. */
  37. void G_set_window(struct Cell_head *window)
  38. {
  39. /* adjust window, check for valid window */
  40. /* adjust the real one, not a copy
  41. G_copy (&twindow, window, sizeof(struct Cell_head));
  42. window = &twindow;
  43. */
  44. G_adjust_Cell_head(window, 0, 0);
  45. /* copy the window to the current window */
  46. G_copy((char *)&G__.window, (char *)window, sizeof(*window));
  47. G__.window_set = 1;
  48. }