GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
build_nat.c
Go to the documentation of this file.
1 
19 #include <string.h>
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <grass/glocale.h>
23 #include <grass/gis.h>
24 #include <grass/Vect.h>
25 
37 int Vect_build_line_area(struct Map_info *Map, int iline, int side)
38 {
39  int j, area, isle, n_lines, line, type, direction;
40  static int first = 1;
41  long offset;
42  struct Plus_head *plus;
43  P_LINE *BLine;
44  static struct line_pnts *Points, *APoints;
45  plus_t *lines;
46  double area_size;
47 
48  plus = &(Map->plus);
49 
50  G_debug(3, "Vect_build_line_area() line = %d, side = %d", iline, side);
51 
52  if (first) {
53  Points = Vect_new_line_struct();
54  APoints = Vect_new_line_struct();
55  first = 0;
56  }
57 
58  area = dig_line_get_area(plus, iline, side);
59  if (area != 0) {
60  G_debug(3, " area/isle = %d -> skip", area);
61  return 0;
62  }
63 
64  n_lines = dig_build_area_with_line(plus, iline, side, &lines);
65  G_debug(3, " n_lines = %d", n_lines);
66  if (n_lines < 1) {
67  return 0;
68  } /* area was not built */
69 
70  /* Area or island ? */
71  Vect_reset_line(APoints);
72  for (j = 0; j < n_lines; j++) {
73  line = abs(lines[j]);
74  BLine = plus->Line[line];
75  offset = BLine->offset;
76  G_debug(3, " line[%d] = %d, offset = %ld", j, line, offset);
77  type = Vect_read_line(Map, Points, NULL, line);
78  if (lines[j] > 0)
79  direction = GV_FORWARD;
80  else
81  direction = GV_BACKWARD;
82  Vect_append_points(APoints, Points, direction);
83  }
84 
85  dig_find_area_poly(APoints, &area_size);
86  G_debug(3, " area/isle size = %f", area_size);
87 
88  if (area_size > 0) { /* area */
89  /* add area structure to plus */
90  area = dig_add_area(plus, n_lines, lines);
91  if (area == -1) { /* error */
92  Vect_close(Map);
93  G_fatal_error(_("Unable to add area (map closed, topo saved)"));
94  }
95  G_debug(3, " -> area %d", area);
96  return area;
97  }
98  else if (area_size < 0) { /* island */
99  isle = dig_add_isle(plus, n_lines, lines);
100  if (isle == -1) { /* error */
101  Vect_close(Map);
102  G_fatal_error(_("Unable to add isle (map closed, topo saved)"));
103  }
104  G_debug(3, " -> isle %d", isle);
105  return -isle;
106  }
107  else {
108  /* TODO: What to do with such areas? Should be areas/isles of size 0 stored,
109  * so that may be found and cleaned by some utility
110  * Note: it would be useful for vertical closed polygons, but such would be added twice
111  * as area */
112  G_warning(_("Area of size = 0.0 ignored"));
113  }
114  return 0;
115 }
116 
126 int Vect_isle_find_area(struct Map_info *Map, int isle)
127 {
128  int j, line, node, sel_area, first, area, poly;
129  static int first_call = 1;
130  struct Plus_head *plus;
131  P_LINE *Line;
132  P_NODE *Node;
133  P_ISLE *Isle;
134  P_AREA *Area;
135  double size, cur_size;
136  BOUND_BOX box, abox;
137  static struct ilist *List;
138  static struct line_pnts *APoints;
139 
140  /* Note: We should check all isle points (at least) because if topology is not clean
141  * and two areas overlap, isle which is not completely within area may be attached,
142  * but it would take long time */
143 
144  G_debug(3, "Vect_isle_find_area () island = %d", isle);
145  plus = &(Map->plus);
146 
147  if (plus->Isle[isle] == NULL) {
148  G_warning(_("Request to find area outside nonexistent isle"));
149  return 0;
150  }
151 
152  if (first_call) {
153  List = Vect_new_list();
154  APoints = Vect_new_line_struct();
155  first_call = 0;
156  }
157 
158  Isle = plus->Isle[isle];
159  line = abs(Isle->lines[0]);
160  Line = plus->Line[line];
161  node = Line->N1;
162  Node = plus->Node[node];
163 
164  /* select areas by box */
165  box.E = Node->x;
166  box.W = Node->x;
167  box.N = Node->y;
168  box.S = Node->y;
169  box.T = PORT_DOUBLE_MAX;
170  box.B = -PORT_DOUBLE_MAX;
171  Vect_select_areas_by_box(Map, &box, List);
172  G_debug(3, "%d areas overlap island boundary point", List->n_values);
173 
174  sel_area = 0;
175  cur_size = -1;
176  first = 1;
177  Vect_get_isle_box(Map, isle, &box);
178  for (j = 0; j < List->n_values; j++) {
179  area = List->value[j];
180  G_debug(3, "area = %d", area);
181 
182  Area = plus->Area[area];
183 
184  /* Before other tests, simply exclude those areas inside isolated isles formed by one boundary */
185  if (abs(Isle->lines[0]) == abs(Area->lines[0])) {
186  G_debug(3, " area inside isolated isle");
187  continue;
188  }
189 
190  /* Check box */
191  /* Note: If build is run on large files of areas imported from nontopo format (shapefile)
192  * attaching of isles takes very long time because each area is also isle and select by
193  * box all overlapping areas selects all areas with box overlapping first node.
194  * Then reading coordinates for all those areas would take a long time -> check first
195  * if isle's box is completely within area box */
196  Vect_get_area_box(Map, area, &abox);
197  if (box.E > abox.E || box.W < abox.W || box.N > abox.N ||
198  box.S < abox.S) {
199  G_debug(3, " isle not completely inside area box");
200  continue;
201  }
202 
203  poly = Vect_point_in_area_outer_ring(Node->x, Node->y, Map, area);
204  G_debug(3, " poly = %d", poly);
205 
206  if (poly == 1) { /* pint in area, but node is not part of area inside isle (would be poly == 2) */
207  /* In rare case island is inside more areas in that case we have to calculate area
208  * of outer ring and take the smaller */
209  if (sel_area == 0) { /* first */
210  sel_area = area;
211  }
212  else { /* is not first */
213  if (cur_size < 0) { /* second area */
214  /* This is slow, but should not be called often */
215  Vect_get_area_points(Map, sel_area, APoints);
217  cur_size =
218  G_area_of_polygon(APoints->x, APoints->y,
219  APoints->n_points);
220  G_debug(3, " first area size = %f (n points = %d)",
221  cur_size, APoints->n_points);
222 
223  }
224 
225  Vect_get_area_points(Map, area, APoints);
226  size =
227  G_area_of_polygon(APoints->x, APoints->y,
228  APoints->n_points);
229  G_debug(3, " area size = %f (n points = %d)", cur_size,
230  APoints->n_points);
231 
232  if (size < cur_size) {
233  sel_area = area;
234  cur_size = size;
235  }
236  }
237  G_debug(3, "sel_area = %d cur_size = %f", sel_area, cur_size);
238  }
239  }
240  if (sel_area > 0) {
241  G_debug(3, "Island %d in area %d", isle, sel_area);
242  }
243  else {
244  G_debug(3, "Island %d is not in area", isle);
245  }
246 
247  return sel_area;
248 }
249 
258 int Vect_attach_isle(struct Map_info *Map, int isle)
259 {
260  int sel_area;
261  P_ISLE *Isle;
262  struct Plus_head *plus;
263 
264  /* Note!: If topology is not clean and areas overlap, one island may fall to more areas
265  * (partially or fully). Before isle is attached to area it must be check if it is not attached yet */
266  G_debug(3, "Vect_attach_isle (): isle = %d", isle);
267 
268  plus = &(Map->plus);
269 
270  sel_area = Vect_isle_find_area(Map, isle);
271  G_debug(3, " isle = %d -> area outside = %d", isle, sel_area);
272  if (sel_area > 0) {
273  Isle = plus->Isle[isle];
274  if (Isle->area > 0) {
275  G_debug(3,
276  "Attempt to attach isle %d to more areas (=>topology is not clean)",
277  isle);
278  }
279  else {
280  Isle->area = sel_area;
281  dig_area_add_isle(plus, sel_area, isle);
282  }
283  }
284  return 0;
285 }
286 
295 int Vect_attach_isles(struct Map_info *Map, BOUND_BOX * box)
296 {
297  int i, isle;
298  static int first = 1;
299  static struct ilist *List;
300  struct Plus_head *plus;
301 
302  G_debug(3, "Vect_attach_isles ()");
303 
304  plus = &(Map->plus);
305 
306  if (first) {
307  List = Vect_new_list();
308  first = 0;
309  }
310 
311  Vect_select_isles_by_box(Map, box, List);
312  G_debug(3, " number of isles to attach = %d", List->n_values);
313 
314  for (i = 0; i < List->n_values; i++) {
315  isle = List->value[i];
316  if (plus->Isle[isle]->area > 0) {
317  dig_area_del_isle(plus, plus->Isle[isle]->area, isle);
318  plus->Isle[isle]->area = 0;
319  }
320  Vect_attach_isle(Map, isle);
321  }
322  return 0;
323 }
324 
333 int Vect_attach_centroids(struct Map_info *Map, BOUND_BOX * box)
334 {
335  int i, sel_area, centr;
336  static int first = 1;
337  static struct ilist *List;
338  P_AREA *Area;
339  P_LINE *Line;
340  struct Plus_head *plus;
341 
342  G_debug(3, "Vect_attach_centroids ()");
343 
344  plus = &(Map->plus);
345 
346  if (first) {
347  List = Vect_new_list();
348  first = 0;
349  }
350 
351  /* Warning: If map is updated on level2, it may happen that previously correct island
352  * becomes incorrect. In that case, centroid of area forming the island is reattached
353  * to outer area, because island polygon is not excluded.
354  *
355  * +-----------+ +-----------+
356  * | 1 | | 1 |
357  * | +---+---+ | | +---+---+ |
358  * | | 2 | 3 | | | | 2 | |
359  * | | x | | | -> | | x | |
360  * | | | | | | | | |
361  * | +---+---+ | | +---+---+ |
362  * | | | |
363  * +-----------+ +-----------+
364  * centroid is centroid is
365  * attached to 2 reattached to 1
366  *
367  * Because of this, when the centroid is reattached to another area, it is always necessary
368  * to check if original area exist, unregister centroid from previous area.
369  * To simplify code, this is implemented so that centroid is always firs unregistered
370  * and if new area is found, it is registered again.
371  */
372 
373  Vect_select_lines_by_box(Map, box, GV_CENTROID, List);
374  G_debug(3, " number of centroids to reattach = %d", List->n_values);
375  for (i = 0; i < List->n_values; i++) {
376  int orig_area;
377 
378  centr = List->value[i];
379  Line = plus->Line[centr];
380 
381  /* Unregister centroid */
382  orig_area = Line->left;
383  if (orig_area > 0) {
384  if (plus->Area[orig_area] != NULL) {
385  plus->Area[orig_area]->centroid = 0;
386  }
387  }
388  Line->left = 0;
389 
390  sel_area = Vect_find_area(Map, Line->E, Line->N);
391  G_debug(3, " centroid %d is in area %d", centr, sel_area);
392  if (sel_area > 0) {
393  Area = plus->Area[sel_area];
394  if (Area->centroid == 0) { /* first centroid */
395  G_debug(3, " first centroid -> attach to area");
396  Area->centroid = centr;
397  Line->left = sel_area;
398 
399  if (sel_area != orig_area && plus->do_uplist)
400  dig_line_add_updated(plus, centr);
401  }
402  else if (Area->centroid != centr) { /* duplicate centroid */
403  /* Note: it cannot happen that Area->centroid == centr, because the centroid
404  * was not registered or a duplicate */
405  G_debug(3, " duplicate centroid -> do not attach to area");
406  Line->left = -sel_area;
407 
408  if (-sel_area != orig_area && plus->do_uplist)
409  dig_line_add_updated(plus, centr);
410  }
411  }
412  else if (orig_area != 0 && plus->do_uplist)
413  dig_line_add_updated(plus, centr);
414  }
415 
416  return 0;
417 }
418 
428 int Vect_build_nat(struct Map_info *Map, int build)
429 {
430  struct Plus_head *plus;
431  int i, s, type, lineid;
432  long offset;
433  int side, line, area;
434  struct line_pnts *Points, *APoints;
435  struct line_cats *Cats;
436  P_LINE *Line;
437  P_NODE *Node;
438  P_AREA *Area;
439  BOUND_BOX box;
440  struct ilist *List;
441 
442  G_debug(3, "Vect_build_nat() build = %d", build);
443 
444  plus = &(Map->plus);
445 
446  if (build == plus->built)
447  return 1; /* Do nothing */
448 
449  /* Check if upgrade or downgrade */
450  if (build < plus->built) { /* lower level request */
451 
452  /* release old sources (this also initializes structures and numbers of elements) */
453  if (plus->built >= GV_BUILD_CENTROIDS && build < GV_BUILD_CENTROIDS) {
454  /* reset info about areas stored for centroids */
455  int nlines = Vect_get_num_lines(Map);
456 
457  for (line = 1; line <= nlines; line++) {
458  Line = plus->Line[line];
459  if (Line && Line->type == GV_CENTROID)
460  Line->left = 0;
461  }
462  dig_free_plus_areas(plus);
463  dig_spidx_free_areas(plus);
464  dig_free_plus_isles(plus);
465  dig_spidx_free_isles(plus);
466  }
467 
468 
469  if (plus->built >= GV_BUILD_AREAS && build < GV_BUILD_AREAS) {
470  /* reset info about areas stored for lines */
471  int nlines = Vect_get_num_lines(Map);
472 
473  for (line = 1; line <= nlines; line++) {
474  Line = plus->Line[line];
475  if (Line && Line->type == GV_BOUNDARY) {
476  Line->left = 0;
477  Line->right = 0;
478  }
479  }
480  dig_free_plus_areas(plus);
481  dig_spidx_free_areas(plus);
482  dig_free_plus_isles(plus);
483  dig_spidx_free_isles(plus);
484  }
485  if (plus->built >= GV_BUILD_BASE && build < GV_BUILD_BASE) {
486  dig_free_plus_nodes(plus);
487  dig_spidx_free_nodes(plus);
488  dig_free_plus_lines(plus);
489  dig_spidx_free_lines(plus);
490  }
491 
492  plus->built = build;
493  return 1;
494  }
495 
496  Points = Vect_new_line_struct();
497  APoints = Vect_new_line_struct();
498  Cats = Vect_new_cats_struct();
499  List = Vect_new_list();
500 
501  if (plus->built < GV_BUILD_BASE) {
502  int npoints, format;
503 
504  format = G_info_format();
505 
506  /*
507  * We shall go through all primitives in coor file and
508  * add new node for each end point to nodes structure
509  * if the node with the same coordinates doesn't exist yet.
510  */
511 
512  /* register lines, create nodes */
513  Vect_rewind(Map);
514  G_message(_("Registering primitives..."));
515  i = 1;
516  npoints = 0;
517  while (1) {
518  /* register line */
519  type = Vect_read_next_line(Map, Points, Cats);
520 
521  /* Note: check for dead lines is not needed, because they are skipped by V1_read_next_line_nat() */
522  if (type == -1) {
523  G_warning(_("Unable to read vector map"));
524  return 0;
525  }
526  else if (type == -2) {
527  break;
528  }
529 
530  npoints += Points->n_points;
531 
532  offset = Map->head.last_offset;
533 
534  G_debug(3, "Register line: offset = %ld", offset);
535  lineid = dig_add_line(plus, type, Points, offset);
536  dig_line_box(Points, &box);
537  if (lineid == 1)
538  Vect_box_copy(&(plus->box), &box);
539  else
540  Vect_box_extend(&(plus->box), &box);
541 
542  /* Add all categories to category index */
543  if (build == GV_BUILD_ALL) {
544  int c;
545 
546  for (c = 0; c < Cats->n_cats; c++) {
547  dig_cidx_add_cat(plus, Cats->field[c], Cats->cat[c],
548  lineid, type);
549  }
550  if (Cats->n_cats == 0) /* add field 0, cat 0 */
551  dig_cidx_add_cat(plus, 0, 0, lineid, type);
552  }
553 
554  if (G_verbose() > G_verbose_min() && i % 1000 == 0) {
555  if (format == G_INFO_FORMAT_PLAIN)
556  fprintf(stderr, "%d..", i);
557  else
558  fprintf(stderr, "%9d\b\b\b\b\b\b\b\b\b", i);
559  }
560 
561  i++;
562  }
563 
564  if ( (G_verbose() > G_verbose_min() ) && format != G_INFO_FORMAT_PLAIN )
565  fprintf(stderr, "\r");
566 
567  G_message(_("%d primitives registered"), plus->n_lines);
568  G_message(_("%d vertices registered"), npoints);
569 
570  plus->built = GV_BUILD_BASE;
571  }
572 
573  if (build < GV_BUILD_AREAS)
574  return 1;
575 
576  if (plus->built < GV_BUILD_AREAS) {
577  /* Build areas */
578  /* Go through all bundaries and try to build area for both sides */
579  G_important_message(_("Building areas..."));
580  for (i = 1; i <= plus->n_lines; i++) {
581  G_percent(i, plus->n_lines, 1);
582 
583  /* build */
584  if (plus->Line[i] == NULL) {
585  continue;
586  } /* dead line */
587  Line = plus->Line[i];
588  if (Line->type != GV_BOUNDARY) {
589  continue;
590  }
591 
592  for (s = 0; s < 2; s++) {
593  if (s == 0)
594  side = GV_LEFT;
595  else
596  side = GV_RIGHT;
597 
598  G_debug(3, "Build area for line = %d, side = %d", i, side);
599  Vect_build_line_area(Map, i, side);
600  }
601  }
602  G_message(_("%d areas built"), plus->n_areas);
603  G_message(_("%d isles built"), plus->n_isles);
604  plus->built = GV_BUILD_AREAS;
605  }
606 
607  if (build < GV_BUILD_ATTACH_ISLES)
608  return 1;
609 
610  /* Attach isles to areas */
611  if (plus->built < GV_BUILD_ATTACH_ISLES) {
612  G_important_message(_("Attaching islands..."));
613  for (i = 1; i <= plus->n_isles; i++) {
614  G_percent(i, plus->n_isles, 1);
615  Vect_attach_isle(Map, i);
616  }
617  plus->built = GV_BUILD_ATTACH_ISLES;
618  }
619 
620  if (build < GV_BUILD_CENTROIDS)
621  return 1;
622 
623  /* Attach centroids to areas */
624  if (plus->built < GV_BUILD_CENTROIDS) {
625  int nlines;
626 
627  G_important_message(_("Attaching centroids..."));
628 
629  nlines = Vect_get_num_lines(Map);
630  for (line = 1; line <= nlines; line++) {
631  G_percent(line, nlines, 1);
632 
633  Line = plus->Line[line];
634  if (!Line)
635  continue; /* Dead */
636 
637  if (Line->type != GV_CENTROID)
638  continue;
639 
640  Node = plus->Node[Line->N1];
641 
642  area = Vect_find_area(Map, Node->x, Node->y);
643 
644  if (area > 0) {
645  G_debug(3, "Centroid (line=%d) in area %d", line, area);
646 
647  Area = plus->Area[area];
648 
649  if (Area->centroid == 0) { /* first */
650  Area->centroid = line;
651  Line->left = area;
652  }
653  else { /* duplicate */
654  Line->left = -area;
655  }
656  }
657  }
658  plus->built = GV_BUILD_CENTROIDS;
659  }
660 
661  /* Add areas to category index */
662  for (area = 1; area <= plus->n_areas; area++) {
663  int c;
664 
665  if (plus->Area[area] == NULL)
666  continue;
667 
668  if (plus->Area[area]->centroid > 0) {
669  Vect_read_line(Map, NULL, Cats, plus->Area[area]->centroid);
670 
671  for (c = 0; c < Cats->n_cats; c++) {
672  dig_cidx_add_cat(plus, Cats->field[c], Cats->cat[c], area,
673  GV_AREA);
674  }
675  }
676 
677  if (plus->Area[area]->centroid == 0 || Cats->n_cats == 0) /* no centroid or no cats */
678  dig_cidx_add_cat(plus, 0, 0, area, GV_AREA);
679  }
680 
681  return 1;
682 }
int Vect_build_nat(struct Map_info *Map, int build)
Build topology.
Definition: build_nat.c:428
void dig_free_plus_lines(struct Plus_head *Plus)
Free Plus-&gt;Line structure.
Definition: plus.c:137
int Vect_select_isles_by_box(struct Map_info *Map, BOUND_BOX *Box, struct ilist *list)
Select isles by box.
int Vect_build_line_area(struct Map_info *Map, int iline, int side)
Build area on given side of line (GV_LEFT or GV_RIGHT)
Definition: build_nat.c:37
double G_area_of_polygon(const double *x, const double *y, int n)
Area in square meters of polygon.
Definition: gis/area.c:165
int Vect_read_next_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c)
Read next vector feature (level 1 and 2)
int dig_line_box(struct line_pnts *Points, BOUND_BOX *Box)
Definition: diglib/box.c:24
struct line_pnts * Vect_new_line_struct()
Creates and initializes a struct line_pnts.
Definition: line.c:57
void G_important_message(const char *msg,...)
Print a message to stderr even in brief mode (verbosity=1)
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int dig_add_line(struct Plus_head *plus, int type, struct line_pnts *Points, long offset)
Add new line to Plus_head structure.
Definition: plus_line.c:102
Definition: index.h:56
int Vect_append_points(struct line_pnts *Points, struct line_pnts *APoints, int direction)
Appends points to the end of a line.
Definition: line.c:312
int Vect_reset_line(struct line_pnts *Points)
Reset line.
Definition: line.c:148
int Vect_get_area_box(struct Map_info *Map, int area, BOUND_BOX *Box)
Get boundary box of area.
Definition: Vlib/box.c:247
void dig_free_plus_areas(struct Plus_head *Plus)
Free Plus-&gt;Area structure.
Definition: plus.c:173
void dig_spidx_free_lines(struct Plus_head *Plus)
Free spatial index for lines.
Definition: spindex.c:68
tuple box
surface = wx.CheckBox(parent = panel, id = wx.ID_ANY, label = _(&quot;Follow source viewpoint&quot;)) pageSizer...
Definition: tools.py:1527
int Vect_get_area_points(struct Map_info *Map, int area, struct line_pnts *BPoints)
Returns the polygon array of points in BPoints.
void dig_spidx_free_areas(struct Plus_head *Plus)
Free spatial index for areas.
Definition: spindex.c:79
tuple size
value.Bind(wx.EVT_TEXT, self.OnVolumeIsosurfMap)
Definition: tools.py:2334
int Vect_isle_find_area(struct Map_info *Map, int isle)
Find area outside island.
Definition: build_nat.c:126
int G_percent(long n, long d, int s)
Print percent complete messages.
Definition: percent.c:63
int Vect_box_extend(BOUND_BOX *A, BOUND_BOX *B)
Extend box A by box B.
Definition: Vlib/box.c:93
int Vect_find_area(struct Map_info *Map, double x, double y)
Find the nearest area.
int dig_area_add_isle(struct Plus_head *plus, int area, int isle)
Add isle to area if does not exist yet.
Definition: plus_area.c:253
int dig_build_area_with_line(struct Plus_head *plus, plus_t first_line, int side, plus_t **lines)
Build topo for area from lines.
Definition: plus_area.c:49
int Vect_point_in_area_outer_ring(double X, double Y, struct Map_info *Map, int area)
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.
Definition: Vlib/poly.c:695
int dig_cidx_add_cat(struct Plus_head *Plus, int field, int cat, int line, int type)
Definition: diglib/cindex.c:68
void G_message(const char *msg,...)
Print a message to stderr.
Definition: lib/gis/error.c:74
int G_begin_polygon_area_calculations(void)
Begin polygon area calculations.
Definition: gis/area.c:123
int Vect_attach_isle(struct Map_info *Map, int isle)
(Re)Attach isle to area
Definition: build_nat.c:258
int Vect_box_copy(BOUND_BOX *A, BOUND_BOX *B)
Copy box B to box A.
Definition: Vlib/box.c:72
int G_info_format(void)
Get current message format.
void dig_spidx_free_isles(struct Plus_head *Plus)
Free spatial index for isles.
Definition: spindex.c:90
int Vect_attach_centroids(struct Map_info *Map, BOUND_BOX *box)
(Re)Attach centroids to areas in given box
Definition: build_nat.c:333
int first
Definition: form/open.c:25
int G_verbose(void)
Get current verbosity level.
Definition: verbose.c:45
void dig_free_plus_isles(struct Plus_head *Plus)
Free Plus-&gt;Isle structure.
Definition: plus.c:207
int Vect_get_isle_box(struct Map_info *Map, int isle, BOUND_BOX *Box)
Get boundary box of isle.
Definition: Vlib/box.c:286
int Vect_close(struct Map_info *Map)
Close vector data file.
Definition: close.c:64
int Vect_select_lines_by_box(struct Map_info *Map, BOUND_BOX *Box, int type, struct ilist *list)
Select lines by box.
struct line_cats * Vect_new_cats_struct()
Creates and initializes line_cats structure.
int Vect_select_areas_by_box(struct Map_info *Map, BOUND_BOX *Box, struct ilist *list)
Select areas by box.
return NULL
Definition: dbfopen.c:1394
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int Vect_get_num_lines(struct Map_info *map)
Fetch number of features (points, lines, boundaries, centroids) in vector map.
Definition: level_two.c:69
tuple Map
Definition: render.py:1310
int Vect_attach_isles(struct Map_info *Map, BOUND_BOX *box)
(Re)Attach isles to areas in given box
Definition: build_nat.c:295
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
int dig_find_area_poly(struct line_pnts *Points, double *totalarea)
Definition: diglib/poly.c:93
void dig_line_add_updated(struct Plus_head *Plus, int line)
Add new line to updated.
int G_verbose_min(void)
Get min verbosity level.
Definition: verbose.c:92
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int dig_add_isle(struct Plus_head *plus, int n_lines, plus_t *lines)
Allocate space for new island and create boundary info from array.
Definition: plus_area.c:634
void dig_spidx_free_nodes(struct Plus_head *Plus)
Free spatial index for nodes.
Definition: spindex.c:57
plus_t dig_line_get_area(struct Plus_head *plus, plus_t line, int side)
Get area number on line side.
Definition: plus_line.c:261
int dig_add_area(struct Plus_head *plus, int n_lines, plus_t *lines)
Allocate space for new area and create boundary info from array.
Definition: plus_area.c:173
void dig_free_plus_nodes(struct Plus_head *Plus)
Free Plus-&gt;Node structure.
Definition: plus.c:105
int Vect_read_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
Read vector feature.
int Vect_rewind(struct Map_info *Map)
Rewind vector data file to cause reads to start at beginning.
int dig_area_del_isle(struct Plus_head *plus, int area, int isle)
Delete isle from area.
Definition: plus_area.c:290