! . */
| 16492 | |
| 16493 | /*! . */ |
| 16494 | void gmt_end_module (struct GMT_CTRL *GMT, struct GMT_CTRL *Ccopy) { |
| 16495 | unsigned int i, V_level = GMT->current.setting.verbose; /* Keep copy of currently selected level */ |
| 16496 | unsigned int func_level_bak = GMT->hidden.func_level; |
| 16497 | bool pass_changes_back; |
| 16498 | struct GMT_DEFAULTS saved_settings; |
| 16499 | double spacing[2]; |
| 16500 | OGRCoordinateTransformationH hCT_fwd_bak; |
| 16501 | OGRCoordinateTransformationH hCT_inv_bak; |
| 16502 | |
| 16503 | GMT->parent->use_gridline_registration = false; /* Reset API default setting on grid registration */ |
| 16504 | GMT->parent->use_gridline_registration_warn = false; /* Reset API default setting on grid registration warning */ |
| 16505 | |
| 16506 | gmt_M_memcpy (spacing, GMT->current.plot.gridline_spacing, 2U, double); /* Remember these so they can survive the end of the module */ |
| 16507 | |
| 16508 | /* If that's the case, clean up any GDAL CT object */ |
| 16509 | if (GMT->hidden.func_level == GMT_TOP_MODULE) { /* Don't free these on nested calls because they may still be needed. */ |
| 16510 | if (GMT->current.gdal_read_in.hCT_fwd) |
| 16511 | OCTDestroyCoordinateTransformation(GMT->current.gdal_read_in.hCT_fwd); |
| 16512 | if (GMT->current.gdal_read_in.hCT_inv) |
| 16513 | OCTDestroyCoordinateTransformation(GMT->current.gdal_read_in.hCT_inv); |
| 16514 | GMT->current.gdal_read_in.hCT_fwd = GMT->current.gdal_read_in.hCT_inv = NULL; |
| 16515 | } |
| 16516 | |
| 16517 | if (GMT->hidden.func_level == GMT_TOP_MODULE && GMT->current.ps.oneliner && GMT->current.ps.active) { |
| 16518 | char *setting = getenv ("GMT_END_SHOW"); |
| 16519 | char *show = (setting && !strcmp (setting, "off")) ? "" : "show"; |
| 16520 | GMT->current.ps.oneliner = false; |
| 16521 | if (gmt_get_current_item (GMT, "cpt", false)) { /* One-liner with a current CPT, place it on top */ |
| 16522 | gmtinit_init_zproject (GMT); /* Reset to 2-D view just in case */ |
| 16523 | GMT->current.map.frame.init = false; /* Since we want -B to be parsed below */ |
| 16524 | if ((i = GMT_Call_Module (GMT->parent, "colorbar", GMT_MODULE_CMD, "-DJBC -Bxaf"))) { |
| 16525 | GMT_Report (GMT->parent, GMT_MSG_ERROR, "Unable to call module colorbar for a one-liner plot.\n"); |
| 16526 | return; |
| 16527 | } |
| 16528 | } |
| 16529 | if ((i = GMT_Call_Module (GMT->parent, "end", GMT_MODULE_CMD, show))) { |
| 16530 | GMT_Report (GMT->parent, GMT_MSG_ERROR, "Unable to call module end for a one-liner plot.\n"); |
| 16531 | return; |
| 16532 | } |
| 16533 | GMT->current.setting.run_mode = GMT_CLASSIC; /* all pau with modern session */ |
| 16534 | } |
| 16535 | |
| 16536 | if (GMT->hidden.func_level == GMT_TOP_MODULE && GMT->parent->log_level == GMT_LOG_ONCE) { /* Reset logging to default at the end of a top-level module */ |
| 16537 | fclose (GMT->session.std[GMT_ERR]); |
| 16538 | GMT->session.std[GMT_ERR] = stderr; |
| 16539 | GMT->parent->log_level = GMT_LOG_OFF; |
| 16540 | } |
| 16541 | |
| 16542 | gmtinit_set_last_dimensions (GMT->parent); /* Save canvas size */ |
| 16543 | |
| 16544 | if (GMT->current.proj.n_geodesic_approx) { |
| 16545 | GMT_Report(GMT->parent, GMT_MSG_DEBUG, "Of % " PRIu64 " geodesic calls, % " PRIu64 " exceeded the iteration limit of 50.\n", |
| 16546 | GMT->current.proj.n_geodesic_calls, GMT->current.proj.n_geodesic_approx); |
| 16547 | } |
| 16548 | |
| 16549 | gmtlib_garbage_collection (GMT->parent, GMT->hidden.func_level); /* Free up all registered memory for this module level */ |
| 16550 | |
| 16551 | /* At the end of the module we restore all GMT settings as we found them (in Ccopy) */ |
nothing calls this directly
no test coverage detected