[GRASS-SVN] r36678 - grass/branches/releasebranch_6_4/vector/v.in.dxf

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 11 02:55:00 EDT 2009


Author: neteler
Date: 2009-04-11 02:54:59 -0400 (Sat, 11 Apr 2009)
New Revision: 36678

Modified:
   grass/branches/releasebranch_6_4/vector/v.in.dxf/add_line.c
   grass/branches/releasebranch_6_4/vector/v.in.dxf/write_vect.c
Log:
huidae: backported import fixes

Modified: grass/branches/releasebranch_6_4/vector/v.in.dxf/add_line.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.in.dxf/add_line.c	2009-04-11 06:18:02 UTC (rev 36677)
+++ grass/branches/releasebranch_6_4/vector/v.in.dxf/add_line.c	2009-04-11 06:54:59 UTC (rev 36678)
@@ -76,11 +76,8 @@
 	}
     }
 
-    if (arr_size == 2) {	/* have both start and stop */
-	if (!zflag)
-	    zpnts[0] = zpnts[1] = 0.0;
+    if (arr_size == 2)	/* have both start and stop */
 	write_line(Map, layer, arr_size);
-    }
 
     return 0;
 }

Modified: grass/branches/releasebranch_6_4/vector/v.in.dxf/write_vect.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.in.dxf/write_vect.c	2009-04-11 06:18:02 UTC (rev 36677)
+++ grass/branches/releasebranch_6_4/vector/v.in.dxf/write_vect.c	2009-04-11 06:54:59 UTC (rev 36678)
@@ -118,13 +118,24 @@
     return;
 }
 
-static int get_field_cat(struct Map_info *Map, char *field_name, int *field,
+static int get_field_cat(struct Map_info *Map, char *layer, int *field,
 			 int *cat)
 {
     int i, type;
+    char field_name[DXF_BUF_SIZE];
+    char x = 0;
 
-    /* make table name SQL compliant */
+    /* make table name SQL compliant: Vect_default_field_info returns
+     * mapname_layername in ->table, and mapname is always SQL compliant.
+     * Because layername is followed by mapname_, it (field_name here) can
+     * start with [a-zA-Z0-9]. No need to change the first digit to 'x'.
+     */
+    strcpy(field_name, layer);
+    if (field_name[0] >= '0' && field_name[0] <= '9')
+	x = field_name[0];
     G_str_to_sql(field_name);
+    if (x)
+        field_name[0] = x;
 
     for (i = 0; i < num_fields; i++) {
 	/* field name already exists */



More information about the grass-commit mailing list