GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
remove_areas.c
Go to the documentation of this file.
1 /*!
2  \file lib/vector/Vlib/remove_areas.c
3 
4  \brief Vector library - clean geometry (remove small areas)
5 
6  Higher level functions for reading/writing/manipulating vectors.
7 
8  (C) 2001-2009 by the GRASS Development Team
9 
10  This program is free software under the GNU General Public License
11  (>=v2). Read the file COPYING that comes with GRASS for details.
12 
13  \author Radim Blazek, Markus Metz
14  */
15 
16 #include <stdlib.h>
17 #include <grass/vector.h>
18 #include <grass/glocale.h>
19 
20 int Vect_remove_small_areas_nat(struct Map_info *, double,
21  struct Map_info *, double *);
22 
23 int Vect_remove_small_areas_ext(struct Map_info *, double,
24  struct Map_info *, double *);
25 
26 /*!
27  \brief Remove small areas from the map map.
28 
29  Centroid of the area and the longest boundary with adjacent area is
30  removed. Map topology must be built GV_BUILD_CENTROIDS.
31 
32  \param[in,out] Map vector map
33  \param thresh maximum area size for removed areas
34  \param[out] Err vector map where removed lines and centroids are written
35  \param removed_area pointer to where total size of removed area is stored or NULL
36 
37  \return number of removed areas
38  */
39 
40 int
41 Vect_remove_small_areas(struct Map_info *Map, double thresh,
42  struct Map_info *Err, double *removed_area)
43 {
44 
45  if (Map->format == GV_FORMAT_NATIVE)
46  return Vect_remove_small_areas_nat(Map, thresh, Err, removed_area);
47  else
48  return Vect_remove_small_areas_ext(Map, thresh, Err, removed_area);
49 }
50 
51 int
52 Vect_remove_small_areas_ext(struct Map_info *Map, double thresh,
53  struct Map_info *Err, double *removed_area)
54 {
55  int area, nareas;
56  int nremoved = 0;
57  struct ilist *List;
58  struct ilist *AList;
59  struct line_pnts *Points;
60  struct line_cats *Cats;
61  double size_removed = 0.0;
62 
63  List = Vect_new_list();
64  AList = Vect_new_list();
65  Points = Vect_new_line_struct();
66  Cats = Vect_new_cats_struct();
67 
68  nareas = Vect_get_num_areas(Map);
69  for (area = 1; area <= nareas; area++) {
70  int i, j, centroid, dissolve_neighbour;
71  double length, size;
72 
73  G_percent(area, nareas, 1);
74  G_debug(3, "area = %d", area);
75  if (!Vect_area_alive(Map, area))
76  continue;
77 
78  size = Vect_get_area_area(Map, area);
79  if (size > thresh)
80  continue;
81  size_removed += size;
82 
83  /* The area is smaller than the limit -> remove */
84 
85  /* Remove centroid */
86  centroid = Vect_get_area_centroid(Map, area);
87  if (centroid > 0) {
88  if (Err) {
89  Vect_read_line(Map, Points, Cats, centroid);
90  Vect_write_line(Err, GV_CENTROID, Points, Cats);
91  }
92  Vect_delete_line(Map, centroid);
93  }
94 
95  /* Find the adjacent area with which the longest boundary is shared */
96 
97  Vect_get_area_boundaries(Map, area, List);
98 
99  /* Create a list of neighbour areas */
100  Vect_reset_list(AList);
101  for (i = 0; i < List->n_values; i++) {
102  int line, left, right, neighbour;
103 
104  line = List->value[i];
105 
106  if (!Vect_line_alive(Map, abs(line))) /* Should not happen */
107  G_fatal_error(_("Area is composed of dead boundary"));
108 
109  Vect_get_line_areas(Map, abs(line), &left, &right);
110  if (line > 0)
111  neighbour = left;
112  else
113  neighbour = right;
114 
115  G_debug(4, " line = %d left = %d right = %d neighbour = %d",
116  line, left, right, neighbour);
117 
118  Vect_list_append(AList, neighbour); /* this checks for duplicity */
119  }
120  G_debug(3, "num neighbours = %d", AList->n_values);
121 
122  /* Go through the list of neighbours and find that with the longest boundary */
123  dissolve_neighbour = 0;
124  length = -1.0;
125  for (i = 0; i < AList->n_values; i++) {
126  int neighbour1;
127  double l = 0.0;
128 
129  neighbour1 = AList->value[i];
130  G_debug(4, " neighbour1 = %d", neighbour1);
131 
132  for (j = 0; j < List->n_values; j++) {
133  int line, left, right, neighbour2;
134 
135  line = List->value[j];
136  Vect_get_line_areas(Map, abs(line), &left, &right);
137  if (line > 0)
138  neighbour2 = left;
139  else
140  neighbour2 = right;
141 
142  if (neighbour2 == neighbour1) {
143  Vect_read_line(Map, Points, NULL, abs(line));
144  l += Vect_line_length(Points);
145  }
146  }
147  if (l > length) {
148  length = l;
149  dissolve_neighbour = neighbour1;
150  }
151  }
152 
153  G_debug(3, "dissolve_neighbour = %d", dissolve_neighbour);
154 
155  /* Make list of boundaries to be removed */
156  Vect_reset_list(AList);
157  for (i = 0; i < List->n_values; i++) {
158  int line, left, right, neighbour;
159 
160  line = List->value[i];
161  Vect_get_line_areas(Map, abs(line), &left, &right);
162  if (line > 0)
163  neighbour = left;
164  else
165  neighbour = right;
166 
167  G_debug(3, " neighbour = %d", neighbour);
168 
169  if (neighbour == dissolve_neighbour) {
170  Vect_list_append(AList, abs(line));
171  }
172  }
173 
174  /* Remove boundaries */
175  for (i = 0; i < AList->n_values; i++) {
176  int line;
177 
178  line = AList->value[i];
179 
180  if (Err) {
181  Vect_read_line(Map, Points, Cats, line);
182  Vect_write_line(Err, GV_BOUNDARY, Points, Cats);
183  }
184  Vect_delete_line(Map, line);
185  }
186 
187  nremoved++;
188  nareas = Vect_get_num_areas(Map);
189  }
190 
191  if (removed_area)
192  *removed_area = size_removed;
193 
194  G_message(_("%d areas of total size %g removed"), nremoved,
195  size_removed);
196 
197  return (nremoved);
198 }
199 
200 
201 /* much faster version */
202 int
203 Vect_remove_small_areas_nat(struct Map_info *Map, double thresh,
204  struct Map_info *Err, double *removed_area)
205 {
206  int area, nareas;
207  int nremoved = 0;
208  struct ilist *List;
209  struct ilist *AList;
210  struct ilist *BList;
211  struct ilist *NList;
212  struct ilist *IList;
213  struct line_pnts *Points;
214  struct line_cats *Cats;
215  double size_removed = 0.0;
216  int dissolve_neighbour;
217  int line, left, right, neighbour;
218  int nisles, nnisles;
219 
220  List = Vect_new_list();
221  AList = Vect_new_list();
222  BList = Vect_new_list();
223  NList = Vect_new_list();
224  IList = Vect_new_list();
225  Points = Vect_new_line_struct();
226  Cats = Vect_new_cats_struct();
227 
228  nareas = Vect_get_num_areas(Map);
229  for (area = 1; area <= nareas; area++) {
230  int i, j, centroid, ncentroid;
231  double length, l, size;
232  int outer_area = -1;
233  int narea, same_atype = 0;
234 
235  G_percent(area, nareas, 1);
236  G_debug(3, "area = %d", area);
237  if (!Vect_area_alive(Map, area))
238  continue;
239 
240  size = Vect_get_area_area(Map, area);
241  if (size > thresh)
242  continue;
243  size_removed += size;
244 
245  /* The area is smaller than the limit -> remove */
246 
247  /* Remove centroid */
248  centroid = Vect_get_area_centroid(Map, area);
249  if (centroid > 0) {
250  if (Err) {
251  Vect_read_line(Map, Points, Cats, centroid);
252  Vect_write_line(Err, GV_CENTROID, Points, Cats);
253  }
254  Vect_delete_line(Map, centroid);
255  }
256 
257  /* Find the adjacent area with which the longest boundary is shared */
258 
259  Vect_get_area_boundaries(Map, area, List);
260 
261  /* Create a list of neighbour areas */
262  Vect_reset_list(AList);
263  for (i = 0; i < List->n_values; i++) {
264 
265  line = List->value[i];
266 
267  if (!Vect_line_alive(Map, abs(line))) /* Should not happen */
268  G_fatal_error(_("Area is composed of dead boundary"));
269 
270  Vect_get_line_areas(Map, abs(line), &left, &right);
271  if (line > 0)
272  neighbour = left;
273  else
274  neighbour = right;
275 
276  G_debug(4, " line = %d left = %d right = %d neighbour = %d",
277  line, left, right, neighbour);
278 
279  ncentroid = 0;
280  if (neighbour > 0) {
281  ncentroid = Vect_get_area_centroid(Map, neighbour);
282  }
283  if (neighbour < 0) {
284  narea = Vect_get_isle_area(Map, -neighbour);
285  if (narea > 0)
286  ncentroid = Vect_get_area_centroid(Map, narea);
287  }
288  if ((centroid != 0) + (ncentroid != 0) != 1)
289  same_atype = 1;
290 
291  Vect_list_append(AList, neighbour); /* this checks for duplicity */
292  }
293  G_debug(3, "num neighbours = %d", AList->n_values);
294 
295  if (AList->n_values == 1)
296  same_atype = 0;
297 
298  /* Go through the list of neighbours and find the one with the longest boundary */
299  dissolve_neighbour = 0;
300  length = -1.0;
301  for (i = 0; i < AList->n_values; i++) {
302  int neighbour1;
303 
304  l = 0.0;
305  neighbour1 = AList->value[i];
306  G_debug(4, " neighbour1 = %d", neighbour1);
307 
308  if (same_atype) {
309  ncentroid = 0;
310  if (neighbour1 > 0) {
311  ncentroid = Vect_get_area_centroid(Map, neighbour1);
312  }
313  if (neighbour1 < 0) {
314  narea = Vect_get_isle_area(Map, -neighbour1);
315  if (narea > 0)
316  ncentroid = Vect_get_area_centroid(Map, narea);
317  }
318  if ((centroid != 0) + (ncentroid != 0) == 1)
319  continue;
320  }
321 
322  for (j = 0; j < List->n_values; j++) {
323  int neighbour2;
324 
325  line = List->value[j];
326  Vect_get_line_areas(Map, abs(line), &left, &right);
327  if (line > 0)
328  neighbour2 = left;
329  else
330  neighbour2 = right;
331 
332  if (neighbour2 == neighbour1) {
333  Vect_read_line(Map, Points, NULL, abs(line));
334  l += Vect_line_length(Points);
335  }
336  }
337  if (l > length) {
338  length = l;
339  dissolve_neighbour = neighbour1;
340  }
341  }
342 
343  G_debug(3, "dissolve_neighbour = %d", dissolve_neighbour);
344 
345  if (dissolve_neighbour == 0) {
346  G_fatal_error("could not find neighbour to dissolve");
347  }
348 
349  /* Make list of boundaries to be removed */
350  Vect_reset_list(AList);
351  Vect_reset_list(BList);
352  for (i = 0; i < List->n_values; i++) {
353 
354  line = List->value[i];
355  Vect_get_line_areas(Map, abs(line), &left, &right);
356  if (line > 0)
357  neighbour = left;
358  else
359  neighbour = right;
360 
361  G_debug(3, " neighbour = %d", neighbour);
362 
363  if (neighbour == dissolve_neighbour) {
364  Vect_list_append(AList, abs(line));
365  }
366  else
367  Vect_list_append(BList, line);
368  }
369  G_debug(3, "remove %d of %d boundaries", AList->n_values, List->n_values);
370 
371  /* Get isles inside area */
372  Vect_reset_list(IList);
373  if ((nisles = Vect_get_area_num_isles(Map, area)) > 0) {
374  for (i = 0; i < nisles; i++) {
375  Vect_list_append(IList, Vect_get_area_isle(Map, area, i));
376  }
377  }
378 
379  /* Remove boundaries */
380  for (i = 0; i < AList->n_values; i++) {
381  int ret;
382 
383  line = AList->value[i];
384 
385  if (Err) {
386  Vect_read_line(Map, Points, Cats, line);
387  Vect_write_line(Err, GV_BOUNDARY, Points, Cats);
388  }
389  /* Vect_delete_line(Map, line); */
390 
391  /* delete the line from coor */
392  ret = V1_delete_line_nat(Map, Map->plus.Line[line]->offset);
393 
394  if (ret == -1) {
395  G_fatal_error(_("Could not delete line from coor"));
396  }
397  }
398 
399  /* update topo */
400  if (dissolve_neighbour > 0) {
401 
402  G_debug(3, "dissolve with neighbour area");
403 
404  /* get neighbour centroid */
405  centroid = Vect_get_area_centroid(Map, dissolve_neighbour);
406  /* get neighbour isles */
407  if ((nnisles = Vect_get_area_num_isles(Map, dissolve_neighbour)) > 0) {
408  for (i = 0; i < nnisles; i++) {
409  Vect_list_append(IList, Vect_get_area_isle(Map, dissolve_neighbour, i));
410  }
411  }
412 
413  /* get neighbour boundaries */
414  Vect_get_area_boundaries(Map, dissolve_neighbour, NList);
415 
416  /* delete area from topo */
417  dig_del_area(&(Map->plus), area);
418  /* delete neighbour area from topo */
419  dig_del_area(&(Map->plus), dissolve_neighbour);
420  /* delete boundaries from topo */
421  for (i = 0; i < AList->n_values; i++) {
422  struct P_topo_b *topo;
423  struct P_node *Node;
424 
425  line = AList->value[i];
426  topo = (struct P_topo_b *)Map->plus.Line[line]->topo;
427  Node = Map->plus.Node[topo->N1];
428  dig_del_line(&(Map->plus), line, Node->x, Node->y, Node->z);
429  }
430  /* build new area from leftover boundaries of deleted area */
431  for (i = 0; i < BList->n_values; i++) {
432  struct P_topo_b *topo;
433  int new_isle;
434 
435  line = BList->value[i];
436  topo = Map->plus.Line[abs(line)]->topo;
437 
438  if (topo->left == 0 || topo->right == 0) {
439  new_isle = Vect_build_line_area(Map, abs(line), (line > 0 ? GV_RIGHT : GV_LEFT));
440  if (new_isle > 0) {
441  if (outer_area > 0)
442  G_fatal_error("dissolve_neighbour > 0, new area has already been created");
443  outer_area = new_isle;
444  /* reattach centroid */
445  Map->plus.Area[outer_area]->centroid = centroid;
446  if (centroid > 0) {
447  struct P_topo_c *ctopo = Map->plus.Line[centroid]->topo;
448 
449  ctopo->area = outer_area;
450  }
451  }
452  else if (new_isle < 0) {
453  /* leftover boundary creates a new isle */
454  Vect_list_append(IList, -new_isle);
455  }
456  else {
457  /* neither area nor isle, should not happen */
458  G_fatal_error(_("dissolve_neighbour > 0, failed to build new area"));
459  }
460  }
461  /* check */
462  if (topo->left == 0 || topo->right == 0)
463  G_fatal_error(_("Dissolve with neighbour area: corrupt topology"));
464  }
465  /* build new area from neighbour's boundaries */
466  for (i = 0; i < NList->n_values; i++) {
467  struct P_topo_b *topo;
468 
469  line = NList->value[i];
470  if (!Vect_line_alive(Map, abs(line)))
471  continue;
472 
473  topo = Map->plus.Line[abs(line)]->topo;
474 
475  if (topo->left == 0 || topo->right == 0) {
476  int new_isle;
477 
478  new_isle = Vect_build_line_area(Map, abs(line), (line > 0 ? GV_RIGHT : GV_LEFT));
479  if (new_isle > 0) {
480  if (outer_area > 0)
481  G_fatal_error("dissolve_neighbour > 0, new area has already been created");
482  outer_area = new_isle;
483  /* reattach centroid */
484  Map->plus.Area[outer_area]->centroid = centroid;
485  if (centroid > 0) {
486  struct P_topo_c *ctopo = Map->plus.Line[centroid]->topo;
487 
488  ctopo->area = outer_area;
489  }
490  }
491  else if (new_isle < 0) {
492  /* Neigbour's boundary creates a new isle */
493  Vect_list_append(IList, -new_isle);
494  }
495  else {
496  /* neither area nor isle, should not happen */
497  G_fatal_error(_("Failed to build new area"));
498  }
499  }
500  if (topo->left == 0 || topo->right == 0)
501  G_fatal_error(_("Dissolve with neighbour area: corrupt topology"));
502  }
503  }
504  /* dissolve with outer isle */
505  else if (dissolve_neighbour < 0) {
506 
507  G_debug(3, "dissolve with outer isle");
508 
509  outer_area = Vect_get_isle_area(Map, -dissolve_neighbour);
510 
511  /* get isle boundaries */
512  Vect_get_isle_boundaries(Map, -dissolve_neighbour, NList);
513 
514  /* delete area from topo */
515  dig_del_area(&(Map->plus), area);
516  /* delete isle from topo */
517  dig_del_isle(&(Map->plus), -dissolve_neighbour);
518  /* delete boundaries from topo */
519  for (i = 0; i < AList->n_values; i++) {
520  struct P_topo_b *topo;
521  struct P_node *Node;
522 
523  line = AList->value[i];
524  topo = (struct P_topo_b *)Map->plus.Line[line]->topo;
525  Node = Map->plus.Node[topo->N1];
526  dig_del_line(&(Map->plus), line, Node->x, Node->y, Node->z);
527  }
528  /* build new isle(s) from leftover boundaries */
529  for (i = 0; i < BList->n_values; i++) {
530  struct P_topo_b *topo;
531 
532  line = BList->value[i];
533  topo = Map->plus.Line[abs(line)]->topo;
534 
535  if (topo->left == 0 || topo->right == 0) {
536  int new_isle;
537 
538  new_isle = Vect_build_line_area(Map, abs(line), (line > 0 ? GV_RIGHT : GV_LEFT));
539  if (new_isle < 0) {
540  Vect_list_append(IList, -new_isle);
541  }
542  else {
543  /* area or nothing should not happen */
544  G_fatal_error(_("Failed to build new isle"));
545  }
546  }
547  /* check */
548  if (topo->left == 0 || topo->right == 0)
549  G_fatal_error(_("Dissolve with outer isle: corrupt topology"));
550  }
551 
552  /* build new isle(s) from old isle's boundaries */
553  for (i = 0; i < NList->n_values; i++) {
554  struct P_topo_b *topo;
555 
556  line = NList->value[i];
557  if (!Vect_line_alive(Map, abs(line)))
558  continue;
559 
560  topo = Map->plus.Line[abs(line)]->topo;
561 
562  if (topo->left == 0 || topo->right == 0) {
563  int new_isle;
564 
565  new_isle = Vect_build_line_area(Map, abs(line), (line > 0 ? GV_RIGHT : GV_LEFT));
566  if (new_isle < 0) {
567  Vect_list_append(IList, -new_isle);
568  }
569  else {
570  /* area or nothing should not happen */
571  G_fatal_error(_("Failed to build new isle"));
572  }
573  }
574  /* check */
575  if (topo->left == 0 || topo->right == 0)
576  G_fatal_error(_("Dissolve with outer isle: corrupt topology"));
577  }
578  }
579 
580  if (dissolve_neighbour > 0 && outer_area <= 0) {
581  G_fatal_error(_("Area merging failed"));
582  }
583 
584  /* attach all isles to outer or new area */
585  if (outer_area >= 0) {
586  for (i = 0; i < IList->n_values; i++) {
587  if (!Map->plus.Isle[IList->value[i]])
588  continue;
589  Map->plus.Isle[IList->value[i]]->area = outer_area;
590  if (outer_area > 0)
591  dig_area_add_isle(&(Map->plus), outer_area, IList->value[i]);
592  }
593  }
594 
595  nremoved++;
596  nareas = Vect_get_num_areas(Map);
597  }
598 
599  if (removed_area)
600  *removed_area = size_removed;
601 
602  G_message(_("%d areas of total size %g removed"), nremoved,
603  size_removed);
604 
605  Vect_destroy_list(List);
606  Vect_destroy_list(AList);
607  Vect_destroy_list(BList);
608  Vect_destroy_list(NList);
609  Vect_destroy_list(IList);
610  Vect_destroy_line_struct(Points);
612 
613  return (nremoved);
614 }
int Vect_build_line_area(struct Map_info *, int, int)
Build area on given side of line (GV_LEFT or GV_RIGHT)
Definition: build.c:77
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
plus_t area
Area number, negative for duplicate centroid.
Definition: dig_structs.h:1537
#define GV_LEFT
Boundary side indicator left/right.
Definition: dig_defines.h:174
int Vect_get_area_isle(const struct Map_info *, int, int)
Returns isle id for area.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
off_t offset
Offset in coor file for line.
Definition: dig_structs.h:1593
#define GV_FORMAT_NATIVE
Geometry data formats supported by lib Don&#39;t change GV_FORMAT_* values, this order is hardcoded in li...
Definition: dig_defines.h:83
struct P_line ** Line
Array of vector geometries.
Definition: dig_structs.h:887
int Vect_get_area_centroid(const struct Map_info *, int)
Returns centroid id for given area.
plus_t right
Area number to the right, negative for isle.
Definition: dig_structs.h:1526
struct P_area ** Area
Array of areas.
Definition: dig_structs.h:891
struct P_node ** Node
Array of nodes.
Definition: dig_structs.h:883
double x
X coordinate.
Definition: dig_structs.h:1453
int dig_area_add_isle(struct Plus_head *, int, int)
Add isle to area if does not exist yet.
Definition: plus_area.c:258
#define GV_CENTROID
Definition: dig_defines.h:185
int n_values
Number of values in the list.
Definition: gis.h:709
plus_t left
Area number to the left, negative for isle.
Definition: dig_structs.h:1522
int Vect_get_area_num_isles(const struct Map_info *, int)
Returns number of isles for given area.
struct P_isle ** Isle
Array of isles.
Definition: dig_structs.h:895
plus_t centroid
Number of first centroid within area.
Definition: dig_structs.h:1628
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
Definition: line.c:576
#define NULL
Definition: ccmath.h:32
plus_t N1
Start node.
Definition: dig_structs.h:1514
int dig_del_line(struct Plus_head *, int, double, double, double)
Delete line from Plus_head structure.
Definition: plus_line.c:219
Feature category info.
Definition: dig_structs.h:1702
void G_message(const char *,...) __attribute__((format(printf
double z
Z coordinate (used only for 3D data)
Definition: dig_structs.h:1461
double l
Definition: r_raster.c:39
Feature geometry info - coordinates.
Definition: dig_structs.h:1675
Centroid topology.
Definition: dig_structs.h:1532
void Vect_destroy_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
Definition: line.c:45
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
void * topo
Topology info.
Definition: dig_structs.h:1599
int dig_del_isle(struct Plus_head *, int)
Delete island from Plus_head structure.
Definition: plus_area.c:757
Boundary topology.
Definition: dig_structs.h:1509
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
#define GV_BOUNDARY
Definition: dig_defines.h:184
struct Plus_head plus
Plus info (topology, version, ...)
Definition: dig_structs.h:1286
int Vect_get_area_boundaries(const struct Map_info *, int, struct ilist *)
Creates list of boundaries for given area.
plus_t Vect_get_num_areas(const struct Map_info *)
Get number of areas in vector map.
Definition: level_two.c:86
int Vect_get_isle_boundaries(const struct Map_info *, int, struct ilist *)
Creates list of boundaries for given isle.
int Vect_area_alive(const struct Map_info *, int)
Check if area is alive or dead (topological level required)
Topological feature - node.
Definition: dig_structs.h:1448
int Vect_get_isle_area(const struct Map_info *, int)
Returns area id for isle.
double y
Y coordinate.
Definition: dig_structs.h:1457
int Vect_remove_small_areas_ext(struct Map_info *, double, struct Map_info *, double *)
Definition: remove_areas.c:52
void G_percent(long, long, int)
Print percent complete messages.
Definition: percent.c:62
Vector map info.
Definition: dig_structs.h:1259
int V1_delete_line_nat(struct Map_info *, off_t)
Deletes feature at level 1 (internal use only)
Definition: write_nat.c:239
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_remove_small_areas(struct Map_info *Map, double thresh, struct Map_info *Err, double *removed_area)
Remove small areas from the map map.
Definition: remove_areas.c:41
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_line_alive(const struct Map_info *, int)
Check if feature is alive or dead (topological level required)
#define GV_RIGHT
Definition: dig_defines.h:175
#define _(str)
Definition: glocale.h:10
List of integers.
Definition: gis.h:700
int format
Map format (native, ogr, postgis)
Definition: dig_structs.h:1271
int * value
Array of values.
Definition: gis.h:705
int Vect_remove_small_areas_nat(struct Map_info *, double, struct Map_info *, double *)
Definition: remove_areas.c:203
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
Definition: line.c:77
int dig_del_area(struct Plus_head *, int)
Delete area from Plus_head structure.
Definition: plus_area.c:357
double Vect_get_area_area(const struct Map_info *, int)
Returns area of area without areas of isles.
int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
plus_t area
Area it exists w/in, if any.
Definition: dig_structs.h:1669
int G_debug(int, const char *,...) __attribute__((format(printf
int Vect_get_line_areas(const struct Map_info *, int, int *, int *)
Get area id on the left and right side of the boundary.
Definition: level_two.c:350