1 // Copyright (C) 2007-2008 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
22 // File: GEOMAlgo_WireSolid.cxx
23 // Created: Wed Jan 12 10:19:31 2005
24 // Author: Peter KURNEV
27 #include <GEOMAlgo_WireSolid.ixx>
29 #include <Standard_Failure.hxx>
31 #include <TopAbs_ShapeEnum.hxx>
33 #include <TopTools_ListIteratorOfListOfShape.hxx>
35 #include <BOPTColStd_Dump.hxx>
37 #include <BooleanOperations_ShapesDataStructure.hxx>
38 #include <BooleanOperations_StateOfShape.hxx>
40 #include <BOPTools_PaveFiller.hxx>
41 #include <BOPTools_SplitShapesPool.hxx>
42 #include <BOPTools_PaveBlock.hxx>
43 #include <BOPTools_ListOfPaveBlock.hxx>
44 #include <BOPTools_DSFiller.hxx>
45 #include <BOPTools_WireStateFiller.hxx>
47 //=======================================================================
48 //function : GEOMAlgo_WireSolid
50 //=======================================================================
51 GEOMAlgo_WireSolid::GEOMAlgo_WireSolid()
56 //=======================================================================
59 //=======================================================================
60 GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid()
63 //=======================================================================
66 //=======================================================================
67 void GEOMAlgo_WireSolid::Perform()
72 if (myDSFiller==NULL) {
76 if(!myDSFiller->IsDone()) {
81 Standard_Boolean bIsNewFiller;
83 bIsNewFiller=myDSFiller->IsNewFiller();
87 myDSFiller->SetNewFiller(!bIsNewFiller);
92 catch (Standard_Failure) {
96 //=======================================================================
99 //=======================================================================
100 void GEOMAlgo_WireSolid::Prepare()
102 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
104 BOPTools_WireStateFiller aStateFiller(aPaveFiller);
108 //=======================================================================
109 // function: BuildResult
111 //=======================================================================
112 void GEOMAlgo_WireSolid::BuildResult()
114 const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
115 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
116 const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
118 Standard_Integer i, aNbPB, nSp, iBeg, iEnd;
119 TopAbs_ShapeEnum aType;
120 BooleanOperations_StateOfShape aState;
127 iEnd=aDS.NumberOfShapesOfTheObject();
128 if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
130 iEnd=aDS.NumberOfSourceShapes();
133 for (i=iBeg; i<=iEnd; ++i) {
134 aType=aDS.GetShapeType(i);
135 if (aType==TopAbs_EDGE) {
136 const TopoDS_Shape& aE=aDS.Shape(i);
137 const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
141 aState=aDS.GetState(i);
143 if (aState==BooleanOperations_IN) {
146 else if (aState==BooleanOperations_OUT) {
149 else if (aState==BooleanOperations_ON) {
155 const BOPTools_PaveBlock& aPB=aLPB.First();
157 const TopoDS_Shape& aSp=aDS.Shape(nSp);
158 aState=aDS.GetState(nSp);
160 if (aState==BooleanOperations_IN) {
163 else if (aState==BooleanOperations_OUT) {
166 else if (aState==BooleanOperations_ON) {