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

« back to all changes in this revision

Viewing changes to raster/r.le/r.le.patch/main.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
 
/*
2
 
 ************************************************************
3
 
 * MODULE: r.le.patch/main.c                                *
4
 
 *         Version 5.0                Nov. 1, 2001          *
5
 
 *                                                         *
6
 
 * AUTHOR: W.L. Baker, University of Wyoming                *
7
 
 *         BAKERWL@UWYO.EDU                                 *
8
 
 *                                                          *
9
 
 * PURPOSE: To analyze attributes of patches in a landscape *
10
 
 *         main.c calls user_input.c to read the user's     *
11
 
 *         requests from the screen, then displays those    *
12
 
 *         choices on screen and calls patch_fore           *
13
 
 *                                                         *
14
 
 * COPYRIGHT: (C) 2001 by W.L. Baker                        *
15
 
 *                                                          *
16
 
 * This program is free software under the GNU General      *
17
 
 * Public License(>=v2).  Read the file COPYING that comes  *
18
 
 * with GRASS for details                                   *
19
 
 *                                                         *
20
 
 ************************************************************/
21
 
 
22
 
#include <stdio.h>
23
 
#include <stdlib.h>
24
 
#include <string.h>
25
 
#include <grass/gis.h>
26
 
#include <grass/glocale.h>
27
 
 
28
 
#include <grass/config.h>
29
 
#define MAIN
30
 
#include "patch.h"
31
 
 
32
 
 
33
 
struct CHOICE *choice;
34
 
 
35
 
 
36
 
int main(int argc, char **argv)
37
 
