|
On Mar 21, 6:38 pm, "Kesh " <tik...@hotmail.removethis.com> wrote:
> > > Does anyone here know whether it is possible (if so, how) to create aMATLABclass that is asubclassof one of graphical objects? For instance,
>
> > > classdef arc < line
> > > ...
> > > end
>
> > > to define asubclassof line and its object to be drawn in an axes.
>
> > > I was hoping the above syntax to work, but apparently "line" is not a class (no constructor available) although if you evaluate "class(handle(line))" returns "line"
>
> > > Does anybody here have any ideas to realize this idea?
>
> > I'm pretty sure that
> > 1. there is no documented way to do it
> > 2. the idea (or close) can be realized with a classes that have handle graphic objects as properies.
>
> Yeah, that's what I was afraid of. I knew of (1) as I've done a quite bit of reading and searching for the possibilities. I will try to use handle (actually, hgsetget) class as its superclass as suggested in (2).
>
> What I want is in two folds:
> 1. The object of the derived arc class can be appended to the axes object's Children list, and
> 2. Parent object of the associated line object to be reassigned from the axes to the object of the derived arc class.
>
> If any of the roaming Mathworks staff has inside info on this, I'd love to know if there is a hidden solution to this problem.
>
> Thanks,
> Kesh
I don't come past CSSM too often these days ( hi Per ),
I think it will work but you just need to use the package prefix 'hg'
for all your handle graphics
base classes. See the following code snippet ripped from the file
exchange. It doesn't do
what you want but gives away the names that Mathworks uses for the
handle graphics
classes. It still might not work though. I don't have a copy of Matlab
handy to test it
out. Let us know how it goes.
From
http://www.mathworks.com/matlabcentral/fileexchange/19877?controller=file_infos&download=true
----
% Ensure hObj is valid target
handleObj = handle(hObj);
if ~ishandle(hObj)
error('MAKEDATATIP:InvalidHandle',...
'HOBJ is an invalid handle object.');
elseif ~isa(handleObj,'hg.surface') &&...
~isa(handleObj,'hg.patch') &&...
~isa(handleObj,'hg.line') &&...
~isa(handleObj,'hg.image')
error('MAKEDATATIP:InvalidObjectType',...
'Objects of class ''%s'' are not a valid targets for
datatips.',...
class(handleObj));
end
--
Brad Phelan
http://xtargets.com
|