1 // Created on: 1996-10-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <TopOpeBRepDS_SurfaceExplorer.ixx>
23 #define MYDS (*((TopOpeBRepDS_DataStructure*)myDS))
25 //=======================================================================
26 //function : TopOpeBRepDS_SurfaceExplorer
28 //=======================================================================
30 TopOpeBRepDS_SurfaceExplorer::TopOpeBRepDS_SurfaceExplorer()
31 : myIndex(1),myMax(0),myDS(NULL),myFound(Standard_False)
35 //=======================================================================
36 //function : TopOpeBRepDS_SurfaceExplorer
38 //=======================================================================
40 TopOpeBRepDS_SurfaceExplorer::TopOpeBRepDS_SurfaceExplorer
41 (const TopOpeBRepDS_DataStructure& DS,
42 const Standard_Boolean FindKeep)
47 //=======================================================================
50 //=======================================================================
52 void TopOpeBRepDS_SurfaceExplorer::Init
53 (const TopOpeBRepDS_DataStructure& DS,
54 const Standard_Boolean FindKeep)
57 myMax = DS.NbSurfaces();
58 myDS = (TopOpeBRepDS_DataStructure*)&DS;
59 myFindKeep = FindKeep;
64 //=======================================================================
67 //=======================================================================
69 void TopOpeBRepDS_SurfaceExplorer::Find()
71 myFound = Standard_False;
72 while (myIndex <= myMax) {
74 myFound = IsSurfaceKeep(myIndex);
77 myFound = IsSurface(myIndex);
84 //=======================================================================
87 //=======================================================================
89 Standard_Boolean TopOpeBRepDS_SurfaceExplorer::More() const
94 //=======================================================================
97 //=======================================================================
99 void TopOpeBRepDS_SurfaceExplorer::Next()
105 //=======================================================================
108 //=======================================================================
110 const TopOpeBRepDS_Surface& TopOpeBRepDS_SurfaceExplorer::Surface()const
113 return MYDS.Surface(myIndex);
120 //=======================================================================
121 //function : IsSurface
123 //=======================================================================
125 Standard_Boolean TopOpeBRepDS_SurfaceExplorer::IsSurface
126 (const Standard_Integer I)const
128 Standard_Boolean b = MYDS.mySurfaces.IsBound(I);
132 //=======================================================================
133 //function : IsSurfaceKeep
135 //=======================================================================
137 Standard_Boolean TopOpeBRepDS_SurfaceExplorer::IsSurfaceKeep
138 (const Standard_Integer I)const
140 Standard_Boolean b = MYDS.mySurfaces.IsBound(I);
141 if (b) b = MYDS.Surface(I).Keep();
145 //=======================================================================
148 //=======================================================================
150 const TopOpeBRepDS_Surface& TopOpeBRepDS_SurfaceExplorer::Surface
151 (const Standard_Integer I)const
153 if ( IsSurface(I) ) {
154 return MYDS.Surface(I);
161 //=======================================================================
162 //function : NbSurface
164 //=======================================================================
166 Standard_Integer TopOpeBRepDS_SurfaceExplorer::NbSurface()
168 myIndex = 1; myMax = MYDS.NbSurfaces();
170 Standard_Integer n = 0;
171 for (; More(); Next() ) n++;
175 //=======================================================================
178 //=======================================================================
180 Standard_Integer TopOpeBRepDS_SurfaceExplorer::Index()const