set_window.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "gis_local_proto.h"
  13. /*!
  14. \brief Get the current working window (region)
  15. The current working window values are returned in the structure
  16. \p window.
  17. Previous calls to G_set_window() affects values returned by this function.
  18. Previous calls to G_put_window() affects values returned by this function
  19. only if the current working window is not initialized.
  20. \param[out] window pointer to window structure to be set
  21. \sa G_set_window(), G_get_window()
  22. */
  23. void G_get_set_window(struct Cell_head *window)
  24. {
  25. G__init_window();
  26. *window = G__.window;
  27. }
  28. /*!
  29. \brief Establishes \p window as the current working window (region).
  30. This function adjusts the \p window before setting the region
  31. so you don't have to call G_adjust_Cell_head().
  32. \note Only the current process is affected.
  33. \param window window to become operative window
  34. \sa G_get_set_window(), G_put_window()
  35. */
  36. void G_set_window(struct Cell_head *window)
  37. {
  38. /* adjust window, check for valid window */
  39. G_adjust_Cell_head(window, 0, 0);
  40. /* copy the window to the current window */
  41. G__.window = *window;
  42. G__.window_set = 1;
  43. }