function m_track(lon,lat,varargin); % M_TRACK Draw a trackline on a map % % M_TRACK draws navigation tracklines on a map. The trackline % itself is optionally annontated with tick marks, time labels, and % date labels. % % M_TRACK (lon,lat) draws just a plain line. lon&lat are in decimal % degrees, +N, -S, +E, -W. % % M_TRACK (lon,lat,navtimes) draws a line, with tick marks every % hour, time labels every four hours, and date labels every twelve % hours. navtimes is in MatLab "serial date numbers," representing the % number of days since January 1, 0000. By convention, ticks and % time labels are drawn on the starboard side, dates on the port. % % M_TRACK (lon,lat,navtime, 'string', property/value pairs) can be % used to change tick marks, time and date label properties. Allowable % combinations are: % % 'ticks' tickmark interval in minutes, default=60 % 'times' time label interval in minutes, default=240 (4hrs) % 'dates' date label interval in minutes, default=720 (12hrs) % 'timef[ormat]' format of time string, see datestr(), default=15 % 'datef[ormat]' format of date string, see datestr(), default=2 % 'color' color of track/labels, default is black % 'linew[idth]' width of trackline, default is current % 'lines[tyle]' style of line, default is solid line % 'fonts[ize]' size of font, default is current % 'fontn[ame]' name of font, default is current % 'clip' 'on' or 'off' (clipping to map) % 'orien[t]' label orientation, 'true' or 'upright', default='true' % % time labels need to be whole multiples of tick intervals. date % labels need to be whole multiples of time labels. using '0' for % any value will tick/label all points. using a negative number % will suppress tick/label. % m_track.m, Peter Lemmond, peter@whoi.edu 13/Nov/98 % % RP - 14/Nov/98 - corrected angle for first label, added tags, added CLIP % options, made labels always face upwards % PL - 04/Dec/98 - added orientation option, to allow labels to either % always follow heading ('true') or to always face upwards % ('upright'). changed quite a bit internally to make % faster and fix some bugs % - 23/Aug/01 - if numinputs = 2 an extra initialization statement % was needed (thanks to Dan Lowen for this fix). global MAP_PROJECTION MAP_VAR_LIST % Have to have initialized a map first if isempty (MAP_PROJECTION), disp ('No Map Projection initialized - call M_PROJ first!'); return; end; numinputs = nargin; % save this TICKS = 60; % default of 60 minute ticks TIMES = 240; % default of 4 hour times, 240 mins DATES = 720; % default of 12 hour dates, 720 minutes TIMEF = 15; % default of HH:MM DATEF = 2; % default of mm/dd/yy COLOR = 'k'; % default is black LINES = '-'; % default is solid line LINEW = get(gca,'linewidth'); % default is current width FONTS = get(gca,'fontsize'); % default is current fontsize FONTN = get(gca,'fontname'); % default is current fontname CLIP = 'on'; % default is to clip ORIEN = 'true'; % default is always follow heading MINSPERDAY = 1440; % need at least lon & lat if numinputs < 2 disp ('Need at least lon & lat vectors!'); return; else l=length(lat); m=length(lon); if (l ~= m) disp ('long and lat vectors must be the same length'); return; end; end; % check for time input. has to be the first varargin if numinputs > 2 if ischar(varargin{1}) navTimes = []; k = 1; else navTimes=varargin{1}; k = 2; end else % numinputs = 2 % Extra case courtesy Dan Lowen. navTimes = []; k = 1; end % look at any remaining options while k