# ASCII2GIS_GUI

## PURPOSE

ASCII2GIS_GUI M-file for ASCII2GIS_GUI.fig

## SYNOPSIS

function varargout = ASCII2GIS_GUI(varargin)

## DESCRIPTION

     ASCII2GIS_GUI M-file for ASCII2GIS_GUI.fig
          ASCII2GIS_GUI, by itself, creates a new ASCII2GIS_GUI or raises the existing
          singleton*.

          H = ASCII2GIS_GUI returns the handle to a new ASCII2GIS_GUI or the handle to
          the existing singleton*.

          ASCII2GIS_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
          function named CALLBACK in ASCII2GIS_GUI.M with the given input arguments.

          ASCII2GIS_GUI('Property','Value',...) creates a new ASCII2GIS_GUI or raises the
          existing singleton*.  Starting from the left, property value pairs are
          applied to the GUI before ASCII2GIS_GUI_OpeningFcn gets called.  An
          unrecognized property name or invalid value makes property application
          stop.  All inputs are passed to ASCII2GIS_GUI_OpeningFcn via varargin.

          *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
          instance to run (singleton)".

     See also: GUIDE, GUIDATA, GUIHANDLES

## CROSS-REFERENCE INFORMATION

This function calls:

- ASCII2GIS WinRiver ASCII to GIS Import Format

This function is called by:

## SUBFUNCTIONS

- function ASCII2GIS_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
- function varargout = ASCII2GIS_GUI_OutputFcn(hObject, eventdata, handles)
- function RunButton_Callback(hObject, eventdata, handles)
- function FullDepthcheckbox_Callback(hObject, eventdata, handles)
- function DFSlow_Callback(hObject, eventdata, handles)
- function DFSlow_CreateFcn(hObject, eventdata, handles)
- function DFShi_Callback(hObject, eventdata, handles)
- function DFShi_CreateFcn(hObject, eventdata, handles)
- function HABlim_Callback(hObject, eventdata, handles)
- function HABlim_CreateFcn(hObject, eventdata, handles)
- function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
- function uipanel3_SelectionChangeFcn(hObject, eventdata, handles)
- function PlotDAVcheckbox_Callback(hObject, eventdata, handles)
- function AscaleEditBox_Callback(hObject, eventdata, handles)
- function AscaleEditBox_CreateFcn(hObject, eventdata, handles)
- function pushbutton2_Callback(hObject, eventdata, handles)
- function PlotDAVcheckbox_DeleteFcn(hObject, eventdata, handles)
- function PlotDAVButton_Callback(hObject, eventdata, handles)
- function edit5_Callback(hObject, eventdata, handles)
- function edit5_CreateFcn(hObject, eventdata, handles)
- function tav_editbox_Callback(hObject, eventdata, handles)
- function tav_editbox_CreateFcn(hObject, eventdata, handles)

