Explorar o código

gislib: define G_unset_window()
cosmetics doxygen messages


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47292 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa %!s(int64=13) %!d(string=hai) anos
pai
achega
e028cffb66
Modificáronse 4 ficheiros con 108 adicións e 110 borrados
  1. 1 0
      include/gisdefs.h
  2. 45 39
      lib/gis/get_window.c
  3. 23 27
      lib/gis/set_window.c
  4. 39 44
      lib/gis/window_map.c

+ 1 - 0
include/gisdefs.h

@@ -562,6 +562,7 @@ void G_fseek(FILE *, off_t, int);
 /* 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 *);

+ 45 - 39
lib/gis/get_window.c

@@ -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 {
 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 @@ void G_get_window(struct Cell_head *window)
 }
 
 /*!
- * \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 @@ void G__get_window(struct Cell_head *window,
     G__read_Cell_head(fp, window, 0);
     fclose(fp);
 }
+
+/*!
+  \brief Unset current window
+*/
+void G_unset_window()
+{
+    st->initialized = 0;
+    G__.window_set = 0;
+}

+ 23 - 27
lib/gis/set_window.c

@@ -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 @@ void G_get_set_window(struct Cell_head *window)
 }
 
 /*!
- * \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;

+ 39 - 44
lib/gis/window_map.c

@@ -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 @@ double G_adjust_east_longitude(double east, double west)
     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 @@ double G_adjust_easting(double east, const struct Cell_head *window)
 }
 
 /*!
- * \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);