| 7964 | } |
| 7965 | |
| 7966 | void gmt_contlabel_plot (struct GMT_CTRL *GMT, struct GMT_CONTOUR *G) { |
| 7967 | unsigned int i, mode; |
| 7968 | bool no_labels; |
| 7969 | struct PSL_CTRL *PSL= GMT->PSL; |
| 7970 | |
| 7971 | if (!G->n_segments) return; /* Northing to do here */ |
| 7972 | |
| 7973 | /* See if there are labels at all */ |
| 7974 | for (i = 0, no_labels = true; i < G->n_segments && no_labels; i++) |
| 7975 | if (G->segment[i]->n_labels) no_labels = false; |
| 7976 | |
| 7977 | if (!G->delay) PSL_command (GMT->PSL, "V\n"); /* Plotting something, so protect current graphics state */ |
| 7978 | |
| 7979 | if (G->debug) gmtplot_contlabel_debug (GMT, PSL, G); /* Debugging lines and points */ |
| 7980 | |
| 7981 | if (no_labels) { /* No labels, just draw lines; no clipping required */ |
| 7982 | gmtplot_contlabel_drawlines (GMT, PSL, G, 0); |
| 7983 | PSL_command (GMT->PSL, "U\n"); /* Restore to where we were */ |
| 7984 | return; |
| 7985 | } |
| 7986 | |
| 7987 | PSL_settextmode (PSL, PSL_TXTMODE_MINUS); /* Replace hyphens with minus signs */ |
| 7988 | gmt_setfont (GMT, &G->font_label); |
| 7989 | |
| 7990 | if (G->must_clip) { /* Transparent boxes means we must set up plot text, then set up clip paths, then draw lines, then deactivate clipping */ |
| 7991 | /* Place PSL variables, plot labels, set up clip paths, draw lines */ |
| 7992 | mode = PSL_TXT_INIT | PSL_TXT_SHOW | PSL_TXT_CLIP_ON; |
| 7993 | if (G->draw) mode |= PSL_TXT_DRAW; |
| 7994 | if (!G->delay) mode |= PSL_TXT_CLIP_OFF; /* Also turn off clip path when done */ |
| 7995 | gmtplot_contlabel_plotlabels (GMT, PSL, G, mode); /* Take the above actions */ |
| 7996 | } |
| 7997 | else { /* Opaque text boxes */ |
| 7998 | mode = PSL_TXT_INIT; /* Plot text */ |
| 7999 | if (G->draw) mode |= PSL_TXT_DRAW; /* Draw lines */ |
| 8000 | gmtplot_contlabel_plotlabels (GMT, PSL, G, mode); /* Place PSL variables and draw lines */ |
| 8001 | mode = PSL_TXT_SHOW; /* Plot text */ |
| 8002 | if (G->delay) mode |= PSL_TXT_CLIP_ON; /* Also turn on clip path after done */ |
| 8003 | gmtplot_contlabel_plotlabels (GMT, PSL, G, mode); /* Plot labels and possibly turn on clipping if delay */ |
| 8004 | } |
| 8005 | PSL_command (GMT->PSL, "[] 0 B\n"); /* Ensure no pen textures remain in effect */ |
| 8006 | PSL_settextmode (PSL, PSL_TXTMODE_HYPHEN); /* Back to leave as is */ |
| 8007 | |
| 8008 | if (!G->delay) PSL_command (GMT->PSL, "U\n"); /* Restore to where we were */ |
| 8009 | } |
| 8010 | |
| 8011 | #if 0 // We have no current need for this anymore |
| 8012 | GMT_LOCAL void gmtplot_wipe_substr(char *str1, char *str2) { |
no test coverage detected