[GRASS-SVN] r55733 - in grass/branches/releasebranch_6_4: display/d.profile sites/s.out.ascii
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 13 03:24:33 PDT 2013
Author: hamish
Date: 2013-04-13 03:24:33 -0700 (Sat, 13 Apr 2013)
New Revision: 55733
Modified:
grass/branches/releasebranch_6_4/display/d.profile/DumpProfile.c
grass/branches/releasebranch_6_4/display/d.profile/PlotProfile.c
grass/branches/releasebranch_6_4/display/d.profile/What.c
grass/branches/releasebranch_6_4/sites/s.out.ascii/main.c
Log:
output correct precision for different projection types (bugs #654 and #335) merge from devbr6 r37979 r37980 r37982
Modified: grass/branches/releasebranch_6_4/display/d.profile/DumpProfile.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.profile/DumpProfile.c 2013-04-13 10:16:02 UTC (rev 55732)
+++ grass/branches/releasebranch_6_4/display/d.profile/DumpProfile.c 2013-04-13 10:24:33 UTC (rev 55733)
@@ -17,6 +17,7 @@
char *buf2 = G_calloc(UCAT_STR_SIZE, sizeof(char));
char *outfile = G_calloc(strlen(fname) + 3, sizeof(char));
char coords[4][80];
+ char outfmt[24];
FILE *outFile;
struct ProfileNode *ptr;
@@ -55,10 +56,15 @@
_fmt_ucat(&profile->MaxCat, &profile->MinCat, buf2));
fprintf(outFile, "# dist value east north\n");
+
+ if (G_projection() == PROJECTION_LL)
+ strcpy(outfmt, "%f %s %.8f %.8f\n");
+ else
+ strcpy(outfmt, "%f %s %.3f %.3f\n");
+
/* Now loop through the nodes, one value per line */
for (ptr = profile->ptr; ptr != NULL; ptr = ptr->next) {
- fprintf(outFile, "%f %s %f %f\n",
- ptr->dist,
+ fprintf(outFile, outfmt, ptr->dist,
_fmt_ucat(&ptr->cat, &profile->MinCat, buf),
ptr->east, ptr->north);
}
Modified: grass/branches/releasebranch_6_4/display/d.profile/PlotProfile.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.profile/PlotProfile.c 2013-04-13 10:16:02 UTC (rev 55732)
+++ grass/branches/releasebranch_6_4/display/d.profile/PlotProfile.c 2013-04-13 10:24:33 UTC (rev 55733)
@@ -98,8 +98,14 @@
text_height = TEXT_HEIGHT * (b - t);
text_width = text_height * 0.8;
R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
- sprintf(txt_buf, "%s: From (%10.2f,%10.2f) to (%10.2f,%10.2f)",
+
+ if (G_projection() == PROJECTION_LL)
+ sprintf(txt_buf, "%s: From (%10.6f,%10.6f) to (%10.6f,%10.6f)",
letter, profile.e1, profile.n1, profile.e2, profile.n2);
+ else
+ sprintf(txt_buf, "%s: From (%10.2f,%10.2f) to (%10.2f,%10.2f)",
+ letter, profile.e1, profile.n1, profile.e2, profile.n2);
+
done = 0;
do {
R_get_text_box(txt_buf, &tt, &tb, &tl, &tr);
Modified: grass/branches/releasebranch_6_4/display/d.profile/What.c
===================================================================
--- grass/branches/releasebranch_6_4/display/d.profile/What.c 2013-04-13 10:16:02 UTC (rev 55732)
+++ grass/branches/releasebranch_6_4/display/d.profile/What.c 2013-04-13 10:24:33 UTC (rev 55733)
@@ -35,10 +35,19 @@
sprintf(txt_buf, "%s in mapset %s", name, mapset);
DrawText(22, 1, 1, txt_buf);
R_standard_color(D_translate_color(DEFAULT_FG_COLOR));
- sprintf(txt_buf, "EAST: %10.2f", east);
+
+ if (G_projection() == PROJECTION_LL)
+ sprintf(txt_buf, "EAST: %10.6f", east);
+ else
+ sprintf(txt_buf, "EAST: %10.2f", east);
DrawText(22, 2, 1, txt_buf);
- sprintf(txt_buf, "NORTH: %10.2f", north);
+
+ if (G_projection() == PROJECTION_LL)
+ sprintf(txt_buf, "NORTH: %10.6f", north);
+ else
+ sprintf(txt_buf, "NORTH: %10.2f", north);
DrawText(22, 3, 1, txt_buf);
+
if (NoCatStrings)
sprintf(txt_buf, "(%d)", buf[col]);
else
Modified: grass/branches/releasebranch_6_4/sites/s.out.ascii/main.c
===================================================================
--- grass/branches/releasebranch_6_4/sites/s.out.ascii/main.c 2013-04-13 10:16:02 UTC (rev 55732)
+++ grass/branches/releasebranch_6_4/sites/s.out.ascii/main.c 2013-04-13 10:24:33 UTC (rev 55733)
@@ -115,9 +115,12 @@
while (G_site_get(fd, site) == 0) {
if (all || G_site_in_region(site, &window)) {
if (!full) {
- G_format_easting(site->east, ebuf, -1);
- G_format_northing(site->north, nbuf, -1);
+ G_format_easting(site->east, ebuf,
+ G_projection() == PROJECTION_LL ? -1 : 0);
+ G_format_northing(site->north, nbuf,
+ G_projection() == PROJECTION_LL ? -1 : 0);
fprintf(stdout, "%s%s%s", ebuf, fs, nbuf);
+
for (n = 0; n < site->dim_alloc; ++n) {
sprintf(nbuf, "%.8f", site->dim[n]);
G_trim_decimal(nbuf);
More information about the grass-commit
mailing list