# VMT_OverlayDOQQ

## PURPOSE

Prompts the user for a geotiff DOQQ (USGS) and overlays the aerial image

## SYNOPSIS

function [guiprefs,log_text] = VMT_OverlayDOQQ(guiprefs,varargin)

## DESCRIPTION

     Prompts the user for a geotiff DOQQ (USGS) and overlays the aerial image
     in the plan view vector plot.  User can select multiple files.

     Currently only supports a geotiff in UTM corrdinates (USGS DOQQ for
     example) as the image is not projected and is plotted as XY data.

     Added save path functionality (PRJ, 6-23-10)

     P.R. Jackson, USGS 6-14-10
     Last modified: F.L. Engel, USGS, 7/25/2013

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- VMT --- THE VELOCITY MAPPING TOOLBOX ---

## SUBFUNCTIONS

- function mypostcallback_zoom(obj,evd)
- function mypostcallback_pan(obj,evd)

## SOURCE CODE

    0001 function [guiprefs,log_text] = VMT_OverlayDOQQ(guiprefs,varargin)
    0002 % Prompts the user for a geotiff DOQQ (USGS) and overlays the aerial image
    0003 % in the plan view vector plot.  User can select multiple files.
    0004 %
    0005 % Currently only supports a geotiff in UTM corrdinates (USGS DOQQ for
    0006 % example) as the image is not projected and is plotted as XY data.
    0007 %
    0008 % Added save path functionality (PRJ, 6-23-10)
    0009 %
    0010 % P.R. Jackson, USGS 6-14-10
    0011 % Last modified: F.L. Engel, USGS, 7/25/2013
    0012
    0013
    0014 if ~isempty(varargin)
    0015     skip_ui = varargin{1};
    0016 else
    0017     skip_ui = false;
    0018 end
    0019
    0020 % See if PLOT 1 exists already, if not, make the figure
    0021 fig_planview_handle = findobj(0,'name','Plan View Map');
    0022 if ~isempty(fig_planview_handle) &&  ishandle(fig_planview_handle)
    0023     figure(fig_planview_handle);
    0024 else
    0025     fig_planview_handle = figure('name','Plan View Map'); clf
    0026     %set(gca,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
    0027 end
    0028
    0029 if ~skip_ui
    0030     if iscell(guiprefs.aerial_file)
    0031         [guiprefs.aerial_file,guiprefs.aerial_path] = uigetfile(...
    0032             {'*.tif;*.shp;*.asc;*.grd;*.ddf','All Background Files'; '*.*','All Files'},...
    0033             'Select Background File(s)',...
    0034             'Multiselect', 'on',...
    0035             fullfile(guiprefs.aerial_path,guiprefs.aerial_file{1}));
    0036     else
    0037         [guiprefs.aerial_file,guiprefs.aerial_path] = uigetfile(...
    0038             {'*.tif;*.shp;*.asc;*.grd;*.ddf','All Background Files'; '*.*','All Files'},...
    0039             'Select Background File(s)',...
    0040             'Multiselect', 'on',...
    0041             fullfile(guiprefs.aerial_path,guiprefs.aerial_file));
    0042     end
    0043 end
    0044
    0045 if ischar(guiprefs.aerial_file) % User did not hit cancel, 1 file selected
    0046
    0047     hdlmap = mapshow(fullfile(guiprefs.aerial_path,guiprefs.aerial_file)); hold on
    0048     uistack(hdlmap,'bottom')
    0049     log_text = vertcat({'Adding background image:'},guiprefs.aerial_file);
    0050     set(gca,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
    0051     axis image on
    0052 elseif iscell(guiprefs.aerial_file) % User did not hit cancel, multiple files selected
    0053
    0054     for i = 1:length(guiprefs.aerial_file);
    0055         hdlmap = mapshow(fullfile(guiprefs.aerial_path,guiprefs.aerial_file{i})); hold on
    0056         uistack(hdlmap,'bottom')
    0057         log_text = vertcat({'Adding background image:'},guiprefs.aerial_file{i});
    0058     end
    0059     set(gca,'DataAspectRatio',[1 1 1],'PlotBoxAspectRatio',[1 1 1])
    0060     axis image on
    0061 end
    0062
    0063
    0064 % Format the ticks for UTM and allow zooming and panning
    0065 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM
    0066 hdlzm = zoom;
    0067 set(hdlzm,'ActionPostCallback',@mypostcallback_zoom);
    0068 set(hdlzm,'Enable','on');
    0069 hdlpn = pan;
    0070 set(hdlpn,'ActionPostCallback',@mypostcallback_pan);
    0071 set(hdlpn,'Enable','on');
    0072
    0073
    0074 %% Embedded functions
    0075 function mypostcallback_zoom(obj,evd)
    0076 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when zooming)
    0077
    0078 function mypostcallback_pan(obj,evd)
    0079 ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM (when panning)
    0080
    0081
    0082
    0083
    0084