1 // Created on: 1993-11-29
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1993-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 
18 #include <ChFiDS_CommonPoint.hxx>
19 #include <ChFiDS_FaceInterference.hxx>
20 #include <ChFiDS_SurfData.hxx>
21 #include <gp_Pnt2d.hxx>
22 #include <Standard_Transient.hxx>
23 #include <Standard_Type.hxx>
24 
IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_SurfData,Standard_Transient)25 IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_SurfData,Standard_Transient)
26 
27 ChFiDS_SurfData::ChFiDS_SurfData()
28 : ufspine (0.0),
29   ulspine (0.0),
30   myfirstextend (0.0),
31   mylastextend (0.0),
32   indexOfS1 (0),
33   indexOfC1 (0),
34   indexOfS2 (0),
35   indexOfC2 (0),
36   indexOfConge (0),
37   isoncurv1 (Standard_False),
38   isoncurv2 (Standard_False),
39   twistons1 (Standard_False),
40   twistons2 (Standard_False),
41   orientation (TopAbs_FORWARD)
42 {
43 }
44 
45 //=======================================================================
46 //function : Copy
47 //purpose  :
48 //=======================================================================
49 
Copy(const Handle (ChFiDS_SurfData)& Other)50 void ChFiDS_SurfData::Copy(const Handle(ChFiDS_SurfData)& Other)
51 {
52 indexOfS1    = Other->indexOfS1;
53 indexOfS2    = Other->indexOfS2;
54 indexOfConge = Other->indexOfConge;
55 orientation  = Other->orientation;
56 intf1        = Other->intf1;
57 intf2        = Other->intf2;
58 
59 pfirstOnS1   = Other->pfirstOnS1;
60 plastOnS1    = Other->plastOnS1;
61 pfirstOnS2   = Other->pfirstOnS2;
62 plastOnS2    = Other->plastOnS2;
63 
64 ufspine      = Other->ufspine;
65 ulspine      = Other->ulspine;
66 
67 simul        = Other->simul;
68 p2df1        = Other->p2df1;
69 p2dl1        = Other->p2dl1;
70 p2df2        = Other->p2df2;
71 p2dl2        = Other->p2dl2;
72 
73 myfirstextend = Other->myfirstextend;
74 mylastextend  = Other->mylastextend;
75 
76 twistons1 = Other->twistons1;
77 twistons2 = Other->twistons2;
78 }
79 
80 //=======================================================================
81 //function : Index
82 //purpose  :
83 //=======================================================================
84 
Index(const Standard_Integer OfS) const85 Standard_Integer ChFiDS_SurfData::Index(const Standard_Integer OfS) const
86 {
87   if(OfS == 1) return indexOfS1;
88   else return indexOfS2;
89 }
90 
91 //=======================================================================
92 //function : Interference
93 //purpose  :
94 //=======================================================================
95 
Interference(const Standard_Integer OnS) const96 const ChFiDS_FaceInterference& ChFiDS_SurfData::Interference
97 (const Standard_Integer OnS) const
98 {
99   if(OnS == 1) return intf1;
100   else return intf2;
101 }
102 
103 
104 //=======================================================================
105 //function : Interference
106 //purpose  :
107 //=======================================================================
108 
ChangeInterference(const Standard_Integer OnS)109 ChFiDS_FaceInterference& ChFiDS_SurfData::ChangeInterference
110 (const Standard_Integer OnS)
111 {
112   if(OnS == 1) return intf1;
113   else return intf2;
114 }
115 
116 
117 //=======================================================================
118 //function : Vertex
119 //purpose  :
120 //=======================================================================
121 
Vertex(const Standard_Boolean First,const Standard_Integer OnS) const122 const ChFiDS_CommonPoint&  ChFiDS_SurfData::Vertex
123 (const Standard_Boolean First,const Standard_Integer OnS) const
124 {
125   if(First && OnS == 1) return pfirstOnS1;
126   else if(First && OnS == 2) return pfirstOnS2;
127   else if(!First && OnS == 1) return plastOnS1;
128   else return plastOnS2;
129 }
130 
131 
132 //=======================================================================
133 //function : ChangeVertex
134 //purpose  :
135 //=======================================================================
136 
ChangeVertex(const Standard_Boolean First,const Standard_Integer OnS)137 ChFiDS_CommonPoint&  ChFiDS_SurfData::ChangeVertex
138 (const Standard_Boolean First,const Standard_Integer OnS)
139 {
140   if(First && OnS == 1) return pfirstOnS1;
141   else if(First && OnS == 2) return pfirstOnS2;
142   else if(!First && OnS == 1) return plastOnS1;
143   else return plastOnS2;
144 }
145 
146 
147 //=======================================================================
148 //function : FirstSpineParam
149 //purpose  :
150 //=======================================================================
151 
FirstSpineParam() const152 Standard_Real ChFiDS_SurfData::FirstSpineParam()const
153 {
154   return ufspine;
155 }
156 
157 //=======================================================================
158 //function : LastSpineParam
159 //purpose  :
160 //=======================================================================
161 
LastSpineParam() const162 Standard_Real ChFiDS_SurfData::LastSpineParam()const
163 {
164   return ulspine;
165 }
166 
167 //=======================================================================
168 //function : FirstSpineParam
169 //purpose  :
170 //=======================================================================
171 
FirstSpineParam(const Standard_Real Par)172 void ChFiDS_SurfData::FirstSpineParam(const Standard_Real Par)
173 {
174   ufspine = Par;
175 }
176 
177 //=======================================================================
178 //function : LastSpineParam
179 //purpose  :
180 //=======================================================================
181 
LastSpineParam(const Standard_Real Par)182 void ChFiDS_SurfData::LastSpineParam(const Standard_Real Par)
183 {
184   ulspine = Par;
185 }
186 
187 //=======================================================================
188 //function : FirstExtensionValue
189 //purpose  :
190 //=======================================================================
191 
FirstExtensionValue() const192 Standard_Real ChFiDS_SurfData::FirstExtensionValue()const
193 {
194   return myfirstextend;
195 }
196 
197 //=======================================================================
198 //function : LastExtensionValue
199 //purpose  :
200 //=======================================================================
201 
LastExtensionValue() const202 Standard_Real ChFiDS_SurfData::LastExtensionValue()const
203 {
204   return mylastextend;
205 }
206 
207 //=======================================================================
208 //function : FirstExtensionValue
209 //purpose  :
210 //=======================================================================
211 
FirstExtensionValue(const Standard_Real Extend)212 void ChFiDS_SurfData::FirstExtensionValue(const Standard_Real Extend)
213 {
214   myfirstextend=Extend;
215 }
216 
217 //=======================================================================
218 //function : LastExtensionValue
219 //purpose  :
220 //=======================================================================
221 
LastExtensionValue(const Standard_Real Extend)222 void ChFiDS_SurfData::LastExtensionValue(const Standard_Real Extend)
223 {
224   mylastextend=Extend;
225 }
226 
227 //=======================================================================
228 //function : Simul
229 //purpose  :
230 //=======================================================================
231 
Handle(Standard_Transient)232 Handle(Standard_Transient) ChFiDS_SurfData::Simul() const
233 {
234   return simul;
235 }
236 
237 
238 //=======================================================================
239 //function : SetSimul
240 //purpose  :
241 //=======================================================================
242 
SetSimul(const Handle (Standard_Transient)& S)243 void ChFiDS_SurfData::SetSimul(const Handle(Standard_Transient)& S)
244 {
245   simul = S;
246 }
247 
248 //=======================================================================
249 //function : ResetSimul
250 //purpose  :
251 //=======================================================================
252 
ResetSimul()253 void ChFiDS_SurfData::ResetSimul()
254 {
255   simul.Nullify();
256 }
257 
258 
259 //=======================================================================
260 //function : Get2dPoints
261 //purpose  :
262 //=======================================================================
263 
Get2dPoints(gp_Pnt2d & P2df1,gp_Pnt2d & P2dl1,gp_Pnt2d & P2df2,gp_Pnt2d & P2dl2) const264 void ChFiDS_SurfData::Get2dPoints(gp_Pnt2d& P2df1,
265 				  gp_Pnt2d& P2dl1,
266 				  gp_Pnt2d& P2df2,
267 				  gp_Pnt2d& P2dl2) const
268 {
269   P2df1 = p2df1;
270   P2dl1 = p2dl1;
271   P2df2 = p2df2;
272   P2dl2 = p2dl2;
273 }
274 
275 //=======================================================================
276 //function : Get2dPoints
277 //purpose  :
278 //=======================================================================
279 
Get2dPoints(const Standard_Boolean First,const Standard_Integer OnS) const280 gp_Pnt2d ChFiDS_SurfData::Get2dPoints(const Standard_Boolean First,
281 				      const Standard_Integer OnS) const
282 
283 {
284   if(First && OnS == 1) return p2df1;
285   else if(!First && OnS == 1) return p2dl1;
286   else if(First && OnS == 2) return p2df2;
287   return p2dl2;
288 }
289 
290 //=======================================================================
291 //function : Set2dPoints
292 //purpose  :
293 //=======================================================================
294 
Set2dPoints(const gp_Pnt2d & P2df1,const gp_Pnt2d & P2dl1,const gp_Pnt2d & P2df2,const gp_Pnt2d & P2dl2)295 void ChFiDS_SurfData::Set2dPoints(const gp_Pnt2d& P2df1,
296 				  const gp_Pnt2d& P2dl1,
297 				  const gp_Pnt2d& P2df2,
298 				  const gp_Pnt2d& P2dl2)
299 {
300   p2df1 = P2df1;
301   p2dl1 = P2dl1;
302   p2df2 = P2df2;
303   p2dl2 = P2dl2;
304 }
305 
306