[GRASS-CVS] markus: grass6/scripts/d.out.file d.out.file, 1.13, 1.13.2.1 description.html, 1.5, 1.5.2.1

grass at intevation.de grass at intevation.de
Thu Nov 29 08:24:59 EST 2007


Author: markus

Update of /grassrepository/grass6/scripts/d.out.file
In directory doto:/tmp/cvs-serv18618

Modified Files:
      Tag: releasebranch_6_3
	d.out.file description.html 
Log Message:
sync'ed to HEAD for cairo

Index: d.out.file
===================================================================
RCS file: /grassrepository/grass6/scripts/d.out.file/d.out.file,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- d.out.file	16 May 2007 04:24:06 -0000	1.13
+++ d.out.file	29 Nov 2007 13:24:57 -0000	1.13.2.1
@@ -29,7 +29,7 @@
 #%option
 #% key: format
 #% type: string
-#% options: png,ppm,tif,jpg,bmp,ps,eps
+#% options: png,ppm,tif,jpg,bmp,ps,eps,svg,pdf
 #% answer: png
 #% description: Graphics file format
 #% required : yes
@@ -99,19 +99,24 @@
 #% description: PostScript level (only limits functionality!)
 #% guisection: PostScript
 #% required : no
-#%end
+#% end
 #%flag
-#%key: b
-#%description: Set background color to black (white default)
-#%end
+#% key: b
+#% description: Set background color to black (white default)
+#% end
 #%flag
-#%key: t
-#%description: Set transparent background
+#% key: t
+#% description: Set transparent background
 #% guisection: Images
-#%end
+#% end
 #%flag
-#%key: r
-#%description: Set paper orientation to landscape (for PostScript output)
+#% key: c
+#% description: Use the Cario driver to render images
+#% guisection: Images
+#% end
+#%flag
+#% key: r
+#% description: Set paper orientation to landscape (for PostScript output)
 #% guisection: PostScript
 #%end
 
@@ -151,6 +156,20 @@
    exit 1
 fi
 
+case "$GIS_OPT_FORMAT" in
+   pdf | svg)
+     if [ $GIS_FLAG_C -eq 0 ] ; then
+	g.message "Using the Cairo driver."
+	GIS_FLAG_C=1
+     fi
+     ;;
+esac
+
+if [ $GIS_FLAG_C -eq 1 ] &&  [ `d.mon -l | grep -c '^cairo'` -eq 0 ] ; then
+   g.message -e "Cairo driver not present in this build of GRASS."
+   exit 1
+fi
+
 
 #### set variables
 res="$GIS_OPT_RESOLUTION"
@@ -195,12 +214,19 @@
 
 #set output file name and format
 case "$GIS_OPT_FORMAT" in
-   png | ppm | ps | eps)
+   png | ppm | ps | eps | svg | pdf)
      output="${GIS_OPT_OUTPUT}.${GIS_OPT_FORMAT}"
      ;;
-   tif | jpg | bmp)
+   tif | jpg)
      output="`g.tempfile pid=$$`.ppm"
      ;;
+   bmp)
+     if [ $GIS_FLAG_C -eq 1 ] ; then
+	output="${GIS_OPT_OUTPUT}.${GIS_OPT_FORMAT}"
+     else
+	output="`g.tempfile pid=$$`.ppm"
+     fi
+     ;;
 esac
 
 outname="${GIS_OPT_OUTPUT}.${GIS_OPT_FORMAT}"
@@ -215,9 +241,25 @@
 
 
 if [ "$GIS_OPT_FORMAT" = "ps" ] || [ "$GIS_OPT_FORMAT" = "eps" ] ; then
