[GRASS-SVN] r43515 - grass/branches/releasebranch_6_4/general/g.region

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 18 15:41:58 EDT 2010


Author: neteler
Date: 2010-09-18 19:41:57 +0000 (Sat, 18 Sep 2010)
New Revision: 43515

Modified:
   grass/branches/releasebranch_6_4/general/g.region/local_proto.h
   grass/branches/releasebranch_6_4/general/g.region/main.c
   grass/branches/releasebranch_6_4/general/g.region/printwindow.c
Log:
backport: gmt and wms output

Modified: grass/branches/releasebranch_6_4/general/g.region/local_proto.h
===================================================================
--- grass/branches/releasebranch_6_4/general/g.region/local_proto.h	2010-09-18 19:41:19 UTC (rev 43514)
+++ grass/branches/releasebranch_6_4/general/g.region/local_proto.h	2010-09-18 19:41:57 UTC (rev 43515)
@@ -10,6 +10,8 @@
 #define PRINT_3D     0x40
 #define PRINT_MBBOX  0x80
 #define PRINT_NANGLE 0x100
+#define PRINT_GMT    0x200
+#define PRINT_WMS    0x400
 
 /* adjust.c */
 int adjust_window(struct Cell_head *, int, int, int);

Modified: grass/branches/releasebranch_6_4/general/g.region/main.c
===================================================================
--- grass/branches/releasebranch_6_4/general/g.region/main.c	2010-09-18 19:41:19 UTC (rev 43514)
+++ grass/branches/releasebranch_6_4/general/g.region/main.c	2010-09-18 19:41:57 UTC (rev 43515)
@@ -46,14 +46,16 @@
     {
 	struct Flag
 	    *update, *print, *gprint, *lprint, *eprint, *nangle,
-	    *center, *res_set, *dist_res, *dflt, *z, *savedefault, *bbox;
+	    *center, *res_set, *dist_res, *dflt, *z, *savedefault,
+	    *bbox, *gmt_style, *wms_style;
     } flag;
     struct
     {
 	struct Option
 	    *north, *south, *east, *west, *top, *bottom,
 	    *res, *nsres, *ewres, *res3, *tbres, *rows, *cols,
-	    *save, *region, *view, *raster, *raster3d, *align, *zoom, *vect;
+	    *save, *region, *view, *raster, *raster3d, *align,
+	    *zoom, *vect;
     } parm;
 
     G_gisinit(argv[0]);
@@ -103,6 +105,18 @@
 	_("Print the current region map center coordinates");
     flag.center->guisection = _("Print");
 
+    flag.gmt_style = G_define_flag();
+    flag.gmt_style->key = 't';
+    flag.gmt_style->description =
+	_("Print the current region in GMT style");
+    flag.gmt_style->guisection = _("Print");
+
+    flag.wms_style = G_define_flag();
+    flag.wms_style->key = 'w';
+    flag.wms_style->description =
+	_("Print the current region in WMS style");
+    flag.wms_style->guisection = _("Print");
+
     flag.dist_res = G_define_flag();
     flag.dist_res->key = 'm';
     flag.dist_res->description =
@@ -370,6 +384,12 @@
     if (flag.center->answer)
 	print_flag |= PRINT_CENTER;
 
+    if (flag.gmt_style->answer)
+	print_flag |= PRINT_GMT;
+
+    if (flag.wms_style->answer)
+	print_flag |= PRINT_WMS;
+
     if (flag.nangle->answer)
 	print_flag |= PRINT_NANGLE;
 

Modified: grass/branches/releasebranch_6_4/general/g.region/printwindow.c
===================================================================
--- grass/branches/releasebranch_6_4/general/g.region/printwindow.c	2010-09-18 19:41:19 UTC (rev 43514)
+++ grass/branches/releasebranch_6_4/general/g.region/printwindow.c	2010-09-18 19:41:57 UTC (rev 43515)
@@ -468,6 +468,21 @@
 	}
     }
 
+
+    /* flag.gmt_style */
+    if (print_flag & PRINT_GMT)
+	fprintf(stdout, "%s/%s/%s/%s\n", west, east, south, north);
+
+    /* flag.wms_style */
+    if (print_flag & PRINT_WMS) {
+	G_format_northing(window->north, north, -1);
+	G_format_northing(window->south, south, -1);
+	G_format_easting(window->east, east, -1);
+	G_format_easting(window->west, west, -1);
+	fprintf(stdout, "bbox=%s,%s,%s,%s\n", west, south, east, north);
+    }
+
+
     /* flag.nangle */
     if (print_flag & PRINT_NANGLE) {
 	double convergence;



More information about the grass-commit mailing list