0024639: Parallelization FillDS part of BO
[occt.git] / src / IntTools / IntTools_EdgeEdge.lxx
1 // Created by: Eugeny MALTCHIKOV
2 // Copyright (c) 2013-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #include <Precision.hxx>
16 #include <BRep_Tool.hxx>
17
18 //=======================================================================
19 //function : IntTools_EdgeEdge
20 //purpose  : 
21 //=======================================================================
22 inline IntTools_EdgeEdge::IntTools_EdgeEdge()
23
24   myTol1(0.),
25   myTol2(0.),
26   myTol(0.),
27   myRes1(0.),
28   myRes2(0.),
29   myRange1(0., 0.),
30   myRange2(0., 0.),
31   mySwap(Standard_False),
32   myErrorStatus(0)
33 {
34 }
35 //=======================================================================
36 //function : IntTools_EdgeEdge
37 //purpose  : 
38 //=======================================================================
39 inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge&  theEdge1,
40                                             const TopoDS_Edge&  theEdge2)
41
42   myEdge1(theEdge1), 
43   myEdge2(theEdge2),
44   myTol1(0.),
45   myTol2(0.),
46   myTol(0.),
47   myRes1(0.),
48   myRes2(0.),
49   myRange1(0., 0.),
50   myRange2(0., 0.),
51   mySwap(Standard_False),
52   myErrorStatus(0)
53 {
54 }
55 //=======================================================================
56 //function : IntTools_EdgeEdge
57 //purpose  : 
58 //=======================================================================
59 inline IntTools_EdgeEdge::IntTools_EdgeEdge(const TopoDS_Edge&  theEdge1,
60                                             const Standard_Real aT11,
61                                             const Standard_Real aT12,
62                                             const TopoDS_Edge&  theEdge2,
63                                             const Standard_Real aT21,
64                                             const Standard_Real aT22)
65
66   myEdge1(theEdge1), 
67   myEdge2(theEdge2),
68   myTol1(0.),
69   myTol2(0.),
70   myTol(0.),
71   myRes1(0.),
72   myRes2(0.),
73   myRange1(aT11, aT12),
74   myRange2(aT21, aT22),
75   mySwap(Standard_False),
76   myErrorStatus(0)
77 {
78 }
79 //=======================================================================
80 //function : IntTools_EdgeEdge
81 //purpose  : 
82 //=======================================================================
83 inline IntTools_EdgeEdge::~IntTools_EdgeEdge()
84 {
85 }
86 //=======================================================================
87 //function : SetEdge1
88 //purpose  : 
89 //=======================================================================
90 inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge& theEdge)
91 {
92   myEdge1 = theEdge;
93 }
94 //=======================================================================
95 //function : SetRange1
96 //purpose  : 
97 //=======================================================================
98 inline void IntTools_EdgeEdge::SetRange1(const IntTools_Range& theRange)
99 {
100   myRange1 = theRange;
101 }
102 //=======================================================================
103 //function : SetRange1
104 //purpose  : 
105 //=======================================================================
106 inline void IntTools_EdgeEdge::SetRange1(const Standard_Real aT1,
107                                          const Standard_Real aT2)
108 {
109   myRange1.SetFirst(aT1);
110   myRange1.SetLast(aT2);
111 }
112 //=======================================================================
113 //function : SetEdge1
114 //purpose  : 
115 //=======================================================================
116 inline void IntTools_EdgeEdge::SetEdge1(const TopoDS_Edge&  theEdge,
117                                         const Standard_Real aT1,
118                                         const Standard_Real aT2)
119 {
120   SetEdge1(theEdge);
121   SetRange1(aT1, aT2);
122 }
123 //=======================================================================
124 //function : SetEdge2
125 //purpose  : 
126 //=======================================================================
127 inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge& theEdge)
128 {
129   myEdge2 = theEdge;
130 }
131 //=======================================================================
132 //function : SetRange1
133 //purpose  : 
134 //=======================================================================
135 inline void IntTools_EdgeEdge::SetRange2(const IntTools_Range& theRange)
136 {
137   myRange2 = theRange;
138 }
139 //=======================================================================
140 //function : SetRange1
141 //purpose  : 
142 //=======================================================================
143 inline void IntTools_EdgeEdge::SetRange2(const Standard_Real aT1,
144                                          const Standard_Real aT2)
145 {
146   myRange2.SetFirst(aT1);
147   myRange2.SetLast(aT2);
148 }
149 //=======================================================================
150 //function : SetEdge1
151 //purpose  : 
152 //=======================================================================
153 inline void IntTools_EdgeEdge::SetEdge2(const TopoDS_Edge&  theEdge,
154                                         const Standard_Real aT1,
155                                         const Standard_Real aT2)
156 {
157   SetEdge2(theEdge);
158   SetRange2(aT1, aT2);
159 }
160 //=======================================================================
161 //function : CommonParts
162 //purpose  : 
163 //=======================================================================
164 inline const IntTools_SequenceOfCommonPrts& IntTools_EdgeEdge::CommonParts() const
165 {
166   return myCommonParts;
167 }
168 //=======================================================================
169 //function : IsDone
170 //purpose  : 
171 //=======================================================================
172 inline Standard_Boolean IntTools_EdgeEdge::IsDone() const
173 {
174   return (myErrorStatus == 0);
175 }
176 //=======================================================================
177 //function : CheckData
178 //purpose  : 
179 //=======================================================================
180 inline void IntTools_EdgeEdge::CheckData()
181 {
182   if (myEdge1.IsNull() || myEdge2.IsNull()) {
183     myErrorStatus = 1;
184     return;
185   }
186   //
187   if (BRep_Tool::Degenerated(myEdge1) || BRep_Tool::Degenerated(myEdge2)) {
188     myErrorStatus = 2;
189     return;
190   }
191   //
192   if (!BRep_Tool::IsGeometric(myEdge1) || !BRep_Tool::IsGeometric(myEdge2)) { 
193     myErrorStatus = 3;
194     return;
195   }
196 }
197