Page MenuHomec4science

duplicate.m
No OneTemporary

File Metadata

Created
Wed, May 1, 12:49

duplicate.m

function hThat = duplicate(hThis,varargin)
% DUPLICATE Duplicate the cursorbar to an identical one.
%
% Duplicate created an identical Cursorbar to the desired by directly
% calling the Cursorbar constructor. Cursorbar has no copy method and does
% not subclass matlab.mixin.Copyable, since the copying procedure in handle
% graphics may result in unexpected behavior. Instead, it uses duplicate as
% a hard-copy method.
%
% See also: graphics.Cursorbar.drawCrossbar, graphics.Cursorbar.
%
% Thanks to <a href="http://www.mathworks.com/matlabcentral/profile/authors/3354683-yaroslav">Yaroslav Don</a> for his assistance in updating cursorbar for
% MATLAB Graphics and for his contribution of new functionality.
% Copyright 2015-2016 The MathWorks, Inc.
% duplicate depending on situation:
if isempty(hThis)
% empty Cursorbar: return empty array
hThat = graphics.Cursorbar.empty(size(hThis));
elseif ~isscalar(hThis)
% an array of Cursorbars: recursively duplicate each
hThat = arrayfun(@(h)duplicate(h,varargin{:}),hThis,'UniformOutput',0);
hThat = reshape([hThat{:}],size(hThis));
elseif ~isvalid(hThis)
% deleted Cursorbar: create default deleted object
hThat = graphics.GraphicsPlaceholder;
delete(hThat);
else
% everything is okay: duplicate the Cursorbar
hThat = graphics.Cursorbar( hThis.Target, ...
'BottomMarker', hThis.BottomMarker, ...
'CreateFcn', hThis.CreateFcn, ...
'CursorLineColor', hThis.CursorLineColor, ...
'CursorLineStyle', hThis.CursorLineStyle, ...
'CursorLineWidth', hThis.CursorLineWidth, ...
'DeleteFcn', hThis.DeleteFcn, ...
'DisplayName', hThis.DisplayName, ...
'FigureCallbacks', hThis.FigureCallbacks, ...
'HitTest', hThis.HitTest, ...
'Interruptible', hThis.Interruptible, ...
'Location', hThis.Location, ...
'Orientation', hThis.Orientation, ...
'Parent', hThis.Parent, ...
'Position', hThis.Position, ...
'SelectionHighlight', hThis.SelectionHighlight, ...
'ShowText', hThis.ShowText, ...
'Tag', hThis.Tag, ...
'TargetIntersections', hThis.TargetIntersections, ...
'TargetMarkerEdgeColor', hThis.TargetMarkerEdgeColor, ...
'TargetMarkerFaceColor', hThis.TargetMarkerFaceColor, ...
'TargetMarkerSize', hThis.TargetMarkerSize, ...
'TargetMarkerStyle', hThis.TargetMarkerStyle, ...
'TextDescription', hThis.TextDescription, ...
'TopMarker', hThis.TopMarker, ...
'UserData', hThis.UserData, ...
'Visible', hThis.Visible, ...
varargin{:});
end
end

Event Timeline