[GRASS-SVN] r29717 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 16 08:14:07 EST 2008


Author: martinl
Date: 2008-01-16 08:14:07 -0500 (Wed, 16 Jan 2008)
New Revision: 29717

Modified:
   grass/trunk/lib/vector/Vlib/open_nat.c
   grass/trunk/lib/vector/Vlib/open_ogr.c
   grass/trunk/lib/vector/Vlib/write_nat.c
Log:
vectlib: doxygen, i18n updated

Modified: grass/trunk/lib/vector/Vlib/open_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_nat.c	2008-01-16 04:14:45 UTC (rev 29716)
+++ grass/trunk/lib/vector/Vlib/open_nat.c	2008-01-16 13:14:07 UTC (rev 29717)
@@ -1,35 +1,45 @@
-/*
-****************************************************************************
-*
-* MODULE:       Vector library 
-*   	    	
-* AUTHOR(S):    Original author CERL, probably Dave Gerdes or Mike Higgins.
-*               Update to GRASS 5.7 Radim Blazek and David D. Gray.
-*
-* PURPOSE:      Higher level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT:    (C) 2001 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.
-*
-*****************************************************************************/
+/*!
+  \file open_nat.c
+  
+  \brief Vector library - open vector map (native format)
+  
+  Higher level functions for reading/writing/manipulating vectors.
+
+  (C) 2001-2008 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, probably Dave Gerdes or Mike Higgins.
+  Update to GRASS 5.7 Radim Blazek and David D. Gray.
+  
+  \date 2001
+*/
+
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #include <grass/Vect.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
+static char name_buf[GPATH_MAX];
+static int check_coor ( struct Map_info *Map );
 
-static char name_buf[1024];
-int check_coor ( struct Map_info *Map );
+/**
+   \brief Open existing vector map
 
-/* Open old file.
-*  Map->name and Map->mapset must be set before
-*  
-*  Return: 0 success
-*         -1 error */
+   Map->name and Map->mapset must be set before.
+
+   \param Map poiter to vector map
+   \param update non-zero for write mode, otherwise read-only
+
+   \return 0 success
+   \return -1 error
+*/
 int 
 V1_open_old_nat ( struct Map_info *Map, int update)
 {
@@ -59,10 +69,17 @@
   return (0);
 }
 
-/* Open new file.
-*  
-*  Return: 0 success
-*         -1 error */
+/**
+   \brief Open/Create new vector map.
+
+   \param Map pointer to vector map
+   \param name map name
+   \param with_z 2D or 3D (unused?)
+
+
+   \return 0 success
+   \return -1 error 
+*/
 int 
 V1_open_new_nat (
 	      struct Map_info *Map,
@@ -123,11 +140,11 @@
 	                     Map->head.size, CInfo.size);
 
     if ( dif > 0 ) {
-        G_warning ( "coor files of vector '%s@%s' is larger than it should be "
-	            "(%ld bytes excess).", Map->name, Map->mapset, dif);
+	G_warning (_("Coor files of vector map <%s@%s> is larger than it should be "
+		     "(%ld bytes excess)"), Map->name, Map->mapset, dif);
     } else if ( dif < 0 ) {
-        G_warning ( "coor files of vector '%s@%s' is shorter than it should be "
-	            "(%ld bytes missing).", Map->name, Map->mapset, -dif);
+        G_warning (_("Coor files of vector <%s@%s> is shorter than it should be "
+		     "(%ld bytes missing)."), Map->name, Map->mapset, -dif);
     }
     return 1;
 }

