diff --git a/tsg_util/tsg_preferences.m b/tsg_util/tsg_preferences.m index 788037edf610928a49acf9a9318e4a822c2f1964..22ea2fd77d15e549eb084409e9c7a769e3412712 100644 --- a/tsg_util/tsg_preferences.m +++ b/tsg_util/tsg_preferences.m @@ -176,6 +176,10 @@ return preference.map.climato.SSPS.min = 30; preference.map.climato.SSPS.max = 37; preference.map.climato.SSPS.step = .2; + preference.map.track.size = 1; + preference.map.track.color = 'b'; + preference.map.ship.size = 5; + preference.map.ship.color = 'r'; preference.plot_connected_string = {'none', '-', '--', ':', '-.'}; preference.plot_connected_value = 1; % 0, line not connected % QC test diff --git a/tsgqc.m b/tsgqc.m index 507e5391e0e9119bde6a682f093ff222d677d07e..d5d387fff26666b39bca124dc2b736e6e4dc9c2e 100644 --- a/tsgqc.m +++ b/tsgqc.m @@ -53,8 +53,8 @@ global DEFAULT_PATH_FILE % or modify the version number to load a new default structure % ------------------------------------------------------------------- VERSION = 1.50; % -> 1.44 -CHAR_VERSION = '1.50RC1'; -DATE_VERSION = '12/05/2018'; +CHAR_VERSION = '1.50RC2'; +DATE_VERSION = '20/12/2018'; % netcdf file version, see DATA FORMAT TSG document: % CORTSG_format_gosud.doc @@ -909,6 +909,126 @@ uimenu(hMapClimatologyMenu,'Label','contour',... 'Enable', 'off',... 'Callback', {@mapClimatologyCallback, 'contourf'}); +% map Track menu, select color and size for track and ship +% -------------------------------------------------------- +hMapCustomizeMenu = uimenu(hMapFig, ... + 'Label', 'Customize', ... + 'Tag', 'TAG_UIMENU_MAP_CUSTOMIZE'); + +hMapShipMenu = uimenu(hMapCustomizeMenu,'Label','Ship', ... + 'Tag', 'TAG_UIMENU_MAP_SHIP'); + +hMapShipSizeMenu = uimenu(hMapShipMenu,'Label','Size', ... + 'Tag', 'TAG_UIMENU_MAP_SHIP_SIZE'); + +hMapShipColorMenu = uimenu(hMapShipMenu,'Label','Color', ... + 'Tag', 'TAG_UIMENU_MAP_SHIP_COLOR'); + +hMapTrackMenu = uimenu(hMapCustomizeMenu,'Label','Track', ... + 'Tag', 'TAG_UIMENU_MAP_TRACK'); + +hMapTrackSizeMenu = uimenu(hMapTrackMenu,'Label','Size', ... + 'Tag', 'TAG_UIMENU_MAP_TRACK_SIZE'); + +hMapTrackColorMenu = uimenu(hMapTrackMenu,'Label','Color', ... + 'Tag', 'TAG_UIMENU_MAP_TRACK_COLOR'); + +uimenu(hMapShipSizeMenu,'Label','4',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_SIZE_4',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 4, 'SHIP_SIZE'}); + +uimenu(hMapShipSizeMenu,'Label','5',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_SIZE_5',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 5, 'SHIP_SIZE'}); + +uimenu(hMapShipSizeMenu,'Label','6',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_SIZE_6',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 6, 'SHIP_SIZE'}); + +uimenu(hMapShipSizeMenu,'Label','7',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_SIZE_7',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 7, 'SHIP_SIZE'}); + +uimenu(hMapShipColorMenu,'Label','red',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_COLOR_R',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'r', 'SHIP_SIZE'}); + +uimenu(hMapShipColorMenu,'Label','black',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_COLOR_K',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'k', 'SHIP_SIZE'}); + +uimenu(hMapShipColorMenu,'Label','blue',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_COLOR_B',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'b', 'SHIP_SIZE'}); + +uimenu(hMapShipColorMenu,'Label','green',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_SHIP_COLOR_G',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'g', 'SHIP_SIZE'}); + +uimenu(hMapTrackSizeMenu,'Label','4',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_SIZE_4',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 4, 'SHIP_SIZE'}); + +uimenu(hMapTrackSizeMenu,'Label','5',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_SIZE_5',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 5, 'SHIP_SIZE'}); + +uimenu(hMapTrackSizeMenu,'Label','6',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_SIZE_6',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 6, 'SHIP_SIZE'}); + +uimenu(hMapTrackSizeMenu,'Label','7',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_SIZE_7',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 7, 'SHIP_SIZE'}); + +uimenu(hMapTrackColorMenu,'Label','red',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_COLOR_R',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'r', 'SHIP_SIZE'}); + +uimenu(hMapTrackColorMenu,'Label','black',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_COLOR_K',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'k', 'SHIP_SIZE'}); + +uimenu(hMapTrackColorMenu,'Label','blue',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_COLOR_B',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'b', 'SHIP_SIZE'}); + +uimenu(hMapTrackColorMenu,'Label','green',... + 'Checked','off',... + 'Tag','TAG_UIMENU_MAP_TRACK_COLOR_G',... + 'Enable', 'on',... + 'Callback', {@mapCustomizeCallback, 'g', 'SHIP_SIZE'}); + % map Print menu % -------------------- hMapPrintMenu = uimenu(hMapFig,'Label','Print', ... @@ -927,6 +1047,14 @@ uimenu(hMapPrintMenu,'Label','Save as',... 'Tag','TAG_UIMENU_MAP_PRINT_SAVEAS',... 'Callback', {@mapSaveAsCallback}); +% map Toolbar display menu +% -------------------- +hMapToolbarMenu = uimenu(hMapFig,'Label','ToolBar', ... + 'Tag', 'TAG_UIMENU_MAP_TOOLBAR',... + 'Checked','off',... + 'Enable', 'on',... + 'Callback', {@mapToolBarCallback}); + % set uipanel for map axes and climato % ------------------------------------ hMapAxesPanel = uipanel( ... @@ -2956,8 +3084,9 @@ end hMarker = m_line(mod(tsg.LONX(indCursor(1)) + ... tsg.lonplus, tsg.lonmod) - tsg.lonplus,... tsg.LATX(indCursor(1)),... - 'Marker', 'o', 'MarkerSize', 5, ... - 'Color', 'r', 'MarkerFaceColor', 'r'); + 'Marker', 'o', 'MarkerSize', tsg.preference.map.ship.size, ... + 'Color', tsg.preference.map.ship.color, 'MarkerFaceColor', ... + tsg.preference.map.ship.color); % Put a tag on the Marker - This tag allows to get the handle % of the Marker @@ -2974,8 +3103,9 @@ end delete( h); hMarker = m_line(... tsg.LONX(indCursor), tsg.LATX(indCursor),... - 'Marker', 'o', 'MarkerSize', 5, ... - 'Color', 'r', 'MarkerFaceColor', 'r'); + 'Marker', 'o', 'MarkerSize', tsg.preference.map.ship.size, ... + 'Color', tsg.preference.map.ship.color,... + 'MarkerFaceColor', tsg.preference.map.ship.color); % Put a tag on the Marker - This tag allows to get the handle % of the Marker @@ -3961,6 +4091,31 @@ end end +% function mapCustomizeCallback +% -------------------------------- + function mapCustomizeCallback(src, evnt, val, tag) + + % get the tsg structure + % --------------------- + tsg = getappdata( hMainFig, 'tsg_data'); + + hdls = findobj( '-regexp', 'tag', ['TAG_UIMENU_MAP_' tag]); + set(hdls, 'Checked', 'off'); + set(src, 'Checked', 'on'); + + % change the map border from menu on map, dynamically transform + % tag to structure member + % ------------------------------------------------------------- + member = regexp(lower(tag),'(\w+)_(\w+)','tokens'); + tsg.preference.map.(member{1}{1}).(member{1}{2}) = val; + setappdata( hMainFig, 'tsg_data', tsg); + + % redraw map + % ------------------------------------------ + erase_Line( hPlotAxes, 4 ); + plot_map(hMainFig, hPlotAxes); + end + % print map figure from menu % ---------------------------- function mapPrintCallback(src, evnt) @@ -3971,6 +4126,17 @@ end printpreview(get(hPlotAxes(4),'parent')); end +% enable toolbar on map figure from menu +% ------------------------------------ + function mapToolBarCallback(src, evnt) + get(hMapFig, 'toolbar') + if( strcmp(get(hMapFig, 'toolbar'), 'none')) + set(hMapFig, 'toolbar', 'figure') + else + set(hMapFig, 'toolbar', 'none') + end + end + % save the map as image file % -------------------------- function mapSaveAsCallback(src, evnt)