summaryrefslogtreecommitdiff
path: root/src/HLRAlgo/HLRAlgo_EdgeStatus.cxx
blob: d712aa9b20cd8658d13e5e138d7dddb64e7bec86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// File:	HLRAlgo_EdgeStatus.cxx
// Created:	Tue Feb 18 11:30:23 1992
// Author:	Christophe MARION
//		<cma@sdsun1>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRAlgo_EdgeStatus.ixx>

//=======================================================================
//function : HLRAlgo_EdgeStatus
//purpose  : 
//=======================================================================

HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus ()
{
}

//=======================================================================
//function : HLRAlgo_EdgeStatus
//purpose  : 
//=======================================================================

HLRAlgo_EdgeStatus::HLRAlgo_EdgeStatus (const Standard_Real Start,
					const Standard_ShortReal TolStart,
					const Standard_Real End  ,
					const Standard_ShortReal TolEnd) :
  myStart     (Start),
  myEnd       (End),
  myTolStart  (TolStart),
  myTolEnd    (TolEnd),
  myFlags     (0)
{
  ShowAll();
}

//=======================================================================
//function : Initialize
//purpose  : 
//=======================================================================

void HLRAlgo_EdgeStatus::Initialize (const Standard_Real Start,
				     const Standard_ShortReal TolStart,
				     const Standard_Real End  ,
				     const Standard_ShortReal TolEnd)
{
  myStart      = Start;
  myTolStart   = TolStart;
  myEnd        = End;
  myTolEnd     = TolEnd;
  ShowAll();
}

//=======================================================================
//function : NbVisiblePart
//purpose  : 
//=======================================================================

Standard_Integer HLRAlgo_EdgeStatus::NbVisiblePart () const
{
  if      (AllHidden ()) return 0;
  else if (AllVisible()) return 1;
  else                   return myVisibles.NbIntervals();
}

//=======================================================================
//function : VisiblePart
//purpose  : 
//=======================================================================

void HLRAlgo_EdgeStatus::VisiblePart (const Standard_Integer Index,
				      Standard_Real& Start,
				      Standard_ShortReal& TolStart,
				      Standard_Real& End  ,
				      Standard_ShortReal& TolEnd  ) const
{ 
  if (AllVisible())            Bounds(Start,TolStart,End,TolEnd);
  else myVisibles.Value(Index).Bounds(Start,TolStart,End,TolEnd);
}

//=======================================================================
//function : Hide
//purpose  : 
//=======================================================================

void HLRAlgo_EdgeStatus::Hide (const Standard_Real Start     ,
			       const Standard_ShortReal TolStart,
			       const Standard_Real End       ,
			       const Standard_ShortReal TolEnd  ,
			       const Standard_Boolean OnFace ,
			       const Standard_Boolean)
{
  if (!OnFace) {
    if (AllVisible()) {
      myVisibles = Intrv_Intervals
	(Intrv_Interval(myStart,myTolStart,myEnd,myTolEnd));
      AllVisible(Standard_False);
    }
    myVisibles.Subtract(Intrv_Interval(Start,TolStart,End,TolEnd));
    if (!AllHidden()) AllHidden(myVisibles.NbIntervals() == 0);
  }
}