b311480e |
1 | // Created on: 2000-10-27 |
2 | // Created by: Peter KURNEV |
973c2be1 |
3 | // Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
42cf5bc1 |
16 | |
17 | #include <gp_Pnt.hxx> |
18 | #include <IntTools_CommonPrt.hxx> |
7fd59977 |
19 | #include <IntTools_Range.hxx> |
20 | #include <IntTools_SequenceOfRanges.hxx> |
42cf5bc1 |
21 | #include <TopoDS_Edge.hxx> |
7fd59977 |
22 | |
23 | //======================================================================= |
24 | //function : IntTools_CommonPrt::IntTools_CommonPr |
25 | //purpose : |
26 | //======================================================================= |
b311480e |
27 | IntTools_CommonPrt::IntTools_CommonPrt() |
7fd59977 |
28 | : |
29 | myType(TopAbs_SHAPE), |
30 | myAllNullFlag(Standard_False) |
31 | |
32 | { |
33 | // |
34 | myPnt1.SetCoord(0.,0.,0.); |
35 | myPnt2.SetCoord(0.,0.,0.); |
36 | // |
37 | // modified by NIZHNY-MKK Wed Jun 8 16:47:04 2005.BEGIN |
38 | myVertPar1 = 0.; |
39 | myVertPar2 = 0.; |
40 | // modified by NIZHNY-MKK Wed Jun 8 16:47:07 2005.END |
41 | } |
42 | |
43 | //======================================================================= |
44 | //function : IntTools_CommonPrt::IntTools_CommonPrt |
45 | //purpose : |
46 | //======================================================================= |
47 | IntTools_CommonPrt::IntTools_CommonPrt(const IntTools_CommonPrt& Other) |
48 | : |
49 | myEdge1(Other.myEdge1), |
50 | myEdge2(Other.myEdge2), |
51 | myType (Other.myType), |
52 | myRange1 (Other.myRange1), |
53 | myVertPar1(Other.myVertPar1), |
54 | myVertPar2(Other.myVertPar2), |
55 | myAllNullFlag(Standard_False), |
56 | // |
57 | myPnt1(Other.myPnt1), |
58 | myPnt2(Other.myPnt2) |
59 | // |
60 | { |
61 | Standard_Integer i, aNb=Other.myRanges2.Length(); |
62 | for (i=1; i<=aNb; i++) { |
63 | myRanges2.Append(Other.myRanges2(i)); |
64 | } |
65 | } |
66 | |
67 | //======================================================================= |
68 | //function : IntTools_CommonPrt::Assign |
69 | //purpose : |
70 | //======================================================================= |
71 | IntTools_CommonPrt& IntTools_CommonPrt::Assign(const IntTools_CommonPrt& Other) |
72 | { |
73 | myEdge1=Other.myEdge1; |
74 | myEdge2=Other.myEdge2; |
75 | myType =Other.myType; |
76 | myRange1 =Other.myRange1; |
77 | myVertPar1=Other.myVertPar1; |
78 | myVertPar2=Other.myVertPar2; |
79 | // |
80 | myPnt1=Other.myPnt1; |
81 | myPnt2=Other.myPnt2; |
82 | // |
83 | Standard_Integer i, aNb=Other.myRanges2.Length(); |
84 | for (i=1; i<=aNb; i++) { |
85 | myRanges2.Append(Other.myRanges2(i)); |
86 | } |
87 | myAllNullFlag=Other.myAllNullFlag; |
88 | return *this; |
89 | } |
90 | |
91 | //======================================================================= |
92 | //function : SetEdge1 |
93 | //purpose : |
94 | //======================================================================= |
95 | void IntTools_CommonPrt::SetEdge1(const TopoDS_Edge& anEdge) |
96 | { |
97 | myEdge1=anEdge; |
98 | } |
99 | |
100 | //======================================================================= |
101 | //function : SetEdge2 |
102 | //purpose : |
103 | //======================================================================= |
104 | void IntTools_CommonPrt::SetEdge2(const TopoDS_Edge& anEdge) |
105 | { |
106 | myEdge2=anEdge; |
107 | } |
108 | |
109 | //======================================================================= |
110 | //function : SetType |
111 | //purpose : |
112 | //======================================================================= |
113 | void IntTools_CommonPrt::SetType (const TopAbs_ShapeEnum aType) |
114 | { |
115 | myType=aType; |
116 | } |
117 | |
118 | //======================================================================= |
119 | //function : SetRange1 |
120 | //purpose : |
121 | //======================================================================= |
122 | void IntTools_CommonPrt::SetRange1 (const IntTools_Range& aRange) |
123 | { |
124 | myRange1=aRange; |
125 | } |
126 | |
127 | //======================================================================= |
128 | //function : SetRange1 |
129 | //purpose : |
130 | //======================================================================= |
131 | void IntTools_CommonPrt::SetRange1 (const Standard_Real tf, |
132 | const Standard_Real tl) |
133 | { |
134 | myRange1.SetFirst(tf); |
135 | myRange1.SetLast (tl); |
136 | } |
137 | |
138 | //======================================================================= |
139 | //function : AppendRange2 |
140 | //purpose : |
141 | //======================================================================= |
142 | void IntTools_CommonPrt::AppendRange2 (const IntTools_Range& aRange) |
143 | { |
144 | myRanges2.Append(aRange); |
145 | } |
146 | //======================================================================= |
147 | //function : AppendRange2 |
148 | //purpose : |
149 | //======================================================================= |
150 | void IntTools_CommonPrt::AppendRange2 (const Standard_Real tf, |
151 | const Standard_Real tl) |
152 | { |
153 | IntTools_Range aRange(tf, tl); |
154 | myRanges2.Append(aRange); |
155 | } |
156 | //======================================================================= |
157 | //function : SetVertexParameter1 |
158 | //purpose : |
159 | //======================================================================= |
160 | void IntTools_CommonPrt::SetVertexParameter1(const Standard_Real tV) |
161 | { |
162 | myVertPar1=tV; |
163 | } |
164 | //======================================================================= |
165 | //function : SetVertexParameter2 |
166 | //purpose : |
167 | //======================================================================= |
168 | void IntTools_CommonPrt::SetVertexParameter2(const Standard_Real tV) |
169 | { |
170 | myVertPar2=tV; |
171 | } |
172 | |
173 | //======================================================================= |
174 | //function : Edge1 |
175 | //purpose : |
176 | //======================================================================= |
177 | const TopoDS_Edge& IntTools_CommonPrt::Edge1() const |
178 | { |
179 | return myEdge1; |
180 | } |
181 | |
182 | //======================================================================= |
183 | //function : Edge2 |
184 | //purpose : |
185 | //======================================================================= |
186 | const TopoDS_Edge& IntTools_CommonPrt::Edge2() const |
187 | { |
188 | return myEdge2; |
189 | } |
190 | |
191 | //======================================================================= |
192 | //function : TopAbs_ShapeEnum |
193 | //purpose : |
194 | //======================================================================= |
195 | TopAbs_ShapeEnum IntTools_CommonPrt::Type() const |
196 | { |
197 | return myType; |
198 | } |
199 | |
200 | //======================================================================= |
201 | //function : Range1 |
202 | //purpose : |
203 | //======================================================================= |
204 | const IntTools_Range& IntTools_CommonPrt::Range1() const |
205 | { |
206 | return myRange1; |
207 | } |
208 | |
209 | //======================================================================= |
210 | //function : Range1 |
211 | //purpose : |
212 | //======================================================================= |
213 | void IntTools_CommonPrt::Range1(Standard_Real& tf, |
214 | Standard_Real& tl) const |
215 | { |
216 | tf=myRange1.First(); |
217 | tl=myRange1.Last(); |
218 | } |
219 | //======================================================================= |
220 | //function : Ranges2 |
221 | //purpose : |
222 | //======================================================================= |
223 | const IntTools_SequenceOfRanges& IntTools_CommonPrt::Ranges2() const |
224 | { |
225 | return myRanges2; |
226 | } |
227 | //======================================================================= |
228 | //function : ChangeRanges2 |
229 | //purpose : |
230 | //======================================================================= |
231 | IntTools_SequenceOfRanges& IntTools_CommonPrt::ChangeRanges2() |
232 | { |
233 | return myRanges2; |
234 | } |
235 | |
236 | //======================================================================= |
237 | //function : VertexParameter1 |
238 | //purpose : |
239 | //======================================================================= |
240 | Standard_Real IntTools_CommonPrt::VertexParameter1() const |
241 | { |
242 | return myVertPar1; |
243 | } |
244 | //======================================================================= |
245 | //function : VertexParameter2 |
246 | //purpose : |
247 | //======================================================================= |
248 | Standard_Real IntTools_CommonPrt::VertexParameter2() const |
249 | { |
250 | return myVertPar2; |
251 | } |
252 | |
253 | //======================================================================= |
254 | //function : Copy |
255 | //purpose : |
256 | //======================================================================= |
257 | void IntTools_CommonPrt::Copy(IntTools_CommonPrt& aCP) const |
258 | { |
259 | aCP.SetEdge1(Edge1()); |
260 | aCP.SetEdge2(Edge2()); |
261 | aCP.SetType (Type()); |
262 | aCP.SetRange1(Range1()); |
263 | aCP.SetVertexParameter1(myVertPar1); |
264 | aCP.SetVertexParameter2(myVertPar2); |
265 | |
266 | IntTools_SequenceOfRanges aSeqRanges; |
267 | Standard_Integer i, aNb; |
268 | aNb=myRanges2.Length(); |
269 | for (i=1; i<=aNb; i++) { |
270 | aCP.AppendRange2(myRanges2(i)); |
271 | } |
272 | } |
273 | |
274 | //======================================================================= |
275 | //function : SetAllNullFlag |
276 | //purpose : |
277 | //======================================================================= |
278 | void IntTools_CommonPrt::SetAllNullFlag(const Standard_Boolean aFlag) |
279 | { |
280 | myAllNullFlag=aFlag; |
281 | } |
282 | |
283 | //======================================================================= |
284 | //function : AllNullFlag |
285 | //purpose : |
286 | //======================================================================= |
287 | Standard_Boolean IntTools_CommonPrt::AllNullFlag()const |
288 | { |
289 | return myAllNullFlag; |
290 | } |
291 | |
292 | // |
293 | //======================================================================= |
294 | //function : SetBoundingPoints |
295 | //purpose : |
296 | //======================================================================= |
297 | void IntTools_CommonPrt::SetBoundingPoints(const gp_Pnt& aP1, |
298 | const gp_Pnt& aP2) |
299 | { |
300 | myPnt1=aP1; |
301 | myPnt2=aP2; |
302 | } |
303 | //======================================================================= |
304 | //function : BoundingPoints |
305 | //purpose : |
306 | //======================================================================= |
307 | void IntTools_CommonPrt::BoundingPoints(gp_Pnt& aP1, |
308 | gp_Pnt& aP2) const |
309 | { |
310 | aP1=myPnt1; |
311 | aP2=myPnt2; |
312 | } |
313 | // |