VMT_GraphicsControl

PURPOSE ^

--- THE VELOCITY MAPPING TOOLBOX ---

SYNOPSIS ^

function varargout = VMT_GraphicsControl(varargin)

DESCRIPTION ^

 --- THE VELOCITY MAPPING TOOLBOX ---
 VMT_GRAPHICSCONTROL is a sub-GUI of VMT which allows the user to
 dynamically adjust the figures.
__________________________________________________________________________
 Frank L. Engel, U.S. Geological Survey, Illinois Water Science Center
 (fengel@usgs.gov)

 Code contributed by P.R. Jackson, D. Parsons, D. Mueller, and J. Czuba.
__________________________________________________________________________

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = VMT_GraphicsControl(varargin)
0002 % --- THE VELOCITY MAPPING TOOLBOX ---
0003 % VMT_GRAPHICSCONTROL is a sub-GUI of VMT which allows the user to
0004 % dynamically adjust the figures.
0005 %__________________________________________________________________________
0006 % Frank L. Engel, U.S. Geological Survey, Illinois Water Science Center
0007 % (fengel@usgs.gov)
0008 %
0009 % Code contributed by P.R. Jackson, D. Parsons, D. Mueller, and J. Czuba.
0010 %__________________________________________________________________________
0011 
0012 % Last Modified by GUIDE v2.5 24-Jul-2013 14:55:36
0013 
0014 % Begin initialization code - DO NOT EDIT
0015 gui_Singleton = 1;
0016 gui_State = struct('gui_Name',       mfilename, ...
0017     'gui_Singleton',  gui_Singleton, ...
0018     'gui_OpeningFcn', @VMT_GraphicsControl_OpeningFcn, ...
0019     'gui_OutputFcn',  @VMT_GraphicsControl_OutputFcn, ...
0020     'gui_LayoutFcn',  [] , ...
0021     'gui_Callback',   []);
0022 if nargin && ischar(varargin{1})
0023     gui_State.gui_Callback = str2func(varargin{1});
0024 end
0025 
0026 if nargout
0027     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0028 else
0029     gui_mainfcn(gui_State, varargin{:});
0030 end
0031 % End initialization code - DO NOT EDIT
0032 
0033 
0034 % --- Executes just before VMT_GraphicsControl is made visible.
0035 function VMT_GraphicsControl_OpeningFcn(hObject, eventdata, handles, varargin)
0036 % This function has no output args, see OutputFcn.
0037 % hObject    handle to figure
0038 % eventdata  reserved - to be defined in a future version of MATLAB
0039 % handles    structure with handles and user data (see GUIDATA)
0040 % varargin   command line arguments to VMT_GraphicsControl (see VARARGIN)
0041 
0042 % Choose default command line output for VMT_GraphicsControl
0043 handles.output = hObject;
0044 
0045 % Update handles structure
0046 guidata(hObject, handles);
0047 
0048 % Initialize the GUI parameters:
0049 % ------------------------------
0050 guiparams = createGUIparams;
0051 
0052 % Store the application data
0053 % --------------------------
0054 setappdata(handles.figure1,'guiparams',guiparams)
0055 
0056 % Load the GUI preferences:
0057 % -------------------------
0058 load_prefs(handles.figure1)
0059 
0060 % Initialize the GUI:
0061 % -------------------
0062 initGUI(handles)
0063 % set_enable(handles,'init')
0064 
0065 % UIWAIT makes VMT_GraphicsControl wait for user response (see UIRESUME)
0066 % uiwait(handles.figure1);
0067 
0068 % [EOF] VMT_GraphicsControl_OpeningFcn
0069 
0070 
0071 % --- Outputs from this function are returned to the command line.
0072 function varargout = VMT_GraphicsControl_OutputFcn(hObject, eventdata, handles)
0073 % varargout  cell array for returning output args (see VARARGOUT);
0074 % hObject    handle to figure
0075 % eventdata  reserved - to be defined in a future version of MATLAB
0076 % handles    structure with handles and user data (see GUIDATA)
0077 
0078 % Get default command line output from handles structure
0079 varargout{1} = handles.output;
0080 
0081 
0082 % --- Executes on button press in UseDataLimitsPlanview.
0083 function UseDataLimitsPlanview_Callback(hObject, eventdata, handles)
0084 
0085 % Get the Application Data
0086 % ------------------------
0087 guiparams = getappdata(handles.figure1,'guiparams');
0088 
0089 % Modify the Application data:
0090 % ----------------------------
0091 guiparams.use_data_limits_planview = logical(get(hObject,'Value')); % boolean
0092 
0093 if ~guiparams.use_data_limits_planview % User wants to set limits
0094     % Update the GUI:
0095     % ---------------
0096     set_enable(handles,'setplanviewon')
0097 else
0098     % Re-populate edit boxes with the data limits
0099     % -------------------------------------------
0100     % Compute the data limits to populate edit boxes
0101     PVdata = guiparams.gp_vmt.iric_anv_planview_data.outmat';
0102     PVdata(:,4:5) = PVdata(:,4:5).*100; % in cm/s
0103     vr = sqrt(PVdata(:,4).^2+PVdata(:,5).^2);
0104     guiparams.min_velocity_planview  = nanmin(vr);
0105     guiparams.max_velocity_planview  = nanmax(vr);
0106     
0107     % Ensure correct units
0108     if ~guiparams.gp_vmt.english_units
0109         % No further action
0110     else
0111         guiparams.min_velocity_planview = guiparams.min_velocity_planview*0.03281;
0112         guiparams.max_velocity_planview = guiparams.max_velocity_planview*0.03281;
0113         %guiparams.min_velocity_mcs      = guiparams.min_velocity_mcs*0.03281;
0114         %guiparams.max_velocity_mcs      = guiparams.max_velocity_mcs*0.03281;
0115     end
0116     set(handles.MinVelocityPlanview, 'String', guiparams.min_velocity_planview);
0117     set(handles.MaxVelocityPlanview, 'String', guiparams.max_velocity_planview);
0118     
0119     % Update the GUI:
0120     % ---------------
0121     set_enable(handles,'setplanviewoff')
0122 end
0123 
0124 % Re-store the Application data:
0125 % ------------------------------
0126 setappdata(handles.figure1,'guiparams',guiparams)
0127 
0128 % [EOF] VMT_GraphicsControl_OutputFcn
0129 
0130 
0131 
0132 
0133 
0134 function MinVelocityPlanview_Callback(hObject, eventdata, handles)
0135 % Get the Application data:
0136 % -------------------------
0137 guiparams = getappdata(handles.figure1,'guiparams');
0138 
0139 % Get the new entry and make sure it is valid (numeric, positive):
0140 % ----------------------------------------------------------------
0141 new_value = str2double(get(hObject,'String'));
0142 is_a_number = ~isnan(new_value);
0143 
0144 % Modify the Application data:
0145 % ----------------------------
0146 if is_a_number
0147     guiparams.min_velocity_planview = new_value;
0148     
0149     % Re-store the Application data:
0150     % ------------------------------
0151     setappdata(handles.figure1,'guiparams',guiparams)
0152     
0153 else % Reject the (incorrect) input
0154     set(hObject,'String',guiparams.min_velocity_planview)
0155 end
0156 % [EOF] MinVelocityPlanview_Callback
0157 
0158 
0159 
0160 
0161 
0162 function MaxVelocityPlanview_Callback(hObject, eventdata, handles)
0163 % Get the Application data:
0164 % -------------------------
0165 guiparams = getappdata(handles.figure1,'guiparams');
0166 
0167 % Get the new entry and make sure it is valid (numeric, positive):
0168 % ----------------------------------------------------------------
0169 new_value = str2double(get(hObject,'String'));
0170 is_a_number = ~isnan(new_value);
0171 
0172 % Modify the Application data:
0173 % ----------------------------
0174 if is_a_number
0175     guiparams.max_velocity_planview = new_value;
0176     
0177     % Re-store the Application data:
0178     % ------------------------------
0179     setappdata(handles.figure1,'guiparams',guiparams)
0180     
0181 else % Reject the (incorrect) input
0182     set(hObject,'String',guiparams.max_velocity_planview)
0183 end
0184 % [EOF] MaxVelocityPlanview_Callback
0185 
0186 
0187 
0188 % --- Executes on selection change in ColormapPlanview.
0189 function ColormapPlanview_Callback(hObject, eventdata, handles)
0190 % Get the Application data:
0191 % -------------------------
0192 guiparams = getappdata(handles.figure1,'guiparams');
0193 guiprefs  = getappdata(handles.figure1,'guiprefs');
0194 
0195 % Modify the Application data:
0196 % ----------------------------
0197 idx_variable = get(hObject,'Value');
0198 guiparams.idx_colormap_planview = idx_variable;
0199 guiparams.colormap_planview = guiparams.colormaps_planview(idx_variable).string;
0200 
0201 if strcmpi('Browse for more (cpt)...',guiparams.colormap_planview)
0202     [FileName,PathName] = uigetfile('*.cpt','Select the cpt colormap file',...
0203         fullfile(guiprefs.cpt_path,guiprefs.cpt_file));
0204     guiparams.cpt_planview = fullfile(PathName,FileName);
0205     
0206     % Update the preferences:
0207     % -----------------------
0208     guiprefs.cpt_path = PathName;
0209     guiprefs.cpt_file = FileName;
0210     setappdata(handles.figure1,'guiprefs',guiprefs)
0211     store_prefs(handles.figure1,'cptplanview')
0212 end
0213 
0214 % Re-store the Application data:
0215 % ------------------------------
0216 setappdata(handles.figure1,'guiparams',guiparams)
0217 
0218 % [EOF] ColormapPlanview_Callback
0219 
0220 
0221 
0222 % --- Executes on button press in UseDataLimitsMCS.
0223 function UseDataLimitsMCS_Callback(hObject, eventdata, handles)
0224 % Get the Application Data
0225 % ------------------------
0226 guiparams = getappdata(handles.figure1,'guiparams');
0227 
0228 % Modify the Application data:
0229 % ----------------------------
0230 guiparams.use_data_limits_mcs = logical(get(hObject,'Value')); % boolean
0231 
0232 if ~guiparams.use_data_limits_mcs % User wants to set limits
0233     % Update the GUI:
0234     % ---------------
0235     set_enable(handles,'setmcson')
0236 else
0237     % Re-populate edit boxes with the data limits
0238     % -------------------------------------------
0239     % Compute the data limits to populate edit boxes
0240     switch guiparams.gp_vmt.contour
0241         case 'streamwise'
0242             vmin = nanmin(guiparams.gp_vmt.V.uSmooth(:));
0243             vmax = nanmax(guiparams.gp_vmt.V.uSmooth(:));
0244         case 'transverse'
0245             vmin = nanmin(guiparams.gp_vmt.V.vSmooth(:));
0246             vmax = nanmax(guiparams.gp_vmt.V.vSmooth(:));
0247         case 'vertical'
0248             vmin = nanmin(guiparams.gp_vmt.V.wSmooth(:));
0249             vmax = nanmax(guiparams.gp_vmt.V.wSmooth(:));
0250         case 'mag'
0251             vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0252             vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0253         case 'east'
0254             vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0255             vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0256         case 'north'
0257             vmin = nanmin(guiparams.gp_vmt.V.mcsEastSmooth(:));
0258             vmax = nanmax(guiparams.gp_vmt.V.mcsNorthSmooth(:));
0259         case 'primary_zsd'
0260             vmin = nanmin(guiparams.gp_vmt.V.vpSmooth(:));
0261             vmax = nanmax(guiparams.gp_vmt.V.vpSmooth(:));
0262         case 'secondary_zsd'
0263             vmin = nanmin(guiparams.gp_vmt.V.vsSmooth(:));
0264             vmax = nanmax(guiparams.gp_vmt.V.vsSmooth(:));
0265         case 'primary_roz'
0266             vmin = nanmin(guiparams.gp_vmt.V.Roz.upSmooth(:));
0267             vmax = nanmax(guiparams.gp_vmt.V.Roz.upSmooth(:));
0268         case 'secondary_roz'
0269             vmin = nanmin(guiparams.gp_vmt.V.Roz.usSmooth(:));
0270             vmax = nanmax(guiparams.gp_vmt.V.Roz.usSmooth(:));
0271         case 'primary_roz_x'
0272             vmin = nanmin(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0273             vmax = nanmax(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0274         case 'primary_roz_y'
0275             vmin = nanmin(guiparams.gp_vmt.V.Roz.upySmooth(:));
0276             vmax = nanmax(guiparams.gp_vmt.V.Roz.upySmooth(:));
0277         case 'secondary_roz_x'
0278             vmin = nanmin(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0279             vmax = nanmax(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0280         case 'secondary_roz_y'
0281             vmin = nanmin(guiparams.gp_vmt.V.Roz.usySmooth(:));
0282             vmax = nanmax(guiparams.gp_vmt.V.Roz.usySmooth(:));
0283         case 'backscatter'
0284             vmin = nanmin(guiparams.gp_vmt.V.mcsBackSmooth(:));
0285             vmax = nanmax(guiparams.gp_vmt.V.mcsBackSmooth(:));
0286         case 'flowangle'
0287             vmin = nanmin(guiparams.gp_vmt.V.mcsDirSmooth(:));
0288             vmax = nanmax(guiparams.gp_vmt.V.mcsDirSmooth(:));
0289     end
0290     guiparams.min_velocity_mcs              = vmin;
0291     guiparams.max_velocity_mcs              = vmax;
0292     
0293     % Ensure correct units
0294     if ~guiparams.gp_vmt.english_units
0295         % No further action
0296     else
0297         %guiparams.min_velocity_planview = guiparams.min_velocity_planview*0.03281;
0298         %guiparams.max_velocity_planview = guiparams.max_velocity_planview*0.03281;
0299         guiparams.min_velocity_mcs      = guiparams.min_velocity_mcs*0.03281;
0300         guiparams.max_velocity_mcs      = guiparams.max_velocity_mcs*0.03281;
0301     end
0302     set(handles.MinVelocityMCS, 'String', guiparams.min_velocity_mcs);
0303     set(handles.MaxVelocityMCS, 'String', guiparams.max_velocity_mcs);
0304     
0305     % Update the GUI:
0306     % ---------------
0307     set_enable(handles,'setmcsoff')
0308 end
0309 
0310 % Re-store the Application data:
0311 % ------------------------------
0312 setappdata(handles.figure1,'guiparams',guiparams)
0313 
0314 % [EOF] UseDataLimitsMCS_Callback
0315 
0316 
0317 function MinVelocityMCS_Callback(hObject, eventdata, handles)
0318 % Get the Application data:
0319 % -------------------------
0320 guiparams = getappdata(handles.figure1,'guiparams');
0321 
0322 % Get the new entry and make sure it is valid (numeric):
0323 % ----------------------------------------------------------------
0324 new_value = str2double(get(hObject,'String'));
0325 is_a_number = ~isnan(new_value);
0326 
0327 % Modify the Application data:
0328 % ----------------------------
0329 if is_a_number
0330     guiparams.min_velocity_mcs = new_value;
0331     
0332     % Re-store the Application data:
0333     % ------------------------------
0334     setappdata(handles.figure1,'guiparams',guiparams)
0335     
0336 else % Reject the (incorrect) input
0337     set(hObject,'String',guiparams.min_velocity_mcs)
0338 end
0339 % [EOF] MinVelocityMCS_Callback
0340 
0341 
0342 
0343 
0344 function MaxVelocityMCS_Callback(hObject, eventdata, handles)
0345 % Get the Application data:
0346 % -------------------------
0347 guiparams = getappdata(handles.figure1,'guiparams');
0348 
0349 % Get the new entry and make sure it is valid (numeric):
0350 % ----------------------------------------------------------------
0351 new_value = str2double(get(hObject,'String'));
0352 is_a_number = ~isnan(new_value);
0353 
0354 % Modify the Application data:
0355 % ----------------------------
0356 if is_a_number
0357     guiparams.max_velocity_mcs = new_value;
0358     
0359     % Re-store the Application data:
0360     % ------------------------------
0361     setappdata(handles.figure1,'guiparams',guiparams)
0362     
0363 else % Reject the (incorrect) input
0364     set(hObject,'String',guiparams.max_velocity_mcs)
0365 end
0366 % [EOF] MaxVelocityMCS_Callback
0367 
0368 
0369 
0370 % --- Executes on selection change in ColormapMCS.
0371 function ColormapMCS_Callback(hObject, eventdata, handles)
0372 % Get the Application data:
0373 % -------------------------
0374 guiparams = getappdata(handles.figure1,'guiparams');
0375 guiprefs  = getappdata(handles.figure1,'guiprefs');
0376 
0377 % Modify the Application data:
0378 % ----------------------------
0379 idx_variable = get(hObject,'Value');
0380 guiparams.idx_colormap_mcs = idx_variable;
0381 guiparams.colormap_mcs = guiparams.colormaps_mcs(idx_variable).string;
0382 
0383 if strcmpi('Browse for more (cpt)...',guiparams.colormap_mcs)
0384     [FileName,PathName] = uigetfile('*.cpt','Select the cpt colormap file',...
0385         fullfile(guiprefs.cpt_path,guiprefs.cpt_file));
0386     guiparams.cpt_mcs = fullfile(PathName,FileName);
0387     
0388     % Update the preferences:
0389     % -----------------------
0390     guiprefs.cpt_path = PathName;
0391     guiprefs.cpt_file = FileName;
0392     setappdata(handles.figure1,'guiprefs',guiprefs)
0393     store_prefs(handles.figure1,'cptmcs')
0394 end
0395 
0396 % Re-store the Application data:
0397 % ------------------------------
0398 setappdata(handles.figure1,'guiparams',guiparams)
0399 
0400 % [EOF] ColormapMCS_Callback
0401 
0402 
0403 
0404 function ReferenceVelocity_Callback(hObject, eventdata, handles)
0405 % Get the Application data:
0406 % -------------------------
0407 guiparams = getappdata(handles.figure1,'guiparams');
0408 
0409 % Get the new entry and make sure it is valid (numeric, positive):
0410 % ----------------------------------------------------------------
0411 new_value = str2double(get(hObject,'String'));
0412 is_a_number = ~isnan(new_value);
0413 is_positive = new_value>=0;
0414 
0415 % Modify the Application data:
0416 % ----------------------------
0417 if is_a_number && is_positive
0418     guiparams.reference_velocity = new_value;
0419     
0420     % Re-store the Application data:
0421     % ------------------------------
0422     setappdata(handles.figure1,'guiparams',guiparams)
0423     
0424 else % Reject the (incorrect) input
0425     set(hObject,'String',guiparams.reference_velocity)
0426 end
0427 % [EOF] ReferenceVelocity_Callback
0428 
0429 
0430 
0431 
0432 % --- Executes on button press in UseDefaults.
0433 function UseDefaults_Callback(hObject, eventdata, handles)
0434 % Get the Application Data
0435 % ------------------------
0436 guiparams = getappdata(handles.figure1,'guiparams');
0437 
0438 % Modify the Application data:
0439 % ----------------------------
0440 guiparams.use_defaults = logical(get(hObject,'Value')); % boolean
0441 
0442 if ~guiparams.use_defaults % User wants to set limits
0443     % Update the GUI:
0444     % ---------------
0445     set_enable(handles,'setrefon')
0446 else
0447     [~,J] = ind2sub(size(guiparams.gp_vmt.V.vp(1,:)),find(~isnan(guiparams.gp_vmt.V.vp(1,:))==1));
0448     et = J(1):guiparams.gp_vmt.horizontal_vector_spacing:J(end);
0449     [r, ~]=size(guiparams.gp_vmt.V.vp);
0450     bi = 1:guiparams.gp_vmt.vertical_vector_spacing:r;
0451     switch guiparams.gp_vmt.secondary_flow_vector_variable
0452         case 'transverse'
0453             reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vSmooth(bi,et)))));
0454         case 'secondary_zsd'
0455             reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vsSmooth(bi,et)))));
0456         case 'secondary_roz'
0457             reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usSmooth(bi,et)))));
0458         case 'secondary_roz_y'
0459             reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usySmooth(bi,et)))));
0460         case 'primary_roz_y'
0461             reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.upySmooth(bi,et)))));
0462     end
0463     
0464     distance = 0.06*max(guiparams.gp_vmt.V.mcsDist(:));
0465     depth    = 0.95*max(guiparams.gp_vmt.V.mcsBed(:));
0466     if guiparams.gp_vmt.english_units
0467         reference_velocity = reference_velocity*0.03281; % cm/s to ft/s
0468         distance = distance*3.281;
0469         depth    = depth*3.281;
0470     end
0471     
0472     
0473     set(handles.ReferenceVelocity, 'String', num2str(reference_velocity))
0474     set(handles.Distance,          'String', num2str(distance))
0475     set(handles.Depth,             'String', num2str(depth))
0476     
0477     % Re-store the Application data:
0478     % ------------------------------
0479     guiparams.reference_velocity = reference_velocity;
0480     guiparams.distance           = distance;
0481     guiparams.depth              = depth;
0482     setappdata(handles.figure1,'guiparams',guiparams)
0483     
0484     % Update the GUI:
0485     % ---------------
0486     set_enable(handles,'setrefoff')
0487 end
0488 
0489 
0490 % [EOF] UseDefaults_Callback
0491 
0492 
0493 function Distance_Callback(hObject, eventdata, handles)
0494 % Get the Application data:
0495 % -------------------------
0496 guiparams = getappdata(handles.figure1,'guiparams');
0497 
0498 % Get the new entry and make sure it is valid (numeric, positive):
0499 % ----------------------------------------------------------------
0500 new_value = str2double(get(hObject,'String'));
0501 is_a_number = ~isnan(new_value);
0502 is_positive = new_value>=0;
0503 
0504 % Modify the Application data:
0505 % ----------------------------
0506 if is_a_number && is_positive
0507     guiparams.distance = new_value;
0508     
0509     % Re-store the Application data:
0510     % ------------------------------
0511     setappdata(handles.figure1,'guiparams',guiparams)
0512     
0513 else % Reject the (incorrect) input
0514     set(hObject,'String',guiparams.distance)
0515 end
0516 % [EOF] Distance_Callback
0517 
0518 
0519 
0520 
0521 
0522 function Depth_Callback(hObject, eventdata, handles)
0523 % Get the Application data:
0524 % -------------------------
0525 guiparams = getappdata(handles.figure1,'guiparams');
0526 
0527 % Get the new entry and make sure it is valid (numeric, positive):
0528 % ----------------------------------------------------------------
0529 new_value = str2double(get(hObject,'String'));
0530 is_a_number = ~isnan(new_value);
0531 is_positive = new_value>=0;
0532 
0533 % Modify the Application data:
0534 % ----------------------------
0535 if is_a_number && is_positive
0536     guiparams.depth = new_value;
0537     
0538     % Re-store the Application data:
0539     % ------------------------------
0540     setappdata(handles.figure1,'guiparams',guiparams)
0541     
0542 else % Reject the (incorrect) input
0543     set(hObject,'String',guiparams.depth)
0544 end
0545 % [EOF] Depth_Callback
0546 
0547 
0548 
0549 
0550 % --- Executes on button press in ApplyChanges.
0551 function ApplyChanges_Callback(hObject, eventdata, handles)
0552 % Get the Application data:
0553 % -------------------------
0554 guiparams = getappdata(handles.figure1,'guiparams');
0555 guiprefs  = getappdata(handles.figure1,'guiprefs');
0556 z   = guiparams.gp_vmt.z;
0557 A   = guiparams.gp_vmt.A;
0558 V   = guiparams.gp_vmt.V;
0559 Map = guiparams.gp_vmt.Map;
0560 
0561 % See if PLOT 1 exists already, if so grab the handle.
0562 fig_planview_handle = findobj(0,'name','Plan View Map');
0563 
0564 % If PLOT 1 exists, go ahead and apply any changes
0565 if ~isempty(fig_planview_handle) &&  ishandle(fig_planview_handle)
0566     figure(fig_planview_handle);
0567     % Plot the data:
0568     % --------------
0569     %msgbox('Plotting Plan View','VMT Status','help','replace');
0570     depth_range = [guiparams.gp_vmt.depth_range_min guiparams.gp_vmt.depth_range_max];
0571     
0572     minrng = guiparams.min_velocity_planview;
0573     maxrng = guiparams.max_velocity_planview;
0574     usecolormap = guiparams.colormap_planview;
0575     cptfullfile = guiparams.cpt_planview;
0576     [~,~,~] = VMT_PlotPlanViewQuivers(z,A,V,Map, ...
0577         depth_range, ...
0578         guiparams.gp_vmt.vector_scale_plan_view, ...
0579         guiparams.gp_vmt.vector_spacing_plan_view, ...
0580         guiparams.gp_vmt.smoothing_window_size, ...
0581         guiparams.gp_vmt.display_shoreline, ...
0582         guiparams.gp_vmt.english_units,...
0583         guiparams.gp_vmt.mat_file, ...
0584         guiparams.gp_vmt.mat_path,...
0585         minrng,...
0586         maxrng,...
0587         usecolormap,...
0588         cptfullfile); % PLOT2
0589     
0590     % Plot Shoreline
0591     if guiparams.gp_vmt.display_shoreline
0592         
0593         if ischar(guiprefs.shoreline_file) % User did not hit cancel
0594             mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
0595             Map.UTMe   = mapdata(:,1);
0596             Map.UTMn   = mapdata(:,2);
0597             Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
0598             %Map.UTMzone = zone;
0599         else
0600             Map = [];
0601         end
0602         VMT_PlotShoreline(Map)
0603     end
0604     
0605     % Overlay DOQQ
0606     if guiparams.gp_vmt.add_background
0607         [~,~] = VMT_OverlayDOQQ(guiprefs,true);
0608     end
0609 end
0610 
0611 % See if PLOT 3 exists already, if so clear the figure
0612 fig_contour_handle = findobj(0,'name','Mean Cross Section Contour');
0613 
0614 % If PLOT 3 exists, go ahead and apply any changes
0615 if ~isempty(fig_contour_handle) &&  ishandle(fig_contour_handle)
0616     figure(fig_contour_handle);
0617     
0618     % Modify reference vector, only if it's already being plotted
0619     if guiparams.gp_vmt.plot_secondary_flow_vectors
0620         if ~guiparams.gp_vmt.english_units
0621             [~,A,V,plot_cont_log_text] = VMT_PlotXSContQuiver(z,A,V, ...
0622                 guiparams.gp_vmt.contour, ...
0623                 guiparams.gp_vmt.vector_scale_cross_section, ...
0624                 guiparams.gp_vmt.vertical_exaggeration, ...
0625                 guiparams.gp_vmt.horizontal_vector_spacing, ...
0626                 guiparams.gp_vmt.vertical_vector_spacing, ...
0627                 guiparams.gp_vmt.secondary_flow_vector_variable, ...
0628                 guiparams.gp_vmt.include_vertical_velocity, ...
0629                 guiparams.gp_vmt.english_units,...
0630                 guiparams.reference_velocity,...
0631                 guiparams.distance,...
0632                 guiparams.depth); %#ok<ASGLU> % PLOT3
0633         else
0634             [~,A,V,plot_cont_log_text] = VMT_PlotXSContQuiver(z,A,V, ...
0635                 guiparams.gp_vmt.contour, ...
0636                 guiparams.gp_vmt.vector_scale_cross_section, ...
0637                 guiparams.gp_vmt.vertical_exaggeration, ...
0638                 guiparams.gp_vmt.horizontal_vector_spacing, ...
0639                 guiparams.gp_vmt.vertical_vector_spacing, ...
0640                 guiparams.gp_vmt.secondary_flow_vector_variable, ...
0641                 guiparams.gp_vmt.include_vertical_velocity, ...
0642                 guiparams.gp_vmt.english_units,...
0643                 guiparams.reference_velocity.*30.48,... %cm/s
0644                 guiparams.distance.*0.3048,...          %m
0645                 guiparams.depth.*0.3048); %#ok<ASGLU> % PLOT3
0646         end
0647     end
0648     
0649     % Set data limits
0650     caxis([
0651         guiparams.min_velocity_mcs
0652         guiparams.max_velocity_mcs])
0653     
0654     % Apply the color map
0655     if ~strcmpi('Browse for more (cpt)...',guiparams.colormap_mcs)
0656         colormap(guiparams.colormap_mcs)
0657     else
0658         cptcmap(guiparams.cpt_mcs)
0659     end
0660 end
0661 
0662 % Force plots to be formated properly
0663 % -----------------------------------
0664 if guiparams.gp_vmt.presentation
0665     UpdatePlotStyle(hObject, eventdata, handles)
0666 else
0667     UpdatePlotStyle(hObject, eventdata, handles)
0668 end
0669 % [EOF] ApplyChanges_Callback
0670 
0671 
0672 % --- Executes on button press in Close.
0673 function Close_Callback(hObject, eventdata, handles)
0674 
0675 close(handles.figure1)
0676 
0677 % [EOF] Close_Callback
0678 
0679 % --------------------------------------------------------------------
0680 function initGUI(handles)
0681 % Initialize the UI controls in the GUI.
0682 
0683 guiparams = getappdata(handles.figure1,'guiparams');
0684 
0685 % Plan View Map Panel
0686 set(handles.UseDataLimitsPlanview,    'Value',  guiparams.use_data_limits_planview);
0687 set(handles.MinVelocityPlanview,      'String', guiparams.min_velocity_planview);
0688 set(handles.MinVelocityPlanviewUnits, 'String', guiparams.min_velocity_planview_units);
0689 set(handles.MaxVelocityPlanview,      'String', guiparams.max_velocity_planview);
0690 set(handles.MaxVelocityPlanviewUnits, 'String', guiparams.max_velocity_planview_units);
0691 set(handles.ColormapPlanview,         'String',{guiparams.colormaps_planview.string}, ...
0692     'Value', guiparams.idx_colormap_planview)
0693 
0694 % Mean Cross Section Contours
0695 set(handles.UseDataLimitsMCS,           'Value',  guiparams.use_data_limits_mcs);
0696 set(handles.MinVelocityMCS,             'String', guiparams.min_velocity_mcs);
0697 set(handles.MinVelocityMCSUnits,        'String', guiparams.min_velocity_mcs_units);
0698 set(handles.MaxVelocityMCS,             'String', guiparams.max_velocity_mcs);
0699 set(handles.MaxVelocityMCSUnits,        'String', guiparams.max_velocity_mcs_units);
0700 set(handles.UseDefaults,                'Value',  guiparams.use_defaults);
0701 set(handles.ReferenceVelocity,          'String', guiparams.reference_velocity);
0702 set(handles.ReferenceVelocityUnits,     'String', guiparams.reference_velocity_units);
0703 set(handles.Distance,                   'String', guiparams.distance);
0704 set(handles.DistanceUnits,              'String', guiparams.distance_units);
0705 set(handles.Depth,                      'String', guiparams.depth);
0706 set(handles.DepthUnits,                 'String', guiparams.depth_units);
0707 set(handles.ColormapMCS,                'String',{guiparams.colormaps_mcs.string}, ...
0708     'Value', guiparams.idx_colormap_mcs);
0709 
0710 % Update the GUI:
0711 % ---------------
0712 if iscell(guiparams.gp_vmt.mat_file) % Multiple mat files loaded
0713     set_enable(handles,'initmultiple')
0714 else
0715     set_enable(handles,'init')
0716 end
0717 % [EOF] initGUI
0718 
0719 function [guiparams] = createGUIparams
0720 
0721 % Get the VMT current state for use by the sub-GUI
0722 % ------------------------------------------------
0723 hVMTgui                 = getappdata(0,'hVMTgui');
0724 guiparams_vmt           = getappdata(hVMTgui,'guiparams');
0725 guiparams.gp_vmt        = guiparams_vmt;
0726 
0727 % Check to see what plots already exist
0728 % -------------------------------------
0729 fig_planview_handle = findobj(0,'name','Plan View Map');
0730 fig_mcs_handle = findobj(0,'name','Mean Cross Section Contour');
0731 % if ~isempty(fig_planview_handle) &&  ishandle(fig_planview_handle)
0732 %     figure(fig_planview_handle); clf
0733 % else
0734 %     fig_planview_handle = figure('name','Plan View Map'); clf
0735 %     %set(gca,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
0736 % end
0737 
0738 %%%%%%%%%%%%%%%%%
0739 % Plan View Map %
0740 %%%%%%%%%%%%%%%%%
0741 guiparams.use_data_limits_planview      = 1;
0742 
0743 if ~isempty(fig_planview_handle) && ishandle(fig_planview_handle)
0744     % Compute the data limits to populate edit boxes
0745     PVdata = guiparams.gp_vmt.iric_anv_planview_data.outmat';
0746     PVdata(:,4:5) = PVdata(:,4:5).*100; % in cm/s
0747     vr = sqrt(PVdata(:,4).^2+PVdata(:,5).^2);
0748     guiparams.min_velocity_planview  = nanmin(vr);
0749     guiparams.max_velocity_planview  = nanmax(vr);
0750 else
0751     guiparams.min_velocity_planview  = 0;
0752     guiparams.max_velocity_planview  = 0;
0753 end
0754 
0755 % Colormap choices
0756 guiparams.idx_colormap_planview  = 1;
0757 idx = 1;
0758 guiparams.colormaps_planview(idx).string   = 'Jet';
0759 idx = idx + 1;
0760 guiparams.colormaps_planview(idx).string   = 'HSV';
0761 idx = idx + 1;
0762 guiparams.colormaps_planview(idx).string   = 'Hot';
0763 idx = idx + 1;
0764 guiparams.colormaps_planview(idx).string   = 'Cool';
0765 idx = idx + 1;
0766 guiparams.colormaps_planview(idx).string   = 'Spring';
0767 idx = idx + 1;
0768 guiparams.colormaps_planview(idx).string   = 'Summer';
0769 idx = idx + 1;
0770 guiparams.colormaps_planview(idx).string   = 'Autumn';
0771 idx = idx + 1;
0772 guiparams.colormaps_planview(idx).string   = 'Winter';
0773 idx = idx + 1;
0774 guiparams.colormaps_planview(idx).string   = 'Gray';
0775 idx = idx + 1;
0776 guiparams.colormaps_planview(idx).string   = 'Bone';
0777 idx = idx + 1;
0778 guiparams.colormaps_planview(idx).string   = 'Copper';
0779 idx = idx + 1;
0780 guiparams.colormaps_planview(idx).string   = 'Pink';
0781 idx = idx + 1;
0782 guiparams.colormaps_planview(idx).string   = 'Browse for more (cpt)...';
0783 guiparams.colormap_planview = ...
0784     guiparams.colormaps_planview(guiparams.idx_colormap_planview).string;
0785 guiparams.cpt_planview                     = [];
0786 
0787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0788 % Mean Cross Section Contours %
0789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0790 guiparams.use_data_limits_mcs           = 1;
0791 guiparams.use_defaults                  = 1;
0792 
0793 if ~isempty(fig_mcs_handle) && ishandle(fig_mcs_handle)
0794 if iscell(guiparams.gp_vmt.mat_file) % Multiple mat files loaded
0795     guiparams.min_velocity_mcs   = 0;
0796     guiparams.max_velocity_mcs   = 0;
0797     guiparams.distance           = 0;
0798     guiparams.depth              = 0;
0799     guiparams.reference_velocity = 0; % cm/s to ft/s
0800 else
0801     % Compute the data limits for the edit box, based on the currently selected
0802     % contour plot variable
0803     switch guiparams.gp_vmt.contour
0804         case 'streamwise'
0805             vmin = nanmin(guiparams.gp_vmt.V.uSmooth(:));
0806             vmax = nanmax(guiparams.gp_vmt.V.uSmooth(:));
0807         case 'transverse'
0808             vmin = nanmin(guiparams.gp_vmt.V.vSmooth(:));
0809             vmax = nanmax(guiparams.gp_vmt.V.vSmooth(:));
0810         case 'vertical'
0811             vmin = nanmin(guiparams.gp_vmt.V.wSmooth(:));
0812             vmax = nanmax(guiparams.gp_vmt.V.wSmooth(:));
0813         case 'mag'
0814             vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0815             vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0816         case 'east'
0817             vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0818             vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0819         case 'north'
0820             vmin = nanmin(guiparams.gp_vmt.V.mcsEastSmooth(:));
0821             vmax = nanmax(guiparams.gp_vmt.V.mcsNorthSmooth(:));
0822         case 'primary_zsd'
0823             vmin = nanmin(guiparams.gp_vmt.V.vpSmooth(:));
0824             vmax = nanmax(guiparams.gp_vmt.V.vpSmooth(:));
0825         case 'secondary_zsd'
0826             vmin = nanmin(guiparams.gp_vmt.V.vsSmooth(:));
0827             vmax = nanmax(guiparams.gp_vmt.V.vsSmooth(:));
0828         case 'primary_roz'
0829             vmin = nanmin(guiparams.gp_vmt.V.Roz.upSmooth(:));
0830             vmax = nanmax(guiparams.gp_vmt.V.Roz.upSmooth(:));
0831         case 'secondary_roz'
0832             vmin = nanmin(guiparams.gp_vmt.V.Roz.usSmooth(:));
0833             vmax = nanmax(guiparams.gp_vmt.V.Roz.usSmooth(:));
0834         case 'primary_roz_x'
0835             vmin = nanmin(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0836             vmax = nanmax(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0837         case 'primary_roz_y'
0838             vmin = nanmin(guiparams.gp_vmt.V.Roz.upySmooth(:));
0839             vmax = nanmax(guiparams.gp_vmt.V.Roz.upySmooth(:));
0840         case 'secondary_roz_x'
0841             vmin = nanmin(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0842             vmax = nanmax(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0843         case 'secondary_roz_y'
0844             vmin = nanmin(guiparams.gp_vmt.V.Roz.usySmooth(:));
0845             vmax = nanmax(guiparams.gp_vmt.V.Roz.usySmooth(:));
0846         case 'backscatter'
0847             vmin = nanmin(guiparams.gp_vmt.V.mcsBackSmooth(:));
0848             vmax = nanmax(guiparams.gp_vmt.V.mcsBackSmooth(:));
0849         case 'flowangle'
0850             vmin = nanmin(guiparams.gp_vmt.V.mcsDirSmooth(:));
0851             vmax = nanmax(guiparams.gp_vmt.V.mcsDirSmooth(:));
0852     end
0853     guiparams.min_velocity_mcs              = vmin;
0854     guiparams.max_velocity_mcs              = vmax;
0855     
0856     % Reference arrow
0857     [~,J] = ind2sub(size(guiparams.gp_vmt.V.vp(1,:)),find(~isnan(guiparams.gp_vmt.V.vp(1,:))==1));
0858     et = J(1):guiparams.gp_vmt.horizontal_vector_spacing:J(end);
0859     [r, ~]=size(guiparams.gp_vmt.V.vp);
0860     bi = 1:guiparams.gp_vmt.vertical_vector_spacing:r;
0861     switch guiparams.gp_vmt.secondary_flow_vector_variable
0862         case 'transverse'
0863             guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vSmooth(bi,et)))));
0864         case 'secondary_zsd'
0865             guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vsSmooth(bi,et)))));
0866         case 'secondary_roz'
0867             guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usSmooth(bi,et)))));
0868         case 'secondary_roz_y'
0869             guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usySmooth(bi,et)))));
0870         case 'primary_roz_y'
0871             guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.upySmooth(bi,et)))));
0872     end
0873     
0874     guiparams.distance = 0.06*max(guiparams.gp_vmt.V.mcsDist(:));
0875     guiparams.depth    = 0.95*max(guiparams.gp_vmt.V.mcsBed(:));
0876     if guiparams.gp_vmt.english_units
0877         guiparams.reference_velocity = guiparams.reference_velocity*0.03281; % cm/s to ft/s
0878         guiparams.distance           = guiparams.distance*3.281;
0879         guiparams.depth              = guiparams.depth*3.281;
0880     end
0881 end
0882 else
0883     guiparams.min_velocity_mcs   = 0;
0884     guiparams.max_velocity_mcs   = 0;
0885     guiparams.distance           = 0;
0886     guiparams.depth              = 0;
0887     guiparams.reference_velocity = 0; % cm/s to ft/s
0888 end
0889 
0890 guiparams.idx_colormap_mcs              = 1;
0891 
0892 % Colormap choices
0893 idx = 1;
0894 guiparams.colormaps_mcs(idx).string   = 'Jet';
0895 idx = idx + 1;
0896 guiparams.colormaps_mcs(idx).string   = 'HSV';
0897 idx = idx + 1;
0898 guiparams.colormaps_mcs(idx).string   = 'Hot';
0899 idx = idx + 1;
0900 guiparams.colormaps_mcs(idx).string   = 'Cool';
0901 idx = idx + 1;
0902 guiparams.colormaps_mcs(idx).string   = 'Spring';
0903 idx = idx + 1;
0904 guiparams.colormaps_mcs(idx).string   = 'Summer';
0905 idx = idx + 1;
0906 guiparams.colormaps_mcs(idx).string   = 'Autumn';
0907 idx = idx + 1;
0908 guiparams.colormaps_mcs(idx).string   = 'Winter';
0909 idx = idx + 1;
0910 guiparams.colormaps_mcs(idx).string   = 'Gray';
0911 idx = idx + 1;
0912 guiparams.colormaps_mcs(idx).string   = 'Bone';
0913 idx = idx + 1;
0914 guiparams.colormaps_mcs(idx).string   = 'Copper';
0915 idx = idx + 1;
0916 guiparams.colormaps_mcs(idx).string   = 'Pink';
0917 idx = idx + 1;
0918 guiparams.colormaps_mcs(idx).string   = 'Browse for more (cpt)...';
0919 guiparams.colormap_mcs = ...
0920     guiparams.colormaps_mcs(guiparams.idx_colormap_mcs).string;
0921 guiparams.cpt_mcs                      = [];
0922 
0923 % Set the units
0924 switch guiparams.gp_vmt.contour
0925     case 'backscatter'
0926         guiparams.min_velocity_mcs_units   = 'dB';
0927         guiparams.max_velocity_mcs_units   = 'dB';
0928         if ~guiparams.gp_vmt.english_units
0929             guiparams.min_velocity_planview_units   = 'cm/s';
0930             guiparams.max_velocity_planview_units   = 'cm/s';
0931             %guiparams.min_velocity_mcs_units        = 'cm/s';
0932             %guiparams.max_velocity_mcs_units        = 'cm/s';
0933             guiparams.reference_velocity_units      = 'cm/s';
0934             guiparams.distance_units                = 'm';
0935             guiparams.depth_units                   = 'm';
0936         else
0937             guiparams.min_velocity_planview_units   = 'ft/s';
0938             guiparams.max_velocity_planview_units   = 'ft/s';
0939             %guiparams.min_velocity_mcs_units        = 'ft/s';
0940             %guiparams.max_velocity_mcs_units        = 'ft/s';
0941             guiparams.reference_velocity_units      = 'ft/s';
0942             guiparams.distance_units                = 'ft';
0943             guiparams.depth_units                   = 'ft';
0944         end
0945     case 'flowangle'
0946         guiparams.min_velocity_mcs_units   = 'deg';
0947         guiparams.max_velocity_mcs_units   = 'deg';
0948         if ~guiparams.gp_vmt.english_units
0949             guiparams.min_velocity_planview_units   = 'cm/s';
0950             guiparams.max_velocity_planview_units   = 'cm/s';
0951             %guiparams.min_velocity_mcs_units        = 'cm/s';
0952             %guiparams.max_velocity_mcs_units        = 'cm/s';
0953             guiparams.reference_velocity_units      = 'cm/s';
0954             guiparams.distance_units                = 'm';
0955             guiparams.depth_units                   = 'm';
0956         else
0957             guiparams.min_velocity_planview_units   = 'ft/s';
0958             guiparams.max_velocity_planview_units   = 'ft/s';
0959             %guiparams.min_velocity_mcs_units        = 'ft/s';
0960             %guiparams.max_velocity_mcs_units        = 'ft/s';
0961             guiparams.reference_velocity_units      = 'ft/s';
0962             guiparams.distance_units                = 'ft';
0963             guiparams.depth_units                   = 'ft';
0964         end
0965     otherwise
0966         if ~guiparams.gp_vmt.english_units
0967             guiparams.min_velocity_planview_units   = 'cm/s';
0968             guiparams.max_velocity_planview_units   = 'cm/s';
0969             
0970             guiparams.min_velocity_mcs_units        = 'cm/s';
0971             guiparams.max_velocity_mcs_units        = 'cm/s';
0972             guiparams.reference_velocity_units      = 'cm/s';
0973             guiparams.distance_units                = 'm';
0974             guiparams.depth_units                   = 'm';
0975         else
0976             guiparams.min_velocity_planview_units   = 'ft/s';
0977             guiparams.max_velocity_planview_units   = 'ft/s';
0978             
0979             guiparams.min_velocity_mcs_units        = 'ft/s';
0980             guiparams.max_velocity_mcs_units        = 'ft/s';
0981             guiparams.reference_velocity_units      = 'ft/s';
0982             guiparams.distance_units                = 'ft';
0983             guiparams.depth_units                   = 'ft';
0984             
0985             guiparams.min_velocity_planview = guiparams.min_velocity_planview*0.03281;
0986             guiparams.max_velocity_planview = guiparams.max_velocity_planview*0.03281;
0987             guiparams.min_velocity_mcs      = guiparams.min_velocity_mcs*0.03281;
0988             guiparams.max_velocity_mcs      = guiparams.max_velocity_mcs*0.03281;
0989         end
0990 end
0991 % [EOF] createGUIparams
0992 
0993 % --------------------------------------------------------------------
0994 function set_enable(handles,enable_state)
0995 
0996 guiparams = getappdata(handles.figure1,'guiparams');
0997 
0998 switch enable_state
0999     case 'init'
1000         % Plan View Map Panel
1001         set([handles.UseDataLimitsPlanview
1002             handles.ColormapPlanview],'Enable', 'on');
1003         set([handles.MinVelocityPlanview
1004             handles.MinVelocityPlanviewUnits
1005             handles.MaxVelocityPlanview
1006             handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1007         
1008         % Mean Cross Section Contours
1009         set([handles.UseDataLimitsMCS
1010             handles.UseDefaults
1011             handles.ColormapMCS],'Enable', 'on');
1012         set([handles.MinVelocityMCS
1013             handles.MinVelocityMCSUnits
1014             handles.MaxVelocityMCS
1015             handles.MaxVelocityMCSUnits
1016             handles.ReferenceVelocity
1017             handles.ReferenceVelocityUnits
1018             handles.Distance
1019             handles.DistanceUnits
1020             handles.Depth
1021             handles.DepthUnits], 'Enable', 'off');
1022     case 'initmultiple'
1023         % Plan View Map Panel
1024         set([handles.UseDataLimitsPlanview
1025             handles.ColormapPlanview],'Enable', 'on');
1026         set([handles.MinVelocityPlanview
1027             handles.MinVelocityPlanviewUnits
1028             handles.MaxVelocityPlanview
1029             handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1030         
1031         % Mean Cross Section Contours
1032         set([handles.UseDataLimitsMCS
1033             handles.UseDefaults
1034             handles.ColormapMCS],'Enable', 'off');
1035         set([handles.MinVelocityMCS
1036             handles.MinVelocityMCSUnits
1037             handles.MaxVelocityMCS
1038             handles.MaxVelocityMCSUnits
1039             handles.ReferenceVelocity
1040             handles.ReferenceVelocityUnits
1041             handles.Distance
1042             handles.DistanceUnits
1043             handles.Depth
1044             handles.DepthUnits], 'Enable', 'off');
1045     case 'setplanviewon'
1046         % Plan View Map Panel
1047         set([handles.UseDataLimitsPlanview
1048             handles.ColormapPlanview],'Enable', 'on');
1049         set([handles.MinVelocityPlanview
1050             handles.MinVelocityPlanviewUnits
1051             handles.MaxVelocityPlanview
1052             handles.MaxVelocityPlanviewUnits], 'Enable', 'on');
1053     case 'setplanviewoff'
1054         % Plan View Map Panel
1055         set([handles.UseDataLimitsPlanview
1056             handles.ColormapPlanview],'Enable', 'on');
1057         set([handles.MinVelocityPlanview
1058             handles.MinVelocityPlanviewUnits
1059             handles.MaxVelocityPlanview
1060             handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1061     case 'setmcson'
1062         % Mean Cross Section Contours
1063         set([handles.UseDataLimitsMCS
1064             handles.ColormapMCS],'Enable', 'on');
1065         set([handles.MinVelocityMCS
1066             handles.MinVelocityMCSUnits
1067             handles.MaxVelocityMCS
1068             handles.MaxVelocityMCSUnits
1069             ], 'Enable', 'on');
1070     case 'setmcsoff'
1071         % Mean Cross Section Contours
1072         set([handles.UseDataLimitsMCS
1073             handles.ColormapMCS],'Enable', 'on');
1074         set([handles.MinVelocityMCS
1075             handles.MinVelocityMCSUnits
1076             handles.MaxVelocityMCS
1077             handles.MaxVelocityMCSUnits
1078             ], 'Enable', 'off');
1079     case 'setrefon'
1080         set([handles.ReferenceVelocity
1081             handles.ReferenceVelocityUnits
1082             handles.Distance
1083             handles.DistanceUnits
1084             handles.Depth
1085             handles.DepthUnits], 'Enable', 'on');
1086     case 'setrefoff'
1087         set([handles.ReferenceVelocity
1088             handles.ReferenceVelocityUnits
1089             handles.Distance
1090             handles.DistanceUnits
1091             handles.Depth
1092             handles.DepthUnits], 'Enable', 'off');
1093     otherwise
1094 end
1095 % [EOF] set_enable
1096 
1097 % --------------------------------------------------------------------
1098 function UpdatePlotStyle(hObject, eventdata, handles)
1099 % Get the Application Data:
1100 % -------------------------
1101 guiparams = getappdata(handles.figure1,'guiparams');
1102 
1103 % Modify the existing figures
1104 % ---------------------------
1105 % Find what plots exist already
1106 hf = findobj('type','figure');
1107 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
1108 
1109 if guiparams.gp_vmt.presentation
1110     % Defaults for Presentation Stlye Figure
1111     BkgdColor   = 'black';
1112     AxColor     = 'white';
1113     FigColor    = 'black'; % [0.3 0.3 0.3]
1114     FntSize     = 14;
1115 else
1116     % Defaults for Print Stlye Figure
1117     BkgdColor   = 'white';
1118     AxColor     = 'black';
1119     FigColor    = 'white'; % [0.3 0.3 0.3]
1120     FntSize     = 14;
1121 end
1122 % Loop through valid figures and adjust
1123 % -------------------------------------
1124 if ~isempty(hf) &&  any(ishandle(hf))
1125     
1126     for i = 1:length(valid_names)
1127         switch valid_names{i}
1128             case 'Plan View Map'
1129                 % Focus the figure
1130                 hff = findobj('name','Plan View Map');
1131                 if ~isempty(hff) &&  ishandle(hff)
1132                     figure(hff)
1133                     
1134                     % Make the changes to figure
1135                     set(gcf,'Color',BkgdColor);
1136                     set(gca,'FontSize',FntSize)
1137                     set(get(gca,'Title'),'FontSize',FntSize)
1138                     set(gca,'Color',FigColor)
1139                     set(gca,'XColor',AxColor)
1140                     set(gca,'YColor',AxColor)
1141                     set(gca,'ZColor',AxColor)
1142                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1143                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1144                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1145                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1146                 end
1147             case 'Mean Cross Section Contour'
1148                 % Focus the figure
1149                 hff = findobj('name','Mean Cross Section Contour');
1150                 if ~isempty(hff) &&  ishandle(hff)
1151                     figure(hff)
1152                     
1153                     % Make the changes to figure
1154                     set(gcf,'Color',BkgdColor);
1155                     set(gca,'FontSize',FntSize)
1156                     set(get(gca,'Title'),'FontSize',FntSize)
1157                     set(gca,'Color',[0.3 0.3 0.3]) %FigColor)
1158                     set(gca,'XColor',AxColor)
1159                     set(gca,'YColor',AxColor)
1160                     set(gca,'ZColor',AxColor)
1161                     set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1162                     set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1163                     set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1164                     set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1165                     set(findobj(gca,'tag','PlotBedElevation')   ,'color'    ,AxColor)
1166                     set(findobj(gca,'tag','ReferenceVectorText'),'color'    ,AxColor)
1167                 end
1168             otherwise
1169         end
1170     end
1171     
1172     
1173 end
1174 
1175 % [EOF] UpdatePlotStyle
1176 % --------------------------------------------------------------------
1177 
1178 % --------------------------------------------------------------------
1179 function load_prefs(hfigure)
1180 % Load the GUI preferences.  Also, initialize preferences if they don't
1181 % already exist.
1182 
1183 % Preferences:
1184 % 'cptplanview'     Path and filenames of current graphic (cpt) files for planview
1185 % 'cptmcs'          Path and filenames of current graphic (cpt) files for MCS
1186 % 'shoreline;
1187 % 'aerial'
1188 
1189 if ispref('VMT','cptplanview')
1190     cptplanview = getpref('VMT','cptplanview');
1191     if exist(cptplanview.path,'dir')
1192         guiprefs.cpt_path = cptplanview.path;
1193     else
1194         guiprefs.cpt_path = pwd;
1195     end
1196     
1197     if exist(fullfile(cptplanview.path,cptplanview.file),'file')
1198         guiprefs.cpt_file = cptplanview.file;
1199     else
1200         guiprefs.cpt_file = [];
1201     end
1202     
1203 else % Initialize graphics
1204     guiprefs.cpt_path = pwd;
1205     guiprefs.cpt_file = [];
1206     
1207     cptplanview.path = pwd;
1208     cptplanview.file = [];
1209     setpref('VMT','cptplanview',cptplanview)
1210 end
1211 
1212 if ispref('VMT','cptmcs')
1213     cptmcs = getpref('VMT','cptmcs');
1214     if exist(cptmcs.path,'dir')
1215         guiprefs.cpt_path = cptmcs.path;
1216     else
1217         guiprefs.cpt_path = pwd;
1218     end
1219     
1220     if exist(fullfile(cptmcs.path,cptmcs.file),'file')
1221         guiprefs.cpt_file = cptmcs.file;
1222     else
1223         guiprefs.cpt_file = [];
1224     end
1225     
1226 else % Initialize graphics
1227     guiprefs.cpt_path = pwd;
1228     guiprefs.cpt_file = [];
1229     
1230     cptmcs.path = pwd;
1231     cptmcs.file = [];
1232     setpref('VMT','cptplanview',cptplanview)
1233 end
1234 if ispref('VMT','shoreline')
1235     shoreline = getpref('VMT','shoreline');
1236     if exist(shoreline.path,'dir')
1237         guiprefs.shoreline_path = shoreline.path;
1238     else
1239         guiprefs.shoreline_path = pwd;
1240     end
1241     
1242     if exist(fullfile(shoreline.path,shoreline.file),'file')
1243         guiprefs.shoreline_file = shoreline.file;
1244     else
1245         guiprefs.shoreline_file = [];
1246     end
1247 end
1248 if ispref('VMT','aerial')
1249     aerial = getpref('VMT','aerial');
1250     if exist(aerial.path,'dir')
1251         guiprefs.aerial_path = aerial.path;
1252     else
1253         guiprefs.aerial_path = pwd;
1254     end
1255     if iscell(aerial.file)
1256         if exist(fullfile(aerial.path,aerial.file{1}),'file')
1257             guiprefs.aerial_file = aerial.file;
1258         else
1259             guiprefs.aerial_file = [];
1260         end
1261     else
1262         if exist(fullfile(aerial.path,aerial.file),'file')
1263             guiprefs.aerial_file = aerial.file;
1264         else
1265             guiprefs.aerial_file = [];
1266         end
1267     end
1268 end
1269 
1270 % Store the prefs
1271 % ---------------
1272 setappdata(hfigure,'guiprefs',guiprefs)
1273 
1274 function store_prefs(hfigure,pref)
1275 % Store preferences in the Application data and in the persistent
1276 % preferences data.
1277 
1278 % Preferences:
1279 % 'cptplanview'     Path and filenames of current graphic (cpt) files for planview
1280 % 'cptmcs'          Path and filenames of current graphic (cpt) files for MCS
1281 
1282 guiprefs = getappdata(hfigure,'guiprefs');
1283 
1284 switch pref
1285     case 'cptplanview'
1286         cptplanview.path = guiprefs.cpt_path;
1287         cptplanview.file = guiprefs.cpt_file;
1288         setpref('VMT','cptplanview',cptplanview)
1289     case 'cptmcs'
1290         cptmcs.path = guiprefs.cpt_path;
1291         cptmcs.file = guiprefs.cpt_file;
1292         setpref('VMT','cptmcs',cptmcs)
1293     otherwise
1294 end
1295 
1296 % [EOF] store_prefs

Generated on Wed 14-Aug-2013 08:31:52 by m2html © 2005