1 -- Created on: 1999-06-10
2 -- Created by: Vladislav ROMASHKO
3 -- Copyright (c) 1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class TreeNode from TDataStd inherits Attribute from TDF
19 ---Purpose: Allows you to define an explicit tree of labels
20 -- which you can also edit.
21 -- Without this class, the data structure cannot be fully edited.
22 -- This service is required if for presentation
23 -- purposes, you want to create an application with
24 -- a tree which allows you to organize and link data
25 -- as a function of application features.
30 OStream from Standard,
32 RelocationTable from TDF,
34 AttributeDelta from TDF,
36 PtrTreeNode from TDataStd
40 ---Purpose: class methods working on the node
41 -- ===================================
43 Find (myclass; L : Label from TDF;
44 T : out TreeNode from TDataStd)
45 ---Purpose: Returns true if the tree node T is found on the label L.
46 -- Otherwise, false is returned.
47 returns Boolean from Standard;
49 Set (myclass; L : Label from TDF)
50 ---Purpose: Finds or Creates a TreeNode attribute on the label <L>
51 -- with the default tree ID, returned by the method
52 -- <GetDefaultTreeID>. Returns the created/found TreeNode
54 returns TreeNode from TDataStd;
56 Set (myclass; L : Label from TDF; ExplicitTreeID : GUID from Standard)
57 ---Purpose: Finds or Creates a TreeNode attribute on the label
58 -- <L>, with an explicit tree ID. <ExplicitTreeID> is
59 -- the ID returned by <TDF_Attribute::ID> method.
60 -- Returns the found/created TreeNode attribute.
61 returns TreeNode from TDataStd;
63 GetDefaultTreeID (myclass)
64 ---Purpose: returns a default tree ID. this ID is used by the
65 -- <Set> method without explicit tree ID.
66 ---C++: return const &
67 returns GUID from Standard;
69 ---Purpose: Instance methods:
72 Create returns TreeNode from TDataStd;
75 Append (me : mutable; Child : TreeNode from TDataStd)
76 ---Purpose: Insert the TreeNode <Child> as last child of <me>. If
77 -- the insertion is successful <me> becomes the Father of <Child>.
78 returns Boolean from Standard;
80 Prepend (me : mutable; Child : TreeNode from TDataStd)
81 ---Purpose: Insert the the TreeNode <Child> as first child of
82 -- <me>. If the insertion is successful <me> becomes the Father of <Child>
83 returns Boolean from Standard;
85 InsertBefore (me : mutable; Node : TreeNode from TDataStd)
86 ---Purpose: Inserts the TreeNode <Node> before <me>. If insertion is successful <me>
87 -- and <Node> belongs to the same Father.
88 returns Boolean from Standard;
90 InsertAfter(me : mutable; Node : TreeNode from TDataStd)
91 ---Purpose: Inserts the TreeNode <Node> after <me>. If insertion is successful <me>
92 -- and <Node> belongs to the same Father.
93 returns Boolean from Standard;
96 ---Purpose: Removes this tree node attribute from its father
97 -- node. The result is that this attribute becomes a root node.
98 returns Boolean from Standard;
100 Depth (me) returns Integer from Standard;
101 ---Purpose: Returns the depth of this tree node in the overall tree node structure.
102 -- In other words, the number of father tree nodes of this one is returned.
104 NbChildren (me; allLevels : Boolean from Standard = Standard_False)
105 returns Integer from Standard;
106 ---Purpose: Returns the number of child nodes.
107 -- If <allLevels> is true, the method counts children of all levels
108 -- (children of children ...)
110 IsAscendant (me; of : TreeNode from TDataStd)
111 ---Purpose: Returns true if this tree node attribute is an
112 -- ascendant of of. In other words, if it is a father or
113 -- the father of a father of of.
114 returns Boolean from Standard;
116 IsDescendant (me; of : TreeNode from TDataStd)
117 ---Purpose: Returns true if this tree node attribute is a
118 -- descendant of of. In other words, if it is a child or
119 -- the child of a child of of.
120 returns Boolean from Standard;
123 ---Purpose: Returns true if this tree node attribute is the
124 -- ultimate father in the tree.
128 ---Purpose: Returns the ultimate father of this tree node attribute.
129 returns TreeNode from TDataStd;
131 IsFather (me; of : TreeNode from TDataStd)
132 ---Purpose: Returns true if this tree node attribute is a father of of.
133 returns Boolean from Standard;
135 IsChild (me; of : TreeNode from TDataStd)
136 ---Purpose: Returns true if this tree node attribute is a child of of.
137 returns Boolean from Standard;
140 ---Purpose: Returns true if this tree node attribute has a father tree node.
145 ---Purpose: Returns the father TreeNode of <me>. Null if root.
146 returns TreeNode from TDataStd;
149 ---Purpose: Returns true if this tree node attribute has a next tree node.
154 ---Purpose: Returns the next tree node in this tree node attribute.
156 -- This tree node is null if it is the last one in this
157 -- tree node attribute.Returns the next TreeNode of <me>. Null if last.
158 returns TreeNode from TDataStd;
161 ---Purpose: Returns true if this tree node attribute has a previous tree node.
166 ---Purpose: Returns the previous tree node of this tree node attribute.
168 -- This tree node is null if it is the first one in this tree node attribute.
169 returns TreeNode from TDataStd;
172 ---Purpose: Returns true if this tree node attribute has a first child tree node.
177 ---Purpose: Returns the first child tree node in this tree node object.
178 returns TreeNode from TDataStd;
181 ---Purpose: Returns true if this tree node attribute has a last child tree node.
186 ---Purpose: Returns the last child tree node in this tree node object.
187 returns TreeNode from TDataStd;
189 FindLast (me : mutable)
190 ---Purpose: Returns the last child tree node in this tree node object.
191 returns TreeNode from TDataStd;
193 ---Purpose: to set fields
196 SetTreeID (me : mutable; explicitID : GUID from Standard);
198 SetFather(me : mutable;F : TreeNode from TDataStd);
200 SetNext (me : mutable;F : TreeNode from TDataStd);
202 SetPrevious (me : mutable;F : TreeNode from TDataStd);
204 SetFirst (me : mutable;F : TreeNode from TDataStd);
206 SetLast (me : mutable;F : TreeNode from TDataStd);
208 ---Purpose: TreeNode callback:
209 -- ==================
211 AfterAddition(me: mutable)
212 ---Purpose: Connect the TreeNode to its father child list
215 BeforeForget(me: mutable)
216 ---Purpose: Disconnect the TreeNode from its Father child list
219 AfterResume(me: mutable)
220 ---Purpose: Reconnect the TreeNode to its father child list.
223 BeforeUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
224 forceIt : Boolean from Standard = Standard_False)
225 ---Purpose: Disconnect the TreeNode, if necessary.
226 returns Boolean from Standard
229 AfterUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
230 forceIt : Boolean from Standard = Standard_False)
231 ---Purpose: Reconnect the TreeNode, if necessary.
232 returns Boolean from Standard
236 ---Purpose: Implementation of Attribute methods:
237 -- ===================================
240 ---Purpose: Returns the tree ID (default or explicit one depending
241 -- onthe Set method used).
242 ---C++: return const &
243 returns GUID from Standard;
245 Restore (me: mutable; with : Attribute from TDF)
248 Paste (me; into : Attribute from TDF;
249 RT : RelocationTable from TDF)
253 returns Attribute from TDF
257 aDataSet : DataSet from TDF)
260 Dump(me; anOS : in out OStream from Standard)
261 returns OStream from Standard
267 myFather : PtrTreeNode from TDataStd;
268 myPrevious : PtrTreeNode from TDataStd;
269 myNext : PtrTreeNode from TDataStd;
270 myFirst : PtrTreeNode from TDataStd;
271 myLast : PtrTreeNode from TDataStd;
272 myTreeID : GUID from Standard;
276 class ChildNodeIterator from TDataStd