## SOURCE CODE

    0001 function varargout = ASCII2GIS_GUI(varargin)
    0002 % ASCII2GIS_GUI M-file for ASCII2GIS_GUI.fig
    0003 %      ASCII2GIS_GUI, by itself, creates a new ASCII2GIS_GUI or raises the existing
    0004 %      singleton*.
    0005 %
    0006 %      H = ASCII2GIS_GUI returns the handle to a new ASCII2GIS_GUI or the handle to
    0007 %      the existing singleton*.
    0008 %
    0009 %      ASCII2GIS_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
    0010 %      function named CALLBACK in ASCII2GIS_GUI.M with the given input arguments.
    0011 %
    0012 %      ASCII2GIS_GUI('Property','Value',...) creates a new ASCII2GIS_GUI or raises the
    0013 %      existing singleton*.  Starting from the left, property value pairs are
    0014 %      applied to the GUI before ASCII2GIS_GUI_OpeningFcn gets called.  An
    0015 %      unrecognized property name or invalid value makes property application
    0016 %      stop.  All inputs are passed to ASCII2GIS_GUI_OpeningFcn via varargin.
    0017 %
    0018 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    0019 %      instance to run (singleton)".
    0020 %
    0021 % See also: GUIDE, GUIDATA, GUIHANDLES
    0022
    0023 % Edit the above text to modify the response to help ASCII2GIS_GUI
    0024
    0025 % Last Modified by GUIDE v2.5 20-Mar-2012 09:55:20
    0026
    0027 % Begin initialization code - DO NOT EDIT
    0028 gui_Singleton = 1;
    0029 gui_State = struct('gui_Name',       mfilename, ...
    0030                    'gui_Singleton',  gui_Singleton, ...
    0031                    'gui_OpeningFcn', @ASCII2GIS_GUI_OpeningFcn, ...
    0032                    'gui_OutputFcn',  @ASCII2GIS_GUI_OutputFcn, ...
    0033                    'gui_LayoutFcn',  [] , ...
    0034                    'gui_Callback',   []);
    0035 if nargin && ischar(varargin{1})
    0036     gui_State.gui_Callback = str2func(varargin{1});
    0037 end
    0038
    0039 if nargout
    0040     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    0041 else
    0042     gui_mainfcn(gui_State, varargin{:});
    0043 end
    0044 % End initialization code - DO NOT EDIT
    0045
    0046
    0047 % --- Executes just before ASCII2GIS_GUI is made visible.
    0048 function ASCII2GIS_GUI_OpeningFcn(hObject, eventdata, handles, varargin)
    0049 % This function has no output args, see OutputFcn.
    0050 % hObject    handle to figure
    0051 % eventdata  reserved - to be defined in a future version of MATLAB
    0052 % handles    structure with handles and user data (see GUIDATA)
    0053 % varargin   command line arguments to ASCII2GIS_GUI (see VARARGIN)
    0054
    0055 % Choose default command line output for ASCII2GIS_GUI
    0056 handles.output = hObject;
    0057
    0058 % Update handles structure
    0059 guidata(hObject, handles);
    0060
    0061 % Ensure path to utils & docs is available
    0062 % ----------------------------------------
    0063 filesep = '\'; % windows
    0064 utilspath = [pwd filesep 'utils'];
    0065 docspath  = [pwd filesep 'doc'];
    0066 toolspath = [pwd filesep 'tools'];
    0067 addpath(utilspath,docspath,toolspath)
    0068
    0069 % UIWAIT makes ASCII2GIS_GUI wait for user response (see UIRESUME)
    0070 % uiwait(handles.figure1);
    0071
    0072
    0073 % --- Outputs from this function are returned to the command line.
    0074 function varargout = ASCII2GIS_GUI_OutputFcn(hObject, eventdata, handles)
    0075 % varargout  cell array for returning output args (see VARARGOUT);
    0076 % hObject    handle to figure
    0077 % eventdata  reserved - to be defined in a future version of MATLAB
    0078 % handles    structure with handles and user data (see GUIDATA)
    0079
    0080 % Get default command line output from handles structure
    0081 varargout{1} = handles.output;
    0082
    0083 %Initialize variables
    0084 handles.dfslow       = 0;
    0085 handles.dfshi        = 1;
    0086 handles.hablim       = 1;
    0087 handles.DFSfull      = 0;
    0088 handles.units        = 1;
    0089 handles.ref          = 1;
    0090 handles.VelOut       = [];
    0091 handles.goodrows     = [];
    0092 handles.Ascale       = 1.0;
    0093 handles.Vspace       = 1;
    0094 handles.TAV          = [];
    0095
    0096 guidata(hObject, handles);
    0097
    0098
    0099 % --- Executes on button press in RunButton.
    0100 function RunButton_Callback(hObject, eventdata, handles)
    0101 % hObject    handle to RunButton (see GCBO)
    0102 % eventdata  reserved - to be defined in a future version of MATLAB
    0103 % handles    structure with handles and user data (see GUIDATA)
    0104 if handles.ref
    0105     vref = 'dfs';
    0106     disp('Reference is set to DFS')
    0107     if handles.DFSfull
    0108         drange = [];
    0109         disp('DFS Range set to Full Depth' )
    0110     else
    0111         if handles.units
    0112             drange = [handles.dfslow handles.dfshi];
    0113             disp(['DFS Range = ' num2str(drange(1)) ' to ' num2str(drange(2)) ' m'])
    0114         else %units = Feet
    0115             drange = [handles.dfslow handles.dfshi]./3.281;  % Convert to meters
    0116             disp(['DFS Range = ' num2str(drange(1)*3.281) ' to ' num2str(drange(2)*3.281) ' ft'])
    0117         end
    0118     end
    0119 else
    0120     vref = 'hab';
    0121     disp('Reference is set to HAB')
    0122     if handles.units
    0123         drange = handles.hablim;
    0124         disp(['HAB Limit = ' num2str(drange) ' m'])
    0125     else %units = Feet
    0126         drange = handles.hablim./3.281;  % Convert to meters
    0127         disp(['HAB Limit = ' num2str(drange*3.281) ' ft'])
    0128     end
    0129 end
    0130
    0131 [handles.VelOut,handles.goodrows] = ASCII2GIS(drange,vref,handles.TAV);
    0132 guidata(hObject,handles)
    0133
    0134 % --- Executes on button press in FullDepthcheckbox.
    0135 function FullDepthcheckbox_Callback(hObject, eventdata, handles)
    0136 % hObject    handle to FullDepthcheckbox (see GCBO)
    0137 % eventdata  reserved - to be defined in a future version of MATLAB
    0138 % handles    structure with handles and user data (see GUIDATA)
    0139
    0140 % Hint: get(hObject,'Value') returns toggle state of FullDepthcheckbox
    0141 handles.DFSfull = get(hObject,'Value');
    0142 guidata(hObject,handles)
    0143
    0144
    0145
    0146
    0147 function DFSlow_Callback(hObject, eventdata, handles)
    0148 % hObject    handle to DFSlow (see GCBO)
    0149 % eventdata  reserved - to be defined in a future version of MATLAB
    0150 % handles    structure with handles and user data (see GUIDATA)
    0151
    0152 % Hints: get(hObject,'String') returns contents of DFSlow as text
    0153 %        str2double(get(hObject,'String')) returns contents of DFSlow as a double
    0154 handles.dfslow = str2double(get(hObject,'String'));
    0155 guidata(hObject,handles)
    0156
    0157
    0158
    0159 % --- Executes during object creation, after setting all properties.
    0160 function DFSlow_CreateFcn(hObject, eventdata, handles)
    0161 % hObject    handle to DFSlow (see GCBO)
    0162 % eventdata  reserved - to be defined in a future version of MATLAB
    0163 % handles    empty - handles not created until after all CreateFcns called
    0164
    0165 % Hint: edit controls usually have a white background on Windows.
    0166 %       See ISPC and COMPUTER.
    0167 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0168     set(hObject,'BackgroundColor','white');
    0169 end
    0170
    0171
    0172
    0173 function DFShi_Callback(hObject, eventdata, handles)
    0174 % hObject    handle to DFShi (see GCBO)
    0175 % eventdata  reserved - to be defined in a future version of MATLAB
    0176 % handles    structure with handles and user data (see GUIDATA)
    0177
    0178 % Hints: get(hObject,'String') returns contents of DFShi as text
    0179 %        str2double(get(hObject,'String')) returns contents of DFShi as a double
    0180 handles.dfshi = str2double(get(hObject,'String'));
    0181 guidata(hObject,handles)
    0182
    0183
    0184
    0185 % --- Executes during object creation, after setting all properties.
    0186 function DFShi_CreateFcn(hObject, eventdata, handles)
    0187 % hObject    handle to DFShi (see GCBO)
    0188 % eventdata  reserved - to be defined in a future version of MATLAB
    0189 % handles    empty - handles not created until after all CreateFcns called
    0190
    0191 % Hint: edit controls usually have a white background on Windows.
    0192 %       See ISPC and COMPUTER.
    0193 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0194     set(hObject,'BackgroundColor','white');
    0195 end
    0196
    0197
    0198
    0199 function HABlim_Callback(hObject, eventdata, handles)
    0200 % hObject    handle to HABlim (see GCBO)
    0201 % eventdata  reserved - to be defined in a future version of MATLAB
    0202 % handles    structure with handles and user data (see GUIDATA)
    0203
    0204 % Hints: get(hObject,'String') returns contents of HABlim as text
    0205 %        str2double(get(hObject,'String')) returns contents of HABlim as a double
    0206 handles.hablim = str2double(get(hObject,'String'));
    0207 guidata(hObject,handles)
    0208
    0209
    0210
    0211 % --- Executes during object creation, after setting all properties.
    0212 function HABlim_CreateFcn(hObject, eventdata, handles)
    0213 % hObject    handle to HABlim (see GCBO)
    0214 % eventdata  reserved - to be defined in a future version of MATLAB
    0215 % handles    empty - handles not created until after all CreateFcns called
    0216
    0217 % Hint: edit controls usually have a white background on Windows.
    0218 %       See ISPC and COMPUTER.
    0219 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0220     set(hObject,'BackgroundColor','white');
    0221 end
    0222
    0223
    0224 % --- Executes when selected object is changed in uipanel1.
    0225 function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
    0226 % hObject    handle to the selected object in uipanel1
    0227 % eventdata  structure with the following fields (see UIBUTTONGROUP)
    0228 %    EventName: string 'SelectionChanged' (read only)
    0229 %    OldValue: handle of the previously selected object or empty if none was selected
    0230 %    NewValue: handle of the currently selected object
    0231 % handles    structure with handles and user data (see GUIDATA)
    0232 switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
    0233     case 'DFSradiobutton'
    0234         handles.ref = 1;
    0235     case 'HABradiobutton'
    0236         handles.ref = 0;
    0237     % Continue with more cases as necessary.
    0238     otherwise
    0239         handles.ref = 1;
    0240 end
    0241 guidata(hObject,handles)
    0242
    0243
    0244
    0245 % --- Executes when selected object is changed in uipanel3.
    0246 function uipanel3_SelectionChangeFcn(hObject, eventdata, handles)
    0247 % hObject    handle to the selected object in uipanel3
    0248 % eventdata  structure with the following fields (see UIBUTTONGROUP)
    0249 %    EventName: string 'SelectionChanged' (read only)
    0250 %    OldValue: handle of the previously selected object or empty if none was selected
    0251 %    NewValue: handle of the currently selected object
    0252 % handles    structure with handles and user data (see GUIDATA)
    0253 switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
    0254     case 'Feetradiobutton'
    0255         handles.units = 0;
    0256     case 'Metersradiobutton'
    0257         handles.units = 1;
    0258     % Continue with more cases as necessary.
    0259     otherwise
    0260         handles.units = 1;
    0261 end
    0262 guidata(hObject,handles)
    0263
    0264
    0265 % --- Executes on button press in PlotDAVcheckbox.
    0266 function PlotDAVcheckbox_Callback(hObject, eventdata, handles)
    0267 % hObject    handle to PlotDAVcheckbox (see GCBO)
    0268 % eventdata  reserved - to be defined in a future version of MATLAB
    0269 % handles    structure with handles and user data (see GUIDATA)
    0270
    0271 % Hint: get(hObject,'Value') returns toggle state of PlotDAVcheckbox
    0272
    0273 handles.plotDAV = get(hObject,'Value');
    0274 guidata(hObject,handles)
    0275
    0276
    0277 function AscaleEditBox_Callback(hObject, eventdata, handles)
    0278 % hObject    handle to AscaleEditBox (see GCBO)
    0279 % eventdata  reserved - to be defined in a future version of MATLAB
    0280 % handles    structure with handles and user data (see GUIDATA)
    0281
    0282 % Hints: get(hObject,'String') returns contents of AscaleEditBox as text
    0283 %        str2double(get(hObject,'String')) returns contents of AscaleEditBox as a double
    0284
    0285 handles.Ascale = str2double(get(hObject,'String'));
    0286 guidata(hObject,handles)
    0287
    0288
    0289 % --- Executes during object creation, after setting all properties.
    0290 function AscaleEditBox_CreateFcn(hObject, eventdata, handles)
    0291 % hObject    handle to AscaleEditBox (see GCBO)
    0292 % eventdata  reserved - to be defined in a future version of MATLAB
    0293 % handles    empty - handles not created until after all CreateFcns called
    0294
    0295 % Hint: edit controls usually have a white background on Windows.
    0296 %       See ISPC and COMPUTER.
    0297 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0298     set(hObject,'BackgroundColor','white');
    0299 end
    0300
    0301
    0302 % --- Executes on button press in pushbutton2.
    0303 function pushbutton2_Callback(hObject, eventdata, handles)
    0304 % hObject    handle to pushbutton2 (see GCBO)
    0305 % eventdata  reserved - to be defined in a future version of MATLAB
    0306 % handles    structure with handles and user data (see GUIDATA)
    0307
    0308 %overlay DOQQ
    0309 msgbox('Adding Background','VMT Status','help','replace');
    0310 log_text = VMT_OverlayDOQQ(pwd);
    0311 msgbox('Replotting Complete','VMT Status','help','replace');
    0312
    0313
    0314 % --- Executes during object deletion, before destroying properties.
    0315 function PlotDAVcheckbox_DeleteFcn(hObject, eventdata, handles)
    0316 % hObject    handle to PlotDAVcheckbox (see GCBO)
    0317 % eventdata  reserved - to be defined in a future version of MATLAB
    0318 % handles    structure with handles and user data (see GUIDATA)
    0319
    0320
    0321 % --- Executes on button press in PlotDAVButton.
    0322 function PlotDAVButton_Callback(hObject, eventdata, handles)
    0323 % hObject    handle to PlotDAVButton (see GCBO)
    0324 % eventdata  reserved - to be defined in a future version of MATLAB
    0325 % handles    structure with handles and user data (see GUIDATA)
    0326
    0327 %Plot the DAV data
    0328 msgbox('Plotting Vectors...Please be patient','VMT Status','help','replace');
    0329 VMT_PlotDAVvectors(handles.VelOut(handles.goodrows,1),handles.VelOut(handles.goodrows,2),handles.VelOut(handles.goodrows,4),handles.VelOut(handles.goodrows,5),handles.Ascale,handles.Vspace,handles.units)
    0330 msgbox('Plotting Complete','VMT Status','help','replace');
    0331
    0332
    0333 function edit5_Callback(hObject, eventdata, handles)
    0334 % hObject    handle to edit5 (see GCBO)
    0335 % eventdata  reserved - to be defined in a future version of MATLAB
    0336 % handles    structure with handles and user data (see GUIDATA)
    0337
    0338 % Hints: get(hObject,'String') returns contents of edit5 as text
    0339 %        str2double(get(hObject,'String')) returns contents of edit5 as a double
    0340
    0341 handles.Vspace = str2double(get(hObject,'String'));
    0342 guidata(hObject,handles)
    0343
    0344
    0345 % --- Executes during object creation, after setting all properties.
    0346 function edit5_CreateFcn(hObject, eventdata, handles)
    0347 % hObject    handle to edit5 (see GCBO)
    0348 % eventdata  reserved - to be defined in a future version of MATLAB
    0349 % handles    empty - handles not created until after all CreateFcns called
    0350
    0351 % Hint: edit controls usually have a white background on Windows.
    0352 %       See ISPC and COMPUTER.
    0353 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0354     set(hObject,'BackgroundColor','white');
    0355 end
    0356
    0357
    0358
    0359 function tav_editbox_Callback(hObject, eventdata, handles)
    0360 % hObject    handle to tav_editbox (see GCBO)
    0361 % eventdata  reserved - to be defined in a future version of MATLAB
    0362 % handles    structure with handles and user data (see GUIDATA)
    0363
    0364 % Hints: get(hObject,'String') returns contents of tav_editbox as text
    0365 %        str2double(get(hObject,'String')) returns contents of tav_editbox as a double
    0366 handles.TAV = str2double(get(hObject,'String'));
    0367 guidata(hObject,handles)
    0368
    0369
    0370 % --- Executes during object creation, after setting all properties.
    0371 function tav_editbox_CreateFcn(hObject, eventdata, handles)
    0372 % hObject    handle to tav_editbox (see GCBO)
    0373 % eventdata  reserved - to be defined in a future version of MATLAB
    0374 % handles    empty - handles not created until after all CreateFcns called
    0375
    0376 % Hint: edit controls usually have a white background on Windows.
    0377 %       See ISPC and COMPUTER.
    0378 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0379     set(hObject,'BackgroundColor','white');
    0380 end