Modified: grass/trunk/lib/vector/Vlib/open_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/open_ogr.c	2008-01-16 04:14:45 UTC (rev 29716)
+++ grass/trunk/lib/vector/Vlib/open_ogr.c	2008-01-16 13:14:07 UTC (rev 29717)
@@ -1,33 +1,46 @@
-/****************************************************************************
-*
-* MODULE:       Vector library 
-*   	    	
-* AUTHOR(S):    Radim Blazek, Piero Cavalieri 
-*
-* PURPOSE:      Higher level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT:    (C) 2001 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.
-*
-*****************************************************************************/
+/*!
+  \file open_ogr.c
+  
+  \brief Vector library - open vector map (OGR format)
+  
+  Higher level functions for reading/writing/manipulating vectors.
+
+  (C) 2001-2008 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, probably Dave Gerdes or Mike Higgins.
+  Update to GRASS 5.7 Radim Blazek and David D. Gray.
+  
+  \date 2001
+*/
+
 #include <unistd.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+
 #include <grass/Vect.h>
 #include <grass/gis.h>
+#include <grass/glocale.h>
 
 #ifdef HAVE_OGR
 #include <ogr_api.h>
 
-/* Open old file.
-*  Map->name and Map->mapset must be set before
-*
-*  Return: 0 success
-*         -1 error
+/**
+   \brief Open existing vector map
+
+   Map->name and Map->mapset must be set before.
+
+   \param Map pointer to vector map
+   \param update non-zero for write mode, otherwise read-only
+   (write mode is currently not supported)
+
+   \return 0 success
+   \return -1 error
 */
 int
 V1_open_old_ogr (struct Map_info *Map, int update)
@@ -38,7 +51,7 @@
     OGRFeatureDefnH Ogr_featuredefn;
 
     if (update) {
-	G_warning ("OGR format cannot be updated.");
+	G_warning (_("OGR format cannot be updated"));
 	return -1;
     }
 
@@ -50,7 +63,7 @@
     /*Data source handle */
     Ogr_ds = OGROpen (Map->fInfo.ogr.dsn, FALSE, NULL);
     if (Ogr_ds == NULL)
-	G_fatal_error ("Cannot open OGR data source '%s'", Map->fInfo.ogr.dsn);
+	G_fatal_error (_("Unable to open OGR data source '%s'"), Map->fInfo.ogr.dsn);
     Map->fInfo.ogr.ds = Ogr_ds;
 
     /* Layer number */
@@ -68,7 +81,7 @@
     }
     if (layer == -1) {
 	OGR_DS_Destroy (Ogr_ds);
-	G_fatal_error ("Cannot open layer '%s'", Map->fInfo.ogr.layer_name);
+	G_fatal_error (_("Unable to open layer <%s>"), Map->fInfo.ogr.layer_name);
     }
     G_debug (2, "OGR layer %d opened", layer);
 
@@ -88,16 +101,19 @@
     return (0);
 }
 
