From 8140022bfc23c254c5e1d567739cd2e9c520ff38 Mon Sep 17 00:00:00 2001 From: Gael Alory <gael.alory@legos.obs-mip.fr> Date: Fri, 18 Sep 2009 12:25:50 +0000 Subject: [PATCH] option: choix de resolution de la carte --- tsg_util/plot_map.m | 36 +++++++++++++++++++++++----------- tsg_util/preferencesForm.m | 40 +++++++++++++++++++++++++++++++++++++- tsg_util/tsg_preferences.m | 2 ++ tsgqc.m | 13 +++++++++---- 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/tsg_util/plot_map.m b/tsg_util/plot_map.m index 6017764..3066913 100644 --- a/tsg_util/plot_map.m +++ b/tsg_util/plot_map.m @@ -12,11 +12,11 @@ function plot_map(hTsgGUI, hPlotAxes) % Library : 'M_MAP' % % TO DO -% note that a decimal degree notation is used, so that a longitude of 120° +% note that a decimal degree notation is used, so that a longitude of 120� % 30'W is specified as -120.5 % % PROBLEM NOT YET RESOLVED -% Does M_MAP use 0-360° or -180°-180° covention ? +% Does M_MAP use 0-360� or -180�-180� covention ? % % $Id$ @@ -52,18 +52,32 @@ if ~isempty( ind ) % Use of Mercator projection % -------------------------- - %m_proj('Mercator','lat',[-70 70],'long',[-180 180]); m_proj('Mercator','lat',[latMin latMax],'long',[lonMin lonMax]); - % detailed coast lines - % m_gshhs_i('patch',[.7 .7 .7]); + switch tsg.preference.map_resolution - % Less detailed coast lines - %m_gshhs_l('patch',[.7 .7 .7]); + case 1 + % Low-resolution coast lines + % -------------------------- + m_coast('patch',[.7 .7 .7], 'TAG', 'TAG_PLOT4_LINE_COAST'); - % Lesser detailed coast lines - % ---------------------------- - m_coast('patch',[.7 .7 .7], 'TAG', 'TAG_PLOT4_LINE_COAST'); + case 2 + % Medium-resolution coast lines + % ----------------------------- + m_gshhs_l('patch',[.7 .7 .7], 'TAG', 'TAG_PLOT4_LINE_COAST'); + + case 3 + % High-resolution coast lines + % ---------------------------- + m_gshhs_i('patch',[.7 .7 .7], 'TAG', 'TAG_PLOT4_LINE_COAST'); + + otherwise + tsg.preference.map_resolution=1; + % Low-resolution coast lines + % -------------------------- + m_coast('patch',[.7 .7 .7], 'TAG', 'TAG_PLOT4_LINE_COAST'); + + end %m_grid('box','fancy','tickdir','in', ... % 'ytick', [-70:20:70],... @@ -74,7 +88,7 @@ if ~isempty( ind ) % Plot the ship track - Check if LAT-LON in deg-decimal % ----------------------------------------------------- %m_line(tsg.LONX,tsg.LATX, 'TAG', 'TAG_PLOT4_LINE_SHIPTRACK', 'marker','.','markersize',3,'color','b'); -% m_line(tsg.LONX,tsg.LATX, 'LineStyle', 'none', 'marker','*','markersize',2,'color','b'); + % m_line(tsg.LONX,tsg.LATX, 'LineStyle', 'none', 'marker','*','markersize',2,'color','b'); % Plot using QC % ------------- diff --git a/tsg_util/preferencesForm.m b/tsg_util/preferencesForm.m index c3e04ef..7332bdf 100644 --- a/tsg_util/preferencesForm.m +++ b/tsg_util/preferencesForm.m @@ -16,6 +16,10 @@ error = -1; % ------------------------------------- tsg = getappdata(hTsgGUI, 'tsg_data'); +% disable ship speed test +% ----------------------- +tsg.preference.ship_speed_test=1; + % set default uicontrol size % -------------------------- height = 0.03; @@ -248,6 +252,38 @@ if bottom < .1 left = left + inc_x; end +% display map resolution text +% ----------------------------- +uicontrol(... + 'Parent', hPreferencesFig, ... + 'Units', 'normalized', ... + 'Style', 'Text', ... + 'Fontsize', tsg.fontSize-1, ... + 'HorizontalAlignment', 'left', ... + 'Position',[left, bottom, length, height], ... + 'TooltipString', 'select map resolution', ... + 'String', 'Map Resolution'); + +% display map resolution uicontrol +% -------------------------------- +uicontrol(... + 'Parent', hPreferencesFig, ... + 'Units', 'normalized', ... + 'BackgroundColor', 'w', ... + 'Style', 'popupmenu', ... + 'Fontsize', tsg.fontSize-2, ... + 'HorizontalAlignment', 'right', ... + 'Position', [left + length, bottom, length, height], ... + 'String', tsg.preference.map_resolution_string, ... + 'Value', tsg.preference.map_resolution, ... + 'Tag', 'PREFERENCES_MAP_RESOLUTION'); + +bottom = bottom - inc_y - height; +if bottom < .1 + bottom = 0.95; + left = left + inc_x; +end + % CONTINUE PUSH BUTTON % -------------------- % The Continue (valid) button @@ -316,7 +352,9 @@ uiwait(hPreferencesFig); get(prefs.PREFERENCES_PLOT_CONNECTED_LINE, 'value'); tsg.preference.coeff_type_value = ... get(prefs.PREFERENCES_COEFF_TYPE, 'value'); - + tsg.preference.map_resolution = ... + get(prefs.PREFERENCES_MAP_RESOLUTION, 'value'); + % Save tsg structure % ------------------ setappdata(hTsgGUI, 'tsg_data', tsg); diff --git a/tsg_util/tsg_preferences.m b/tsg_util/tsg_preferences.m index 456edd2..61c320a 100644 --- a/tsg_util/tsg_preferences.m +++ b/tsg_util/tsg_preferences.m @@ -143,6 +143,8 @@ end preference.plot_connected_value = 1; % 0, line not connected preference.coeff_type_string = {'use A-D', 'use G-J'}; preference.coeff_type_value = 2; + preference.map_resolution_string = {'low','medium','high'}; + preference.map_resolution = 1; % save preference struct to 'prefdir.mat' file % --------------------------------------------- diff --git a/tsgqc.m b/tsgqc.m index f4a1868..e2f3ef2 100644 --- a/tsgqc.m +++ b/tsgqc.m @@ -2868,6 +2868,8 @@ hrbInterpCancel = uicontrol( ... % ------------------------------------------------------------------- function PreferencesMenuCallback(hObject, eventdata) + oldmapres=tsg.preference.map_resolution; + % call preferences form function % ------------------------------ if( preferencesForm(hMainFig) ) @@ -2878,13 +2880,16 @@ hrbInterpCancel = uicontrol( ... SelectParameter(pmhPara(1),[],1); end - % Update the map if visible and ship speed QC has been applied - % ------------------------------------------------------------ - if (strcmp( get(hMapFig,'visible'), 'on') == 1 & tsg.preference.ship_speed_test == 2) + % Update the map (if visible) if ship speed QC has been applied + % or map resolution has been changed + % ------------------------------------------------------------- + if (strcmp( get(hMapFig,'visible'), 'on') == 1 & ... + (tsg.preference.ship_speed_test == 2 | ... + tsg.preference.map_resolution ~= oldmapres)) erase_Line( hPlotAxes, 4 ); plot_map( hMainFig, hPlotAxes); end - + end end -- GitLab