~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to raster/r.watershed/seg/no_stream.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
{
7
7
    int r, rr, c, cc, uprow = 0, upcol = 0;
8
8
    double slope;
9
 
    CELL downdir, asp_value, hih_ele, new_ele, aspect, value;
 
9
    CELL hih_ele, new_ele, value;
 
10
    char downdir, asp_value, aspect;
10
11
    DCELL dvalue, max_drain;    /* flow acc is now DCELL */
11
 
    SHORT updir, riteflag, leftflag, thisdir;
 
12
    int updir, riteflag, leftflag, thisdir;
 
13
    WAT_ALT wa;
 
14
    ASP_FLAG af;
12
15
 
13
16
    while (1) {
14
17
        cseg_put(&bas, &basin_num, row, col);
16
19
        for (r = row - 1, rr = 0; r <= row + 1; r++, rr++) {
17
20
            for (c = col - 1, cc = 0; c <= col + 1; c++, cc++) {
18
21
                if (r >= 0 && c >= 0 && r < nrows && c < ncols) {
 
22
                    if (r == row && c == col)
 
23
                        continue;
19
24
 
20
 
                    cseg_get(&asp, &aspect, r, c);
 
25
                    seg_get(&aspflag, (char *)&af, r, c);
 
26
                    aspect = af.asp;
21
27
                    if (aspect == drain[rr][cc]) {
22
 
                        dseg_get(&wat, &dvalue, r, c);
 
28
                        seg_get(&watalt, (char *)&wa, r, c);
 
29
                        dvalue = wa.wat;
23
30
                        if (dvalue < 0)
24
31
                            dvalue = -dvalue;
25
 
                        if ((dvalue - max_drain) > 5E-8f) {     /* floating point comparison problem workaround */
 
32
                        if (dvalue > max_drain) {
26
33
                            uprow = r;
27
34
                            upcol = c;
28
35
                            max_drain = dvalue;
33
40
        }
34
41
        if (max_drain > -1) {
35
42
            updir = drain[row - uprow + 1][col - upcol + 1];
36
 
            cseg_get(&asp, &downdir, row, col);
 
43
            seg_get(&aspflag, (char *)&af, row, col);
 
44
            downdir = af.asp;
37
45
            if (downdir < 0)
38
46
                downdir = -downdir;
39
 
            if (sides == 8) {
40
 
                if (uprow != row && upcol != col)
41
 
                    stream_length += diag;
42
 
                else if (uprow != row)
43
 
                    stream_length += window.ns_res;
44
 
                else
45
 
                    stream_length += window.ew_res;
46
 
            }
47
 
            else {              /* sides == 4 */
48
 
 
49
 
                cseg_get(&asp, &asp_value, uprow, upcol);
50
 
                if (downdir == 2 || downdir == 6) {
51
 
                    if (asp_value == 2 || asp_value == 6)
 
47
            if (arm_flag) {
 
48
                if (sides == 8) {
 
49
                    if (uprow != row && upcol != col)
 
50
                        stream_length += diag;
 
51
                    else if (uprow != row)
52
52
                        stream_length += window.ns_res;
53
53
                    else
54
 
                        stream_length += diag;
55
 
                }
56
 
                else {          /* downdir == 4,8 */
57
 
 
58
 
                    if (asp_value == 4 || asp_value == 8)
59
54
                        stream_length += window.ew_res;
60
 
                    else
61
 
                        stream_length += diag;
 
55
                }
 
56
                else {          /* sides == 4 */
 
57
                    seg_get(&aspflag, (char *)&af, uprow, upcol);
 
58
                    asp_value = af.asp;
 
59
                    if (downdir == 2 || downdir == 6) {
 
60
                        if (asp_value == 2 || asp_value == 6)
 
61
                            stream_length += window.ns_res;
 
62
                        else
 
63
                            stream_length += diag;
 
64
                    }
 
65
                    else {              /* downdir == 4,8 */
 
66
 
 
67
                        if (asp_value == 4 || asp_value == 8)
 
68
                            stream_length += window.ew_res;
 
69
                        else
 
70
                            stream_length += diag;
 
71
                    }
62
72
                }
63
73
            }
64
74
            riteflag = leftflag = 0;
65
75
            for (r = row - 1, rr = 0; rr < 3; r++, rr++) {
66
76
                for (c = col - 1, cc = 0; cc < 3; c++, cc++) {
67
77
                    if (r >= 0 && c >= 0 && r < nrows && c < ncols) {
68
 
                        cseg_get(&asp, &aspect, r, c);
 
78
                        seg_get(&aspflag, (char *)&af, r, c);
 
79
                        aspect = af.asp;
69
80
                        if (aspect == drain[rr][cc]) {
70
81
                            thisdir = updrain[rr][cc];
71
82
                            switch (haf_basin_side(updir,
72
 
                                               (SHORT) downdir,
 
83
                                               (int) downdir,
73
84
                                               thisdir)) {
74
85
                            case RITE:
75
86
                                overland_cells(r, c, basin_num, basin_num,
80
91
                                overland_cells(r, c, basin_num, basin_num - 1,
81
92
                                               &new_ele);
82
93
                                leftflag++;
 
94
                                break;
83
95
                            }
84
96
                        }
85
97
                    }
96
108
        }
97
109
        else {
98
110
            if (arm_flag) {
99
 
                cseg_get(&alt, &hih_ele, row, col);
 
111
                seg_get(&watalt, (char *) &wa, row, col);
 
112
                hih_ele = wa.ele;
100
113
                slope = (hih_ele - old_elev) / stream_length;
101
114
                if (slope < MIN_SLOPE)
102
115
                    slope = MIN_SLOPE;