]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMDS/GEOMDS_Explorer.cxx
Salome HOME
NRI : First integration.
[modules/geom.git] / src / GEOMDS / GEOMDS_Explorer.cxx
1 using namespace std;
2 //  File      : GEOMDS_Explorer.cxx
3 //  Created   :
4 //  Author    : Yves FRICAUD
5 //  Project   : SALOME
6 //  Module    : GEOM
7 //  Copyright : OPEN CASCADE
8 //  $Header$
9
10
11 #include "GEOMDS_Explorer.ixx"
12
13 #include <TNaming_NamedShape.hxx>
14 #include <TNaming_Tool.hxx>
15 #include <TDataStd_Name.hxx>
16
17
18 //=======================================================================
19 //function : GEOMDS_Explorer
20 //purpose  : 
21 //=======================================================================
22
23 GEOMDS_Explorer::GEOMDS_Explorer(const TDF_Label& Main) : myChildIterator(Main)
24 {
25 }
26
27
28 //=======================================================================
29 //function : const;
30 //purpose  : 
31 //=======================================================================
32
33 Standard_Boolean GEOMDS_Explorer::More() 
34 {
35   if (!myChildIterator.More())
36     return 0;
37   Handle(TDataStd_Name) Att;
38   Handle(TNaming_NamedShape) NS; 
39   TDF_Label L = myChildIterator.Value();
40   if (( L.FindAttribute(TDataStd_Name::GetID(),Att) ) || 
41       (L.FindAttribute(TNaming_NamedShape::GetID(),NS))
42       )
43     return 1;
44   //  myChildIterator.Next();
45   //  More();
46   return 0;
47   /*
48     if (!myChildIterator.More())
49     return 0;
50     TDF_Label L = myChildIterator.Value();
51     Handle(TNaming_NamedShape) NS; 
52     for (TDF_ChildIterator it2(L); it2.More(); it2.Next()) {
53     TDF_Label L2 = it2.Value();
54     if (L2.FindAttribute(TNaming_NamedShape::GetID(),NS)) {
55     return 1;
56     }
57     myChildIterator.Next();
58     }
59     return 0;
60   */
61 }
62
63
64 //=======================================================================
65 //function : Next
66 //purpose  : 
67 //=======================================================================
68
69 void GEOMDS_Explorer::Next() 
70 {
71   myChildIterator.Next();
72 }
73
74
75 //=======================================================================
76 //function : Shape
77 //purpose  : 
78 //=======================================================================
79
80 TopoDS_Shape GEOMDS_Explorer::Shape() const
81 {
82   Handle(TNaming_NamedShape) NS; 
83   TDF_Label L = myChildIterator.Value();
84   L.FindAttribute(TNaming_NamedShape::GetID(),NS);
85   TopoDS_Shape S = TNaming_Tool::GetShape(NS);
86   return S;
87 }
88
89 //=======================================================================
90 //function : Name
91 //purpose  : 
92 //=======================================================================
93
94 TCollection_ExtendedString GEOMDS_Explorer::Name() const
95 {
96  TDF_Label L = myChildIterator.Value();
97  Handle(TDataStd_Name) Att;
98  if ( L.FindAttribute(TDataStd_Name::GetID(),Att) )
99    //L.FindAttribute(TDataStd_Name::GetID(),Att);
100    return Att->Get();
101  else
102    return TCollection_ExtendedString();
103 }
104
105
106
107