summaryrefslogtreecommitdiff
path: root/src/TObj/TObj_OcafObjectIterator.cxx
blob: 93d07ebd5f71458e7bd9909d7f9a4ed2bda21995 (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
// File:        TObj_OcafObjectIterator.cxx
// Created:     Tue Nov  23 12:17:26 2004
// Author:      Pavel TELKOV
// Copyright:   Open CASCADE  2007
// The original implementation Copyright: (C) RINA S.p.A

#include <TObj_OcafObjectIterator.hxx>
#include <TObj_Object.hxx>


IMPLEMENT_STANDARD_HANDLE(TObj_OcafObjectIterator,TObj_LabelIterator)
IMPLEMENT_STANDARD_RTTIEXT(TObj_OcafObjectIterator,TObj_LabelIterator)

//=======================================================================
//function : TObj_OcafObjectIterator
//purpose  :
//=======================================================================

TObj_OcafObjectIterator::TObj_OcafObjectIterator
                         (const TDF_Label&             theLabel,
                          const Handle(Standard_Type)& theType,
                          const Standard_Boolean       theRecursive)
     : TObj_LabelIterator( theLabel, theRecursive ), myType( theType )
{
  MakeStep();
}

//=======================================================================
//function : MakeStep
//purpose  :
//=======================================================================

void TObj_OcafObjectIterator::MakeStep()
{
  for(;myIterator.More() && myNode.IsNull(); )
  {
    TDF_Label L = myIterator.Value();
    Handle(TObj_Object) anObject;
    if(TObj_Object::GetObj(L,anObject))
    {
      if (myType.IsNull() || anObject->IsKind( myType ))
      {
        myObject = anObject;
        myNode = L;
      }
      myIterator.NextBrother();
    }
    else
      myIterator.Next();
  }
}