function handle = big_centered_text(par, string)

% big_centered_text - display big text centered on axes
% -----------------------------------------------------
%
% handle = big_centered_text(par, string)
%
% Input:
% ------
%  par - parent axes 
%  string - display string
%
% Output:
% -------
%  handle - text handle

%--------------------------------
% Author: Harold Figueroa
%--------------------------------
% $Revision: 4580 $
% $Date: 2006-04-14 17:24:52 -0400 (Fri, 14 Apr 2006) $
%--------------------------------

% TODO: add display options

% TODO: develop display with axes and figure parent

%---------------------------
% HANDLE INPUT
%---------------------------

%--
% check parent input
%--

if ~ishandle(par) || ~strcmp(get(par, 'type'), 'axes')
	error('Parent input must be axes handle.');
end

%--
% get handle to big text
%--

% NOTE: ensure singleton condition for figure

handle = findobj(ancestor(par, 'figure'), 'tag', 'BIG_CENTERED_TEXT');

if length(handle) > 1
	delete(handle(2:end)); handle = handle(1);
end

% NOTE: return handle for no further input

if nargin < 2
	return;
end

%---------------------------
% SET TEXT
%---------------------------

%--
% compute axes center
%--

x = 0.5 * sum(get(par, 'xlim')); y = 0.5 * sum(get(par, 'ylim'));

%--
% set string properties
%--

if isempty(handle)
	handle = text(x, y, string); 
end

set(handle, ...
	'parent', par, ...
	'fontsize', 24, ...
	'horizontalalignment', 'center', ...
	'position', [x, y, 0], ...
	'string', string, ...
	'tag', 'BIG_CENTERED_TEXT' ...
);

% TEST: this makes the display 'opaque'

opaque = 1;

if opaque
	set(handle, ...
		'backgroundcolor', get(par,'color'), ...
		'clipping', 'on', ...
		'margin', 48 ...
	);
end