{
38
 
    struct GModule *module;
39
 
 
40
 
    /* initialize the GRASS GIS system */
41
 
    G_gisinit(argv[0]);
42
 
 
43
 
    /* allocate space for the choice data structure */
44
 
    choice = (struct CHOICE *)G_calloc(1, sizeof(struct CHOICE));
45
 
 
46
 
    module = G_define_module();
47
 
    module->keywords = _("raster, landscape structure analysis, patch index");
48
 
    module->description =
49
 
        _("Calculates attribute, patch size, core (interior) size, shape, "
50
 
          "fractal dimension, and perimeter measures for sets of patches "
51
 
          "in a landscape.");
52
 
 
53
 
    /* call user_input to read in the parameters */
54
 
    user_input(argc, argv);
55
 
 
56
 
 
57
 
    /* display the parameter choices */
58
 
    fprintf(stderr, "\nPARAMETER CHOICES:\n");
59
 
    fprintf(stderr, "\tMAP:\t  %s\n", choice->fn);
60
 
    if (choice->wrum == 'r')
61
 
        fprintf(stderr, "\tREGION:\t  %s\n", choice->reg);
62
 
 
63
 
    fprintf(stderr, "\tSAMPLE:");
64
 
    if (choice->wrum == 'w')
65
 
        fprintf(stderr, "\t  whole map    ");
66
 
    if (choice->wrum == 'm')
67
 
        fprintf(stderr, "\t  moving window");
68
 
    if (choice->wrum == 'u')
69
 
        fprintf(stderr, "\t  units        ");
70
 
    if (choice->wrum == 'r')
71
 
        fprintf(stderr, "\t  regions      ");
72
 
 
73
 
    fprintf(stderr, "\tTRACING:");
74
 
    if (choice->trace)
75
 
        fprintf(stderr, "  8 neighbor\n");
76
 
    else
77
 
        fprintf(stderr, "  4 neighbor\n");
78
 
 
79
 
    if (choice->coremap || choice->patchmap || choice->units)
80
 
        fprintf(stderr, "\tOUTPUT MAPS:\n");
81
 
    if (choice->coremap)
82
 
        fprintf(stderr, "\t\t  interior\n");
83
 
    if (choice->patchmap)
84
 
        fprintf(stderr, "\t\t  num\n");
85
 
    if (choice->units)
86
 
        fprintf(stderr, "\t\t  units_x\n");
87
 
 
88
 
    if (choice->att[0])
89
 
        fprintf(stderr, "\tATTRIBUTE MEASURES:\n");
90
 
    if (choice->att[1])
91
 
        fprintf(stderr, "\t\t  mean pixel attribute\n");
92
 
    if (choice->att[2])
93
 
        fprintf(stderr, "\t\t  st. dev. pixel attribute\n");
94
 
    if (choice->att[3])
95
 
        fprintf(stderr, "\t\t  mean patch attribute\n");
96
 
    if (choice->att[4])
97
 
        fprintf(stderr, "\t\t  st. dev. patch attribute\n");
98
 
    if (choice->att[5])
99
 
        fprintf(stderr, "\t\t  cover by gp\n");
100
 
    if (choice->att[6])
101
 
        fprintf(stderr, "\t\t  density by gp\n");
102
 
    if (choice->att[7])
103
 
        fprintf(stderr, "\t\t  total density\n");
104
 
    if (choice->att[8])
105
 
        fprintf(stderr, "\t\t  eff. mesh no.\n");
106
 
 
107
 
    if (choice->size[0])
108
 
        fprintf(stderr, "\tSIZE MEASURES:\n");
109
 
    if (choice->size[1])
110
 
        fprintf(stderr, "\t\t  mean patch size\n");
111
 
    if (choice->size[2])
112
 
        fprintf(stderr, "\t\t  st. dev. patch size\n");
113
 
    if (choice->size[3])
114
 
        fprintf(stderr, "\t\t  mean patch size by gp\n");
115
 
    if (choice->size[4])
116
 
        fprintf(stderr, "\t\t  st. dev. patch size by gp\n");
117
 
    if (choice->size[5])
118
 
        fprintf(stderr, "\t\t  no. by size class\n");
119
 
    if (choice->size[6])
120
 
        fprintf(stderr, "\t\t  no. by size class by gp\n");
121
 
    if (choice->size[7])
122
 
        fprintf(stderr, "\t\t  eff. mesh size\n");
123
 
    if (choice->size[8])
124
 
        fprintf(stderr, "\t\t  deg. landsc. division\n");
125
 
 
126
 
 
127
 
    if (choice->core[0])
128
 
        fprintf(stderr, "\tCORE MEASURES:\n");
129
 
    if (choice->core[1])
130
 
        fprintf(stderr, "\t\t  mean core size\n");
131
 
    if (choice->core[2])
132
 
        fprintf(stderr, "\t\t  st. dev. core size\n");
133
 
    if (choice->core[3])
134
 
        fprintf(stderr, "\t\t  mean edge size\n");
135
 
    if (choice->core[4])
136
 
        fprintf(stderr, "\t\t  st. dev. edge size\n");
137
 
    if (choice->core[5])
138
 
        fprintf(stderr, "\t\t  mean core size by gp\n");
139
 
    if (choice->core[6])
140
 
        fprintf(stderr, "\t\t  st. dev. core size by gp\n");
141
 
    if (choice->core[7])
142
 
        fprintf(stderr, "\t\t  mean edge size by gp \n");
143
 
    if (choice->core[8])
144
 
        fprintf(stderr, "\t\t  st. dev. edge size by gp\n");
145
 
    if (choice->core[9])
146
 
        fprintf(stderr, "\t\t  no. by size class \n");
147
 
    if (choice->core[10])
148
 
        fprintf(stderr, "\t\t  no. by size class by gp\n");
149
 
 
150
 
    if (choice->shape[0])
151
 
        fprintf(stderr, "\tSHAPE MEASURES:\n");
152
 
    if (choice->shape[1])
153
 
        fprintf(stderr, "\t\t  mean patch shape\n");
154
 
    if (choice->shape[2])
155
 
        fprintf(stderr, "\t\t  st. dev. patch shape\n");
156
 
    if (choice->shape[3])
157
 
        fprintf(stderr, "\t\t  mean patch shape by gp\n");
158
 
    if (choice->shape[4])
159
 
        fprintf(stderr, "\t\t  st. dev. patch shape by gp\n");
160
 
    if (choice->shape[5])
161
 
        fprintf(stderr, "\t\t  no. by shape class\n");
162
 
    if (choice->shape[6])
163
 
        fprintf(stderr, "\t\t  no. by shape class by gp\n");
164
 
 
165
 
    if (choice->boundary[0])
166
 
        fprintf(stderr, "\tBOUNDARY COMPLEXITY MEASURES:\n");
167
 
    if (choice->boundary[1])
168
 
        fprintf(stderr, "\t\t  mean twist number\n");
169
 
    if (choice->boundary[2])
170
 
        fprintf(stderr, "\t\t  st. dev. twist number\n");
171
 
    if (choice->boundary[3])
172
 
        fprintf(stderr, "\t\t  mean omega index\n");
173
 
    if (choice->boundary[4])
174
 
        fprintf(stderr, "\t\t  st. dev. omega index\n");
175
 
 
176
 
    if (choice->perim[0])
177
 
        fprintf(stderr, "\tPERIMETER MEASURES:\n");
178
 
    if (choice->perim[1])
179
 
        fprintf(stderr, "\t\t  sum of perims\n");
180
 
    if (choice->perim[2])
181
 
        fprintf(stderr, "\t\t  mean perim.\n");
182
 
    if (choice->perim[3])
183
 
        fprintf(stderr, "\t\t  st. dev. perim.\n");
184
 
    if (choice->perim[4])
185
 
        fprintf(stderr, "\t\t  sum of perims. by gp\n");
186
 
    if (choice->perim[5])
187
 
        fprintf(stderr, "\t\t  mean perim. by gp\n");
188
 
    if (choice->perim[6])
189
 
        fprintf(stderr, "\t\t  st. dev. perim. by gp\n");
190
 
 
191
 
    /* if not moving window, setup the
192
 
       r.le.out subdirectory */
193
 
 
194
 
    if (choice->wrum != 'm')
195
 
        G_mkdir("r.le.out");
196
 
 
197
 
    patch_fore();
198
 
    G_free(choice);
199
 
 
200
 
    return (EXIT_SUCCESS);
201
 
}