1 // Created on: 1995-07-13
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1995-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 #include <TopOpeBRepTool_ShapeExplorer.ixx>
19 #include <Standard_NoMoreObject.hxx>
20 #include <Standard_NoSuchObject.hxx>
23 //=======================================================================
24 //function : TopOpeBRepTool_ShapeExplorer
26 //=======================================================================
28 TopOpeBRepTool_ShapeExplorer::TopOpeBRepTool_ShapeExplorer() :
35 //=======================================================================
36 //function : TopOpeBRepTool_ShapeExplorer
38 //=======================================================================
40 TopOpeBRepTool_ShapeExplorer::TopOpeBRepTool_ShapeExplorer
41 (const TopoDS_Shape& S,
42 const TopAbs_ShapeEnum ToFind,
43 const TopAbs_ShapeEnum ToAvoid)
45 Init(S,ToFind,ToAvoid);
49 //=======================================================================
52 //=======================================================================
54 void TopOpeBRepTool_ShapeExplorer::Init(const TopoDS_Shape& S,
55 const TopAbs_ShapeEnum ToFind,
56 const TopAbs_ShapeEnum ToAvoid)
58 myExplorer.Init(S,ToFind,ToAvoid);
61 myIndex = myNbShapes = 0;
62 for (;More();Next()) myNbShapes++;
64 if (More()) myIndex = 1;
69 //=======================================================================
72 //=======================================================================
74 Standard_Boolean TopOpeBRepTool_ShapeExplorer::More()const
76 Standard_Boolean b = myExplorer.More();
80 //=======================================================================
83 //=======================================================================
85 void TopOpeBRepTool_ShapeExplorer::Next()
93 //=======================================================================
96 //=======================================================================
98 const TopoDS_Shape& TopOpeBRepTool_ShapeExplorer::Current()const
100 const TopoDS_Shape& S = myExplorer.Current();
105 //=======================================================================
106 //function : NbShapes
108 //=======================================================================
110 Standard_Integer TopOpeBRepTool_ShapeExplorer::NbShapes()const
112 Standard_Integer n = 0;
120 //=======================================================================
123 //=======================================================================
125 Standard_Integer TopOpeBRepTool_ShapeExplorer::Index()const
127 Standard_Integer n = 0;
134 //=======================================================================
135 //function : DumpCurrent
137 //=======================================================================
139 Standard_OStream& TopOpeBRepTool_ShapeExplorer::DumpCurrent
140 (Standard_OStream& OS)const
144 const TopoDS_Shape& S = Current();
145 TopAbs_ShapeEnum T = S.ShapeType();
146 TopAbs_Orientation O = S.Orientation();
147 Standard_Integer I = Index();
148 TopAbs::Print(T,cout);
149 cout<<"("<<I<<","; TopAbs::Print(O,cout); cout<<") ";