Normand Briere
2019-09-17 d248db5fc21c4b0ab24968974e5e590f413ef8fc
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class cTreePath extends java.util.Vector<Object3D> // javax.swing.tree.TreePath
{
   public cTreePath(Object3D r, cTreePath cp)
   {
       add(r);
                
                for (Object3D o : cp)
                {
                    add(o);
                }
                
                //System.out.println("TP = " + this);
   }
 
   public cTreePath(cTreePath pp, Object3D l)
   {
       //super(pp, o);
                
                for (Object3D o : pp)
                {
                    add(o);
                }
                
       add(l);
                
                //System.out.println("TP = " + this);
   }
 
   public cTreePath(Object3D o)
   {
       //super(o);
            add(o);
                //System.out.println("Root = " + this);
   }
        
   public cTreePath(java.util.Collection<Object3D> c)
   {
            super(c);
   }
        
        public Object3D Leaf()
        {
            if (size() == 0)
                return null;
            
            return get(size()-1);
        }
        
        public cTreePath Raise2Material()
        {
            if (lastElement().material != null || size() <= 1)
                return this;
            
            return new cTreePath(subList(0,size()-1)).Raise2Material();
        }
        
        public String toString()
        {
            String string = "";
            
            for (Object3D o : this)
            {
                string += "/" + o.GetName();
            }
            
            return string;
        }
        
        javax.swing.tree.TreePath GetTreePath()
        {
            return new javax.swing.tree.TreePath(toArray());
        }
}