[GRASS-SVN] r47292 - in grass/trunk: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 28 06:56:29 EDT 2011


Author: martinl
Date: 2011-07-28 03:56:29 -0700 (Thu, 28 Jul 2011)
New Revision: 47292

Modified:
   grass/trunk/include/gisdefs.h
   grass/trunk/lib/gis/get_window.c
   grass/trunk/lib/gis/set_window.c
   grass/trunk/lib/gis/window_map.c
Log:
gislib: define G_unset_window()
	cosmetics doxygen messages


Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h	2011-07-28 10:54:22 UTC (rev 47291)
+++ grass/trunk/include/gisdefs.h	2011-07-28 10:56:29 UTC (rev 47292)
@@ -562,6 +562,7 @@
 /* set_window.c */
 void G_get_set_window(struct Cell_head *);
 void G_set_window(struct Cell_head *);
+void G_unset_window();
 
 /* short_way.c */
 void G_shortest_way(double *, double *);

Modified: grass/trunk/lib/gis/get_window.c
===================================================================
--- grass/trunk/lib/gis/get_window.c	2011-07-28 10:54:22 UTC (rev 47291)
+++ grass/trunk/lib/gis/get_window.c	2011-07-28 10:56:29 UTC (rev 47292)
@@ -1,12 +1,12 @@
 /*!
-  \file gis/get_window.c
+  \file lib/gis/get_window.c
 
   \brief GIS Library - Get window (i.e. GRASS region)
 
-  (C) 2001-2009 by the GRASS Development Team
-
+  (C) 2001-2009, 2011 by the GRASS Development Team
+  
   This program is free software under the GNU General Public License
-  (>=v2).  Read the file COPYING that comes with GRASS for details.
+  (>=v2). Read the file COPYING that comes with GRASS for details.
 
   \author Original author CERL
 */
@@ -26,24 +26,23 @@
 static struct state *st = &state;
 
 /*!
- * \brief Read the database region
- *
- * Reads the database region as stored in the WIND file in the user's
- * current mapset into region.
- *
- * 3D values are set to defaults if not available in WIND file.
- * An error message is printed and exit() is called if there is a problem reading
- * the region.
- *
- * <b>Note:</b> GRASS applications that read or write raster maps
- * should not use this routine since its use implies that the active
- * module region will not be used. Programs that read or write raster
- * map data (or vector data) can query the active module region using
- * Rast_window_rows() and Rast_window_cols().
- *
- * \param window pointer to Cell_head
- */
-
+  \brief Read the database region
+  
+  Reads the database region as stored in the WIND file in the user's
+  current mapset into region.
+  
+  3D values are set to defaults if not available in WIND file.  An
+  error message is printed and exit() is called if there is a problem
+  reading the region.
+  
+  <b>Note:</b> GRASS applications that read or write raster maps
+  should not use this routine since its use implies that the active
+  module region will not be used. Programs that read or write raster
+  map data (or vector data) can query the active module region using
+  Rast_window_rows() and Rast_window_cols().
+  
+  \param[out] window pointer to Cell_head
+*/
 void G_get_window(struct Cell_head *window)
 {
     const char *regvar;
@@ -80,32 +79,30 @@
 }
 
 /*!
- * \brief Read the default region
- *
- * Reads the default region for the location into <i>region.</i> 3D
- * values are set to defaults if not available in WIND file.
- *
- * An error message is printed and exit() is called if there is a
- * problem reading the default region.
- *
- * \param[out] window pointer to Cell_head
- */
-
+  \brief Read the default region
+  
+  Reads the default region for the location into <i>region.</i> 3D
+  values are set to defaults if not available in WIND file.
+  
+  An error message is printed and exit() is called if there is a
+  problem reading the default region.
+  
+  \param[out] window pointer to Cell_head
+*/
 void G_get_default_window(struct Cell_head *window)
 {
     G__get_window(window, "", "DEFAULT_WIND", "PERMANENT");
 }
 
 /*!
-  \brief Get cwindow (region) of selected map layer
+  \brief Get window (region) of selected map
   
-  \param window pointer to Cell_head
-  \param element element name
+  G_fatal_error() is called on error
+  
+  \param window[out] pointer to Cell_head
+  \param element element type
   \param name map name
   \param mapset mapset name
-
-  \return string on error
-  \return NULL on success
 */
 void G__get_window(struct Cell_head *window,
 		   const char *element, const char *name, const char *mapset)
@@ -123,3 +120,12 @@
     G__read_Cell_head(fp, window, 0);
     fclose(fp);
 }
+
+/*!
+  \brief Unset current window
+*/
+void G_unset_window()
+{
+    st->initialized = 0;
+    G__.window_set = 0;
+}

