Quellcode durchsuchen

document GRASS_RENDER_COMMAND

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64403 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa vor 10 Jahren
Ursprung
Commit
80401c662e
2 geänderte Dateien mit 61 neuen und 4 gelöschten Zeilen
  1. 51 0
      display/displaydrivers.html
  2. 10 4
      lib/init/variables.html

+ 51 - 0
display/displaydrivers.html

@@ -15,6 +15,57 @@ running <em><a href="d.mon.html">d.mon</a></em> module.
   <li><a href="htmldriver.html">HTMLMAP driver</a>
 </ul>
 
+<h2>NOTES</h2>
+
+<h3>GRASS_RENDER_COMMAND</h3>
+
+If environmental variable GRASS_RENDER_COMMAND is defined,
+rendering is redirected by display library to the given external command
+defined by this variable. Currently only Python scrips are supported.
+
+<p>
+Lets start with simple example of Python script called <i>render.py</i>:
+
+<div class="code"><pre>
+#!/usr/bin/evn python
+
+import os
+import sys
+
+import grass.script as grass
+from grass.script import task as gtask
+
+os.environ['GRASS_RENDER_IMMEDIATE'] = 'default'
+os.environ['GRASS_RENDER_FILE'] = 'output.png'
+
+cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])
+
+grass.run_command('d.text', text="Test of GRASS_RENDER_COMMAND redirection")
+
+os.environ['GRASS_RENDER_FILE_READ'] = 'TRUE'
+grass.run_command(cmd, **dcmd)
+</pre></div>
+
+After defining GRASS_RENDER_COMMAND variable (example for Bash):
+
+<div class="code"><pre>
+export GRASS_RENDER_COMMAND=render.py
+</pre></div>
+
+Display GRASS modules like <em><a href="d.rast.html">d.rast</a></em>
+or <em><a href="d.vect.html">d.vect</a></em> will be executed
+by <i>render.py</i> program.
+
+For example the command
+
+<div class="code"><pre>
+d.vect roadsmajor
+</pre></div>
+
+produces output PNG file <i>output.png</i> which will contain rendered
+features from vector map <i>roadsmajor</i> and sample text <i>&quot;Test of
+GRASS_RENDER_COMMAND redirection&quot;</i>.
+
 <h2>SEE ALSO</h2>
 
 <em>

+ 10 - 4
lib/init/variables.html

@@ -378,15 +378,21 @@ PERMANENT
   <dt>GRASS_RENDER_TEXT_SIZE</dt>
   <dd>defines default text size.</dd>
 
+  <dt>GRASS_RENDER_COMMAND</dt>
+  <dd>external command called by display library to render data (see
+    example in <em><a href="displaydrivers.html">display
+    drivers</a></em> page for details).<br>Currently only Python scripts
+    are supported.</dd>
+
 </dl>
 
 For specific driver-related variables see:
 
 <ul>
-  <li><em><a href="cairodriver.html">Cairo driver</a></em></li>
-  <li><em><a href="pngdriver.html">PNG driver</a></em></li>
-  <li><em><a href="psdriver.html">PS (Postscript) driver</a></em></li>
-  <li><em><a href="htmldriver.html">HTML driver</a></em></li>
+  <li><em><a href="cairodriver.html">Cairo display driver</a></em></li>
+  <li><em><a href="pngdriver.html">PNG display driver</a></em></li>
+  <li><em><a href="psdriver.html">PS (Postscript) display driver</a></em></li>
+  <li><em><a href="htmldriver.html">HTML display driver</a></em></li>
 </ul>
 
 <h3>List of selected internal GRASS environment variables</h3>