summaryrefslogtreecommitdiff
path: root/inc/Contap_Line.gxx
blob: bc581723a2b5f65c577228318f7305af225b0e0f (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
//--------------------------------------------------
//--        C o n t a p _ L i n e . g x x         --
//--------------------------------------------------

Contap_Line::Contap_Line () {
  svtx = new TheHSequenceOfPoint ();
  Trans = IntSurf_Undecided;
}

void Contap_Line::ResetSeqOfVertex() {
  svtx = new TheHSequenceOfPoint ();
}



void Contap_Line::Add(const ThePoint& P) {
  Standard_Integer n = svtx->Length();
  if(n==0) { 
    svtx->Append(P);
  }
  else { 
    Standard_Real prm = P.ParameterOnLine();
    if(prm > svtx->Value(n).ParameterOnLine()) { 
      svtx->Append(P);      
    }
    else { 
      for(Standard_Integer i=n-1;i>0;i--) { 
	if(prm> svtx->Value(i).ParameterOnLine()) { 
	  svtx->InsertBefore(i+1,P);
	  return;
	}
      }
      svtx->Prepend(P);
    }
  }
}




void Contap_Line::Clear () {
  if(!curv.IsNull()) 
    curv->Clear();
  svtx = new TheHSequenceOfPoint ();
  typL = Contap_Walking;
}

void Contap_Line::SetValue(const gp_Lin& L)
{
  pt   = L.Location();
  dir1 = L.Direction();
  typL = Contap_Lin;
}

void Contap_Line::SetValue(const gp_Circ& C)
{
  pt   = C.Location();
  dir1 = C.Position().Direction();
  dir2 = C.Position().XDirection();
  rad  = C.Radius();
  typL = Contap_Circle;
}

void Contap_Line::SetValue(const TheArc& A)
{
  thearc = A;
  typL = Contap_Restriction;
}

void Contap_Line::SetLineOn2S(const Handle(IntSurf_LineOn2S)& L) { 
  curv = L;
  typL = Contap_Walking;
}

void Contap_Line::SetTransitionOnS(const IntSurf_TypeTrans T) { 
  Trans = T;
}

IntSurf_TypeTrans Contap_Line::TransitionOnS() const { 
  return(Trans);
}


const TheArc& Contap_Line::Arc () const
{
  if (typL != Contap_Restriction) {Standard_DomainError::Raise();}
  return thearc;
}