-/* Open OGR specific level 2 files (feature index).
-*
-*  Return: 0 success
-*         -1 error
+/**
+   \brief Open OGR specific level 2 files (feature index)
+
+   \param Map pointer to vector map
+
+   \return 0 success
+   \return -1 error
 */
 int
 V2_open_old_ogr (struct Map_info *Map )
 {
-    char elem[1000];
-    char buf[5];
+    char elem[GPATH_MAX];
+    char buf[5]; /* used for format version */
     long length; 
     GVFILE fp;
     struct Port_info port;
@@ -109,7 +125,7 @@
     dig_file_init ( &fp );
     fp.file = G_fopen_old ( elem, "fidx", Map->mapset);
     if ( fp.file ==  NULL) {
-	G_warning("Can't open fidx file for vector '%s@%s'.", Map->name, Map->mapset);
+	G_warning(_("Unable to open fidx file for vector map <%s@%s>"), Map->name, Map->mapset);
 	return -1;
     }
     
@@ -125,13 +141,13 @@
     /* check version numbers */
     if ( Version_Major > 5 || Version_Minor > 0 ) {
         if ( Back_Major > 5 || Back_Minor > 0 ) {
-            G_fatal_error ( "Feature index format version %d.%d is not supported by this release."
-                            " Try to rebuild topology or upgrade GRASS.", Version_Major, Version_Minor);
+            G_fatal_error (_("Feature index format version %d.%d is not supported by this release."
+			     " Try to rebuild topology or upgrade GRASS."), Version_Major, Version_Minor);
             return (-1);
         }
-        G_warning ( "Your GRASS version does not fully support feature index format %d.%d of the vector."
-	            " Consider to rebuild topology or upgrade GRASS.",
-                    Version_Major, Version_Minor );
+        G_warning (_("Your GRASS version does not fully support feature index format %d.%d of the vector."
+		     " Consider to rebuild topology or upgrade GRASS."),
+		   Version_Major, Version_Minor );
     }
 
     dig_init_portable ( &port, byte_order );

Modified: grass/trunk/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_nat.c	2008-01-16 04:14:45 UTC (rev 29716)
+++ grass/trunk/lib/vector/Vlib/write_nat.c	2008-01-16 13:14:07 UTC (rev 29717)
@@ -1,27 +1,32 @@
-/*
-****************************************************************************
-*
-* MODULE:       Vector library 
-*   	    	
-* AUTHOR(S):    Original author CERL, probably Dave Gerdes or Mike Higgins.
-*               Update to GRASS 5.7 Radim Blazek and David D. Gray.
-*
-* PURPOSE:      Higher level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT:    (C) 2001 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.
-*
-*****************************************************************************/
+/*!
+  \file write_nat.c
+  
+  \brief Vector library - write data
+  
+  Higher level functions for reading/writing/manipulating vectors.
+
+  (C) 2001-2008 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, probably Dave Gerdes or Mike Higgins.
+  Update to GRASS 5.7 Radim Blazek and David D. Gray.
+  
+  \date 2001
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
+
 #include <grass/gis.h>
 #include <grass/Vect.h>
+#include <grass/glocale.h>
 
-void delete_area_cats_from_cidx ( struct Map_info *Map, int area ) 
+static void delete_area_cats_from_cidx ( struct Map_info *Map, int area ) 
 {
     int i;
     P_AREA *Area;
@@ -30,7 +35,7 @@
     G_debug ( 3, "delete_area_cats_from_cidx() area = %d", area );
 
     Area =  Map->plus.Area[area];
-    if ( !Area ) G_fatal_error ("BUG (delete_area_cats_from_cidx): Area %d does not exist", area );
+    if ( !Area ) G_fatal_error (_("BUG (delete_area_cats_from_cidx): Area %d does not exist"), area);
 
     if ( Area->centroid == 0 ) return;
 
@@ -43,7 +48,7 @@
     }
 }
 
-void add_area_cats_to_cidx ( struct Map_info *Map, int area ) 
+static void add_area_cats_to_cidx ( struct Map_info *Map, int area ) 
 {
     int i;
     P_AREA *Area;
@@ -52,7 +57,7 @@
     G_debug ( 3, "add_area_cats_to_cidx() area = %d", area );
 
     Area =  Map->plus.Area[area];
-    if ( !Area ) G_fatal_error ("BUG (add_area_cats_to_cidx): Area %d does not exist", area );
+    if ( !Area ) G_fatal_error (_("BUG (add_area_cats_to_cidx): Area %d does not exist"), area );
 
     if ( Area->centroid == 0 ) return;
 
@@ -66,12 +71,19 @@
 }
 
 long V1__rewrite_line_nat ( struct Map_info *Map, long   offset, int    type,
-		       struct line_pnts *points, struct line_cats *cats);
+			    struct line_pnts *points, struct line_cats *cats);
 
-/* Writes line to 'coor' file.
-*  
-*  Returns: offset into file
-*           -1 on error */
+/**
+   \brief Writes line to 'coor' file
+
+   \param Map pointer to vector map
+   \param type feature type
+   \param points line geometry
+   \param cats line cats
+
+   \return offset into file
+   \return -1 on error
+*/
 long 
 V1_write_line_nat (  struct Map_info *Map,
 		     int    type,
@@ -90,10 +102,17 @@
   return V1__rewrite_line_nat (Map, offset, type, points, cats);
 }
 
-/* Writes line to 'coor' file.
-*  
-*  Returns: number of new line
-*           -1 on error */
+/**
+   \brief Writes line to 'coor' file.
+
+   \param Map pointer to vector map
+   \param type feature type
+   \param points line geometry
+   \param cats line cats
+
+   \return  number of new line
+   \return -1 on error
+*/
 long 
 V2_write_line_nat (  struct Map_info *Map,
 		     int    type,
@@ -276,15 +295,25 @@
     return line;
 }
 
-/* Rewrites line at the given offset.
-*  If the number of points or cats differs from
-*  the original one or the type is changed:
-*  GV_POINTS -> GV_LINES or GV_LINES -> GV_POINTS,
-*  the old one is deleted and the
-*  new is appended to the end of the file.
-*
-*  Returns: line offset
-*           -1 on error
+/**
+   \brief Rewrites line at the given offset.
+   
+   If the number of points or cats differs from
+   the original one or the type is changed:
+   GV_POINTS -> GV_LINES or GV_LINES -> GV_POINTS,
+   the old one is deleted and the
+   new is appended to the end of the file.
+
+   Old line is deleted (marked as dead), new line written.
+
+   \param Map pointer to vector map
+   \param offset line offset
+   \param type feature type
+   \param points line geometry
+   \param cats line cats
+
+   \return line offset (rewriten line)
+   \return -1 on error
 */
 long 
 V1_rewrite_line_nat (  struct Map_info *Map,
@@ -332,10 +361,19 @@
   }
 }
 
