87
101
/* The color option specifies the color for the labels, tic-marks,
88
102
* and borders of the chart. */
89
opt2 = G_define_standard_option(G_OPT_C_FG);
103
opt2 = G_define_standard_option(G_OPT_C);
90
104
opt2->label = _("Color for text and axes");
92
bg_opt = G_define_standard_option(G_OPT_C_BG);
106
bg_opt = G_define_standard_option(G_OPT_CN);
107
bg_opt->key = "bgcolor";
108
bg_opt->label = _("Background color");
109
bg_opt->answer = DEFAULT_BG_COLOR;
94
111
#ifdef CAN_DO_AREAS
95
112
opt3 = G_define_option();
154
166
G_warning(_("When -C flag is set, the nsteps argument is ignored"));
156
168
nodata = flag1->answer;
157
quiet = flag2->answer ? YES : NO;
159
/* Make sure map is available */
160
mapset = G_find_cell2(map_name, "");
162
G_fatal_error(_("Raster map <%s> not found"), map_name);
164
if (G_read_colors(map_name, mapset, &pcolors) == -1)
170
if (Rast_read_colors(map_name, "", &pcolors) == -1)
165
171
G_fatal_error(_("Color file for <%s> not available"), map_name);
167
if (G_read_cats(map_name, mapset, &cats) == -1)
173
if (Rast_read_cats(map_name, "", &cats) == -1)
168
174
G_fatal_error(_("Category file for <%s> not available"), map_name);
170
if (G_read_range(map_name, mapset, &range) == -1)
176
if (Rast_read_range(map_name, "", &range) == -1)
171
177
G_fatal_error(_("Range information for <%s> not available"),
174
180
/* get the distribution statistics */
176
get_stats(map_name, mapset, &dist_stats, quiet);
182
get_stats(map_name, &dist_stats);
178
184
/* set up the graphics driver and initialize its color-table */
180
if (R_open_driver() != 0)
181
G_fatal_error(_("No graphics device selected"));
183
D_setup(0); /* 0 = don't clear frame */
184
D_get_screen_window(&t, &b, &l, &r);
188
D_setup_unity(0); /* 0 = don't clear frame */
189
D_get_src(&t, &b, &l, &r);
186
191
/* clear the frame, if requested to do so */
187
if (strcmp(bg_opt->answer, "none")) {
188
/* D_clear_window(); *//* clears d.save history: but also any font setting! */
189
D_raster_use_color(bgcolor);
190
R_box_abs(l, t, r, b);
192
if (strcmp(bg_opt->answer, "none") != 0)
193
D_erase(bg_opt->answer);
193
195
/* draw a title for */
194
sprintf(title, "%s in mapset %s", map_name, mapset);
196
sprintf(title, "%s", map_name);
195
197
text_height = (b - t) * 0.05;
196
198
text_width = (r - l) * 0.05 * 0.50;
197
R_text_size(text_width, text_height);
198
R_get_text_box(title, &tt, &tb, &tl, &tr);
199
R_move_abs((int)(l + (r - l) / 2 - (tr - tl) / 2),
200
(int)(t + (b - t) * 0.07));
201
D_raster_use_color(color);
199
D_text_size(text_width, text_height);
200
D_get_text_box(title, &tt, &tb, &tl, &tr);
201
D_pos_abs(l + (r - l) / 2 - (tr - tl) / 2,
204
206
/* plot the distributrion statistics */
205
207
if (style == PIE)