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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 4 03:48:43 EST 2011


Author: hamish
Date: 2011-02-04 00:48:43 -0800 (Fri, 04 Feb 2011)
New Revision: 45306

Modified:
   grass/trunk/ps/ps.map/main.c
Log:
add -b flag to print map box bounds (#153)

Modified: grass/trunk/ps/ps.map/main.c
===================================================================
--- grass/trunk/ps/ps.map/main.c	2011-02-04 08:38:55 UTC (rev 45305)
+++ grass/trunk/ps/ps.map/main.c	2011-02-04 08:48:43 UTC (rev 45306)
@@ -98,7 +98,7 @@
     struct Option *input_file;
     struct Option *output_file;
     struct Option *copies;
-    struct Flag *rflag, *pflag, *eflag;
+    struct Flag *rflag, *pflag, *eflag, *bflag;
     struct GModule *module;
     static char *def_font = "Helvetica";
 
@@ -132,6 +132,11 @@
     eflag->description =
 	_("Create EPS (Encapsulated PostScript) instead of PostScript file");
 
+    eflag = G_define_flag();
+    eflag->key = 'b';
+    eflag->description =
+	_("Print map-box's position on the page and exit (inches from top-left of paper)");
+
     input_file = G_define_option();
     input_file->key = "input";
     input_file->type = TYPE_STRING;
@@ -716,6 +721,12 @@
     /* reset map location base on 'paper' on 'location' */
     reset_map_location();
 
+    if (bflag->answer) {
+	fprintf(stdout, "bbox=%.3f,%.3f,%.3f,%.3f\n", PS.map_left,
+		PS.map_top, PS.map_right, PS.map_bot); /* +/- 0.5 ? see ps.map.c brd.* */
+	exit(EXIT_SUCCESS);
+    }
+
     /* write the PostScript output file */
     ps_mask_file = G_tempfile();
     ps_map();



More information about the grass-commit mailing list