From a11208e8988b2129856f3ff73a242ad63d537a9f Mon Sep 17 00:00:00 2001 From: Jacques Grelet <Jacques.grelet@ird.fr> Date: Thu, 10 Jan 2019 16:32:10 +0100 Subject: [PATCH] fix #11, improve print functions --- tsg_util/plot_map.m | 9 ++++++--- tsgqc.m | 36 +++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/tsg_util/plot_map.m b/tsg_util/plot_map.m index 0fcaa32..71e2021 100644 --- a/tsg_util/plot_map.m +++ b/tsg_util/plot_map.m @@ -54,6 +54,9 @@ ind = find( tsg.DAYD >= dateLim(1) & tsg.DAYD <= dateLim(2)); latx = double(tsg.LATX); lonx = double(tsg.LONX); +dt = datacursormode; +dt.UpdateFcn = {@labeldatatips}; + if ~isempty( ind ) latMin = min(latx(ind) ); @@ -294,11 +297,11 @@ if ~isempty( ind ) % Write title % ----------- if strcmp(tsg.preference.map.climatology, 'none') % if climato selected on 2D map - title(['Cruise: ', tsg.file.name], 'fontsize',tsg.fontSize +2,... + title(tsg.file.name, 'fontsize',tsg.fontSize,... 'fontweight', 'bold', 'interpreter','none'); else - title({['Cruise: ', tsg.file.name], ['Climatology: ', ... - tsg.levitus.version, ' ', tsg.levitus.type]}, 'fontsize',tsg.fontSize +2,... + title([tsg.file.name, ' / ', ... + tsg.levitus.version, ' ', tsg.levitus.type], 'fontsize',tsg.fontSize,... 'fontweight', 'bold', 'interpreter','none'); end diff --git a/tsgqc.m b/tsgqc.m index f27e320..d39d8fb 100644 --- a/tsgqc.m +++ b/tsgqc.m @@ -54,7 +54,7 @@ global DEFAULT_PATH_FILE % ------------------------------------------------------------------- VERSION = 1.50; % -> 1.44 CHAR_VERSION = '1.50RC2'; -DATE_VERSION = '07/01/2019'; +DATE_VERSION = '10/01/2019'; % netcdf file version, see DATA FORMAT TSG document: % CORTSG_format_gosud.doc @@ -4088,8 +4088,8 @@ end end -% Generic function for all customization menus. -% The tag argument (second) is used to extract the handle of the selected +% Generic function for all customization menus. +% The tag argument (second) is used to extract the handle of the selected % menu. % We use a regular expression to access and modify the preference structure % ------------------------------------------------------------------------- @@ -4122,8 +4122,8 @@ end plot_map(hMainFig, hPlotAxes); end - % color picker callback - % --------------------- +% color picker callback +% --------------------- function mapColorPickerCallback(src, evnt, tag) % open color picker @@ -4141,11 +4141,18 @@ end % print map figure from menu % ---------------------------- function mapPrintCallback(src, evnt) - printdlg(get(hPlotAxes(4),'parent')); + % cache the contourf setting panel before printing + set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'off'); + % call the print dialog box + printdlg(get(get(hPlotAxes(4),'parent'),'parent')); + % enable the contourf setting panel + set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on'); end +% print preview of the map figure, parent of panel and axe +% -------------------------------------------------------- function mapPrintPreviewCallback(src, evnt) - printpreview(get(hPlotAxes(4),'parent')); + printpreview(get(get(hPlotAxes(4),'parent'),'parent')); end % enable toolbar on map figure from menu @@ -4155,7 +4162,7 @@ end % https://fr.mathworks.com/matlabcentral/answers/419036-what-happened-to-the-figure-toolbar-in-r2018b-why-is-it-an-axes-toolbar-how-can-i-put-the-buttons % -------------------------------------------------------------------- function mapToolBarCallback(src, evnt) - + if( strcmp(get(hMapFig, 'toolbar'), 'none')) set(hMapFig, 'toolbar', 'figure'); if ~verLessThan('matlab','9.5') @@ -4174,7 +4181,18 @@ end return end fprintf(1, 'Save figure map as %s\n', fullfile(path,file)); - saveas(get(hPlotAxes(4),'parent'), fullfile(path,file)); + % cache the contourf setting panel before printing + set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'off'); + % resize map panel for full figure + set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, 1, 1]) + % save figure to specific file format + saveas(get(get(hPlotAxes(4),'parent'),'parent'), fullfile(path,file)); + if strcmp(tsg.preference.map.climatology, 'contourf') + % resize map panel for axes only when contourf is selected + set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, .8, 1]) + % enable the contourf setting panel + set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on'); + end end -- GitLab