Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 9 additions & 1 deletion src/gmt_plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -5657,6 +5657,13 @@ void gmt_map_text (struct GMT_CTRL *GMT, double x, double y, struct GMT_FONT *fo
PSL_plottext (PSL, x, y, font->size, label, angle, just, form);
}

GMT_LOCAL bool gmtplot_upside_down_3D (struct GMT_CTRL *GMT, double angle) {
/* True if text at this x-y plane angle would read right-to-left (or downward) in the perspective view */
double s, c;
sincosd (angle + GMT->current.proj.z_project.view_azimuth, &s, &c);
return (c > GMT_CONV8_LIMIT || (fabs (c) <= GMT_CONV8_LIMIT && s > 0.0));
}

void gmt_xy_axis (struct GMT_CTRL *GMT, double x0, double y0, double length, double val0, double val1, struct GMT_PLOT_AXIS *A, bool below, unsigned side) {
unsigned int k, i, nx, nx1, np = 0;/* Misc. variables */
unsigned int annot_pos; /* Either 0 for upper annotation or 1 for lower annotation */
Expand Down Expand Up @@ -5765,8 +5772,9 @@ void gmt_xy_axis (struct GMT_CTRL *GMT, double x0, double y0, double length, dou
}
}
flip = (GMT->current.setting.map_frame_type & GMT_IS_INSIDE); /* Inside annotation */
if (axis != GMT_Z && GMT->current.proj.three_D && GMT->current.proj.z_project.cos_az > 0) { /* Rotate x/y-annotations when seen "from North" */
if (axis != GMT_Z && GMT->current.proj.three_D) { /* Rotate x/y-annotations that would appear upside down */
for (pr = GMT_PRIMARY; pr <= GMT_SECONDARY; pr++) {
if (!gmtplot_upside_down_3D (GMT, text_angle[pr])) continue;
if (!flip) justify[pr] = gmt_flip_justify (GMT, justify[pr]);
text_angle[pr] += 180.0;
}
Expand Down
6 changes: 3 additions & 3 deletions test/baseline/psbasemap.dvc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
outs:
- md5: ea7d3e81d00ae837430f398584d9fb7c.dir
nfiles: 59
- md5: d415fbb0fff01cc3673b11ce5585b1ea.dir
nfiles: 60
path: psbasemap
hash: md5
size: 3023798
size: 3059086
5 changes: 1 addition & 4 deletions test/psbasemap/rotalign.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/usr/bin/env bash
# GMT_KNOWN_FAILURE
# The failure pointed out in http://gmt.soest.hawaii.edu/boards/1/topics/7776
# The axes labels and annotations are 180 out of phase.
#
# Check that x/y annotations and labels are not upside down in perspective views
ps=rotalign.ps

gmt set MAP_ANNOT_ORTHO ""
Expand Down
Loading