[GRASS-SVN] r33781 - grass/branches/develbranch_6/display/d.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 9 04:35:21 EDT 2008


Author: martinl
Date: 2008-10-09 04:35:21 -0400 (Thu, 09 Oct 2008)
New Revision: 33781

Removed:
   grass/branches/develbranch_6/display/d.rast/colors.c
Modified:
   grass/branches/develbranch_6/display/d.rast/display.c
   grass/branches/develbranch_6/display/d.rast/local_proto.h
   grass/branches/develbranch_6/display/d.rast/main.c
Log:
d.rast: 'bg' parameter changed to GISPROMPT_COLOR


Deleted: grass/branches/develbranch_6/display/d.rast/colors.c
===================================================================
--- grass/branches/develbranch_6/display/d.rast/colors.c	2008-10-09 08:03:46 UTC (rev 33780)
+++ grass/branches/develbranch_6/display/d.rast/colors.c	2008-10-09 08:35:21 UTC (rev 33781)
@@ -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(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/branches/develbranch_6/display/d.rast/display.c
===================================================================
--- grass/branches/develbranch_6/display/d.rast/display.c	2008-10-09 08:03:46 UTC (rev 33780)
+++ grass/branches/develbranch_6/display/d.rast/display.c	2008-10-09 08:35:21 UTC (rev 33781)
@@ -28,7 +28,10 @@
     *********/
 
     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/branches/develbranch_6/display/d.rast/local_proto.h
===================================================================
--- grass/branches/develbranch_6/display/d.rast/local_proto.h	2008-10-09 08:03:46 UTC (rev 33780)
+++ grass/branches/develbranch_6/display/d.rast/local_proto.h	2008-10-09 08:35:21 UTC (rev 33781)
@@ -1,7 +1,3 @@
-/* colors.c */
-char *color_list(void);
-int get_rgb(char *, int *, int *, int *);
-
 /* display.c */
 int display(char *, char *, int, char *, RASTER_MAP_TYPE, int, int);
 int mask_raster_array(void *, int, int, RASTER_MAP_TYPE);

Modified: grass/branches/develbranch_6/display/d.rast/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.rast/main.c	2008-10-09 08:03:46 UTC (rev 33780)
+++ grass/branches/develbranch_6/display/d.rast/main.c	2008-10-09 08:35:21 UTC (rev 33781)
@@ -48,17 +48,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();
@@ -80,9 +76,8 @@
     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_o = G_define_flag();



More information about the grass-commit mailing list