Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/gmt_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,11 +1161,16 @@ GMT_LOCAL int gmtmap_jump_x (struct GMT_CTRL *GMT, double x0, double y0, double
dx = x1 - x0;
if (fabs (dx) > map_half_size) { /* Possible jump; let's see how far apart those longitudes really are */
/* This test on longitudes was added to deal with issue #672, also see test/psxy/nojump.sh */
double last_lon = 0.0, this_lon = 0.0, dummy = 0.0, dlon;
double last_lon = 0.0, this_lon = 0.0, dummy = 0.0, dlon, d0, d1, mid_lon;
gmt_xy_to_geo (GMT, &last_lon, &dummy, x0, y0);
gmt_xy_to_geo (GMT, &this_lon, &dummy, x1, y1);
gmt_M_set_delta_lon (last_lon, this_lon, dlon); /* Beware of jumps due to sign differences */
if (fabs (dlon) < half_lon_range) /* Not going the long way so we judge this to be no jump */
if (fabs (dlon) < half_lon_range) /* Gap is less than half the region width so we judge this to be no jump */
return (0);
mid_lon = 0.5 * (GMT->common.R.wesn[XLO] + GMT->common.R.wesn[XHI]);
gmt_M_set_delta_lon (mid_lon, last_lon, d0); /* Longitudes relative to the middle of the region */
gmt_M_set_delta_lon (mid_lon, this_lon, d1);
if (fabs (d1 - d0) < 180.0) /* The straight path is the short way, so no jump */
return (0);
/* Jump it is */
if (dx > map_half_size) return (-1); /* Cross left/west boundary */
Expand Down
3 changes: 2 additions & 1 deletion test/baseline/psxy.dvc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
outs:
- md5: fd04135cb8226c86f8f109e5dca463fe.dir
- md5: 6dbbc75aa2f8752b1450e4f22b7656f2.dir
nfiles: 147
path: psxy
hash: md5
size: 9555170
2 changes: 0 additions & 2 deletions test/psxy/nojump.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
# GMT_KNOWN_FAILURE
# Added after issue #672 which exposed a map jump that should not happen
# Fixed in r14052 but we keep this test in case it resurfaces
# Well, bottom panel plots the wrong closed polygon
ps=nojump.ps
cat << EOF > t.txt
115 -20
Expand Down
Loading