function [cmat,hout] = contorm(varargin)

%CONTORM  Project a contour plot of data onto the current map axes
%
%  CONTORM(lat,lon,map) produces a contour plot of map data projected
%  onto the current map axes.  The input latitude and longitude vectors
%  can be the size of map (as in a general matrix map), or can specify the 
%  corresponding row and column dimensions for the map.
%
%  CONTORM(map,maplegend) produces a contour plot of map data in a 
%  regular matrix map.
%
%  CONTORM(lat,lon,map,'LineSpec') uses any valid LineSpec string
%  to draw the contour lines.
%
%  CONTORM(lat,lon,map,'PropertyName',PropertyValue,...) uses the
%  line properties specified to draw the contours.
%
%  CONTORM(lat,lon,map,n,...) draws n contour levels, where n is a scalar.
%
%  CONTORM(lat,lon,map,v,...) draws contours at the levels specified
%  by the input vector v.
%
%  CONTORM(map,maplegend,...) takes any of the optional arguments 
%  described above.
%
%  c = CONTORM(...) returns a standard contour matrix, with the first
%  row representing longitude data and the second row represents
%  latitude data.
%
%  [c,h] = CONTORM(...) returns the contour matrix and the handles
%  to the contour lines drawn.
%
%  CONTORM, without any inputs, will activate a GUI to project contour
%  lines onto the current map axes.
%
%  See also CONTOR3M, CONTOUR, PLOT

%  Copyright 1996-2000 Systems Planning and Analysis, Inc. and The MathWorks, Inc.
%  Written by:  E. Byrns, E. Brown
%   $Revision: 1.9 $    $Date: 2000/01/18 02:02:54 $

if nargin == 0;            contor3m;   return
     elseif nargin < 2;    error('Incorrect number of arguments');
end

%  Compute and project the contour levels

[c,h,msg] = contor3m(varargin{:});
if ~isempty(msg);   error(msg);   end

%  Set the zdata to the zero plane

zdatam(h,0);

%  Set the output arguments

if nargout == 1
    cmat = c;
elseif nargout == 2
    cmat = c;  hout = h;
end
