Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g.region: Fix the flat flag #3216

Merged
merged 8 commits into from
Feb 9, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions general/g.region/printwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
double ew_dist1, ew_dist2, ns_dist1, ns_dist2;
double longitude, latitude;

if (print_flag & PRINT_SH)
if (print_flag & PRINT_SH) {
x = G_projection() == PROJECTION_LL ? -1 : 0;
if (flat_flag)
sep = " ";
}
else
x = window->proj;

Expand Down Expand Up @@ -97,8 +100,8 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
prj = "** unknown **";

if (print_flag & PRINT_SH) {
fprintf(stdout, "projection=%d\n", window->proj);
fprintf(stdout, "zone=%d\n", window->zone);
fprintf(stdout, "projection=%d%s", window->proj, sep);
fprintf(stdout, "zone=%d%s", window->zone, sep);
}
else {
fprintf(stdout, "%-*s %d (%s)\n", width,
Expand All @@ -122,13 +125,13 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
if (print_flag & PRINT_SH)
{
if (datum[0] != '*')
fprintf(stdout, "datum=%s\n", datum);
fprintf(stdout, "datum=%s%s", datum, sep);
else
fprintf(stdout, "datum=wgs84\n");
fprintf(stdout, "datum=wgs84%s", sep);
if (ellps[0] != '*')
fprintf(stdout, "ellipsoid=%s\n", ellps);
fprintf(stdout, "ellipsoid=%s%s", ellps, sep);
else
fprintf(stdout, "ellipsoid=wgs84\n");
fprintf(stdout, "ellipsoid=wgs84%s", sep);
}
else
{
Expand All @@ -144,8 +147,6 @@ void print_window(struct Cell_head *window, int print_flag, int flat_flag)
}

if (print_flag & PRINT_SH) {
if (flat_flag)
sep = " ";
fprintf(stdout, "n=%s%s", north, sep);
fprintf(stdout, "s=%s%s", south, sep);
fprintf(stdout, "w=%s%s", west, sep);
Expand Down
Loading