[GRASS-SVN] r40773 - in grass/trunk: include lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 1 18:07:48 EST 2010


Author: glynn
Date: 2010-02-01 18:07:47 -0500 (Mon, 01 Feb 2010)
New Revision: 40773

Modified:
   grass/trunk/include/rasterdefs.h
   grass/trunk/lib/raster/window.c
Log:
Add Rast_get_window(), Rast_get_{input,output}_window()


Modified: grass/trunk/include/rasterdefs.h
===================================================================
--- grass/trunk/include/rasterdefs.h	2010-02-01 22:49:26 UTC (rev 40772)
+++ grass/trunk/include/rasterdefs.h	2010-02-01 23:07:47 UTC (rev 40773)
@@ -524,16 +524,19 @@
 void Rast_set_input_window(struct Cell_head *);
 
 /* window.c */
-double Rast_northing_to_row(double, const struct Cell_head *);
-double Rast_easting_to_col(double, const struct Cell_head *);
-double Rast_row_to_northing(double, const struct Cell_head *);
-double Rast_col_to_easting(double, const struct Cell_head *);
+void Rast_get_window(struct Cell_head *);
+void Rast_get_input_window(struct Cell_head *);
+void Rast_get_output_window(struct Cell_head *);
 int Rast_window_rows(void);
 int Rast_window_cols(void);
 int Rast_input_window_rows(void);
 int Rast_input_window_cols(void);
 int Rast_output_window_rows(void);
 int Rast_output_window_cols(void);
+double Rast_northing_to_row(double, const struct Cell_head *);
+double Rast_easting_to_col(double, const struct Cell_head *);
+double Rast_row_to_northing(double, const struct Cell_head *);
+double Rast_col_to_easting(double, const struct Cell_head *);
 
 /* window_map.c */
 void Rast__create_window_mapping(int);

Modified: grass/trunk/lib/raster/window.c
===================================================================
--- grass/trunk/lib/raster/window.c	2010-02-01 22:49:26 UTC (rev 40772)
+++ grass/trunk/lib/raster/window.c	2010-02-01 23:07:47 UTC (rev 40773)
@@ -5,6 +5,49 @@
 #include "R.h"
 
 /*!
+ * \brief Read the current window
+ *
+ * \param window pointer to Cell_head
+ */
+
+void Rast_get_window(struct Cell_head *window)
+{
+    Rast__init_window();
+
+    if (R__.split_window)
+	G_fatal_error(_("Internal error: Rast_get_window() called with split window."
+			"Use Rast_get_input_window() or Rast_get_output_window() instead."));
+
+    *window = R__.wr_window;
+}
+
+/*!
+ * \brief Read the current input window
+ *
+ * \param window pointer to Cell_head
+ */
+
+void Rast_get_input_window(struct Cell_head *window)
+{
+    Rast__init_window();
+
+    *window = R__.rd_window;
+}
+
+/*!
+ * \brief Read the current output window
+ *
+ * \param window pointer to Cell_head
+ */
+
+void Rast_get_output_window(struct Cell_head *window)
+{
+    Rast__init_window();
+
+    *window = R__.wr_window;
+}
+
+/*!
  * \brief Number of rows in active window.
  *
  * This routine returns the number of rows in the active module window. 



More information about the grass-commit mailing list