1 // Created on: 1994-10-24
2 // Created by: Christophe MARION
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <HLRTopoBRep_Data.hxx>
19 #include <HLRTopoBRep_ListOfVData.hxx>
20 #include <HLRTopoBRep_VData.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <TopoDS_Vertex.hxx>
26 #include <TopTools_ListIteratorOfListOfShape.hxx>
28 //=======================================================================
29 //function : HLRTopoBRep_Data
31 //=======================================================================
32 HLRTopoBRep_Data::HLRTopoBRep_Data ()
37 //=======================================================================
40 //=======================================================================
42 void HLRTopoBRep_Data::Clear ()
49 myEdgesVertices.Clear();
52 //=======================================================================
55 //=======================================================================
57 void HLRTopoBRep_Data::Clean ()
61 //=======================================================================
62 //function : EdgeHasSplE
64 //=======================================================================
67 HLRTopoBRep_Data::EdgeHasSplE (const TopoDS_Edge& E) const
69 if (!mySplE.IsBound(E)) return Standard_False;
70 return !mySplE(E).IsEmpty();
73 //=======================================================================
74 //function : FaceHasIntL
76 //=======================================================================
79 HLRTopoBRep_Data::FaceHasIntL (const TopoDS_Face& F) const
81 if (!myData.IsBound(F)) return Standard_False;
82 return !myData(F).FaceIntL().IsEmpty();
85 //=======================================================================
86 //function : FaceHasOutL
88 //=======================================================================
91 HLRTopoBRep_Data::FaceHasOutL (const TopoDS_Face& F) const
93 if (!myData.IsBound(F)) return Standard_False;
94 return !myData(F).FaceOutL().IsEmpty();
97 //=======================================================================
98 //function : FaceHasIsoL
100 //=======================================================================
103 HLRTopoBRep_Data::FaceHasIsoL (const TopoDS_Face& F) const
105 if (!myData.IsBound(F)) return Standard_False;
106 return !myData(F).FaceIsoL().IsEmpty();
109 //=======================================================================
110 //function : IsSplEEdgeEdge
112 //=======================================================================
115 HLRTopoBRep_Data::IsSplEEdgeEdge (const TopoDS_Edge& E1,
116 const TopoDS_Edge& E2) const
118 Standard_Boolean found = Standard_False;
119 if (EdgeHasSplE(E1)) {
121 TopTools_ListIteratorOfListOfShape itS;
122 for (itS.Initialize(EdgeSplE(E1));
123 itS.More() && !found;
125 found= itS.Value().IsSame(E2);
128 found = E1.IsSame(E2);
132 //=======================================================================
133 //function : IsIntLFaceEdge
135 //=======================================================================
138 HLRTopoBRep_Data::IsIntLFaceEdge (const TopoDS_Face& F,
139 const TopoDS_Edge& E) const
141 Standard_Boolean found = Standard_False;
142 if (FaceHasIntL(F)) {
144 TopTools_ListIteratorOfListOfShape itE;
145 for(itE.Initialize(FaceIntL(F));
146 itE.More() && !found;
148 found = IsSplEEdgeEdge(TopoDS::Edge(itE.Value()),E);
154 //=======================================================================
155 //function : IsOutLFaceEdge
157 //=======================================================================
160 HLRTopoBRep_Data::IsOutLFaceEdge (const TopoDS_Face& F,
161 const TopoDS_Edge& E) const
163 Standard_Boolean found = Standard_False;
164 if (FaceHasOutL(F)) {
166 TopTools_ListIteratorOfListOfShape itE;
167 for(itE.Initialize(FaceOutL(F));
168 itE.More() && !found;
170 found = IsSplEEdgeEdge(TopoDS::Edge(itE.Value()),E);
176 //=======================================================================
177 //function : IsIsoLFaceEdge
179 //=======================================================================
182 HLRTopoBRep_Data::IsIsoLFaceEdge (const TopoDS_Face& F,
183 const TopoDS_Edge& E) const
185 Standard_Boolean found = Standard_False;
186 if (FaceHasIsoL(F)) {
188 TopTools_ListIteratorOfListOfShape itE;
189 for(itE.Initialize(FaceIsoL(F));
190 itE.More() && !found;
192 found = IsSplEEdgeEdge(TopoDS::Edge(itE.Value()),E);
198 //=======================================================================
199 //function : NewSOldS
201 //=======================================================================
203 TopoDS_Shape HLRTopoBRep_Data::NewSOldS (const TopoDS_Shape& NewS) const
205 if (myOldS.IsBound(NewS)) return myOldS(NewS);
209 //=======================================================================
212 //=======================================================================
214 void HLRTopoBRep_Data::AddOldS (const TopoDS_Shape& NewS,
215 const TopoDS_Shape& OldS)
217 if (!myOldS.IsBound(NewS))
218 myOldS.Bind(NewS,OldS);
221 //=======================================================================
224 //=======================================================================
226 TopTools_ListOfShape & HLRTopoBRep_Data::AddSplE (const TopoDS_Edge& E)
228 if (!mySplE.IsBound(E)) {
229 TopTools_ListOfShape empty;
230 mySplE.Bind(E,empty);
235 //=======================================================================
238 //=======================================================================
240 TopTools_ListOfShape & HLRTopoBRep_Data::AddIntL (const TopoDS_Face& F)
242 if (!myData.IsBound(F)) {
243 HLRTopoBRep_FaceData theData;
244 myData.Bind(F, theData);
246 return myData(F).AddIntL();
249 //=======================================================================
252 //=======================================================================
254 TopTools_ListOfShape & HLRTopoBRep_Data::AddOutL (const TopoDS_Face& F)
256 if (!myData.IsBound(F)) {
257 HLRTopoBRep_FaceData theData;
258 myData.Bind(F, theData);
260 return myData(F).AddOutL();
263 //=======================================================================
266 //=======================================================================
268 TopTools_ListOfShape & HLRTopoBRep_Data::AddIsoL (const TopoDS_Face& F)
270 if (!myData.IsBound(F)) {
271 HLRTopoBRep_FaceData theData;
272 myData.Bind(F, theData);
274 return myData(F).AddIsoL();
277 //=======================================================================
278 //function : InitEdge
280 //=======================================================================
282 void HLRTopoBRep_Data::InitEdge ()
284 myEIterator.Initialize(myEdgesVertices);
286 while (myEIterator.More() && myEIterator.Value().IsEmpty())
290 //=======================================================================
291 //function : NextEdge
293 //=======================================================================
295 void HLRTopoBRep_Data::NextEdge ()
299 while (myEIterator.More() && myEIterator.Value().IsEmpty())
303 //=======================================================================
304 //function : InitVertex
306 //=======================================================================
308 void HLRTopoBRep_Data::InitVertex (const TopoDS_Edge& E)
310 if (!myEdgesVertices.IsBound(E)) {
311 HLRTopoBRep_ListOfVData empty;
312 myEdgesVertices.Bind(E,empty);
314 HLRTopoBRep_ListOfVData& L = myEdgesVertices(E);
316 myVIterator.Initialize(L);
319 //=======================================================================
322 //=======================================================================
324 const TopoDS_Vertex & HLRTopoBRep_Data::Vertex () const
326 return TopoDS::Vertex(myVIterator.Value().Vertex());
329 //=======================================================================
330 //function : Parameter
332 //=======================================================================
334 Standard_Real HLRTopoBRep_Data::Parameter() const
336 return myVIterator.Value().Parameter();
339 //=======================================================================
340 //function : InsertBefore
342 //=======================================================================
344 void HLRTopoBRep_Data::InsertBefore (const TopoDS_Vertex& V,
345 const Standard_Real P)
347 HLRTopoBRep_VData VD(P,V);
348 myVList->InsertBefore(VD,myVIterator);
351 //=======================================================================
354 //=======================================================================
356 void HLRTopoBRep_Data::Append (const TopoDS_Vertex& V,
357 const Standard_Real P)
359 HLRTopoBRep_VData VD(P,V);