7fd59977 |
1 | // File: HLRAlgo_EdgeStatus.cxx |
2 | // Created: Tue Feb 18 11:30:23 1992 |
3 | // Author: Christophe MARION |
4 | // <cma@sdsun1> |
5 | #ifndef No_Exception |
6 | #define No_Exception |
7 | #endif |
8 | #include <HLRAlgo_EdgeStatus.ixx> |
9 | |
10 | //======================================================================= |
11 | //function : HLRAlgo_EdgeStatus |
12 | //purpose : |
13 | //======================================================================= |
14 | |
15 | HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus () |
16 | { |
17 | } |
18 | |
19 | //======================================================================= |
20 | //function : HLRAlgo_EdgeStatus |
21 | //purpose : |
22 | //======================================================================= |
23 | |
24 | HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus (const Standard_Real Start, |
25 | const Standard_ShortReal TolStart, |
26 | const Standard_Real End , |
27 | const Standard_ShortReal TolEnd) : |
28 | myStart (Start), |
29 | myEnd (End), |
30 | myTolStart (TolStart), |
31 | myTolEnd (TolEnd), |
32 | myFlags (0) |
33 | { |
34 | ShowAll(); |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : Initialize |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | void HLRAlgo_EdgeStatus::Initialize (const Standard_Real Start, |
43 | const Standard_ShortReal TolStart, |
44 | const Standard_Real End , |
45 | const Standard_ShortReal TolEnd) |
46 | { |
47 | myStart = Start; |
48 | myTolStart = TolStart; |
49 | myEnd = End; |
50 | myTolEnd = TolEnd; |
51 | ShowAll(); |
52 | } |
53 | |
54 | //======================================================================= |
55 | //function : NbVisiblePart |
56 | //purpose : |
57 | //======================================================================= |
58 | |
59 | Standard_Integer HLRAlgo_EdgeStatus::NbVisiblePart () const |
60 | { |
61 | if (AllHidden ()) return 0; |
62 | else if (AllVisible()) return 1; |
63 | else return myVisibles.NbIntervals(); |
64 | } |
65 | |
66 | //======================================================================= |
67 | //function : VisiblePart |
68 | //purpose : |
69 | //======================================================================= |
70 | |
71 | void HLRAlgo_EdgeStatus::VisiblePart (const Standard_Integer Index, |
72 | Standard_Real& Start, |
73 | Standard_ShortReal& TolStart, |
74 | Standard_Real& End , |
75 | Standard_ShortReal& TolEnd ) const |
76 | { |
77 | if (AllVisible()) Bounds(Start,TolStart,End,TolEnd); |
78 | else myVisibles.Value(Index).Bounds(Start,TolStart,End,TolEnd); |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : Hide |
83 | //purpose : |
84 | //======================================================================= |
85 | |
86 | void HLRAlgo_EdgeStatus::Hide (const Standard_Real Start , |
87 | const Standard_ShortReal TolStart, |
88 | const Standard_Real End , |
89 | const Standard_ShortReal TolEnd , |
90 | const Standard_Boolean OnFace , |
91 | const Standard_Boolean) |
92 | { |
93 | if (!OnFace) { |
94 | if (AllVisible()) { |
95 | myVisibles = Intrv_Intervals |
96 | (Intrv_Interval(myStart,myTolStart,myEnd,myTolEnd)); |
97 | AllVisible(Standard_False); |
98 | } |
99 | myVisibles.Subtract(Intrv_Interval(Start,TolStart,End,TolEnd)); |
100 | if (!AllHidden()) AllHidden(myVisibles.NbIntervals() == 0); |
101 | } |
102 | } |
103 | |