[GRASS-SVN] r46376 - grass/branches/releasebranch_6_4/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 23 03:22:55 EDT 2011


Author: hamish
Date: 2011-05-23 00:22:55 -0700 (Mon, 23 May 2011)
New Revision: 46376

Modified:
   grass/branches/releasebranch_6_4/ps/ps.map/main.c
Log:
backport -b flag from trunk (see #153)

Modified: grass/branches/releasebranch_6_4/ps/ps.map/main.c
===================================================================
--- grass/branches/releasebranch_6_4/ps/ps.map/main.c	2011-05-22 15:20:03 UTC (rev 46375)
+++ grass/branches/releasebranch_6_4/ps/ps.map/main.c	2011-05-23 07:22:55 UTC (rev 46376)
@@ -10,7 +10,7 @@
  *               Markus Neteler <neteler itc.it>,
  *               Alessandro Frigeri <afrigeri unipg.it>
  * PURPOSE:      This is an enhanced PostScript version of the p.map program
- * COPYRIGHT:    (C) 2003-2008 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2003-2011 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -82,7 +82,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";
 
@@ -114,6 +114,11 @@
     eflag->description =
 	_("Create EPS (Encapsulated PostScript) instead of PostScript file");
 
+    bflag = G_define_flag();
+    bflag->key = 'b';
+    bflag->description =
+	_("Describe 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;
@@ -148,7 +153,7 @@
     if (G_parser(argc, argv))
 	usage(0);
 
-    /* Print papers */
+    /* Print paper sizes to stdout */
     if (pflag->answer) {
 	print_papers();
 	exit(EXIT_SUCCESS);
@@ -265,6 +270,7 @@
 	usage(1);
     }
 
+
     /* get current mapset */
     PS.cell_mapset = G_mapset();
 
@@ -718,6 +724,16 @@
     /* reset map location base on 'paper' on 'location' */
     reset_map_location();
 
+    if (bflag->answer) {
+	map_setup();
+	fprintf(stdout, "bbox=%.3f,%.3f,%.3f,%.3f\n", PS.map_left / 72.0,
+		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);
+    }
+
     /* write the PostScript output file */
     ps_mask_file = G_tempfile();
     ps_map();



More information about the grass-commit mailing list