b311480e |
1 | // Created on: 1993-02-05 |
2 | // Created by: Jacques GOUSSARD |
3 | // Copyright (c) 1993-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | Contap_Line::Contap_Line () { |
23 | svtx = new TheHSequenceOfPoint (); |
24 | Trans = IntSurf_Undecided; |
25 | } |
26 | |
27 | void Contap_Line::ResetSeqOfVertex() { |
28 | svtx = new TheHSequenceOfPoint (); |
29 | } |
30 | |
7fd59977 |
31 | void Contap_Line::Add(const ThePoint& P) { |
32 | Standard_Integer n = svtx->Length(); |
33 | if(n==0) { |
34 | svtx->Append(P); |
35 | } |
36 | else { |
37 | Standard_Real prm = P.ParameterOnLine(); |
38 | if(prm > svtx->Value(n).ParameterOnLine()) { |
39 | svtx->Append(P); |
40 | } |
41 | else { |
42 | for(Standard_Integer i=n-1;i>0;i--) { |
43 | if(prm> svtx->Value(i).ParameterOnLine()) { |
44 | svtx->InsertBefore(i+1,P); |
45 | return; |
46 | } |
47 | } |
48 | svtx->Prepend(P); |
49 | } |
50 | } |
51 | } |
52 | |
7fd59977 |
53 | void Contap_Line::Clear () { |
54 | if(!curv.IsNull()) |
55 | curv->Clear(); |
56 | svtx = new TheHSequenceOfPoint (); |
57 | typL = Contap_Walking; |
58 | } |
59 | |
60 | void Contap_Line::SetValue(const gp_Lin& L) |
61 | { |
62 | pt = L.Location(); |
63 | dir1 = L.Direction(); |
64 | typL = Contap_Lin; |
65 | } |
66 | |
67 | void Contap_Line::SetValue(const gp_Circ& C) |
68 | { |
69 | pt = C.Location(); |
70 | dir1 = C.Position().Direction(); |
71 | dir2 = C.Position().XDirection(); |
72 | rad = C.Radius(); |
73 | typL = Contap_Circle; |
74 | } |
75 | |
76 | void Contap_Line::SetValue(const TheArc& A) |
77 | { |
78 | thearc = A; |
79 | typL = Contap_Restriction; |
80 | } |
81 | |
82 | void Contap_Line::SetLineOn2S(const Handle(IntSurf_LineOn2S)& L) { |
83 | curv = L; |
84 | typL = Contap_Walking; |
85 | } |
86 | |
87 | void Contap_Line::SetTransitionOnS(const IntSurf_TypeTrans T) { |
88 | Trans = T; |
89 | } |
90 | |
91 | IntSurf_TypeTrans Contap_Line::TransitionOnS() const { |
92 | return(Trans); |
93 | } |
94 | |
7fd59977 |
95 | const TheArc& Contap_Line::Arc () const |
96 | { |
97 | if (typL != Contap_Restriction) {Standard_DomainError::Raise();} |
98 | return thearc; |
99 | } |