[GRASS-SVN] r44137 - in grass/branches/develbranch_6:
gui/wxpython/xml raster raster/r.colors.out
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 1 03:52:05 EDT 2010
Author: martinl
Date: 2010-11-01 00:52:05 -0700 (Mon, 01 Nov 2010)
New Revision: 44137
Added:
grass/branches/develbranch_6/raster/r.colors.out/
grass/branches/develbranch_6/raster/r.colors.out/description.html
Removed:
grass/branches/develbranch_6/raster/r.colors.out/r.colors.out.html
Modified:
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
grass/branches/develbranch_6/raster/r.colors.out/main.c
Log:
r.colors.out: backported from trunk
Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-11-01 07:41:16 UTC (rev 44136)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-11-01 07:52:05 UTC (rev 44137)
@@ -959,6 +959,13 @@
<handler>RulesCmd</handler>
<command>r.colors</command>
</menuitem>
+ <menuitem>
+ <label>Export color table</label>
+ <help>Exports the color table associated with a raster map layer.</help>
+ <keywords>raster,color table</keywords>
+ <handler>OnMenuCmd</handler>
+ <command>r.colors.out</command>
+ </menuitem>
<separator />
<menuitem>
<label>Blend 2 color rasters</label>
Copied: grass/branches/develbranch_6/raster/r.colors.out/description.html (from rev 44136, grass/trunk/raster/r.colors.out/r.colors.out.html)
===================================================================
--- grass/branches/develbranch_6/raster/r.colors.out/description.html (rev 0)
+++ grass/branches/develbranch_6/raster/r.colors.out/description.html 2010-11-01 07:52:05 UTC (rev 44137)
@@ -0,0 +1,24 @@
+<h2>DESCRIPTION</h2>
+
+<em>r.colors.out</em> allows the user to export the color table for a
+raster map to a file which is suitable as input
+to <em><a href="r.colors.html">r.colors</a></em>.
+
+<h2>EXAMPLES</h2>
+
+<div class="code"><pre>
+r.colors.out map=el_D782_6m rules=rules.txt
+r.colors map=el_D783_6m rules=rules.txt
+</pre></div>
+
+<h2>SEE ALSO</h2>
+
+<em>
+ <a href="r.colors.html">r.colors</a>
+</em>
+
+<h2>AUTHOR</h2>
+Glynn Clements
+
+<p>
+<i>Last changed: $Date$</i>
Modified: grass/branches/develbranch_6/raster/r.colors.out/main.c
===================================================================
--- grass/trunk/raster/r.colors.out/main.c 2010-11-01 07:41:16 UTC (rev 44136)
+++ grass/branches/develbranch_6/raster/r.colors.out/main.c 2010-11-01 07:52:05 UTC (rev 44137)
@@ -51,7 +51,7 @@
{
struct Flag *p;
} flag;
- const char *name, *file;
+ const char *name, *file, *mapset;
struct Colors colors;
struct FPRange range;
int count;
@@ -60,9 +60,7 @@
G_gisinit(argv[0]);
module = G_define_module();
- G_add_keyword(_("raster"));
- G_add_keyword(_("export"));
- G_add_keyword(_("color table"));
+ module->keywords = _("raster, export, color table");
module->description =
_("Exports the color table associated with a raster map layer.");
@@ -84,11 +82,15 @@
file = opt.file->answer;
perc = flag.p->answer ? 1 : 0;
- if (Rast_read_colors(name, "", &colors) < 0)
+ mapset = G_find_cell2(name, "");
+ if (mapset == NULL)
+ G_fatal_error(_("Raster map <%s> not found"), name);
+
+ if (G_read_colors(name, "", &colors) < 0)
G_fatal_error(_("Unable to read color table for raster map <%s>"));
- Rast_read_fp_range(name, "", &range);
- Rast_get_fp_range_min_max(&range, &min, &max);
+ G_read_fp_range(name, "", &range);
+ G_get_fp_range_min_max(&range, &min, &max);
if (!file || strcmp(file, "-") == 0)
fp = stdout;
@@ -102,26 +104,25 @@
/* 3.0 format */
CELL lo, hi;
- Rast_get_c_color_range(&lo, &hi, &colors);
+ G_get_color_range(&lo, &hi, &colors);
for (i = lo; i <= hi; i++) {
unsigned char r, g, b, set;
DCELL val = (DCELL) i;
- Rast_lookup_c_colors(&i, &r, &g, &b, &set, 1, &colors);
+ G_lookup_colors(&i, &r, &g, &b, &set, 1, &colors);
write_rule(&val, r, g, b);
}
}
else {
- count = Rast_colors_count(&colors);
+ count = G_colors_count(&colors);
for (i = 0; i < count; i++) {
DCELL val1, val2;
unsigned char r1, g1, b1, r2, g2, b2;
- Rast_get_fp_color_rule(
- &val1, &r1, &g1, &b1,
- &val2, &r2, &g2, &b2,
- &colors, count - 1 - i);
+ G_get_f_color_rule(&val1, &r1, &g1, &b1,
+ &val2, &r2, &g2, &b2,
+ &colors, count - 1 - i);
write_rule(&val1, r1, g1, b1);
write_rule(&val2, r2, g2, b2);
@@ -130,9 +131,9 @@
{
int r, g, b;
- Rast_get_null_value_color(&r, &g, &b, &colors);
+ G_get_null_value_color(&r, &g, &b, &colors);
fprintf(fp, "nv %d:%d:%d\n", r, g, b);
- Rast_get_default_color(&r, &g, &b, &colors);
+ G_get_default_color(&r, &g, &b, &colors);
fprintf(fp, "default %d:%d:%d\n", r, g, b);
}
Deleted: grass/branches/develbranch_6/raster/r.colors.out/r.colors.out.html
===================================================================
--- grass/trunk/raster/r.colors.out/r.colors.out.html 2010-11-01 07:41:16 UTC (rev 44136)
+++ grass/branches/develbranch_6/raster/r.colors.out/r.colors.out.html 2010-11-01 07:52:05 UTC (rev 44137)
@@ -1,24 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.colors.out</em> allows the user to export the color table for a
-raster map to a file which is suitable as input
-to <em><a href="r.colors.html">r.colors</a></em>.
-
-<h2>EXAMPLES</h2>
-
-<div class="code"><pre>
-r.colors.out map=el_D782_6m rules=rules.txt
-r.colors map=el_D783_6m rules=rules.txt
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<em>
- <a href="r.colors.html">r.colors</a>
-</em>
-
-<h2>AUTHOR</h2>
-Glynn Clements
-
-<p>
-<i>Last changed: $Date$</i>
More information about the grass-commit
mailing list