[GRASS-SVN] r70331 - grass/trunk/vector/v.what.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 10 03:38:52 PST 2017
Author: martinl
Date: 2017-01-10 03:38:52 -0800 (Tue, 10 Jan 2017)
New Revision: 70331
Modified:
grass/trunk/vector/v.what.rast/main.c
Log:
v.what.rast: do not require level 2 (topology)
Modified: grass/trunk/vector/v.what.rast/main.c
===================================================================
--- grass/trunk/vector/v.what.rast/main.c 2017-01-10 10:45:30 UTC (rev 70330)
+++ grass/trunk/vector/v.what.rast/main.c 2017-01-10 11:38:52 UTC (rev 70331)
@@ -28,7 +28,7 @@
int main(int argc, char *argv[])
{
- int i, j, nlines, type, field, cat, vtype;
+ int i, j, type, field, cat, vtype;
int fd;
/* struct Categories RCats; */ /* TODO */
@@ -124,7 +124,6 @@
Vect_region_box(&window, &box); /* T and B set to +/- PORT_DOUBLE_MAX */
/* Open vector */
- Vect_set_open_level(2);
if (Vect_open_old2(&Map, opt.vect->answer,
print_flag->answer ? "" : G_mapset(),
opt.field->answer) < 0)
@@ -199,21 +198,21 @@
point_cnt = outside_cnt = nocat_cnt = 0;
- nlines = Vect_get_num_lines(&Map);
-
- G_debug(1, "Reading %d vector features fom map", nlines);
-
G_important_message(_("Reading features from vector map..."));
- for (i = 1; i <= nlines; i++) {
- type = Vect_read_line(&Map, Points, Cats, i);
- G_debug(4, "line = %d type = %d", i, type);
+ Vect_set_constraint_type(&Map, vtype);
+ while (TRUE) {
+ /* register line */
+ type = Vect_read_next_line(&Map, Points, Cats);
+ if (type == -1) {
+ G_fatal_error(_("Unable to read vector map"));
+ }
+ else if (type == -2) {
+ break;
+ }
- G_percent(i, nlines, 2);
+ G_progress(++i, 1e4);
- /* check type */
- if (!(type & vtype))
- continue; /* Points or centroids only */
- G_debug(1, "line = %d type = %d", i, type);
+ G_debug(4, "line = %d type = %d", i, type);
/* check region */
if (!Vect_point_in_box(Points->x[0], Points->y[0], 0.0, &box)) {
@@ -245,7 +244,8 @@
cache[point_cnt].count = 1;
point_cnt++;
}
-
+ G_progress(1, 1);
+
if (!print_flag->answer) {
Vect_set_db_updated(&Map);
Vect_hist_command(&Map);
More information about the grass-commit
mailing list