[GRASS-SVN] r39620 - in grass/trunk: include lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 23 10:48:50 EDT 2009


Author: martinl
Date: 2009-10-23 10:48:49 -0400 (Fri, 23 Oct 2009)
New Revision: 39620

Modified:
   grass/trunk/include/vector.h
   grass/trunk/lib/vector/Vlib/field.c
   grass/trunk/lib/vector/Vlib/read.c
Log:
vlib: Vect_get_field_number() added


Modified: grass/trunk/include/vector.h
===================================================================
--- grass/trunk/include/vector.h	2009-10-23 14:40:32 UTC (rev 39619)
+++ grass/trunk/include/vector.h	2009-10-23 14:48:49 UTC (rev 39620)
@@ -112,6 +112,7 @@
 struct field_info *Vect_get_field(const struct Map_info *, int);
 struct field_info *Vect_get_field_by_name(const struct Map_info *, const char *);
 struct field_info *Vect_get_field2(const struct Map_info *, const char *);
+int Vect_get_field_number(const struct Map_info *, const char *);
 void Vect_set_db_updated(struct Map_info *);
 const char *Vect_get_column_names(const struct Map_info *, int);
 const char *Vect_get_column_types(const struct Map_info *, int);

Modified: grass/trunk/lib/vector/Vlib/field.c
===================================================================
--- grass/trunk/lib/vector/Vlib/field.c	2009-10-23 14:40:32 UTC (rev 39619)
+++ grass/trunk/lib/vector/Vlib/field.c	2009-10-23 14:48:49 UTC (rev 39620)
@@ -479,6 +479,29 @@
 }
 
 /*!
+  \brief Get field number of given field
+
+  \param Map pointer to Map_info structure
+  \param field layer name
+
+  \return layer number
+  \return 0 if layer not found
+*/
+int Vect_get_field_number(const struct Map_info *Map, const char *field)
+{
+    struct field_info *fi;
+
+    G_debug(1, "Vect_get_field_number(): field = %s", field);
+
+    fi = Vect_get_field2(Map, field);
+
+    if (fi)
+	return fi->number;
+
+    return 0;
+}
+
+/*!
   \brief Read dblinks to existing structure.
   
   Variables are not substituted by values.

Modified: grass/trunk/lib/vector/Vlib/read.c
===================================================================
--- grass/trunk/lib/vector/Vlib/read.c	2009-10-23 14:40:32 UTC (rev 39619)
+++ grass/trunk/lib/vector/Vlib/read.c	2009-10-23 14:48:49 UTC (rev 39620)
@@ -99,7 +99,7 @@
 		   struct line_pnts *line_p, struct line_cats *line_c, int line)
 {
 
-    G_debug(3, "Vect_read_line()");
+    G_debug(3, "Vect_read_line() line=%d", line);
 
     if (!VECT_OPEN(Map))
 	G_fatal_error("Vect_read_line(): %s", _("vector map is not opened"));



More information about the grass-commit mailing list