marker - draw marker on curve
marker(h)
- h : handle of the scilab figure
//t=0.1:0.1:10-0.1;
//plot(t,sin(t));
//h=gcf();
//
function []=marker(h)
data=h.children(1).children(1).children(1).data;
rep=[];repa=[];p=[];v=[];xx=[];yy=[];
rep(3)=-1;mark_id=1;mark_color=1;sty=5;
while rep(3)<>2 then
v=[];
repa=rep;
rep=xgetmouse();
//horizontal detection
v=find(data(:,1)>repa(1) & data(:,1)<rep(1));
if (size(v,'*'))==0
v=find(data(:,1)<repa(1) & data(:,1)>rep(1));
end;
if (size(v,'*'))>=1
v=v(1);
xx=data(v,1);yy=data(v,2);
if (p<>[]) delete(p); end;
xpoly(xx,yy,"marks",0);
p=get("hdl");
p.mark_style=sty;
p.mark_size=5;
p.foreground=mark_color;
show_pixmap();
xinfo("x:"+string(xx)+",y:"+string(yy));
end;
if rep(3)==0
xpoly(xx,yy,"marks",0);
q=get("hdl");
q.mark_style=sty;
q.mark_size=5;
q.foreground=mark_color;
show_pixmap();
disp("x"+string(mark_id)+":"+string(xx)+",y"+string(mark_id)+":"+string(yy))
mark_color=mark_color+1;mark_id=mark_id+1;
end;
end;
if (p<>[]) delete(p); end;
endfunction
IRCOM Group
Alan Layec