1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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: GEOMAlgo_VertexSolid.cxx
24 // Created: Wed Jan 12 16:36:40 2005
25 // Author: Peter KURNEV
28 #include <GEOMAlgo_VertexSolid.hxx>
30 #include <Basics_OCCTVersion.hxx>
34 #include <TopAbs_ShapeEnum.hxx>
35 #include <TopAbs_State.hxx>
37 #include <TopTools_ListIteratorOfListOfShape.hxx>
38 #include <TopTools_ListOfShape.hxx>
39 #include <TopTools_IndexedMapOfShape.hxx>
42 #include <TopoDS_Solid.hxx>
43 #include <TopoDS_Vertex.hxx>
47 #include <BRep_Tool.hxx>
48 #include <BRepClass3d_SolidClassifier.hxx>
50 #include <BOPCol_ListOfShape.hxx>
51 #if OCC_VERSION_LARGE > 0x06070100
52 #include <IntTools_Context.hxx>
54 #include <BOPInt_Context.hxx>
57 #include <BOPDS_DS.hxx>
58 #include <BOPDS_IndexRange.hxx>
59 #include <BOPDS_VectorOfInterfVV.hxx>
60 #include <BOPDS_VectorOfInterfVE.hxx>
61 #include <BOPDS_VectorOfInterfVF.hxx>
62 #include <BOPDS_Interf.hxx>
64 //=======================================================================
65 //function : GEOMAlgo_VertexSolid
67 //=======================================================================
68 GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid()
73 //=======================================================================
76 //=======================================================================
77 GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid()
80 //=======================================================================
83 //=======================================================================
84 void GEOMAlgo_VertexSolid::Perform()
89 if (myDSFiller==NULL) {
93 if(myDSFiller->ErrorStatus()) {
98 Standard_Integer aNbF, aNbArgs;
99 TopTools_IndexedMapOfShape aM;
101 const BOPDS_DS& aDS=myDSFiller->DS();
102 const BOPCol_ListOfShape& aLS=aDS.Arguments();
103 aNbArgs=aLS.Extent();
109 const TopoDS_Shape& aObj=aLS.First();
111 TopExp::MapShapes(aObj, TopAbs_FACE, aM);
113 myRank=(aNbF) ? 1 : 0;
118 catch (Standard_Failure) {
122 //=======================================================================
123 // function: BuildResult
125 //=======================================================================
126 void GEOMAlgo_VertexSolid::BuildResult()
128 Standard_Integer i, iBeg, iEnd, aNbVV, aNbVE, aNbVF, j, iFound, aNbRanges;
131 TopAbs_ShapeEnum aType;
138 const BOPDS_DS& aDS=myDSFiller->DS();
139 BOPDS_DS* pDS=(BOPDS_DS*)&aDS;
141 BOPDS_VectorOfInterfVV& aVVs=pDS->InterfVV();
142 BOPDS_VectorOfInterfVE& aVEs=pDS->InterfVE();
143 BOPDS_VectorOfInterfVF& aVFs=pDS->InterfVF();
145 const BOPCol_ListOfShape& aLS=aDS.Arguments();
146 const TopoDS_Shape& aObj=aLS.First();
148 const TopoDS_Shape& aTool=aLS.Last();
149 const TopoDS_Solid& aSolid=(myRank==0) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
151 #if OCC_VERSION_LARGE > 0x06070100
152 Handle(IntTools_Context) aCtx=myDSFiller->Context();
154 Handle(BOPInt_Context) aCtx=myDSFiller->Context();
156 BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
158 aNbRanges=aDS.NbRanges();
159 const BOPDS_IndexRange& aRange=aDS.Range(myRank);
160 aRange.Indices(iBeg, iEnd);
162 for (i=iBeg; i<=iEnd; ++i) {
163 const TopoDS_Shape& aS=aDS.Shape(i);
164 aType=aS.ShapeType();
165 if (aType!=TopAbs_VERTEX) {
169 const TopoDS_Vertex& aV=TopoDS::Vertex(aS);
175 for (j=0; j<aNbVV; ++j) {
176 BOPDS_InterfVV& aVV=aVVs(j);
177 if (aVV.Contains(i)) {
188 for (j=0; j<aNbVE; ++j) {
189 BOPDS_InterfVE& aVE=aVEs(j);
190 if (aVE.Contains(i)) {
201 for (j=0; j<aNbVF; ++j) {
202 BOPDS_InterfVF& aVF=aVFs(j);
203 if (aVF.Contains(i)) {
214 aP3D=BRep_Tool::Pnt(aV);
216 aSC.Perform(aP3D, aTol);
218 if (aSt==TopAbs_IN) {
221 else if (aSt==TopAbs_OUT) {
224 }//for (i=iBeg; i<iEnd; ++i) {