1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
16 #include <TopoDS_Edge.hxx>
17 #include <TopoDS_Vertex.hxx>
18 #include <TopOpeBRepBuild_VertexInfo.hxx>
19 #include <TopTools_ListIteratorOfListOfShape.hxx>
22 //=======================================================================
23 // function :TopOpeBRepBuild_VertexInfo
25 //=======================================================================
26 TopOpeBRepBuild_VertexInfo::TopOpeBRepBuild_VertexInfo()
28 mySmart=Standard_False;
30 myEdgesPassed.Clear();
32 //=======================================================================
33 // function :TopOpeBRepBuild_VertexInfo::SetVertex
35 //=======================================================================
36 void TopOpeBRepBuild_VertexInfo::SetVertex(const TopoDS_Vertex& aV)
40 //=======================================================================
41 // function :TopOpeBRepBuild_VertexInfo::Vertex
43 //=======================================================================
44 const TopoDS_Vertex& TopOpeBRepBuild_VertexInfo::Vertex() const
48 //=======================================================================
49 // function :TopOpeBRepBuild_VertexInfo::SetSmart
51 //=======================================================================
52 void TopOpeBRepBuild_VertexInfo::SetSmart(const Standard_Boolean aFlag)
56 //=======================================================================
57 // function :TopOpeBRepBuild_VertexInfo:Smart
59 //=======================================================================
60 Standard_Boolean TopOpeBRepBuild_VertexInfo::Smart() const
64 //=======================================================================
65 // function :TopOpeBRepBuild_VertexInfo:NbCases
67 //=======================================================================
68 Standard_Integer TopOpeBRepBuild_VertexInfo::NbCases() const
70 return myLocalEdgesOut.Extent();
73 //=======================================================================
74 // function :TopOpeBRepBuild_VertexInfo:FoundOut
76 //=======================================================================
77 Standard_Integer TopOpeBRepBuild_VertexInfo::FoundOut () const
82 //=======================================================================
83 // function :TopOpeBRepBuild_VertexInfo::AddIn
85 //=======================================================================
86 void TopOpeBRepBuild_VertexInfo::AddIn(const TopoDS_Edge& anE)
91 //=======================================================================
92 // function :TopOpeBRepBuild_VertexInfo::AddOut
94 //=======================================================================
95 void TopOpeBRepBuild_VertexInfo::AddOut(const TopoDS_Edge& anE)
100 //=======================================================================
101 // function :TopOpeBRepBuild_VertexInfo::SetCurrentIn
103 //=======================================================================
104 void TopOpeBRepBuild_VertexInfo::SetCurrentIn(const TopoDS_Edge& anE)
109 //=======================================================================
110 // function :TopOpeBRepBuild_VertexInfo::EdgesIn
112 //=======================================================================
113 const TopTools_IndexedMapOfOrientedShape& TopOpeBRepBuild_VertexInfo::EdgesIn() const
118 //=======================================================================
119 // function :TopOpeBRepBuild_VertexInfo::EdgesOut
121 //=======================================================================
122 const TopTools_IndexedMapOfOrientedShape& TopOpeBRepBuild_VertexInfo::EdgesOut() const
127 //=======================================================================
128 // function :TopOpeBRepBuild_VertexInfo::ChangeEdgesOut
130 //=======================================================================
131 TopTools_IndexedMapOfOrientedShape& TopOpeBRepBuild_VertexInfo::ChangeEdgesOut()
136 //=======================================================================
137 // function :TopOpeBRepBuild_VertexInfo::Dump
139 //=======================================================================
140 void TopOpeBRepBuild_VertexInfo::Dump() const
142 printf(" *** Dump the Vertex Info ***\n");
143 printf(" mySmart : %ud\n", mySmart);
144 printf(" Edges : %d In, %d Out\n", myEdgesIn.Extent(), myEdgesOut.Extent());
150 //=======================================================================
151 // function :TopOpeBRepBuild_VertexInfo::AppendPassed
153 //=======================================================================
154 void TopOpeBRepBuild_VertexInfo::AppendPassed(const TopoDS_Edge& anE)
156 myEdgesPassed.Prepend(anE);
160 //=======================================================================
161 // function :TopOpeBRepBuild_VertexInfo::RemovePassed
163 //=======================================================================
164 void TopOpeBRepBuild_VertexInfo::RemovePassed()
166 myEdgesPassed.RemoveFirst();
168 //=======================================================================
169 // function :TopOpeBRepBuild_VertexInfo::ListPassed
171 //=======================================================================
172 const TopTools_ListOfShape& TopOpeBRepBuild_VertexInfo::ListPassed() const
174 return myEdgesPassed;
176 //=======================================================================
177 // function :TopOpeBRepBuild_VertexInfo::Prepare
179 //=======================================================================
180 void TopOpeBRepBuild_VertexInfo::Prepare(const TopTools_ListOfShape& aL)
182 myLocalEdgesOut.Clear();
184 TopTools_IndexedMapOfOrientedShape tmpMap;
186 TopTools_ListIteratorOfListOfShape anIt(aL);
187 for (; anIt.More(); anIt.Next()) {
188 tmpMap.Add(anIt.Value());
191 Standard_Integer i = 1, nb = myEdgesOut.Extent();
192 for(; i <= nb; i++) {
193 const TopoDS_Shape& aE = myEdgesOut(i);
194 if(!tmpMap.Contains(aE))
195 myLocalEdgesOut.Add(aE);
201 //=======================================================================
202 // function :TopOpeBRepBuild_VertexInfo:CurrentOut
204 //=======================================================================
205 const TopoDS_Edge& TopOpeBRepBuild_VertexInfo::CurrentOut ()
208 Standard_Integer i, aNbOut;
209 aNbOut =myLocalEdgesOut.Extent();
211 TopTools_IndexedMapOfOrientedShape aMapPassed;
212 TopTools_ListIteratorOfListOfShape anIt(myEdgesPassed);
213 for (; anIt.More(); anIt.Next()) {
214 aMapPassed.Add (anIt.Value());
217 for (i=1; i<=aNbOut; i++) {
218 if (!aMapPassed.Contains(myLocalEdgesOut(i))) {
219 myCurrent=TopoDS::Edge(myLocalEdgesOut(i));