~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/vector/Vlib/clean_nodes.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*!
2
 
   \file clean_nodes.c
 
2
   \file lib/vector/Vlib/clean_nodes.c
3
3
 
4
4
   \brief Vector library - Clean boundaries at nodes
5
5
 
6
6
   Higher level functions for reading/writing/manipulating vectors.
7
7
 
8
 
   (C) 2001-2008 by the GRASS Development Team
 
8
   (C) 2001-2009 by the GRASS Development Team
9
9
 
10
 
   This program is free software under the 
11
 
   GNU General Public License (>=v2). 
12
 
   Read the file COPYING that comes with GRASS
13
 
   for details.
 
10
   This program is free software under the GNU General Public License
 
11
   (>=v2).  Read the file COPYING that comes with GRASS for details.
14
12
 
15
13
   \author Radim Blazek
16
 
 
17
 
   \date 2001-2008
18
14
 */
19
15
 
20
16
#include <stdlib.h>
21
 
#include <grass/gis.h>
22
 
#include <grass/Vect.h>
 
17
#include <grass/vector.h>
23
18
#include <grass/glocale.h>
24
19
 
25
20
/*!
26
21
   \brief Clean small angles at nodes.
27
22
 
28
 
   It may happen that even if the angle between 2 boundaries at node is
29
 
   very small, the calculated angle is 0 because of
30
 
   representation error.  The map must be built at least on level
31
 
   GV_BUILD_BASE
 
23
   It may happen that even if the angle between 2 boundaries at node
 
24
   is very small, the calculated angle is 0 because of representation
 
25
   error. The map must be built at least on level GV_BUILD_BASE
32
26
 
33
27
   \param Map input map
34
 
   \param Err vector map where error line segments are written
 
28
   \param otype feature type
 
29
   \param[out] Err vector map where error line segments are written
35
30
 
36
31
   \return number of line modifications
37
32
 */
50
45
    OCats = Vect_new_cats_struct();
51
46
 
52
47
    nnodes = Vect_get_num_nodes(Map);
53
 
    for (node = 1; node <= nnodes; node++) {
 
48
    for (node = 1; node <= Vect_get_num_nodes(Map); node++) {
54
49
        int i, nlines;
55
50
 
56
 
        G_percent(node, nnodes, 1);
 
51
        if (node <= nnodes)
 
52
            G_percent(node, nnodes, 1);
57
53
        G_debug(3, "node = %d", node);
58
54
        if (!Vect_node_alive(Map, node))
59
55
            continue;
67
63
            G_debug(3, "nlines = %d", nlines);
68
64
 
69
65
            for (i = 0; i < nlines; i++) {
70
 
                P_LINE *Line;
 
66
                struct P_line *Line;
71
67
                int line2;
72
68
                float angle2;
73
69
 
248
244
            if (clean || !Vect_node_alive(Map, node))
249
245
                break;
250
246
        }
251
 
        nnodes = Vect_get_num_nodes(Map);
252
247
    }
 
248
    G_verbose_message(_("Modifications: %d"), nmodif);
253
249
 
254
250
    return (nmodif);
255
251
}