0032951: Coding - get rid of unused headers [GeomConvert to IGESBasic]
[occt.git] / src / HLRAlgo / HLRAlgo_EdgeStatus.cxx
1 // Created on: 1992-02-18
2 // Created by: Christophe MARION
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef No_Exception
18 #define No_Exception
19 #endif
20
21
22 #include <HLRAlgo_EdgeStatus.hxx>
23
24 //=======================================================================
25 //function : HLRAlgo_EdgeStatus
26 //purpose  : 
27 //=======================================================================
28 HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus()
29 : myStart     (0.0),
30   myEnd       (0.0),
31   myTolStart  (0.0f),
32   myTolEnd    (0.0f),
33   myAllHidden (false),
34   myAllVisible(false)
35 {
36 }
37
38 //=======================================================================
39 //function : HLRAlgo_EdgeStatus
40 //purpose  : 
41 //=======================================================================
42
43 HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus (const Standard_Real Start,
44                                         const Standard_ShortReal TolStart,
45                                         const Standard_Real End  ,
46                                         const Standard_ShortReal TolEnd) :
47   myStart     (Start),
48   myEnd       (End),
49   myTolStart  (TolStart),
50   myTolEnd    (TolEnd),
51   myAllHidden (false),
52   myAllVisible(false)
53 {
54   ShowAll();
55 }
56
57 //=======================================================================
58 //function : Initialize
59 //purpose  : 
60 //=======================================================================
61
62 void HLRAlgo_EdgeStatus::Initialize (const Standard_Real Start,
63                                      const Standard_ShortReal TolStart,
64                                      const Standard_Real End  ,
65                                      const Standard_ShortReal TolEnd)
66 {
67   myStart      = Start;
68   myTolStart   = TolStart;
69   myEnd        = End;
70   myTolEnd     = TolEnd;
71   ShowAll();
72 }
73
74 //=======================================================================
75 //function : NbVisiblePart
76 //purpose  : 
77 //=======================================================================
78
79 Standard_Integer HLRAlgo_EdgeStatus::NbVisiblePart () const
80 {
81   if      (AllHidden ()) return 0;
82   else if (AllVisible()) return 1;
83   else                   return myVisibles.NbIntervals();
84 }
85
86 //=======================================================================
87 //function : VisiblePart
88 //purpose  : 
89 //=======================================================================
90
91 void HLRAlgo_EdgeStatus::VisiblePart (const Standard_Integer Index,
92                                       Standard_Real& Start,
93                                       Standard_ShortReal& TolStart,
94                                       Standard_Real& End  ,
95                                       Standard_ShortReal& TolEnd  ) const
96
97   if (AllVisible())            Bounds(Start,TolStart,End,TolEnd);
98   else myVisibles.Value(Index).Bounds(Start,TolStart,End,TolEnd);
99 }
100
101 //=======================================================================
102 //function : Hide
103 //purpose  : 
104 //=======================================================================
105
106 void HLRAlgo_EdgeStatus::Hide (const Standard_Real Start     ,
107                                const Standard_ShortReal TolStart,
108                                const Standard_Real End       ,
109                                const Standard_ShortReal TolEnd  ,
110                                const Standard_Boolean OnFace ,
111                                const Standard_Boolean)
112 {
113   if (!OnFace) {
114     if (AllVisible()) {
115       myVisibles = Intrv_Intervals
116         (Intrv_Interval(myStart,myTolStart,myEnd,myTolEnd));
117       AllVisible(Standard_False);
118     }
119     myVisibles.Subtract(Intrv_Interval(Start,TolStart,End,TolEnd));
120     if (!AllHidden()) AllHidden(myVisibles.NbIntervals() == 0);
121   }
122 }