b311480e |
1 | // Created on: 1993-01-11 |
2 | // Created by: Christophe MARION |
3 | // Copyright (c) 1993-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. |
733a0e55 |
16 | |
7fd59977 |
17 | #ifndef No_Exception |
18 | #define No_Exception |
19 | #endif |
42cf5bc1 |
20 | |
21 | |
22 | #include <HLRAlgo_EdgeIterator.hxx> |
23 | #include <HLRAlgo_EdgeStatus.hxx> |
7fd59977 |
24 | |
25 | //======================================================================= |
26 | //function : EdgeIterator |
27 | //purpose : |
28 | //======================================================================= |
7fd59977 |
29 | HLRAlgo_EdgeIterator::HLRAlgo_EdgeIterator () |
30 | {} |
31 | |
32 | //======================================================================= |
33 | //function : InitHidden |
34 | //purpose : |
35 | //======================================================================= |
36 | |
681f3919 |
37 | void HLRAlgo_EdgeIterator::InitHidden (HLRAlgo_EdgeStatus& status) |
7fd59977 |
38 | { |
681f3919 |
39 | EHid = &status; |
7fd59977 |
40 | iHid = 1; |
41 | if (((HLRAlgo_EdgeStatus*)EHid)->AllHidden()) { |
42 | ((HLRAlgo_EdgeStatus*)EHid)->Bounds |
43 | (myHidStart,myHidTolStart,myHidEnd,myHidTolEnd); |
44 | myNbHid = 0; |
45 | } |
46 | else { |
47 | myNbHid = ((HLRAlgo_EdgeStatus*)EHid)->NbVisiblePart(); |
48 | Standard_Real B1; |
49 | Standard_ShortReal B2; |
50 | ((HLRAlgo_EdgeStatus*)EHid)->Bounds |
51 | (myHidStart,myHidTolStart,B1,B2); |
52 | ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart |
53 | (iHid,myHidEnd,myHidTolEnd,B1,B2); |
54 | } |
55 | if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd && |
56 | myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart ) |
57 | NextHidden(); |
58 | } |
59 | |
60 | //======================================================================= |
61 | //function : NextHidden |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | void HLRAlgo_EdgeIterator::NextHidden () |
66 | { |
67 | if (iHid >= myNbHid + 1) iHid++; |
68 | else { |
69 | Standard_Real B1; |
70 | Standard_ShortReal B2; |
71 | ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart |
72 | (iHid,B1,B2,myHidStart,myHidTolStart); |
73 | iHid++; |
74 | if (iHid == myNbHid + 1) { |
75 | ((HLRAlgo_EdgeStatus*)EHid)->Bounds(B1,B2,myHidEnd,myHidTolEnd); |
76 | if (myHidStart + myHidTolStart >= myHidEnd - myHidTolEnd && |
77 | myHidEnd + myHidTolEnd >= myHidStart - myHidTolStart ) iHid++; |
78 | } |
79 | else ((HLRAlgo_EdgeStatus*)EHid)->VisiblePart |
80 | (iHid,myHidEnd,myHidTolEnd,B1,B2); |
81 | } |
82 | } |