[GRASS-SVN] r46381 - grass/trunk/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 23 06:13:13 EDT 2011


Author: hamish
Date: 2011-05-23 03:13:13 -0700 (Mon, 23 May 2011)
New Revision: 46381

Modified:
   grass/trunk/ps/ps.map/box.c
   grass/trunk/ps/ps.map/do_scalebar.c
   grass/trunk/ps/ps.map/main.c
   grass/trunk/ps/ps.map/map_setup.c
   grass/trunk/ps/ps.map/ps.map.html
Log:
merge -b flag fixes from relbr4:
 - explicitly zero the output file pointer (if only for clarity's sake);
 - don't try to remove an output file we never created;
 - jump out of map_setup() before trying to write anything.

minor cosmetics to code comment and man page.


Modified: grass/trunk/ps/ps.map/box.c
===================================================================
--- grass/trunk/ps/ps.map/box.c	2011-05-23 10:09:40 UTC (rev 46380)
+++ grass/trunk/ps/ps.map/box.c	2011-05-23 10:13:13 UTC (rev 46381)
@@ -7,8 +7,7 @@
 
 int box_path(double t, double b, double l, double r)
 {
-    if (PS.fp)
-	fprintf(PS.fp, "%.1f %.1f %.1f %.1f B ", l, b, r, t);
+    fprintf(PS.fp, "%.1f %.1f %.1f %.1f B ", l, b, r, t);
 
     return 0;
 }
@@ -16,8 +15,7 @@
 int box_clip(double t, double b, double l, double r)
 {
     box_path(t, b, l, r);
-    if (PS.fp)
-	fprintf(PS.fp, "clip newpath\n");
+    fprintf(PS.fp, "clip newpath\n");
     
     return 0;
 }

Modified: grass/trunk/ps/ps.map/do_scalebar.c
===================================================================
--- grass/trunk/ps/ps.map/do_scalebar.c	2011-05-23 10:09:40 UTC (rev 46380)
+++ grass/trunk/ps/ps.map/do_scalebar.c	2011-05-23 10:13:13 UTC (rev 46381)
@@ -1,6 +1,4 @@
-/* Function to draw scalebar on page 
- * **
- */
+/* Function to draw scalebar on page */
 
 #include <string.h>
 #include <math.h>

Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c	2011-05-23 10:09:40 UTC (rev 46380)
+++ grass/trunk/ps/ps.map/main.c	2011-05-23 10:13:13 UTC (rev 46381)
@@ -235,7 +235,9 @@
 			  output_file->key, output_file->description);
 	}
     }
-    
+    else
+	PS.fp = NULL;
+
     /* get current mapset */
     PS.cell_mapset = G_mapset();
 
@@ -255,7 +257,6 @@
 		PS.page_height - (PS.map_bot / 72.0), PS.map_right / 72.0,
 		PS.page_height - (PS.map_top / 72.0));
 		/* +/- 0.5 ? see ps.map.c brd.* */
-	unlink(output_file->answer); /* fixme: don't open it in the first place */
 	exit(EXIT_SUCCESS);
     }
 

Modified: grass/trunk/ps/ps.map/map_setup.c
===================================================================
--- grass/trunk/ps/ps.map/map_setup.c	2011-05-23 10:09:40 UTC (rev 46380)
+++ grass/trunk/ps/ps.map/map_setup.c	2011-05-23 10:13:13 UTC (rev 46381)
@@ -103,9 +103,13 @@
        PS.map_bot, PS.map_left, PS.map_right);
      */
 
+    /* no need to go on if we're just here for a look-see. (-b flag) */
+    if (!PS.fp)
+	return 0;
+
+
     /* save original graphics state */
-    if (PS.fp)
-	fprintf(PS.fp, "gsave ");
+    fprintf(PS.fp, "gsave ");
     
     /* compute conversion factor from meters to PostScript window coordinates */
     /*

Modified: grass/trunk/ps/ps.map/ps.map.html
===================================================================
--- grass/trunk/ps/ps.map/ps.map.html	2011-05-23 10:09:40 UTC (rev 46380)
+++ grass/trunk/ps/ps.map/ps.map.html	2011-05-23 10:13:13 UTC (rev 46381)
@@ -1229,7 +1229,7 @@
 part of the text should be placed on the location specified by the map
 coordinates.  Reference points can refer to:
 [lower|upper|center] [left|right|center] of the text to be printed;
-The default is center center, i.e the text is centered on the reference point.
+The default is center center, i.e. the text is centered on the reference point.
 <P>
 <B>rotate</B>
 sets the text rotation angle, measured in degrees counter-clockwise.



More information about the grass-commit mailing list