b311480e |
1 | // Created on: 2000-10-27 |
2 | // Created by: Peter KURNEV |
3 | // Copyright (c) 2000-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | |
22 | #include <IntTools_CommonPrt.ixx> |
23 | #include <IntTools_Range.hxx> |
24 | #include <IntTools_SequenceOfRanges.hxx> |
25 | |
26 | //======================================================================= |
27 | //function : IntTools_CommonPrt::IntTools_CommonPr |
28 | //purpose : |
29 | //======================================================================= |
b311480e |
30 | IntTools_CommonPrt::IntTools_CommonPrt() |
7fd59977 |
31 | : |
32 | myType(TopAbs_SHAPE), |
33 | myAllNullFlag(Standard_False) |
34 | |
35 | { |
36 | // |
37 | myPnt1.SetCoord(0.,0.,0.); |
38 | myPnt2.SetCoord(0.,0.,0.); |
39 | // |
40 | // modified by NIZHNY-MKK Wed Jun 8 16:47:04 2005.BEGIN |
41 | myVertPar1 = 0.; |
42 | myVertPar2 = 0.; |
43 | // modified by NIZHNY-MKK Wed Jun 8 16:47:07 2005.END |
44 | } |
45 | |
46 | //======================================================================= |
47 | //function : IntTools_CommonPrt::IntTools_CommonPrt |
48 | //purpose : |
49 | //======================================================================= |
50 | IntTools_CommonPrt::IntTools_CommonPrt(const IntTools_CommonPrt& Other) |
51 | : |
52 | myEdge1(Other.myEdge1), |
53 | myEdge2(Other.myEdge2), |
54 | myType (Other.myType), |
55 | myRange1 (Other.myRange1), |
56 | myVertPar1(Other.myVertPar1), |
57 | myVertPar2(Other.myVertPar2), |
58 | myAllNullFlag(Standard_False), |
59 | // |
60 | myPnt1(Other.myPnt1), |
61 | myPnt2(Other.myPnt2) |
62 | // |
63 | { |
64 | Standard_Integer i, aNb=Other.myRanges2.Length(); |
65 | for (i=1; i<=aNb; i++) { |
66 | myRanges2.Append(Other.myRanges2(i)); |
67 | } |
68 | } |
69 | |
70 | //======================================================================= |
71 | //function : IntTools_CommonPrt::Assign |
72 | //purpose : |
73 | //======================================================================= |
74 | IntTools_CommonPrt& IntTools_CommonPrt::Assign(const IntTools_CommonPrt& Other) |
75 | { |
76 | myEdge1=Other.myEdge1; |
77 | myEdge2=Other.myEdge2; |
78 | myType =Other.myType; |
79 | myRange1 =Other.myRange1; |
80 | myVertPar1=Other.myVertPar1; |
81 | myVertPar2=Other.myVertPar2; |
82 | // |
83 | myPnt1=Other.myPnt1; |
84 | myPnt2=Other.myPnt2; |
85 | // |
86 | Standard_Integer i, aNb=Other.myRanges2.Length(); |
87 | for (i=1; i<=aNb; i++) { |
88 | myRanges2.Append(Other.myRanges2(i)); |
89 | } |
90 | myAllNullFlag=Other.myAllNullFlag; |
91 | return *this; |
92 | } |
93 | |
94 | //======================================================================= |
95 | //function : SetEdge1 |
96 | //purpose : |
97 | //======================================================================= |
98 | void IntTools_CommonPrt::SetEdge1(const TopoDS_Edge& anEdge) |
99 | { |
100 | myEdge1=anEdge; |
101 | } |
102 | |
103 | //======================================================================= |
104 | //function : SetEdge2 |
105 | //purpose : |
106 | //======================================================================= |
107 | void IntTools_CommonPrt::SetEdge2(const TopoDS_Edge& anEdge) |
108 | { |
109 | myEdge2=anEdge; |
110 | } |
111 | |
112 | //======================================================================= |
113 | //function : SetType |
114 | //purpose : |
115 | //======================================================================= |
116 | void IntTools_CommonPrt::SetType (const TopAbs_ShapeEnum aType) |
117 | { |
118 | myType=aType; |
119 | } |
120 | |
121 | //======================================================================= |
122 | //function : SetRange1 |
123 | //purpose : |
124 | //======================================================================= |
125 | void IntTools_CommonPrt::SetRange1 (const IntTools_Range& aRange) |
126 | { |
127 | myRange1=aRange; |
128 | } |
129 | |
130 | //======================================================================= |
131 | //function : SetRange1 |
132 | //purpose : |
133 | //======================================================================= |
134 | void IntTools_CommonPrt::SetRange1 (const Standard_Real tf, |
135 | const Standard_Real tl) |
136 | { |
137 | myRange1.SetFirst(tf); |
138 | myRange1.SetLast (tl); |
139 | } |
140 | |
141 | //======================================================================= |
142 | //function : AppendRange2 |
143 | //purpose : |
144 | //======================================================================= |
145 | void IntTools_CommonPrt::AppendRange2 (const IntTools_Range& aRange) |
146 | { |
147 | myRanges2.Append(aRange); |
148 | } |
149 | //======================================================================= |
150 | //function : AppendRange2 |
151 | //purpose : |
152 | //======================================================================= |
153 | void IntTools_CommonPrt::AppendRange2 (const Standard_Real tf, |
154 | const Standard_Real tl) |
155 | { |
156 | IntTools_Range aRange(tf, tl); |
157 | myRanges2.Append(aRange); |
158 | } |
159 | //======================================================================= |
160 | //function : SetVertexParameter1 |
161 | //purpose : |
162 | //======================================================================= |
163 | void IntTools_CommonPrt::SetVertexParameter1(const Standard_Real tV) |
164 | { |
165 | myVertPar1=tV; |
166 | } |
167 | //======================================================================= |
168 | //function : SetVertexParameter2 |
169 | //purpose : |
170 | //======================================================================= |
171 | void IntTools_CommonPrt::SetVertexParameter2(const Standard_Real tV) |
172 | { |
173 | myVertPar2=tV; |
174 | } |
175 | |
176 | //======================================================================= |
177 | //function : Edge1 |
178 | //purpose : |
179 | //======================================================================= |
180 | const TopoDS_Edge& IntTools_CommonPrt::Edge1() const |
181 | { |
182 | return myEdge1; |
183 | } |
184 | |
185 | //======================================================================= |
186 | //function : Edge2 |
187 | //purpose : |
188 | //======================================================================= |
189 | const TopoDS_Edge& IntTools_CommonPrt::Edge2() const |
190 | { |
191 | return myEdge2; |
192 | } |
193 | |
194 | //======================================================================= |
195 | //function : TopAbs_ShapeEnum |
196 | //purpose : |
197 | //======================================================================= |
198 | TopAbs_ShapeEnum IntTools_CommonPrt::Type() const |
199 | { |
200 | return myType; |
201 | } |
202 | |
203 | //======================================================================= |
204 | //function : Range1 |
205 | //purpose : |
206 | //======================================================================= |
207 | const IntTools_Range& IntTools_CommonPrt::Range1() const |
208 | { |
209 | return myRange1; |
210 | } |
211 | |
212 | //======================================================================= |
213 | //function : Range1 |
214 | //purpose : |
215 | //======================================================================= |
216 | void IntTools_CommonPrt::Range1(Standard_Real& tf, |
217 | Standard_Real& tl) const |
218 | { |
219 | tf=myRange1.First(); |
220 | tl=myRange1.Last(); |
221 | } |
222 | //======================================================================= |
223 | //function : Ranges2 |
224 | //purpose : |
225 | //======================================================================= |
226 | const IntTools_SequenceOfRanges& IntTools_CommonPrt::Ranges2() const |
227 | { |
228 | return myRanges2; |
229 | } |
230 | //======================================================================= |
231 | //function : ChangeRanges2 |
232 | //purpose : |
233 | //======================================================================= |
234 | IntTools_SequenceOfRanges& IntTools_CommonPrt::ChangeRanges2() |
235 | { |
236 | return myRanges2; |
237 | } |
238 | |
239 | //======================================================================= |
240 | //function : VertexParameter1 |
241 | //purpose : |
242 | //======================================================================= |
243 | Standard_Real IntTools_CommonPrt::VertexParameter1() const |
244 | { |
245 | return myVertPar1; |
246 | } |
247 | //======================================================================= |
248 | //function : VertexParameter2 |
249 | //purpose : |
250 | //======================================================================= |
251 | Standard_Real IntTools_CommonPrt::VertexParameter2() const |
252 | { |
253 | return myVertPar2; |
254 | } |
255 | |
256 | //======================================================================= |
257 | //function : Copy |
258 | //purpose : |
259 | //======================================================================= |
260 | void IntTools_CommonPrt::Copy(IntTools_CommonPrt& aCP) const |
261 | { |
262 | aCP.SetEdge1(Edge1()); |
263 | aCP.SetEdge2(Edge2()); |
264 | aCP.SetType (Type()); |
265 | aCP.SetRange1(Range1()); |
266 | aCP.SetVertexParameter1(myVertPar1); |
267 | aCP.SetVertexParameter2(myVertPar2); |
268 | |
269 | IntTools_SequenceOfRanges aSeqRanges; |
270 | Standard_Integer i, aNb; |
271 | aNb=myRanges2.Length(); |
272 | for (i=1; i<=aNb; i++) { |
273 | aCP.AppendRange2(myRanges2(i)); |
274 | } |
275 | } |
276 | |
277 | //======================================================================= |
278 | //function : SetAllNullFlag |
279 | //purpose : |
280 | //======================================================================= |
281 | void IntTools_CommonPrt::SetAllNullFlag(const Standard_Boolean aFlag) |
282 | { |
283 | myAllNullFlag=aFlag; |
284 | } |
285 | |
286 | //======================================================================= |
287 | //function : AllNullFlag |
288 | //purpose : |
289 | //======================================================================= |
290 | Standard_Boolean IntTools_CommonPrt::AllNullFlag()const |
291 | { |
292 | return myAllNullFlag; |
293 | } |
294 | |
295 | // |
296 | //======================================================================= |
297 | //function : SetBoundingPoints |
298 | //purpose : |
299 | //======================================================================= |
300 | void IntTools_CommonPrt::SetBoundingPoints(const gp_Pnt& aP1, |
301 | const gp_Pnt& aP2) |
302 | { |
303 | myPnt1=aP1; |
304 | myPnt2=aP2; |
305 | } |
306 | //======================================================================= |
307 | //function : BoundingPoints |
308 | //purpose : |
309 | //======================================================================= |
310 | void IntTools_CommonPrt::BoundingPoints(gp_Pnt& aP1, |
311 | gp_Pnt& aP2) const |
312 | { |
313 | aP1=myPnt1; |
314 | aP2=myPnt2; |
315 | } |
316 | // |