[GRASS-SVN] r36805 - grass/trunk/vector/v.in.dxf
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Apr 19 23:18:22 EDT 2009
Author: hcho
Date: 2009-04-19 23:18:22 -0400 (Sun, 19 Apr 2009)
New Revision: 36805
Modified:
grass/trunk/vector/v.in.dxf/add_lwpolyline.c
grass/trunk/vector/v.in.dxf/add_polyline.c
grass/trunk/vector/v.in.dxf/make_arc.c
Log:
code cleanup
Modified: grass/trunk/vector/v.in.dxf/add_lwpolyline.c
===================================================================
--- grass/trunk/vector/v.in.dxf/add_lwpolyline.c 2009-04-20 03:17:35 UTC (rev 36804)
+++ grass/trunk/vector/v.in.dxf/add_lwpolyline.c 2009-04-20 03:18:22 UTC (rev 36805)
@@ -56,7 +56,7 @@
ypnts[arr_size] = atof(dxf_buf);
yflag = 1;
break;
- case 38:
+ case 38: /* elevation */
elevation = atof(dxf_buf);
break;
case 42: /* bulge */
@@ -100,15 +100,15 @@
xpnts[arr_size] = xpnts[0];
ypnts[arr_size] = ypnts[0];
zpnts[arr_size] = zpnts[0];
+ arr_size++;
/* arr_size incremented to be consistent with polyline_flag != 1 */
- if (arr_size >= arr_max - 1) {
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
}
}
Modified: grass/trunk/vector/v.in.dxf/add_polyline.c
===================================================================
--- grass/trunk/vector/v.in.dxf/add_polyline.c 2009-04-20 03:17:35 UTC (rev 36804)
+++ grass/trunk/vector/v.in.dxf/add_polyline.c 2009-04-20 03:18:22 UTC (rev 36805)
@@ -257,15 +257,15 @@
xpnts[arr_size] = xpnts[0];
ypnts[arr_size] = ypnts[0];
zpnts[arr_size] = zpnts[0];
+ arr_size++;
/* arr_size incremented to be consistent with polyline_flag != 1 */
- if (arr_size >= arr_max - 1) {
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
}
}
Modified: grass/trunk/vector/v.in.dxf/make_arc.c
===================================================================
--- grass/trunk/vector/v.in.dxf/make_arc.c 2009-04-20 03:17:35 UTC (rev 36804)
+++ grass/trunk/vector/v.in.dxf/make_arc.c 2009-04-20 03:18:22 UTC (rev 36805)
@@ -31,14 +31,14 @@
xpnts[arr_size] = radius * cos(alpha) + centerx;
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
+ arr_size++;
theta -= RSTEP;
- if (arr_size >= arr_max - 1) {
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
}
}
else {
@@ -48,14 +48,14 @@
xpnts[arr_size] = radius * cos(alpha) + centerx;
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
+ arr_size++;
theta += RSTEP;
- if (arr_size >= arr_max - 1) {
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
}
}
/* this insures that the last point will be correct */
@@ -63,13 +63,13 @@
xpnts[arr_size] = radius * cos(alpha) + centerx;
ypnts[arr_size] = radius * sin(alpha) + centery;
zpnts[arr_size] = zcoor;
- if (arr_size >= arr_max - 1) {
+ arr_size++;
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
return arr_size - offset;
}
@@ -88,13 +88,13 @@
arc_tan = (-1.0) * prev_bulge;
if (arc_tan == 0.0) { /* straight line segment */
- if (arr_size >= arr_max - 1) {
+ arr_size++;
+ if (arr_size == arr_max) {
arr_max += ARR_INCR;
xpnts = (double *)G_realloc(xpnts, arr_max * sizeof(double));
ypnts = (double *)G_realloc(ypnts, arr_max * sizeof(double));
zpnts = (double *)G_realloc(zpnts, arr_max * sizeof(double));
}
- arr_size++;
}
else if (!(xpnts[arr_size - 1] == xpnts[arr_size] &&
ypnts[arr_size - 1] == ypnts[arr_size]))
More information about the grass-commit
mailing list