[GRASS-SVN] r33246 - grass/trunk/display/d.thematic.area
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 4 09:13:48 EDT 2008
Author: mlennert
Date: 2008-09-04 09:13:48 -0400 (Thu, 04 Sep 2008)
New Revision: 33246
Modified:
grass/trunk/display/d.thematic.area/main.c
Log:
don't need to calculate max and min as we have them in the stats
stucture
Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c 2008-09-04 12:29:43 UTC (rev 33245)
+++ grass/trunk/display/d.thematic.area/main.c 2008-09-04 13:13:48 UTC (rev 33246)
@@ -65,8 +65,7 @@
dbCatValArray cvarr;
struct Cell_head window;
BOUND_BOX box;
- double overlap, *breakpoints, min = 0, max = 0, *data = NULL, class_info =
- 0.0;
+ double overlap, *breakpoints, *data = NULL, class_info = 0.0;
struct GASTATS stats;
FILE *fd;
@@ -106,7 +105,7 @@
"std;standard deviations;"
"qua;quantiles;"
"equ;equiprobable (normal distribution);");
-/*currently disabled because of bugs "dis;discontinuities");*/
+ /*currently disabled because of bugs "dis;discontinuities"); */
nbclass_opt = G_define_option();
nbclass_opt->key = "nbclasses";
@@ -310,17 +309,6 @@
data[i] = cvarr.value[i].val.d;
}
-
- /* min and max are needed later for the legend */
- if (cvarr.ctype == DB_C_TYPE_INT) {
- min = cvarr.value[0].val.i;
- max = cvarr.value[cvarr.n_values - 1].val.i;
- }
- else {
- min = cvarr.value[0].val.d;
- max = cvarr.value[cvarr.n_values - 1].val.d;
- }
-
db_CatValArray_sort(&cvarr);
nclass = atoi(nbclass_opt->answer);
@@ -424,7 +412,7 @@
frequencies[i] = 0.0;
class_frequencies(data, nrec, nbreaks, breakpoints, frequencies);
- /*Get basic statistics about the data*/
+ /*Get basic statistics about the data */
basic_stats(data, nrec, &stats);
if (legend_flag->answer) {
@@ -452,8 +440,8 @@
}
fprintf(stdout, "%f|%f|%i|%d:%d:%d\n",
- stats.min, breakpoints[0], frequencies[0], colors[0].r, colors[0].g,
- colors[0].b);
+ stats.min, breakpoints[0], frequencies[0], colors[0].r,
+ colors[0].g, colors[0].b);
for (i = 1; i < nbreaks; i++) {
fprintf(stdout, "%f|%f|%i|%d:%d:%d\n",
@@ -474,7 +462,7 @@
fprintf(fd, "symbol basic/box %i 5 %i black %d:%d:%d\n", boxsize,
ypos, colors[0].r, colors[0].g, colors[0].b);
fprintf(fd, "move 8 %f \n", ypos - textsize / 2.5);
- fprintf(fd, "text %f - %f | %i\n", min, breakpoints[0],
+ fprintf(fd, "text %f - %f | %i\n", stats.min, breakpoints[0],
frequencies[0]);
for (i = 1; i < nbreaks; i++) {
ypos = 10 + i * 6;
@@ -489,8 +477,8 @@
ypos, colors[nbreaks].r, colors[nbreaks].g,
colors[nbreaks].b);
fprintf(fd, "move 8 %f\n", ypos - textsize / 2.5);
- fprintf(fd, "text %f - %f | %i\n", breakpoints[nbreaks - 1], max,
- frequencies[nbreaks]);
+ fprintf(fd, "text %f - %f | %i\n", breakpoints[nbreaks - 1],
+ stats.max, frequencies[nbreaks]);
fclose(fd);
}
More information about the grass-commit
mailing list