[GRASS-SVN] r36803 - grass/trunk/vector/v.in.dxf
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Apr 19 23:08:01 EDT 2009
Author: hcho
Date: 2009-04-19 23:08:01 -0400 (Sun, 19 Apr 2009)
New Revision: 36803
Modified:
grass/trunk/vector/v.in.dxf/add_lwpolyline.c
grass/trunk/vector/v.in.dxf/make_arc.c
Log:
Support for LWPOLYLINE elevations
Modified: grass/trunk/vector/v.in.dxf/add_lwpolyline.c
===================================================================
--- grass/trunk/vector/v.in.dxf/add_lwpolyline.c 2009-04-20 03:06:32 UTC (rev 36802)
+++ grass/trunk/vector/v.in.dxf/add_lwpolyline.c 2009-04-20 03:08:01 UTC (rev 36803)
@@ -11,6 +11,7 @@
int polyline_flag = 0; /* indicates the type of polyline */
int xflag = 0; /* indicates if a x value has been found */
int yflag = 0; /* indicates if a y value has been found */
+ double elevation = 0.0; /* elevation */
int arr_size = 0;
/* variables to create arcs */
@@ -20,7 +21,6 @@
handle[0] = 0;
strcpy(layer, UNIDENTIFIED_LAYER);
- zpnts[0] = 0.0;
/* read in lines and process information until a 0 is read in */
while ((code = dxf_get_code(dxf)) != 0) {
if (code == -2)
@@ -56,6 +56,9 @@
ypnts[arr_size] = atof(dxf_buf);
yflag = 1;
break;
+ case 38:
+ elevation = atof(dxf_buf);
+ break;
case 42: /* bulge */
bulge = atof(dxf_buf);
break;
@@ -83,6 +86,13 @@
}
}
+ {
+ int i;
+
+ for (i = 0; i < arr_size; i++)
+ zpnts[i] = elevation;
+ }
+
if (polyline_flag & 1) {
if (xpnts[0] != xpnts[arr_size - 1] ||
ypnts[0] != ypnts[arr_size - 1]) {
@@ -102,13 +112,6 @@
}
}
- {
- int i;
-
- for (i = 0; i < arr_size; i++)
- zpnts[i] = 0.0;
- }
-
write_vect(Map, layer, "LWPOLYLINE", handle, "", arr_size, GV_LINE);
return;
Modified: grass/trunk/vector/v.in.dxf/make_arc.c
===================================================================
--- grass/trunk/vector/v.in.dxf/make_arc.c 2009-04-20 03:06:32 UTC (rev 36802)
+++ grass/trunk/vector/v.in.dxf/make_arc.c 2009-04-20 03:08:01 UTC (rev 36803)
@@ -32,7 +32,7 @@
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
theta -= RSTEP;
- if (arr_size == arr_max) {
+ if (arr_size >= arr_max - 1) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
@@ -49,7 +49,7 @@
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
theta += RSTEP;
- if (arr_size == arr_max) {
+ if (arr_size >= arr_max - 1) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
@@ -63,7 +63,7 @@
xpnts[arr_size] = radius * cos(alpha) + centerx;
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
- if (arr_size == arr_max) {
+ if (arr_size >= arr_max - 1) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
More information about the grass-commit
mailing list