Modified: grass/trunk/lib/gis/set_window.c
===================================================================
--- grass/trunk/lib/gis/set_window.c	2011-07-28 10:54:22 UTC (rev 47291)
+++ grass/trunk/lib/gis/set_window.c	2011-07-28 10:56:29 UTC (rev 47292)
@@ -1,15 +1,15 @@
 /*!
- * \file gis/set_window.c
- *
- * \brief GIS Library - Set window (map region)
- *
- * (C) 2001-2009 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author Original author CERL
- */
+  \file lib/gis/set_window.c
+  
+  \brief GIS Library - Set window (map region)
+  
+  (C) 2001-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Original author CERL
+*/
 
 #include <grass/gis.h>
 #include <grass/glocale.h>
@@ -17,13 +17,13 @@
 #include "G.h"
 
 /*!
- * \brief Get the current working window (region)
- *
- * The current working window values are returned in the structure
- * <i>window</i>.
- *
- * \param[in,out] window window structure to be set
- */
+  \brief Get the current working window (region)
+  
+  The current working window values are returned in the structure
+  <i>window</i>.
+  
+  \param[out] window window structure to be set
+*/
 void G_get_set_window(struct Cell_head *window)
 {
     G__init_window();
@@ -31,19 +31,15 @@
 }
 
 /*!
- * \brief Establishes 'window' as the current working window.
- * 
- * \param window window to become operative window
- * 
- * \return -1 on error
- * \return  1 on success
- */
+  \brief Establishes 'window' as the current working window.
+  
+  \param window window to become operative window
+*/
 void G_set_window(struct Cell_head *window)
 {
     /* adjust window, check for valid window */
-
     G_adjust_Cell_head(window, 0, 0);
-
+    
     /* copy the window to the current window */
     G__.window = *window;
     G__.window_set = 1;

Modified: grass/trunk/lib/gis/window_map.c
===================================================================
--- grass/trunk/lib/gis/window_map.c	2011-07-28 10:54:22 UTC (rev 47291)
+++ grass/trunk/lib/gis/window_map.c	2011-07-28 10:56:29 UTC (rev 47292)
@@ -1,36 +1,34 @@
 /*!
- * \file window_map.c
- *
- * \brief GIS Library - Window mapping functions.
- *
- * (C) 2001-2009 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public License
- * (>=v2). Read the file COPYING that comes with GRASS for details.
- *
- * \author Original author CERL
- */
+  \file lib/gis/window_map.c
+  
+  \brief GIS Library - Window mapping functions.
+  
+  (C) 2001-2009, 2011 by the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Original author CERL
+*/
 
 #include <grass/gis.h>
 
 #include "G.h"
 
-
 /*!
- * \brief Adjust east longitude.
- *
- * This routine returns an equivalent <i>east</i> that is
- * larger, but no more than 360 larger than the <i>west</i> 
- * coordinate.
+  \brief Adjust east longitude.
+ 
+  This routine returns an equivalent <i>east</i> that is larger, but
+  no more than 360 larger than the <i>west</i> coordinate.
 
- * <b>Note:</b> This routine should be used only with
- * latitude-longitude coordinates.
- *
- * \param east east coordinate
- * \param west west coordinate
- *
- * \return east coordinate
- */
+  <b>Note:</b> This routine should be used only with
+  latitude-longitude coordinates.
+ 
+  \param east east coordinate
+  \param west west coordinate
+  
+  \return east coordinate
+*/
 double G_adjust_east_longitude(double east, double west)
 {
     while (east > west + 360.0)
@@ -41,22 +39,20 @@
     return east;
 }
 
-
 /*!
- * \brief Returns east larger than west.
- *
- * If the region projection is <tt>PROJECTION_LL</tt>, then this routine 
- * returns an equivalent <i>east</i> that is larger, but no more than 
- * 360 degrees larger, than the coordinate for the western edge of the 
- * region. Otherwise no adjustment is made and the original
- * <i>east</i> is returned.
- *
- * \param east east coordinate
- * \param window pointer to Cell_head
- *
- * \return east coordinate
- */
-
+  \brief Returns east larger than west.
+  
+  If the region projection is <tt>PROJECTION_LL</tt>, then this
+  routine returns an equivalent <i>east</i> that is larger, but no
+  more than 360 degrees larger, than the coordinate for the western
+  edge of the region. Otherwise no adjustment is made and the original
+  <i>east</i> is returned.
+  
+  \param east east coordinate
+  \param window pointer to Cell_head
+  
+  \return east coordinate
+*/
 double G_adjust_easting(double east, const struct Cell_head *window)
 {
     if (window->proj == PROJECTION_LL) {
@@ -69,14 +65,13 @@
 }
 
 /*!
- * \brief Initialize window.
- *
- */
+  \brief Initialize window (region).
+*/
 void G__init_window(void)
 {
     if (G_is_initialized(&G__.window_set))
 	return;
-
+    
     G_get_window(&G__.window);
 
     G_initialize_done(&G__.window_set);



More information about the grass-commit mailing list