[GRASS-SVN] r58795 - grass/trunk/raster/r.to.vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 28 12:05:18 PST 2014
Author: mmetz
Date: 2014-01-28 12:05:18 -0800 (Tue, 28 Jan 2014)
New Revision: 58795
Modified:
grass/trunk/raster/r.to.vect/areas.c
grass/trunk/raster/r.to.vect/areas_io.c
grass/trunk/raster/r.to.vect/lines.c
grass/trunk/raster/r.to.vect/points.c
Log:
r.to.vect: strip out duplicate points, free memory
Modified: grass/trunk/raster/r.to.vect/areas.c
===================================================================
--- grass/trunk/raster/r.to.vect/areas.c 2014-01-28 20:02:49 UTC (rev 58794)
+++ grass/trunk/raster/r.to.vect/areas.c 2014-01-28 20:05:18 UTC (rev 58795)
@@ -141,6 +141,9 @@
G_free(a_list);
G_free(e_list);
+ G_free(v_list);
+ G_free(buffer[0]);
+ G_free(buffer[1]);
return 0;
} /* extract_areas */
Modified: grass/trunk/raster/r.to.vect/areas_io.c
===================================================================
--- grass/trunk/raster/r.to.vect/areas_io.c 2014-01-28 20:02:49 UTC (rev 58794)
+++ grass/trunk/raster/r.to.vect/areas_io.c 2014-01-28 20:05:18 UTC (rev 58795)
@@ -210,8 +210,6 @@
x = cell_head.west + (p->col - dx) * cell_head.ew_res;
total++;
Vect_append_point(points, x, y, 0.0);
-
- /* G_free (last); */
} /* end of for i */
y = cell_head.north - (double)p->row * cell_head.ns_res;
@@ -220,15 +218,13 @@
Vect_append_point(points, x, y, 0.0);
/* strip out the duplicate points from the list */
- y = cell_head.north - (double)p->row * cell_head.ns_res;
- x = cell_head.west + (double)p->col * cell_head.ew_res;
- total++;
- Vect_append_point(points, x, y, 0.0);
+ Vect_line_prune(points);
+ G_debug(3, "removed duplicates: %d", total - points->n_points);
/* write files */
Vect_write_line(&Map, GV_BOUNDARY, points, Cats);
- /* now free all thwe pointers */
+ /* now free all the pointers */
p = line_begin;
for (i = 1; i < n; i++) {
Modified: grass/trunk/raster/r.to.vect/lines.c
===================================================================
--- grass/trunk/raster/r.to.vect/lines.c 2014-01-28 20:02:49 UTC (rev 58794)
+++ grass/trunk/raster/r.to.vect/lines.c 2014-01-28 20:05:18 UTC (rev 58795)
@@ -176,6 +176,11 @@
}
}
+ G_free(top);
+ G_free(middle);
+ G_free(bottom);
+ G_free(v_list);
+
return 0;
}
Modified: grass/trunk/raster/r.to.vect/points.c
===================================================================
--- grass/trunk/raster/r.to.vect/points.c 2014-01-28 20:02:49 UTC (rev 58794)
+++ grass/trunk/raster/r.to.vect/points.c 2014-01-28 20:05:18 UTC (rev 58795)
@@ -98,5 +98,19 @@
G_percent(row, n_rows, 2);
+ switch (data_type) {
+ case CELL_TYPE:
+ G_free(cellbuf);
+ break;
+ case FCELL_TYPE:
+ G_free(fcellbuf);
+ break;
+ case DCELL_TYPE:
+ G_free(dcellbuf);
+ break;
+ }
+
+ Vect_destroy_line_struct(points);
+
return (1);
}
More information about the grass-commit
mailing list