blob: 1a7582a3b5bde512dc1f2da429651f1eadccc85e (
plain)
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
74
75
76
77
78
|
// File: TObj_ModelIterator.cxx
// Created: Tue Nov 23 11:58:14 2004
// Author: Pavel TELKOV
// Copyright: Open CASCADE 2007
// The original implementation Copyright: (C) RINA S.p.A
#include <TObj_ModelIterator.hxx>
#include <TObj_Model.hxx>
IMPLEMENT_STANDARD_HANDLE(TObj_ModelIterator,TObj_ObjectIterator)
IMPLEMENT_STANDARD_RTTIEXT(TObj_ModelIterator,TObj_ObjectIterator)
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
TObj_ModelIterator::TObj_ModelIterator(const Handle(TObj_Model)& theModel)
{
myObject = theModel->GetRoot();
if ( ! myObject.IsNull() )
addIterator(myObject);
}
//=======================================================================
//function : addIterator
//purpose :
//=======================================================================
void TObj_ModelIterator::addIterator(const Handle(TObj_Object)& theObj)
{
Handle(TObj_ObjectIterator) anIter = theObj->GetChildren();
if (anIter.IsNull() )
return; // object has no children.
myIterSeq.Append(anIter);
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
Standard_Boolean TObj_ModelIterator::More() const
{
return ! myObject.IsNull();
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Handle(TObj_Object) TObj_ModelIterator::Value() const
{
return myObject;
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TObj_ModelIterator::Next()
{
myObject.Nullify();
while ( myIterSeq.Length() >0 )
{
if ( myIterSeq.Last()->More() )
{
myObject = myIterSeq.Last()->Value();
myIterSeq.Last()->Next();
addIterator ( myObject );
return;
}
else myIterSeq.Remove(myIterSeq.Length());
}
}
|