b311480e |
1 | // Created on: 1996-02-13 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <TopOpeBRepBuild_GIter.hxx> |
7fd59977 |
19 | #include <TopOpeBRepBuild_GTopo.hxx> |
42cf5bc1 |
20 | |
7fd59977 |
21 | #define MYGTOPO (*((TopOpeBRepBuild_GTopo*)mypG)) |
22 | |
23 | TopOpeBRepBuild_GIter::TopOpeBRepBuild_GIter() : myII(0),mypG(NULL) |
24 | { |
25 | } |
26 | |
27 | TopOpeBRepBuild_GIter::TopOpeBRepBuild_GIter(const TopOpeBRepBuild_GTopo& G) : |
28 | myII(0),mypG(NULL) |
29 | { |
30 | Init(G); |
31 | } |
32 | |
33 | void TopOpeBRepBuild_GIter::Find() |
34 | { |
35 | while ( myII <= 8 ) { |
36 | Standard_Boolean b = MYGTOPO.Value(myII); |
37 | if (b) break; |
38 | myII++; |
39 | } |
40 | } |
41 | |
42 | void TopOpeBRepBuild_GIter::Init() |
43 | { |
44 | myII = 0; |
45 | Find(); |
46 | } |
47 | |
48 | void TopOpeBRepBuild_GIter::Init(const TopOpeBRepBuild_GTopo& G) |
49 | { |
50 | mypG = (Standard_Address)&G; |
51 | Init(); |
52 | } |
53 | |
54 | Standard_Boolean TopOpeBRepBuild_GIter::More() const |
55 | { |
56 | if (myII <= 8) { |
57 | Standard_Boolean b = MYGTOPO.Value(myII); |
58 | return b; |
59 | } |
60 | else |
61 | return Standard_False; |
62 | } |
63 | |
64 | void TopOpeBRepBuild_GIter::Next() |
65 | { |
66 | myII++; |
67 | Find(); |
68 | } |
69 | |
70 | void TopOpeBRepBuild_GIter::Current(TopAbs_State& s1, TopAbs_State& s2) const |
71 | { |
7c65581d |
72 | if ( !More() ) |
73 | { |
74 | s1 = s2 = TopAbs_UNKNOWN; |
75 | return; |
76 | } |
7fd59977 |
77 | Standard_Integer i1,i2; |
78 | MYGTOPO.Index(myII,i1,i2); |
79 | s1 = MYGTOPO.GState(i1); |
80 | s2 = MYGTOPO.GState(i2); |
81 | } |
82 | |
83 | void TopOpeBRepBuild_GIter::Dump(Standard_OStream& OS) const |
84 | { |
85 | if ( !More()) return; |
86 | TopAbs_State s1,s2; Current(s1,s2); |
87 | Standard_Boolean b = MYGTOPO.Value(s1,s2); |
88 | TopOpeBRepBuild_GTopo::DumpSSB(OS,s1,s2,b); OS<<endl; |
89 | } |