1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: NMTTools_PaveFiller_3.cxx
21 // Created: Mon Dec 8 16:06:56 2003
22 // Author: Peter KURNEV
26 #include <NMTTools_PaveFiller.ixx>
29 #include <TopoDS_Shape.hxx>
30 #include <TopoDS_Vertex.hxx>
31 #include <TopoDS_Face.hxx>
33 #include <TopExp_Explorer.hxx>
35 #include <BOPTools_VSInterference.hxx>
36 #include <BOPTools_CArray1OfVSInterference.hxx>
38 #include <NMTDS_Iterator.hxx>
39 #include <NMTDS_ShapesDataStructure.hxx>
40 #include <NMTDS_InterfPool.hxx>
43 // Modified Thu Sep 14 14:35:18 2006
44 // Contribution of Samtech www.samcef.com BEGIN
46 Standard_Boolean Contains(const TopoDS_Face& aF,
47 const TopoDS_Vertex& aV);
48 // Contribution of Samtech www.samcef.com END
49 //=======================================================================
50 // function: PerformVF
52 //=======================================================================
53 void NMTTools_PaveFiller::PerformVF()
55 myIsDone=Standard_False;
57 Standard_Boolean aJustAdd;
58 Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV;
63 BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences();
66 myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE);
68 // BlockLength correction
69 aNbVSs=myDSIt->BlockLength();
70 aBlockLength=aVSs.BlockLength();
71 if (aNbVSs > aBlockLength) {
72 aVSs.SetBlockLength(aNbVSs);
75 for (; myDSIt->More(); myDSIt->Next()) {
76 myDSIt->Current(n1, n2, aJustAdd);
77 if (! IsSuccessorsComputed(n1, n2)) {
81 if (myDS->GetShapeType(n1)==TopAbs_FACE) {
86 iSDV=FindSDVertex(aWhat);
89 //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
93 aV1=TopoDS::Vertex(myDS->Shape(aWhat));
95 aV1=TopoDS::Vertex(myDS->Shape(iSDV));
98 aF2=TopoDS::Face(myDS->Shape(aWith));
100 // Modified Thu Sep 14 14:35:18 2006
101 // Contribution of Samtech www.samcef.com BEGIN
102 if (Contains(aF2, aV1)) {
105 // Contribution of Samtech www.samcef.com END
107 aFlag=myContext.ComputeVS (aV1, aF2, aU, aV);
111 // Add Interference to the Pool
112 BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV);
113 anIndexIn=aVSs.Append(anInterf);
115 // SetState for Vertex in DS;
116 myDS->SetState (aWhat, BooleanOperations_ON);
117 // Insert Vertex in Interference Object
118 BOPTools_VSInterference& aVS=aVSs(anIndexIn);
119 aVS.SetNewShape(aWhat);
122 myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF);
126 //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
129 myIsDone=Standard_True;
131 // Modified Thu Sep 14 14:35:18 2006
132 // Contribution of Samtech www.samcef.com BEGIN
133 //=======================================================================
134 //function : Contains
136 //=======================================================================
137 Standard_Boolean Contains(const TopoDS_Face& aF,
138 const TopoDS_Vertex& aV)
140 Standard_Boolean bRet;
141 TopExp_Explorer aExp;
144 aExp.Init(aF, TopAbs_VERTEX);
145 for (; aExp.More(); aExp.Next()) {
146 const TopoDS_Shape& aVF=aExp.Current();
147 if (aVF.IsSame(aV)) {
154 // Contribution of Samtech www.samcef.com END