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