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 _HLRAlgo_EdgeStatus_HeaderFile
18 #define _HLRAlgo_EdgeStatus_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <Standard_Real.hxx>
25 #include <Standard_ShortReal.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Intrv_Intervals.hxx>
28 #include <Standard_Integer.hxx>
29 
30 
31 //! This class describes the Hidden  Line status of an
32 //! Edge. It contains :
33 //!
34 //! The Bounds of the Edge and their tolerances
35 //!
36 //! Two flags indicating if the edge is full visible
37 //! or full hidden.
38 //!
39 //! The Sequence  of visible Intervals  on the Edge.
40 class HLRAlgo_EdgeStatus
41 {
42 public:
43 
44   DEFINE_STANDARD_ALLOC
45 
46 
47   Standard_EXPORT HLRAlgo_EdgeStatus();
48 
49   //! Creates a  new  EdgeStatus.  Default visible.  The
50   //! Edge is   bounded by the  interval  <Start>, <End>
51   //! with the tolerances <TolStart>, <TolEnd>.
52   Standard_EXPORT HLRAlgo_EdgeStatus(const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd);
53 
54   //! Initialize  an  EdgeStatus.  Default visible.  The
55   //! Edge is   bounded by the  interval  <Start>, <End>
56   //! with the tolerances <TolStart>, <TolEnd>.
57   Standard_EXPORT void Initialize (const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd);
58 
Bounds(Standard_Real & theStart,Standard_ShortReal & theTolStart,Standard_Real & theEnd,Standard_ShortReal & theTolEnd) const59   void Bounds (Standard_Real& theStart, Standard_ShortReal& theTolStart, Standard_Real& theEnd, Standard_ShortReal& theTolEnd) const
60   {
61     theStart    = myStart;
62     theTolStart = myTolStart;
63     theEnd      = myEnd;
64     theTolEnd   = myTolEnd;
65   }
66 
67   Standard_EXPORT Standard_Integer NbVisiblePart() const;
68 
69   Standard_EXPORT void VisiblePart (const Standard_Integer Index, Standard_Real& Start, Standard_ShortReal& TolStart, Standard_Real& End, Standard_ShortReal& TolEnd) const;
70 
71   //! Hides  the  interval  <Start>,    <End>   with the
72   //! tolerances <TolStart>,  <TolEnd>. This interval is
73   //! subtracted from the visible  parts.  If the hidden
74   //! part is on ( or under ) the face the flag <OnFace>
75   //! is True ( or False ).  If the hidden  part is on (
76   //! or  inside  ) the boundary  of  the  face the flag
77   //! <OnBoundary> is True ( or False ).
78   Standard_EXPORT void Hide (const Standard_Real Start, const Standard_ShortReal TolStart, const Standard_Real End, const Standard_ShortReal TolEnd, const Standard_Boolean OnFace, const Standard_Boolean OnBoundary);
79 
80   //! Hide the whole Edge.
HideAll()81   void HideAll()
82   {
83     AllVisible(Standard_False);
84     AllHidden (Standard_True);
85   }
86 
87   //! Show the whole Edge.
ShowAll()88   void ShowAll()
89   {
90     AllVisible(Standard_True);
91     AllHidden (Standard_False);
92   }
93 
AllHidden() const94   Standard_Boolean AllHidden() const { return myAllHidden; }
95 
AllHidden(const Standard_Boolean B)96   void AllHidden (const Standard_Boolean B) { myAllHidden = B; }
97 
AllVisible() const98   Standard_Boolean AllVisible() const { return myAllVisible; }
99 
AllVisible(const Standard_Boolean B)100   void AllVisible (const Standard_Boolean B) { myAllVisible = B; }
101 
102 private:
103 
104   Standard_Real myStart;
105   Standard_Real myEnd;
106   Standard_ShortReal myTolStart;
107   Standard_ShortReal myTolEnd;
108   Standard_Boolean myAllHidden;
109   Standard_Boolean myAllVisible;
110   Intrv_Intervals myVisibles;
111 
112 };
113 
114 #endif // _HLRAlgo_EdgeStatus_HeaderFile
115