|
@@ -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 @@ int main(int argc, char *argv[])
|
|
|
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 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
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 @@ int main(int argc, char *argv[])
|
|
|
cache[point_cnt].count = 1;
|
|
|
point_cnt++;
|
|
|
}
|
|
|
-
|
|
|
+ G_progress(1, 1);
|
|
|
+
|
|
|
if (!print_flag->answer) {
|
|
|
Vect_set_db_updated(&Map);
|
|
|
Vect_hist_command(&Map);
|