Procházet zdrojové kódy

vlib: Vect_get_field_number() added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39620 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa před 15 roky
rodič
revize
d308642604
3 změnil soubory, kde provedl 25 přidání a 1 odebrání
  1. 1 0
      include/vector.h
  2. 23 0
      lib/vector/Vlib/field.c
  3. 1 1
      lib/vector/Vlib/read.c

+ 1 - 0
include/vector.h

@@ -112,6 +112,7 @@ struct field_info *Vect_get_dblink(const struct Map_info *, int);
 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);

+ 23 - 0
lib/vector/Vlib/field.c

@@ -479,6 +479,29 @@ struct field_info *Vect_get_field2(const struct Map_info *Map, const char *field
 }
 
 /*!
+  \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.

+ 1 - 1
lib/vector/Vlib/read.c

@@ -99,7 +99,7 @@ int Vect_read_line(const struct Map_info *Map,
 		   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"));