-/* Rewrites line of given number.
-* 
-*  Returns: number of new line
-*           -1 on error
+/**
+   \brief Rewrites line of given number.
+
+   Old line is deleted (marked as dead), new line written.
+
+   \param Map pointer to vector map
+   \param line line id
+   \param type feature type
+   \param points line geometry
+   \param cats line cats
+
+   \return number of new line
+   \return -1 on error
 */
 int
 V2_rewrite_line_nat (  struct Map_info *Map,
@@ -355,10 +393,17 @@
     return ( V2_write_line_nat ( Map, type, points, cats) );
 }
 
-/* Rewrites line at the given offset.
-*
-*  Returns: line offset
-*           -1 on error
+/**
+   \brief Rewrites line at the given offset.
+
+   \param Map pointer to vector map
+   \param offset line offset
+   \param type feature type
+   \param points line geometry
+   \param cats line cats
+
+   \return line offset
+   \return -1 on error
 */
 long 
 V1__rewrite_line_nat (
@@ -447,10 +492,14 @@
   return offset;
 }
 
-/* Deletes line at the given offset.
-*
-*  Returns:  0 ok
-*           -1 on error
+/**
+   \brief Deletes line at the given offset.
+
+   \param Map pointer to vector map
+   \param offset line offset
+
+   \return  0 ok
+   \return -1 on error
 */
 int 
 V1_delete_line_nat (
@@ -486,10 +535,14 @@
   return 0;
 }
 
-/* Deletes line of given number.
-*
-*  Returns:  0 ok
-*           -1 on error
+/**
+   \brief Deletes line of given number.
+
+   \param pointer to vector map
+   \param line line id
+
+   \return 0 ok
+   \return -1 on error
 */
 int 
 V2_delete_line_nat ( struct Map_info *Map, int  line )
@@ -509,7 +562,7 @@
   if (  plus->built >= GV_BUILD_BASE ) {
       Line = Map->plus.Line[line]; 
 
-      if ( Line == NULL ) G_fatal_error ("Attempt to delete dead line");
+      if ( Line == NULL ) G_fatal_error (_("Attempt to delete dead line"));
       type = Line->type;
   }
 
@@ -655,4 +708,3 @@
   G_debug ( 3, "updated lines : %d , updated nodes : %d", plus->n_uplines, plus->n_upnodes );
   return ret;
 }
-



More information about the grass-commit mailing list