[GRASS-SVN] r33783 - grass/trunk/display/d.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 9 04:55:59 EDT 2008
Author: martinl
Date: 2008-10-09 04:55:59 -0400 (Thu, 09 Oct 2008)
New Revision: 33783
Removed:
grass/trunk/display/d.rast/colors.c
Modified:
grass/trunk/display/d.rast/display.c
grass/trunk/display/d.rast/local_proto.h
grass/trunk/display/d.rast/main.c
Log:
d.rast: 'bg' parameter changed to GISPROMPT_COLOR
more gui section ('Query')
Deleted: grass/trunk/display/d.rast/colors.c
===================================================================
--- grass/trunk/display/d.rast/colors.c 2008-10-09 08:41:41 UTC (rev 33782)
+++ grass/trunk/display/d.rast/colors.c 2008-10-09 08:55:59 UTC (rev 33783)
@@ -1,30 +0,0 @@
-#include <string.h>
-#include <grass/gis.h>
-
-char *color_list(void)
-{
- const char *color;
- int n;
- static char list[1024];
-
- *list = 0;
- for (n = 0; color = G_color_name(n); n++) {
- if (n)
- strcat(list, ",");
- strcat(list, color);
- }
- return list;
-}
-
-int get_rgb(const char *color, int *r, int *g, int *b)
-{
- float fr, fg, fb;
-
- G_color_values(color, &fr, &fg, &fb);
-
- *r = (int)(fr * 255);
- *b = (int)(fb * 255);
- *g = (int)(fg * 255);
-
- return 0;
-}
Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c 2008-10-09 08:41:41 UTC (rev 33782)
+++ grass/trunk/display/d.rast/display.c 2008-10-09 08:55:59 UTC (rev 33783)
@@ -19,7 +19,10 @@
G_fatal_error(_("Color file for <%s> not available"), name);
if (bg) {
- get_rgb(bg, &r, &g, &b);
+ if (G_str_to_color(bg, &r, &g, &b) != 1) {
+ G_warning(_("[%s]: No such color"), bg);
+ r = g = b = 255;
+ }
G_set_null_value_color(r, g, b, &colors);
}
Modified: grass/trunk/display/d.rast/local_proto.h
===================================================================
--- grass/trunk/display/d.rast/local_proto.h 2008-10-09 08:41:41 UTC (rev 33782)
+++ grass/trunk/display/d.rast/local_proto.h 2008-10-09 08:55:59 UTC (rev 33783)
@@ -1,7 +1,3 @@
-/* colors.c */
-char *color_list(void);
-int get_rgb(const char *, int *, int *, int *);
-
/* display.c */
int display(const char *, int, char *, RASTER_MAP_TYPE, int);
int mask_raster_array(void *, int, int, RASTER_MAP_TYPE);
Modified: grass/trunk/display/d.rast/main.c
===================================================================
--- grass/trunk/display/d.rast/main.c 2008-10-09 08:41:41 UTC (rev 33782)
+++ grass/trunk/display/d.rast/main.c 2008-10-09 08:55:59 UTC (rev 33783)
@@ -49,17 +49,13 @@
G_gisinit(argv[0]);
module = G_define_module();
- module->keywords = _("display");
+ module->keywords = _("display, raster");
module->description =
_("Displays and overlays raster map layers "
"in the active display frame on the graphics monitor.");
/* set up command line */
- map = G_define_option();
- map->key = "map";
- map->type = TYPE_STRING;
- map->required = YES;
- map->gisprompt = "old,cell,raster";
+ map = G_define_standard_option(G_OPT_R_MAP);
map->description = _("Raster map to be displayed");
catlist = G_define_option();
@@ -69,6 +65,7 @@
catlist->required = NO;
catlist->multiple = YES;
catlist->description = _("List of categories to be displayed (INT maps)");
+ catlist->guisection = _("Query");
vallist = G_define_option();
vallist->key = "vallist";
@@ -77,13 +74,13 @@
vallist->required = NO;
vallist->multiple = YES;
vallist->description = _("List of values to be displayed (FP maps)");
+ vallist->guisection = _("Query");
bg = G_define_option();
bg->key = "bg";
bg->key_desc = "color";
- bg->type = TYPE_STRING;
+ bg->gisprompt = GISPROMPT_COLOR;
bg->required = NO;
- bg->options = color_list();
bg->description = _("Background color (for null)");
flag_n = G_define_flag();
@@ -93,6 +90,7 @@
flag_i = G_define_flag();
flag_i->key = 'i';
flag_i->description = _("Invert catlist");
+ flag_i->guisection = _("Query");
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
More information about the grass-commit
mailing list