[GRASS-SVN] r38024 - in grass/trunk: include lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 22 07:45:36 EDT 2009
Author: glynn
Date: 2009-06-22 07:45:35 -0400 (Mon, 22 Jun 2009)
New Revision: 38024
Modified:
grass/trunk/include/gisdefs.h
grass/trunk/lib/gis/set_window.c
Log:
Re-instate G_set_window()
Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2009-06-22 09:09:10 UTC (rev 38023)
+++ grass/trunk/include/gisdefs.h 2009-06-22 11:45:35 UTC (rev 38024)
@@ -536,6 +536,7 @@
/* set_window.c */
void G_get_set_window(struct Cell_head *);
+int G_set_window(struct Cell_head *);
/* short_way.c */
void G_shortest_way(double *, double *);
Modified: grass/trunk/lib/gis/set_window.c
===================================================================
--- grass/trunk/lib/gis/set_window.c 2009-06-22 09:09:10 UTC (rev 38023)
+++ grass/trunk/lib/gis/set_window.c 2009-06-22 11:45:35 UTC (rev 38024)
@@ -29,3 +29,34 @@
G__init_window();
G_copy(window, &G__.window, sizeof(*window));
}
+
+/*!
+ * \brief Establishes 'window' as the current working window.
+ *
+ * \param window window to become operative window
+ *
+ * \return -1 on error
+ * \return 1 on success
+ */
+int G_set_window(struct Cell_head *window)
+{
+ const char *err;
+
+ /* adjust window, check for valid window */
+ /* adjust the real one, not a copy
+ G_copy (&twindow, window, sizeof(struct Cell_head));
+ window = &twindow;
+ */
+
+ if ((err = G_adjust_Cell_head(window, 0, 0))) {
+ G_warning("G_set_window(): %s", err);
+ return -1;
+ }
+
+ /* copy the window to the current window */
+ G_copy((char *)&G__.window, (char *)window, sizeof(*window));
+
+ G__.window_set = 1;
+
+ return 1;
+}
More information about the grass-commit
mailing list