~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to macros/scicos/do_navigator.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [Tree,windows]=do_navigator(scs_m,windows)
 
2
//build the tree representation
 
3
y0=0;x0=0;
 
4
path=[];larg=0;
 
5
[xx,yy,lp]=build_scs_tree(scs_m);
 
6
// open tree window
 
7
kw=find(windows(:,1)==100000)
 
8
if kw==[] then
 
9
  windows=[windows;[100000,get_new_window(windows)]]
 
10
  kw=size(windows,1)
 
11
end
 
12
xset('window',windows(kw,2))
 
13
xbasc();xset('default');xselect();
 
14
n_node=size(lp)
 
15
mnx=min(xx)-0.1;mxx=max(xx)+0.1
 
16
if n_node<=20 then
 
17
  dx=(mxx-mnx)
 
18
  mnx=mnx-dx/5
 
19
  x0=[mnx,mnx+dx/5]
 
20
 
 
21
else
 
22
  dx=(mxx-mnx)
 
23
  mnx=mnx-dx/2
 
24
  x0=[mnx,mnx+dx/4,mnx+dx/2]
 
25
end
 
26
bnds=[mnx,min(yy)-0.2, mxx,max(yy)+0.2];
 
27
xsetech([-1/6 -1/6 8/6 8/6],bnds)
 
28
 
 
29
// draw tree
 
30
xsegs(xx,yy,1)
 
31
xx=[xx(1,1);xx(2,:)'];
 
32
yy=[yy(1,1);yy(2,:)'];
 
33
plot2d(xx,yy,-9,'000')
 
34
xtitle('Navigator window')
 
35
 
 
36
 
 
37
for k=1:size(xx,1)
 
38
  xstring(xx(k),yy(k),string(k))
 
39
end
 
40
 
 
41
r=xstringl(x0(1),y0,'X');h=r(4);
 
42
y0=bnds(4)-h;
 
43
kx=1
 
44
xrect(x0(kx),bnds(4),x0(kx+1)-x0(kx),bnds(4)-bnds(2))
 
45
xclip([x0(kx),bnds(4),x0(kx+1)-x0(kx),bnds(4)-bnds(2)])
 
46
for k=1:size(xx,1)
 
47
  if k==1 then path=[]; else path=lp(k-1);end
 
48
  Path=list();
 
49
  for pk=path
 
50
    Path=lstcat(Path,pk,3,8);
 
51
  end
 
52
  Path=lstcat(Path,1,2,1);
 
53
  xstring(x0(kx),y0,string(k)+': '+scs_m(Path))
 
54
  y0=y0-h;
 
55
  if k==20 then 
 
56
    y0=bnds(4)-h;
 
57
    kx=kx+1
 
58
    xclip()
 
59
    xrect(x0(kx),bnds(4),x0(kx+1)-x0(kx),bnds(4)-bnds(2))
 
60
    xclip([x0(kx),bnds(4),x0(kx+1)-x0(kx),bnds(4)-bnds(2)])
 
61
  end
 
62
end
 
63
xclip()
 
64
//build data structure
 
65
Tree=tlist(['scs_tree','x','y','paths','orig'],xx,yy,lp,super_path)
 
66
xset('window',curwin)