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

pssac: first fill then outline #240

Merged
merged 1 commit into from
Dec 27, 2018
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
60 changes: 30 additions & 30 deletions src/meca/pssac.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Brief synopsis: pssac will plot seismograms in SAC format on maps
*/

/*
/*
The SAC I/O functions are initially written by Prof. Lupei Zhu,
and modified by Dongdong Tian.

Expand Down Expand Up @@ -304,7 +304,7 @@ GMT_LOCAL int parse (struct GMT_CTRL *GMT, struct PSSAC_CTRL *Ctrl, struct GMT_O
else if (j == 2) {
if (strcmp(txt_b, "s") == 0 ) { /* -Msize/s */
// TODO
}
}
else if (strcmp(txt_b, "b") == 0) { /* -Msize/b */
// TODO
}
Expand Down Expand Up @@ -662,7 +662,7 @@ int GMT_pssac (void *V_API, int mode, void *args) { /* High-level function that

for (n = 0; n < (int)n_files; n++) { /* Loop over all SAC files */
GMT_Report (API, GMT_MSG_LONG_VERBOSE, "Plotting SAC file %d: %s\n", n, L[n].file);

/* -T: determine the reference time for all times in pssac */
tref = 0.0;
if (Ctrl->T.active) {
Expand Down Expand Up @@ -857,33 +857,6 @@ int GMT_pssac (void *V_API, int mode, void *args) { /* High-level function that
GMT_Report (API, GMT_MSG_LONG_VERBOSE, "=> %s: after scaling and shifting : xmin=%g xmax=%g ymin=%g ymax=%g\n",
L[n].file, x[0], x[hd.npts-1], hd.depmin, hd.depmax);

if (gmt_M_is_linear(GMT)) {
GMT->current.plot.n = gmt_geo_to_xy_line (GMT, x, y, hd.npts);
xp = GMT->current.plot.x;
yp = GMT->current.plot.y;
npts = (int)GMT->current.plot.n;
plot_pen = GMT->current.plot.pen;
}
else {
xp = x;
yp = y;
npts = hd.npts;
plot_pen = gmt_M_memory (GMT, NULL, npts, unsigned int);
plot_pen[0] = PSL_MOVE;
free_plot_pen = true;
}

/* plot trace */
if (L[n].custom_pen) {
current_pen = L[n].pen;
gmt_setpen (GMT, &L[n].pen);
}
gmt_plot_line (GMT, xp, yp, plot_pen, npts, current_pen.mode);
if (L[n].custom_pen) {
current_pen = Ctrl->W.pen;
gmt_setpen (GMT, &current_pen);
}

/* paint trace */
for (i = 0; i <= 1; i++) { /* 0=positive; 1=negative */
if (Ctrl->G.active[i]) {
Expand Down Expand Up @@ -916,6 +889,33 @@ int GMT_pssac (void *V_API, int mode, void *args) { /* High-level function that
paint_phase(GMT, Ctrl, PSL, x, y, hd.npts, zero, Ctrl->G.t0[i], Ctrl->G.t1[i], i);
}
}

/* plot trace */
if (gmt_M_is_linear(GMT)) {
GMT->current.plot.n = gmt_geo_to_xy_line (GMT, x, y, hd.npts);
xp = GMT->current.plot.x;
yp = GMT->current.plot.y;
npts = (int)GMT->current.plot.n;
plot_pen = GMT->current.plot.pen;
}
else {
xp = x;
yp = y;
npts = hd.npts;
plot_pen = gmt_M_memory (GMT, NULL, npts, unsigned int);
plot_pen[0] = PSL_MOVE;
free_plot_pen = true;
}
if (L[n].custom_pen) {
current_pen = L[n].pen;
gmt_setpen (GMT, &L[n].pen);
}
gmt_plot_line (GMT, xp, yp, plot_pen, npts, current_pen.mode);
if (L[n].custom_pen) {
current_pen = Ctrl->W.pen;
gmt_setpen (GMT, &current_pen);
}

gmt_M_free(GMT, x);
gmt_M_free(GMT, y);
if (free_plot_pen) gmt_M_free(GMT, plot_pen);
Expand Down
Binary file modified test/pssac/pssac_G.ps
Binary file not shown.
Binary file modified test/pssac/pssac_Q.ps
Binary file not shown.
Binary file modified test/pssac/pssac_geo.ps
Binary file not shown.