-    GRAPHICS_DRIVER=PS
-    GRASS_PSFILE="$output"
-    export GRASS_PSFILE
+    if [ $GIS_FLAG_C -eq 1 ] ; then
+	if [ $GIS_FLAG_R -eq 1 ] ; then
+	   g.message -w "Cairo driver doesn't know how to do landscape mode"
+	fi
+	if [ "$GIS_OPT_FORMAT" = "eps" ] ; then
+	   g.message -e "Cairo driver doesn't support EPS"
+	   exit 1
+	fi
+    fi
+
+    if [ $GIS_FLAG_C -eq 0 ] ; then
+	GRAPHICS_DRIVER=PS
+	GRASS_PSFILE="$output"
+	export GRASS_PSFILE
+    else
+	GRAPHICS_DRIVER=cairo
+	GRASS_CAIROFILE="$output"
+	export GRASS_CAIROFILE
+    fi
 
     if [ "$GIS_OPT_FORMAT" = "ps" ] ; then
 	GRASS_PAPER="$GIS_OPT_PAPER"
@@ -244,9 +286,15 @@
     fi
 
 else
-    GRAPHICS_DRIVER=PNG
-    GRASS_PNGFILE="$output"
-    export GRASS_PNGFILE
+    if [ $GIS_FLAG_C -eq 0 ] ; then
+	GRAPHICS_DRIVER=PNG
+	GRASS_PNGFILE="$output"
+	export GRASS_PNGFILE
+    else
+	GRAPHICS_DRIVER=cairo
+	GRASS_CAIROFILE="$output"
+	export GRASS_CAIROFILE
+    fi
 
     #make sure that output is 24 bit color
     GRASS_TRUECOLOR=TRUE
@@ -258,6 +306,7 @@
 
 
 g.message "Saving display from Monitor: [$curr_mon] to <$outname>."
+# what does the Cairo/PS driver do?
 if [ "$GIS_OPT_FORMAT" != "ps" ] ; then
     g.message "Image size [$out_width x $out_height]"
 else
@@ -278,15 +327,25 @@
 d.mon select="$curr_mon"
 
 case "$GIS_OPT_FORMAT" in
-   png | ppm | ps | eps)
+   png | ppm | ps | eps | svg | pdf)
      g.message "Done."
      exit
      ;;
-   tif | jpg | bmp)
+   tif | jpg)
      # delay not needed if using GRASS_PNG_AUTO_WRITE ?
      g.message "Waiting for file to write ..."
      sleep 5
      ;;
+   bmp)
+     if [ $GIS_FLAG_C -eq 1 ] ; then
+	g.message "Done."
+	exit
+     else
+	# delay not needed if using GRASS_PNG_AUTO_WRITE ?
+	g.message "Waiting for file to write ..."
+	sleep 5
+     fi
+     ;;
 esac
 
 
@@ -310,6 +369,6 @@
 
 \rm "$output"
 
-g.message "Done." 
+g.message "Done."
 
 exit $EXITCODE

Index: description.html
===================================================================
RCS file: /grassrepository/grass6/scripts/d.out.file/description.html,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- description.html	16 May 2007 05:32:53 -0000	1.5
+++ description.html	29 Nov 2007 13:24:57 -0000	1.5.2.1
@@ -73,10 +73,11 @@
 <A HREF="d.out.png.html">d.out.png</A>,
 <A HREF="d.save.html">d.save</A>,
 <A HREF="ps.map.html">ps.map</A></EM><BR>
-<A HREF="pngdriver.html">GRASS PNG driver</A>,
-<A HREF="psdriver.html">GRASS PostScript driver</A>,
-<A HREF="htmlmapdriver.html">GRASS HTML-map driver</A>,
-<A HREF="xdriver.html">GRASS X driver</A><BR>
+<A HREF="cairodriver.html">Cairo driver</A>,
+<A HREF="pngdriver.html">PNG driver</A>,
+<A HREF="psdriver.html">PostScript driver</A>,
+<A HREF="htmlmapdriver.html">HTML-map driver</A>,
+<A HREF="xdriver.html">X driver</A><BR>
 <A HREF="http://www.gdal.org">GDAL Homepage</a>
 
 




More information about the grass-commit mailing list