Newer
Older
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
% flushes the event queue and updates the closed uiputfile window
% ---------------------------------------------------------------
drawnow;
% write netcdf file
% -----------------
error = writeTSGDataNetCDF(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% Check for NetCDF writing error
% must to be rewriting
% ------------------------------
if error == -1
warning('tsgqc:SaveMenuCallback', ...
'NetCDF writing error: %s %s', pathName, fileName);
return;
end
% update the display
% ------------------
set( hInfoFileText, 'String', strcat(tsg.file.name, tsg.file.ext));
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
end
end
% -------------------------------------------------------------------
% Callback function run when the Export menu item is selected
% -------------------------------------------------------------------
function ExportTsgCallback(hObject, eventdata)
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Desactivate MouseMotion 'off'
% ----------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Open standard dialog box for saving files
% -----------------------------------------
[fileName, pathName, filterindex] = uiputfile('*.tsgqc', ...
'Save file name', strcat(tsg.file.name, '.tsgqc'));
% if user press cancel button, all var are set to zero
% ----------------------------------------------------
if filterindex == 0
return;
end
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
% Write a .TSG (ascii) file
% --------------------------
Yves Gouriou
committed
error = writeAsciiTsg(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
% Set MouseMotion 'on'
% --------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
% Check for .TSG writing error - must to be rewriting
% Because of the 'return' - These line must be at the end
% --------------------------------------------------------
warning('tsgqc:SaveMenuCallback', ...
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
'TSG no ouput: %s %s', pathName, fileName);
return;
end
end
%% ExportSampleCallback
% -------------------------------------------------------------------
% Callback function run when the Export menu item is selected
% -------------------------------------------------------------------
function ExportSampleCallback(hObject, eventdata)
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Desactivate MouseMotion 'off'
% ----------------------------
set( hMainFig, 'WindowButtonMotionFcn', []);
% Open standard dialog box for saving files
% -----------------------------------------
[fileName, pathName, filterindex] = uiputfile('*.spl', ...
'Save file name', strcat(tsg.file.name, '.spl'));
% if user press cancel button, all var are set to zero
% ----------------------------------------------------
if filterindex == 0
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' );
% Write a .SPL (ascii) file
% --------------------------
error = writeAsciiSample(hMainFig, strcat(pathName, fileName));
% Pointer reset to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% enable Quality Control mode
% ---------------------------
hdl_pushtool = findobj('Tag', 'QC');
set(hdl_pushtool, 'Enable', 'on');
% Set MouseMotion 'on'
% --------------------
set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);
% Check for .TSG writing error - must to be rewriting
% Because of the 'return' - These line must be at the end
% --------------------------------------------------------
if error == -1
warning('tsgqc:SaveMenuCallback', ...
'TSG no ouput: %s %s', pathName, fileName);
return;
end
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
end
%% UndoMenuCallback
% -----------------------------------------------------------------------
% Callback function run when the Edit/Undo menu item is selected (Ctrl+Z)
% -----------------------------------------------------------------------
function UndoMenuCallback(hObject, eventdata)
% Undo module not yet implemented
% -------------------------------
% msgbox('Undo module not yet implemented', 'modal');
tsg.queue = undo(tsg.queue);
tsg.SSPS_QC = get(tsg.queue);
% Make the Salinity, temperature and velocity plot
% ------------------------------------------------
plot_SalTempVel( hMainFig, hPlotAxes );
end
%% RedoMenuCallback
% -----------------------------------------------------------------------
% Callback function run when the Edit/Redo menu item is selected (Ctrl+R)
% -----------------------------------------------------------------------
function RedoMenuCallback(hObject, eventdata)
% Redo module not yet implemented
% -------------------------------
msgbox('Redo module not yet implemented', 'modal');
end
%% QuitMapCallback
% -----------------------------------------------------------------
% Callback function run when the Quit Map Figure item is selected
% -----------------------------------------------------------------
function QuitMapCallback(hObject, eventdata)
% Make the earth map invisible
% ----------------------------
set(hMapPanel, 'Visible', 'off' );
set(hMapToggletool, 'state', 'off' );
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
%% QuitMenuCallback
% -----------------------------------------------------------------
% Callback function run when the Quit menu item is selected
% -----------------------------------------------------------------
function QuitMenuCallback(hObject, eventdata)
% save config mat file in prefdir
% -------------------------------
config_file = [prefdir, filesep, tsgqcname, '.mat'];
% set tsg.levitus empty before save preferences in mat file
% ---------------------------------------------------------
tsg.levitus = [];
% save preference mat file
% ------------------------
save( config_file, 'tsg');
% If the data have been modified and not save, the program
% ask to save the data
% --------------------------------------------------------
if strcmp( get( hSaveMenu, 'UserData' ), 'on')
selection = ...
questdlg('The file has been modified. Do you want to save it ?',...
'Save before Quit?',...
'Yes', 'No', 'Yes');
if strcmp(selection, 'Yes')
% call File/Save Menu Callback before before quit
% -----------------------------------------------
SaveMenuCallback;
end
% quit program
% ------------
quitProgram(hMainFig, hMapPanel, DEFAULT_PATH_FILE);
else
selection = ...
questdlg(['Quit ' get(hMainFig, 'Name') '?'],...
['Quit ' get(hMainFig, 'Name') '?'],...
'Yes', 'No', 'Yes');
if strcmp(selection, 'No')
return;
else
quitProgram(hMainFig, hMapPanel, DEFAULT_PATH_FILE);