1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: NMTTools_PaveFiller_3.cxx
24 // Created: Mon Dec 8 16:06:56 2003
25 // Author: Peter KURNEV
28 #include <NMTTools_PaveFiller.ixx>
31 #include <TopoDS_Shape.hxx>
32 #include <TopoDS_Vertex.hxx>
33 #include <TopoDS_Face.hxx>
35 #include <TopExp_Explorer.hxx>
37 #include <BOPTools_VSInterference.hxx>
38 #include <BOPTools_CArray1OfVSInterference.hxx>
40 #include <NMTDS_Iterator.hxx>
41 #include <NMTDS_ShapesDataStructure.hxx>
42 #include <NMTDS_InterfPool.hxx>
45 // Modified Thu Sep 14 14:35:18 2006
46 // Contribution of Samtech www.samcef.com BEGIN
48 Standard_Boolean Contains(const TopoDS_Face& aF,
49 const TopoDS_Vertex& aV);
50 // Contribution of Samtech www.samcef.com END
51 //=======================================================================
52 // function: PerformVF
54 //=======================================================================
55 void NMTTools_PaveFiller::PerformVF()
57 myIsDone=Standard_False;
59 Standard_Boolean aJustAdd;
60 Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV;
65 BOPTools_CArray1OfVSInterference& aVSs=myIP->VSInterferences();
68 myDSIt->Initialize(TopAbs_VERTEX, TopAbs_FACE);
70 // BlockLength correction
71 aNbVSs=myDSIt->BlockLength();
72 aBlockLength=aVSs.BlockLength();
73 if (aNbVSs > aBlockLength) {
74 aVSs.SetBlockLength(aNbVSs);
77 for (; myDSIt->More(); myDSIt->Next()) {
78 myDSIt->Current(n1, n2, aJustAdd);
79 if (! IsSuccessorsComputed(n1, n2)) {
83 if (myDS->GetShapeType(n1)==TopAbs_FACE) {
88 iSDV=FindSDVertex(aWhat);
91 //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
95 aV1=TopoDS::Vertex(myDS->Shape(aWhat));
97 aV1=TopoDS::Vertex(myDS->Shape(iSDV));
100 aF2=TopoDS::Face(myDS->Shape(aWith));
102 // Modified Thu Sep 14 14:35:18 2006
103 // Contribution of Samtech www.samcef.com BEGIN
104 if (Contains(aF2, aV1)) {
107 // Contribution of Samtech www.samcef.com END
109 aFlag=myContext.ComputeVS (aV1, aF2, aU, aV);
113 // Add Interference to the Pool
114 BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV);
115 anIndexIn=aVSs.Append(anInterf);
117 // SetState for Vertex in DS;
118 myDS->SetState (aWhat, BooleanOperations_ON);
119 // Insert Vertex in Interference Object
120 BOPTools_VSInterference& aVS=aVSs(anIndexIn);
121 aVS.SetNewShape(aWhat);
124 myIP->Add(aWhat, aWith, Standard_True, NMTDS_TI_VF);
128 //myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
131 myIsDone=Standard_True;
133 // Modified Thu Sep 14 14:35:18 2006
134 // Contribution of Samtech www.samcef.com BEGIN
135 //=======================================================================
136 //function : Contains
138 //=======================================================================
139 Standard_Boolean Contains(const TopoDS_Face& aF,
140 const TopoDS_Vertex& aV)
142 Standard_Boolean bRet;
143 TopExp_Explorer aExp;
146 aExp.Init(aF, TopAbs_VERTEX);
147 for (; aExp.More(); aExp.Next()) {
148 const TopoDS_Shape& aVF=aExp.Current();
149 if (aVF.IsSame(aV)) {
156 // Contribution of Samtech www.samcef.com END