File: whereintree.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (44 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function [Path,path,ok]=whereintree(Tree,xc,yc)
[m,k]=mini((Tree('x')-xc).^2+(Tree('y')-yc).^2)
ok=%t;path=[];Path=list()
if k==1 then return,end

O=Tree('orig')
path=Tree('paths')(k-1);
if size(O,'*')>size(super_path,'*') then
  message(['Navigator tree doesnt correspond to this'
      'diagram'])
  ok=%f
  return
end
n=size(O,'*')
if or(O<>super_path(1:n)) then
  message(['Navigator tree doesnt correspond to this'
      'diagram'])
  ok=%f
  return
end

sp=super_path;sp(1:n)=[]
if size(path,'*')<size(sp,'*') then
  message(['Upper level or New branch';
      'close current edition window first'])
  ok=%f
  return
end
n=size(sp,'*')
if or(sp<>path(1:n)) then
  message(['New branch, close current edition window first'])
  ok=%f
  return
end
path(1:n)=[]



Path=list();
for pk=path
  Path=lstcat(Path,pk,3,8);
end