[GRASS-SVN] r37836 - grass/branches/develbranch_6/ps/ps.map
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 12 05:38:03 EDT 2009
Author: hamish
Date: 2009-06-12 05:38:03 -0400 (Fri, 12 Jun 2009)
New Revision: 37836
Modified:
grass/branches/develbranch_6/ps/ps.map/description.html
grass/branches/develbranch_6/ps/ps.map/ps_header.c
Log:
take title from raster map (#641), add simple example
Modified: grass/branches/develbranch_6/ps/ps.map/description.html
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/description.html 2009-06-11 21:07:00 UTC (rev 37835)
+++ grass/branches/develbranch_6/ps/ps.map/description.html 2009-06-12 09:38:03 UTC (rev 37836)
@@ -892,7 +892,9 @@
<EM>rgb</EM> option, count as a raster map layer for the
purposes of the preceding paragraph.
<P>
-
+The PostScript file's internal title will be set to the raster map's
+title, which in turn may be set with the <em>r.suppport</em> module.
+<P>
This example would paint a map of the raster map layer <EM>soils</EM>.
<PRE>
@@ -1578,13 +1580,36 @@
-<H2>EXAMPLE ps.map INPUT FILE</H2>
+<H2>EXAMPLES</H2>
-The following is an example of a <EM>ps.map</EM> script file. The file has been
-named <EM>spear.soils</EM>:
+The following are examples of <EM>ps.map</EM> script files.
+<P>
+<h4>Simple example</h4>
+The file has been named <EM>spear.basic</EM>:
+
<PRE>
# this ps.map example draws a map of Spearfish, SD
+<B>raster</B> elevation.dem
+<B>header</B>
+ <B>end</B>
+<B>vlines</B> roads
+ <B>color</B> brown
+ <B>end</B>
+<B>end</B>
+</PRE>
+
+Generate map as Postsript file:
+<PRE>
+ ps.map input=spear.basic output=spear_basic.ps
+</PRE>
+
+
+<h4>More complicated example</h4>
+The file has been named <EM>spear.soils</EM>:
+
+<PRE>
+# this ps.map example draws a map of Spearfish, SD
<B>raster</B> soils
<B>outline</B>
<B>color</B> black
Modified: grass/branches/develbranch_6/ps/ps.map/ps_header.c
===================================================================
--- grass/branches/develbranch_6/ps/ps.map/ps_header.c 2009-06-11 21:07:00 UTC (rev 37835)
+++ grass/branches/develbranch_6/ps/ps.map/ps_header.c 2009-06-12 09:38:03 UTC (rev 37836)
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <unistd.h>
+#include <grass/gis.h>
#include "ps_info.h"
static long bb_offset;
@@ -13,6 +14,12 @@
int write_PS_header(void)
{
+ struct Categories cats;
+ int cats_ok;
+
+ if (PS.do_raster)
+ cats_ok = G_read_cats(PS.cell_name, PS.cell_mapset, &cats) >= 0;
+
/* write PostScript header */
/*fprintf(PS.fp, "%%!PS-Adobe-2.0 EPSF-1.2\n"); */
if (eps_output)
@@ -24,9 +31,10 @@
fprintf(PS.fp, " ");
fprintf(PS.fp, " \n");
fprintf(PS.fp, "%%%%Title: ");
- if (PS.do_raster)
- fprintf(PS.fp, "Map layer = %s ", PS.cell_name);
- fprintf(PS.fp, "Mapset = %s\n", PS.cell_mapset);
+ if (PS.do_raster && cats_ok)
+ fprintf(PS.fp, "%s\n", cats.title);
+ else
+ fprintf(PS.fp, "Mapset = %s\n", PS.cell_mapset);
fprintf(PS.fp, "%%%%EndComments\n");
return 0;
More information about the grass-commit
mailing list