set_window.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. \file lib/gis/set_window.c
  3. \brief GIS Library - Set window (map region)
  4. (C) 2001-2009, 2011 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. */
  9. #include <grass/gis.h>
  10. #include <grass/glocale.h>
  11. #include "G.h"
  12. /*!
  13. \brief Get the current working window (region)
  14. The current working window values are returned in the structure
  15. \p window.
  16. Previous calls to G_set_window() affects values returned by this function.
  17. Previous calls to G_put_window() affects values returned by this function
  18. only if the current working window is not initialized.
  19. \param[out] window pointer to window structure to be set
  20. \sa G_set_window(), G_get_window()
  21. */
  22. void G_get_set_window(struct Cell_head *window)
  23. {
  24. G__init_window();
  25. *window = G__.window;
  26. }
  27. /*!
  28. \brief Establishes \p window as the current working window (region).
  29. This function adjusts the \p window before setting the region
  30. so you don't have to call G_adjust_Cell_head().
  31. \note Only the current process is affected.
  32. \param window window to become operative window
  33. \sa G_get_set_window(), G_put_window()
  34. */
  35. void G_set_window(struct Cell_head *window)
  36. {
  37. /* adjust window, check for valid window */
  38. G_adjust_Cell_head(window, 0, 0);
  39. /* copy the window to the current window */
  40. G__.window = *window;
  41. G__.window_set = 1;
  42. }