Procházet zdrojové kódy

add a flag to print region in a style suitable for WMS

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41834 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman před 15 roky
rodič
revize
4f841d19ed

+ 1 - 0
general/g.region/local_proto.h

@@ -11,6 +11,7 @@
 #define PRINT_MBBOX  0x80
 #define PRINT_NANGLE 0x100
 #define PRINT_GMT    0x200
+#define PRINT_WMS    0x400
 
 /* zoom.c */
 int zoom(struct Cell_head *, const char *, const char *);

+ 10 - 1
general/g.region/main.c

@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
 	struct Flag
 	    *update, *print, *gprint, *lprint, *eprint, *nangle,
 	    *center, *res_set, *dist_res, *dflt, *z, *savedefault,
-	    *bbox, *gmt_style;
+	    *bbox, *gmt_style, *wms_style;
     } flag;
     struct
     {
@@ -103,6 +103,12 @@ int main(int argc, char *argv[])
 	_("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 =
@@ -367,6 +373,9 @@ int main(int argc, char *argv[])
     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;
 

+ 9 - 0
general/g.region/printwindow.c

@@ -473,6 +473,15 @@ void print_window(struct Cell_head *window, int print_flag)
     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) {