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
6 changes: 5 additions & 1 deletion src/gmt_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,12 +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;
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 */
return (0);
gmt_M_set_delta_lon (GMT->current.proj.central_meridian, last_lon, d0); /* Longitudes relative to the central meridian */
gmt_M_set_delta_lon (GMT->current.proj.central_meridian, 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 */
if (dx < (-map_half_size)) return (1); /* Cross right/east 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
1 change: 0 additions & 1 deletion test/psxy/nojump.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/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
Expand Down
Loading